浏览代码

feat:klarna异常处理

“wangdongchao” 1 年之前
父节点
当前提交
a23cc7bc61

+ 16 - 2
Asteria/Fuction/Cart/Cart_CheckoutC.m

@@ -488,6 +488,7 @@
     [ASCheckoutPayManager sharedInstance].payFinishBlock = ^(NSString * _Nonnull payMethod, NSUInteger isSucess, id  _Nonnull payData) {
         K_STRONG_SELF;
         NSLog(@"payData======%@", payData);
+        NSDictionary *payDic = (NSDictionary *)payData;
         if (isSucess == 1) {
             
             [self.view makeToast:@"支付成功,正在为你下单" duration:0.5 position:CSToastPositionCenter];
@@ -495,7 +496,7 @@
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                 K_STRONG_SELF;
                 
-                NSDictionary *payDic = (NSDictionary *)payData;
+                
                 
                 NSString *orderidStr = [NSString stringWithFormat:@"%@", [payDic objectForKey:@"orderid"]];
                 
@@ -516,7 +517,20 @@
             
         } else {
             
-            [self.view makeToast:@"支付失败/取消支付" duration:0.5 position:CSToastPositionCenter];
+            NSString *msg = [NSString stringWithFormat:@"%@", [payDic objectForKey:@"msg"]];
+            
+            if ([msg isEqualToString:@"支付异常"] && [payMethod isEqualToString:@"klarna_kco"]) {
+                [self.view makeToast:@"支付失败,请重试" duration:0.5 position:CSToastPositionCenter];
+                
+                K_WEAK_SELF;
+                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                    K_STRONG_SELF;
+                    [self reqNet_Cart_cartsMineTotals];
+                });
+                return;
+            }
+            
+            [self.view makeToast:@"支付失败" duration:0.5 position:CSToastPositionCenter];
             K_WEAK_SELF;
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                 K_STRONG_SELF;

+ 4 - 1
Asteria/Fuction/Cart/PayManager/ASCheckoutPayManager.m

@@ -214,6 +214,9 @@ static ASCheckoutPayManager *_instance = nil;
             [self tool_creatOrderAutoken:authToken];
         } else {
             //异常状态、需要返回购物车刷新
+            if (self.payFinishBlock) {
+                self.payFinishBlock(self.payType, 0, @{@"msg":@"支付异常"});
+            }
         }
         
     } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
@@ -221,7 +224,7 @@ static ASCheckoutPayManager *_instance = nil;
         [MBProgressHUD hideHUDForView:topVC.view animated:YES];
         
         if (self.payFinishBlock) {
-            self.payFinishBlock(self.payType, 0, @{@"msg":msg});
+            self.payFinishBlock(self.payType, 0, @{@"msg":@"支付异常"});
         }
     }];
 }

+ 2 - 1
Asteria/Fuction/UserCenter/Orders/View/ASPayFinishHeadView.m

@@ -172,8 +172,9 @@
             _iconImage.image = [UIImage imageNamed:@"pay_success_icon"];
             _payStatusLab.text = @"Your Order Has Been Received";
             _orderNumLab.text = [NSString stringWithFormat:@"Order #%@", desc];
-            _descLab.text = @"Please try another card or refresh browser. Paypal gateway has rejected request. The buyer cannot pay with PayPal for this transaction(#13113: buyer cannot pay).";
+            _descLab.text = [NSString stringWithFormat:@"An order confirmation email will be sent to you in about 1 hour at %@ for you to check and respond. Shipment info also will be sent to your email after the order is shipped out. Please ensure to check your spam box in case you cannot find it in your inbox. To ensure delivery, Please add Service@asteriahair.com to your email address book or safe sender list.", ASUserInfoManager.shared.userInfo.email];
             [_topBtn setTitle:@"Continue Shopping" forState:UIControlStateNormal];
+
         }
             
         [self layoutIfNeeded];