From 146445f882cbda1ef5a7d1c2c7b3251bb8b3d425 Mon Sep 17 00:00:00 2001 From: codinronan Date: Tue, 10 Sep 2019 23:37:04 -0500 Subject: [PATCH 1/5] 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 } } - From 7a1f4c25d173aa5deefc918ca20c5633a0b95b33 Mon Sep 17 00:00:00 2001 From: codinronan Date: Tue, 10 Sep 2019 23:44:44 -0500 Subject: [PATCH 2/5] chore(build): bump version, use podspec for iOS pod resolution --- plugin.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugin.xml b/plugin.xml index f389162..1438caa 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,7 +3,7 @@ + version="0.1.1"> Stripe Payments Cordova plugin for Stripe payments using the native Android/iOS SDKs. Supports Apple Pay and card payments. @@ -14,15 +14,15 @@ https://github.com/rolamix/cordova-plugin-stripe-payments/issues - - + + - + @@ -71,20 +71,22 @@ + + - + From a7a762d43f54101e09bd01e24b56c042e9089ce6 Mon Sep 17 00:00:00 2001 From: codinronan Date: Tue, 10 Sep 2019 23:46:53 -0500 Subject: [PATCH 3/5] chore(note): explain why the STPPaymentResult callback changed --- src/ios/StripePaymentsPlugin.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ios/StripePaymentsPlugin.swift b/src/ios/StripePaymentsPlugin.swift index 4010608..9f2cef4 100644 --- a/src/ios/StripePaymentsPlugin.swift +++ b/src/ios/StripePaymentsPlugin.swift @@ -248,6 +248,9 @@ import Stripe print("[StripePaymentsPlugin].paymentContext.didCreatePaymentResult: \(resultMsg)") successCallback(paymentStatusCallback, resultMsg, keepCallback: true) + + // This is here to, for example, inform the context that the user canceled payment (if we were processing it + // from the native side). However we are not handling it here. completion(STPPaymentStatus.success, nil) } From 7b70ff22022ea7bf1d1417a848e4d0ef21a551b3 Mon Sep 17 00:00:00 2001 From: codinronan Date: Thu, 12 Sep 2019 11:53:00 -0500 Subject: [PATCH 4/5] chore(deploy): 0.1.1 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index da0b8a3..6b02715 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cordova-plugin-stripe-payments", "description": "Stripe Card Entry plugin for Cordova. Available for Android and iOS.", - "version": "0.0.8", + "version": "0.1.1", "homepage": "https://github.com/rolamix/cordova-plugin-stripe-payments#readme", "author": "Rolamix (https://rolamix.com)", "license": "MIT", @@ -33,4 +33,4 @@ "ach", "credit card" ] -} \ No newline at end of file +} From 166b866f855ca6792a9623d999ef7c6a04ea5296 Mon Sep 17 00:00:00 2001 From: codinronan Date: Thu, 12 Sep 2019 11:54:33 -0500 Subject: [PATCH 5/5] feat(readme): cordova 9 update --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 02e7783..5e64896 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,12 @@ Plugin for Cordova to use the [native android SDK](https://github.com/stripe/str ## Installing the plugin ## ``` -cordova plugin add cordova-plugin-filepickerio --save +cordova plugin add cordova-plugin-stripe-payments --save ``` +### NOTE: +This plugin now requires Cordova 9 as of version 0.1.1. If you are using Cordova 8 or lower, please use the 0.0.8 version of this plugin. + ## Using the plugin ##