Commit f8f9c8a3 by lee

u chechout logic

parent 5ce74fef
......@@ -119,8 +119,8 @@
this.address = address;
this.checkout = checkout;
[this showToast:@"更新地址成功"];
[this initData];
[this flushCheckout:dictionary];
// [this initData];
// [this.userDao saveCheckoutCache:checkout.JSONDictionary];
}
else {
......@@ -317,7 +317,7 @@
if (!checkoutCache || self.cartCookie) {
checkout = [[BUYCheckout alloc] initWithModelManager:self.client.modelManager JSONDictionary:nil];
}
if(self.address){
// if(self.address){
if([self checkAddress:self.address]){
KWMSelectAddressVC *addressVC = (KWMSelectAddressVC *)[KWMBaseVC findControllerBy:[KWMSelectAddressVC kwmTag] fromStoryboard:@"ShopCart"];
addressVC.checkout = checkout;
......@@ -333,7 +333,7 @@
}
checkout.shippingAddress = self.address;
checkout.billingAddress = self.address;
}
// }
checkout.email = self.customer.email;
checkout.customerId = self.customer.identifier;
// self.client.urlScheme = @"CemaroseApp://";
......@@ -565,17 +565,21 @@
[this hideLoading];
BUYCheckout *checkout = [this.client.modelManager insertCheckoutWithJSONDictionary:responseObject[@"checkout"]];
this.checkout = checkout;
[this initData];
[this.userDao saveCheckoutCache:responseObject[@"checkout"]];
if(this.checkout.shippingAddress && !this.checkout.shippingRate) {
[this requestShippingData];
}
[self flushCheckout:responseObject[@"checkout"]];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[this hideLoading];
[this showError:error];
}];
}
-(void) flushCheckout:(NSDictionary *) dic {
[self initData];
[self.userDao saveCheckoutCache:dic];
if(self.checkout.shippingAddress && !self.checkout.shippingRate) {
[self requestShippingData];
}
}
-(void)requestShippingData{
if(self.checkout==nil){
return;
......
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