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.
This commit is contained in:
codinronan 2019-09-10 23:37:04 -05:00 committed by GitHub
parent 73820adcc3
commit 146445f882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,7 @@ import Stripe
paymentContext.hostViewController = self.viewController paymentContext.hostViewController = self.viewController
} }
customerContext.clearCachedCustomer() customerContext.clearCache()
} }
@ -235,19 +235,20 @@ import Stripe
print("[StripePaymentsPlugin].paymentContextDidChange: \(resultMsg)") print("[StripePaymentsPlugin].paymentContextDidChange: \(resultMsg)")
successCallback(paymentStatusCallback, resultMsg, keepCallback: true) successCallback(paymentStatusCallback, resultMsg, keepCallback: true)
} }
// This callback is triggered when requestPayment() completes successfully to create a Source. // 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.) // 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 // Create charge using payment result
let resultMsg: [String : Any] = [ let resultMsg: [String : Any] = [
"status": "PAYMENT_CREATED", "status": "PAYMENT_CREATED",
"source": paymentResult.source.stripeID "source": paymentResult.paymentMethod.stripeId
// "source": paymentResult.source.stripeID
] ]
print("[StripePaymentsPlugin].paymentContext.didCreatePaymentResult: \(resultMsg)") print("[StripePaymentsPlugin].paymentContext.didCreatePaymentResult: \(resultMsg)")
successCallback(paymentStatusCallback, resultMsg, keepCallback: true) successCallback(paymentStatusCallback, resultMsg, keepCallback: true)
completion(nil) completion(STPPaymentStatus.success, nil)
} }
// This callback triggers due to: // This callback triggers due to:
@ -313,4 +314,3 @@ import Stripe
} }
} }