From 146445f882cbda1ef5a7d1c2c7b3251bb8b3d425 Mon Sep 17 00:00:00 2001 From: codinronan Date: Tue, 10 Sep 2019 23:37:04 -0500 Subject: [PATCH] feat(ios): update stripe objects for latest sdk Updates usage of stripe iOS SDK to use latest objects after their refactoring It's actually important to upgrade to this version of the SDK because they have finally brought the SDK into the present and are using a recent version of the Stripe API (may 2019) instead of one from 2015. --- src/ios/StripePaymentsPlugin.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ios/StripePaymentsPlugin.swift b/src/ios/StripePaymentsPlugin.swift index 9063dea..4010608 100644 --- a/src/ios/StripePaymentsPlugin.swift +++ b/src/ios/StripePaymentsPlugin.swift @@ -82,7 +82,7 @@ import Stripe paymentContext.hostViewController = self.viewController } - customerContext.clearCachedCustomer() + customerContext.clearCache() } @@ -235,19 +235,20 @@ import Stripe print("[StripePaymentsPlugin].paymentContextDidChange: \(resultMsg)") successCallback(paymentStatusCallback, resultMsg, keepCallback: true) } - + // This callback is triggered when requestPayment() completes successfully to create a Source. // This Source can then be used by the app to process a payment (create a charge, subscription etc.) - func paymentContext(_ paymentContext: STPPaymentContext, didCreatePaymentResult paymentResult: STPPaymentResult, completion: @escaping STPErrorBlock) { + func paymentContext(_ paymentContext: STPPaymentContext, didCreatePaymentResult paymentResult: STPPaymentResult, completion: @escaping STPPaymentStatusBlock) { // Create charge using payment result let resultMsg: [String : Any] = [ "status": "PAYMENT_CREATED", - "source": paymentResult.source.stripeID + "source": paymentResult.paymentMethod.stripeId + // "source": paymentResult.source.stripeID ] print("[StripePaymentsPlugin].paymentContext.didCreatePaymentResult: \(resultMsg)") successCallback(paymentStatusCallback, resultMsg, keepCallback: true) - completion(nil) + completion(STPPaymentStatus.success, nil) } // This callback triggers due to: @@ -313,4 +314,3 @@ import Stripe } } -