Commit 90e1f7ce by lee

add clear checkout

parent 4dc91403
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#import "KWMHttpUtil.h" #import "KWMHttpUtil.h"
#import "KWMValidateUtil.h" #import "KWMValidateUtil.h"
#import "KWMPayUtil.h" #import "KWMPayUtil.h"
#import "KWMShopCartData.h"
@interface KWMBeforePayVC () @interface KWMBeforePayVC ()
@property (nonatomic) BUYCustomer *customer; @property (nonatomic) BUYCustomer *customer;
...@@ -711,9 +712,17 @@ ...@@ -711,9 +712,17 @@
} }
-(void)paySuccess{ -(void)paySuccess{
[self clearCheckout];
KWMPaySuccessVC *successVC = (KWMPaySuccessVC *)[KWMBaseVC findControllerBy:[KWMPaySuccessVC kwmTag] fromStoryboard:@"ShopCart"]; KWMPaySuccessVC *successVC = (KWMPaySuccessVC *)[KWMBaseVC findControllerBy:[KWMPaySuccessVC kwmTag] fromStoryboard:@"ShopCart"];
[self.navigationController pushViewController:successVC animated:YES]; [self.navigationController pushViewController:successVC animated:YES];
} }
-(void) clearCheckout {
self.cartCookie = nil;
[KWMHttpUtil deleteCookie:@"cart"];
[[KWMShopCartData alloc] removeAllItems];
[self.userDao deleteCheckoutCache];
}
@end @end
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"支付成功"; self.title = @"支付成功";
[[KWMShopCartData alloc] removeAllItems];
[self.userDao deleteCheckoutCache];
[self initButton]; [self initButton];
} }
......
...@@ -12,4 +12,6 @@ ...@@ -12,4 +12,6 @@
+ (NSString *) buildRequestCookieString; + (NSString *) buildRequestCookieString;
+ (void) deleteCookie:(NSString *) name;
@end @end
...@@ -19,4 +19,15 @@ ...@@ -19,4 +19,15 @@
return cookieString; return cookieString;
} }
+ (void)deleteCookie:(NSString *)name {
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
for (int i=0; i<cookies.count; i++) {
NSHTTPCookie *cookie = cookies[i];
if ([cookie.name isEqualToString:name]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
return;
}
}
}
@end @end
...@@ -60,21 +60,25 @@ ...@@ -60,21 +60,25 @@
#define User_Pay_KEY @"bd3f58f5cd3d7a217ac8c8e655ab52f8" #define User_Pay_KEY @"bd3f58f5cd3d7a217ac8c8e655ab52f8"
#if DEBUG && 1
//测试 //测试
#define TestModel @"YES" #define TestModel @"YES"
//Shopify对应的key(测试用) //Shopify对应的key(测试用)
#define Shopify_SHOP_DOMAIN @"cemarose-test.myshopify.com" #define Shopify_SHOP_DOMAIN @"cemarose-test.myshopify.com"
#define Shopify_API_KEY @"4f34b3c32f4297386fc4fdaee7ef2bce" #define Shopify_API_KEY @"4f34b3c32f4297386fc4fdaee7ef2bce"
#define Shopify_APP_ID @"8" #define Shopify_APP_ID @"8"
#else
////正式 //正式
//#define TestModel @"NO" #define TestModel @"NO"
//
////Shopify对应的key(正式) //Shopify对应的key(正式)
//#define Shopify_SHOP_DOMAIN @"cemarose.myshopify.com" #define Shopify_SHOP_DOMAIN @"cemarose.myshopify.com"
//#define Shopify_API_KEY @"c2f6fae97741ea6db4cad7ae8f70fef3" #define Shopify_API_KEY @"c2f6fae97741ea6db4cad7ae8f70fef3"
//#define Shopify_APP_ID @"8" #define Shopify_APP_ID @"8"
#end
//软键盘输入限制 //软键盘输入限制
#define NUM @"0123456789" #define NUM @"0123456789"
......
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