Browse Source

[fix]修复苹果支付错误的问题

Destiny 1 year ago
parent
commit
2988ca871a
1 changed files with 24 additions and 23 deletions
  1. 24 23
      lib/sdk/pay/assist/apple_or_google_pay.dart

+ 24 - 23
lib/sdk/pay/assist/apple_or_google_pay.dart

@@ -102,32 +102,33 @@ abstract class AppleOrGooglePay extends AgilePayStateInfo {
 
   void listenToPurchaseUpdated(
       List<PurchaseDetails> purchaseDetailsList) async {
-    try {
-      for (var purchaseDetails in purchaseDetailsList) {
-        debugPrint(
-            'agilePay-purchasePay--PurchaseUpdated-> ${purchaseDetails.toString()}');
-        if (purchaseDetails.status == PurchaseStatus.pending) {
-          verifyPendingPurchase(purchaseDetails);
-        } else {
-          if (purchaseDetails.status == PurchaseStatus.error) {
-            verifyErrorPurchase(purchaseDetails);
-          } else if (purchaseDetails.status == PurchaseStatus.purchased) {
-            verifySuccessPurchase(purchaseDetails);
-          } else if (purchaseDetails.status == PurchaseStatus.canceled) {
-            verifyCancelPurchase(purchaseDetails);
-          }
-
-          if (purchaseDetails.pendingCompletePurchase) {
-            await InAppPurchase.instance.completePurchase(purchaseDetails);
-          }
+    // try {
+    for (var purchaseDetails in purchaseDetailsList) {
+      debugPrint(
+          'agilePay-purchasePay--PurchaseUpdated-> ${purchaseDetails.toString()}');
+      if (purchaseDetails.status == PurchaseStatus.pending) {
+        verifyPendingPurchase(purchaseDetails);
+      } else {
+        if (purchaseDetails.status == PurchaseStatus.error) {
+          verifyErrorPurchase(purchaseDetails);
+        } else if (purchaseDetails.status == PurchaseStatus.purchased) {
+          verifySuccessPurchase(purchaseDetails);
+        } else if (purchaseDetails.status == PurchaseStatus.canceled) {
+          verifyCancelPurchase(purchaseDetails);
+        }
+
+        if (purchaseDetails.pendingCompletePurchase) {
+          await InAppPurchase.instance.completePurchase(purchaseDetails);
+          dispose();
         }
       }
-    } catch (e) {
-      sendError(AgilePayCode.payCodeOtherError,
-          AgilePayCode.getMessageByCode(AgilePayCode.payCodeOtherError));
-    } finally {
-      dispose();
     }
+    // } catch (e) {
+    //   sendError(AgilePayCode.payCodeOtherError,
+    //       AgilePayCode.getMessageByCode(AgilePayCode.payCodeOtherError));
+    // } finally {
+    //   dispose();
+    // }
   }
 
   void verifyPendingPurchase(PurchaseDetails purchaseDetails) {}