Commit fd13ea37 by lee

Merge branch 'checkoutNow'

parents 50dec2ec 2860048d
...@@ -470,7 +470,12 @@ ...@@ -470,7 +470,12 @@
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
if (self.cartCookie) { if (self.cartCookie) {
[manager.requestSerializer setHTTPShouldHandleCookies:NO]; [manager.requestSerializer setHTTPShouldHandleCookies:NO];
NSString *cookie = [[KWMHttpUtil buildRequestCookieString] stringByReplacingOccurrencesOfRegex:@"cart=.*?;" withString:[NSString stringWithFormat:@"cart=%@;",self.cartCookie]]; NSString *cookie = [KWMHttpUtil buildRequestCookieString];
if ([cookie isMatchedByRegex:@"cart=.*?;"]) {
cookie = [cookie stringByReplacingOccurrencesOfRegex:@"cart=.*?;" withString:[NSString stringWithFormat:@"cart=%@;",self.cartCookie]];
}else{
cookie = [NSString stringWithFormat:@"cart=%@; %@",self.cartCookie,cookie];
}
[manager.requestSerializer setValue:cookie forHTTPHeaderField:@"Cookie"]; [manager.requestSerializer setValue:cookie forHTTPHeaderField:@"Cookie"];
} }
[manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) { [manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) {
...@@ -502,7 +507,7 @@ ...@@ -502,7 +507,7 @@
this.checkout = checkout; this.checkout = checkout;
[this initData]; [this initData];
[this.userDao saveCheckoutCache:responseObject[@"checkout"]]; [this.userDao saveCheckoutCache:responseObject[@"checkout"]];
if(!this.checkout.shippingRate) { if(this.checkout.shippingAddress && !this.checkout.shippingRate) {
[this requestShippingData]; [this requestShippingData];
} }
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
......
...@@ -50,12 +50,17 @@ ...@@ -50,12 +50,17 @@
[self setTotalPrice]; [self setTotalPrice];
__weak typeof(self) this = self; __weak typeof(self) this = self;
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
[this refresh];
}];
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC));
dispatch_after(delay, dispatch_get_main_queue(), ^{
[[KWMShoppingCart sharedInstance] allItemsWithCallback:^(NSError *error, KWMCartResult *cart) {
[this refresh];
}];
});
} }
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (_shopCartList.count == 0) { if (_shopCartList.count == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment