@stripe/stripe-react-native 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -1
- package/android/build.gradle +1 -0
- package/android/proguard-rules.txt +7 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -2
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +2 -3
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +46 -8
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +132 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +144 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +123 -8
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +5 -0
- package/android/src/main/res/drawable/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable/googlepay_button_background_shape.xml +11 -0
- package/android/src/main/res/drawable/googlepay_mark_background.xml +12 -0
- package/android/src/main/res/drawable/googlepay_mark_content.xml +27 -0
- package/android/src/main/res/drawable/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ar/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ar/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ar/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ar/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ar/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ar/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-ar/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-bg/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-bg/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-bg/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-bg/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-bg/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-bg/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-bg/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ca/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ca/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ca/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ca/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ca/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ca/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-ca/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-cs/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-cs/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-cs/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-cs/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-cs/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-cs/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-cs/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-da/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-da/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-da/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-da/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-da/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-da/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-da/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-de/book_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-de/buy_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-de/checkout_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-de/donate_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-de/order_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-de/pay_with_googlepay_button_content.xml +7 -7
- package/android/src/main/res/drawable-de/subscribe_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-el/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-el/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-el/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-el/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-el/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-el/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-el/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-et/book_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-et/buy_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-et/checkout_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-et/donate_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-et/order_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-et/pay_with_googlepay_button_content.xml +8 -8
- package/android/src/main/res/drawable-et/subscribe_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fi/book_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fi/buy_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fi/checkout_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fi/donate_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fi/order_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fi/pay_with_googlepay_button_content.xml +8 -8
- package/android/src/main/res/drawable-fi/subscribe_with_googlepay_button_content.xml +15 -0
- package/android/src/main/res/drawable-fr/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-fr/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-fr/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-fr/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-fr/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-fr/pay_with_googlepay_button_content.xml +5 -5
- package/android/src/main/res/drawable-fr/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-hr/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-hr/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-hr/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-hr/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-hr/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-hr/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-hr/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-id/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-id/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-id/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-id/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-id/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-id/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-id/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-it/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-it/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-it/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-it/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-it/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-it/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-it/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ja/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ja/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ja/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ja/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ja/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ja/pay_with_googlepay_button_content.xml +5 -5
- package/android/src/main/res/drawable-ja/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ko/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ko/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ko/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ko/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ko/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ko/pay_with_googlepay_button_content.xml +7 -7
- package/android/src/main/res/drawable-ko/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ms/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ms/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ms/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ms/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ms/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ms/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-ms/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-nl/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-nl/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-nl/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-nl/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-nl/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-nl/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-nl/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-no/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-no/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-no/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-no/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-no/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-no/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-no/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-pl/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-pl/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-pl/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-pl/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-pl/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-pl/pay_with_googlepay_button_content.xml +7 -7
- package/android/src/main/res/drawable-pl/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ru/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ru/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ru/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ru/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ru/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-ru/pay_with_googlepay_button_content.xml +7 -7
- package/android/src/main/res/drawable-ru/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sk/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sk/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sk/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sk/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sk/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sk/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-sk/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sl/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sl/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sl/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sl/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sl/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sl/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-sl/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sr/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sr/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sr/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sr/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sr/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sr/pay_with_googlepay_button_content.xml +7 -7
- package/android/src/main/res/drawable-sr/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sv/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sv/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sv/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sv/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sv/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-sv/pay_with_googlepay_button_content.xml +4 -4
- package/android/src/main/res/drawable-sv/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-th/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-th/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-th/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-th/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-th/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-th/pay_with_googlepay_button_content.xml +6 -6
- package/android/src/main/res/drawable-th/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-tr/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-tr/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-tr/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-tr/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-tr/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-tr/pay_with_googlepay_button_content.xml +7 -7
- package/android/src/main/res/drawable-tr/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-uk/book_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-uk/buy_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-uk/checkout_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-uk/donate_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-uk/order_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/drawable-uk/pay_with_googlepay_button_content.xml +5 -5
- package/android/src/main/res/drawable-uk/subscribe_with_googlepay_button_content.xml +14 -0
- package/android/src/main/res/layout/book_with_googlepay_button.xml +20 -0
- package/android/src/main/res/layout/buy_with_googlepay_button.xml +20 -0
- package/android/src/main/res/layout/checkout_with_googlepay_button.xml +20 -0
- package/android/src/main/res/layout/donate_with_googlepay_button.xml +20 -0
- package/android/src/main/res/layout/googlepay_mark_button.xml +18 -0
- package/android/src/main/res/layout/order_with_googlepay_button.xml +20 -0
- package/android/src/main/res/layout/pay_with_googlepay_button.xml +10 -24
- package/android/src/main/res/layout/plain_googlepay_button.xml +17 -0
- package/android/src/main/res/layout/subscribe_with_googlepay_button.xml +20 -0
- package/android/src/main/res/values/googlepay_strings.xml +3 -2
- package/ios/ApplePayButtonManager.m +5 -0
- package/ios/ApplePayButtonManager.swift +3 -1
- package/ios/ApplePayButtonView.swift +21 -0
- package/ios/ApplePayUtils.swift +187 -0
- package/ios/ApplePayViewController.swift +279 -0
- package/ios/Mappers.swift +26 -7
- package/ios/PaymentPassFinder.swift +61 -0
- package/ios/PushProvisioning/AddToWalletButtonView.swift +10 -10
- package/ios/PushProvisioning/PushProvisioningUtils.swift +39 -16
- package/ios/StripeSdk.m +29 -0
- package/ios/StripeSdk.swift +193 -129
- package/ios/Tests/AddressSheetUtilsTests.swift +1 -7
- package/ios/Tests/PushProvisioningTests.swift +14 -11
- package/jest/mock.js +44 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/ApplePayButton.js +1 -1
- package/lib/commonjs/components/ApplePayButton.js.map +1 -1
- package/lib/commonjs/components/ApplePayButtonNative.js +2 -0
- package/lib/commonjs/components/ApplePayButtonNative.js.map +1 -0
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/GooglePayButton.js +1 -1
- package/lib/commonjs/components/GooglePayButton.js.map +1 -1
- package/lib/commonjs/components/GooglePayButtonNative.js +2 -0
- package/lib/commonjs/components/GooglePayButtonNative.js.map +1 -0
- package/lib/commonjs/components/PlatformPayButton.js +2 -0
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -0
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/hooks/useApplePay.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmPayment.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/commonjs/hooks/useGooglePay.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js +2 -0
- package/lib/commonjs/hooks/usePlatformPay.js.map +1 -0
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/types/ApplePay.js.map +1 -1
- package/lib/commonjs/types/Common.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/FinancialConnections.js.map +1 -1
- package/lib/commonjs/types/GooglePay.js.map +1 -1
- package/lib/commonjs/types/NextAction.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentMethod.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js +2 -0
- package/lib/commonjs/types/PlatformPay.js.map +1 -0
- package/lib/commonjs/types/PushProvisioning.js +2 -0
- package/lib/commonjs/types/PushProvisioning.js.map +1 -0
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/ThreeDSecure.js.map +1 -1
- package/lib/commonjs/types/Token.js.map +1 -1
- package/lib/commonjs/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/commonjs/types/components/AuBECSDebitFormComponent.js.map +1 -1
- package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
- package/lib/commonjs/types/components/CardFormView.js.map +1 -1
- package/lib/commonjs/types/components/GooglePayButtonComponent.js +2 -0
- package/lib/commonjs/types/components/GooglePayButtonComponent.js.map +1 -0
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/ApplePayButton.js +1 -1
- package/lib/module/components/ApplePayButton.js.map +1 -1
- package/lib/module/components/ApplePayButtonNative.js +2 -0
- package/lib/module/components/ApplePayButtonNative.js.map +1 -0
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/GooglePayButton.js +1 -1
- package/lib/module/components/GooglePayButton.js.map +1 -1
- package/lib/module/components/GooglePayButtonNative.js +2 -0
- package/lib/module/components/GooglePayButtonNative.js.map +1 -0
- package/lib/module/components/PlatformPayButton.js +2 -0
- package/lib/module/components/PlatformPayButton.js.map +1 -0
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/hooks/useApplePay.js.map +1 -1
- package/lib/module/hooks/useConfirmPayment.js.map +1 -1
- package/lib/module/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/module/hooks/useGooglePay.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/usePlatformPay.js +2 -0
- package/lib/module/hooks/usePlatformPay.js.map +1 -0
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/types/ApplePay.js.map +1 -1
- package/lib/module/types/Common.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/FinancialConnections.js.map +1 -1
- package/lib/module/types/GooglePay.js.map +1 -1
- package/lib/module/types/NextAction.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentMethod.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js +2 -0
- package/lib/module/types/PlatformPay.js.map +1 -0
- package/lib/module/types/PushProvisioning.js +2 -0
- package/lib/module/types/PushProvisioning.js.map +1 -0
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/module/types/ThreeDSecure.js.map +1 -1
- package/lib/module/types/Token.js.map +1 -1
- package/lib/module/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/module/types/components/AuBECSDebitFormComponent.js.map +1 -1
- package/lib/module/types/components/CardFieldInput.js.map +1 -1
- package/lib/module/types/components/CardFormView.js.map +1 -1
- package/lib/module/types/components/GooglePayButtonComponent.js +2 -0
- package/lib/module/types/components/GooglePayButtonComponent.js.map +1 -0
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +8 -1
- package/lib/typescript/src/components/ApplePayButton.d.ts +1 -1
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +3 -0
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +3 -0
- package/lib/typescript/src/components/PlatformPayButton.d.ts +65 -0
- package/lib/typescript/src/functions.d.ts +73 -1
- package/lib/typescript/src/hooks/usePlatformPay.d.ts +70 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +18 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/types/ApplePay.d.ts +9 -0
- package/lib/typescript/src/types/Errors.d.ts +6 -1
- package/lib/typescript/src/types/GooglePay.d.ts +2 -1
- package/lib/typescript/src/types/PlatformPay.d.ts +285 -0
- package/lib/typescript/src/types/PushProvisioning.d.ts +66 -0
- package/lib/typescript/src/types/Token.d.ts +1 -0
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts +14 -3
- package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts +6 -0
- package/lib/typescript/src/types/index.d.ts +4 -38
- package/package.json +10 -3
- package/src/NativeStripeSdk.tsx +20 -0
- package/src/components/ApplePayButton.tsx +3 -10
- package/src/components/ApplePayButtonNative.tsx +5 -0
- package/src/components/GooglePayButton.tsx +1 -3
- package/src/components/GooglePayButtonNative.tsx +7 -0
- package/src/components/PlatformPayButton.tsx +155 -0
- package/src/functions.ts +181 -0
- package/src/hooks/usePlatformPay.tsx +174 -0
- package/src/hooks/useStripe.tsx +77 -0
- package/src/index.tsx +6 -0
- package/src/types/ApplePay.ts +9 -0
- package/src/types/Errors.ts +7 -1
- package/src/types/GooglePay.ts +2 -1
- package/src/types/PlatformPay.ts +326 -0
- package/src/types/PushProvisioning.ts +76 -0
- package/src/types/Token.ts +1 -0
- package/src/types/components/ApplePayButtonComponent.ts +21 -4
- package/src/types/components/GooglePayButtonComponent.ts +6 -0
- package/src/types/index.ts +5 -54
- package/stripe-react-native.podspec +1 -1
- package/android/src/main/res/drawable/googlepay_button_background.xml +0 -6
- package/android/src/main/res/drawable/googlepay_button_content.xml +0 -48
- package/android/src/main/res/drawable/googlepay_button_overlay.xml +0 -12
- package/android/src/main/res/drawable-af/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-am/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-as/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-az/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-be/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-bn/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-bs/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-cy/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-en-rau/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-en-rca/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-en-rgb/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-en-rin/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-es/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-es-res/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-eu/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-fa/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-fil/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-fr-rca/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ga/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-gl/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-gu/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-hdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-hu/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-hy/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-is/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-iw/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ka/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-kk/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-km/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-kn/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ky/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-lo/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-lt/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-lv/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-mdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-mk/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ml/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-mn/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-mr/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ne/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-pt-rbr/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-pt-rpt/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ro/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-sq/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-sw/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ta/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-te/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-ur/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-uz/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-v21/googlepay_button_background.xml +0 -7
- package/android/src/main/res/drawable-vi/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/drawable-xhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-zh-rcn/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-zh-rhk/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-zh-rtw/pay_with_googlepay_button_content.xml +0 -15
- package/android/src/main/res/drawable-zu/pay_with_googlepay_button_content.xml +0 -14
- package/android/src/main/res/layout/googlepay_button.xml +0 -39
|
@@ -12,25 +12,33 @@ internal class PushProvisioningUtils {
|
|
|
12
12
|
class func canAddCardToWallet(
|
|
13
13
|
last4: String,
|
|
14
14
|
primaryAccountIdentifier: String,
|
|
15
|
-
testEnv: Bool
|
|
16
|
-
|
|
15
|
+
testEnv: Bool,
|
|
16
|
+
hasPairedAppleWatch: Bool,
|
|
17
|
+
completion: @escaping (_ canAddCard: Bool, _ status: AddCardToWalletStatus?) -> Void
|
|
18
|
+
) {
|
|
17
19
|
if (!PKAddPassesViewController.canAddPasses()) {
|
|
18
|
-
|
|
20
|
+
completion(false, AddCardToWalletStatus.UNSUPPORTED_DEVICE)
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
var canAddCard = PushProvisioningUtils.canAddPaymentPass(
|
|
23
|
+
let canAddCard = canAddPaymentPass(
|
|
23
24
|
primaryAccountIdentifier: primaryAccountIdentifier,
|
|
24
25
|
isTestMode: testEnv)
|
|
25
26
|
|
|
26
27
|
if (!canAddCard) {
|
|
27
|
-
|
|
28
|
-
} else
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
completion(canAddCard, AddCardToWalletStatus.MISSING_CONFIGURATION)
|
|
29
|
+
} else {
|
|
30
|
+
PaymentPassFinder.findPassWithLast4(last4: last4, hasPairedAppleWatch: hasPairedAppleWatch) { canAddCardToADevice, passLocations in
|
|
31
|
+
var status: AddCardToWalletStatus? = nil
|
|
32
|
+
if (!canAddCardToADevice) {
|
|
33
|
+
status = AddCardToWalletStatus.CARD_ALREADY_EXISTS
|
|
34
|
+
} else if (passLocations.contains(.PAIRED_DEVICE)) {
|
|
35
|
+
status = AddCardToWalletStatus.CARD_EXISTS_ON_PAIRED_DEVICE
|
|
36
|
+
} else if (passLocations.contains(.CURRENT_DEVICE)) {
|
|
37
|
+
status = AddCardToWalletStatus.CARD_EXISTS_ON_CURRENT_DEVICE
|
|
38
|
+
}
|
|
39
|
+
completion(canAddCardToADevice, status)
|
|
40
|
+
}
|
|
31
41
|
}
|
|
32
|
-
|
|
33
|
-
return (canAddCard, status)
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
class func canAddPaymentPass(primaryAccountIdentifier: String, isTestMode: Bool) -> Bool {
|
|
@@ -45,20 +53,35 @@ internal class PushProvisioningUtils {
|
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
class func
|
|
49
|
-
let
|
|
56
|
+
class func getPassLocation(last4: String) -> PaymentPassFinder.PassLocation? {
|
|
57
|
+
let existingPassOnDevice: PKPass? = {
|
|
50
58
|
if #available(iOS 13.4, *) {
|
|
51
|
-
return PKPassLibrary().passes(of: PKPassType.secureElement)
|
|
59
|
+
return PKPassLibrary().passes(of: PKPassType.secureElement)
|
|
60
|
+
.first(where: { $0.secureElementPass?.primaryAccountNumberSuffix == last4 && $0.secureElementPass?.passActivationState != .suspended && !$0.isRemotePass })
|
|
52
61
|
} else {
|
|
53
|
-
return PKPassLibrary().passes(of: PKPassType.payment)
|
|
62
|
+
return PKPassLibrary().passes(of: PKPassType.payment)
|
|
63
|
+
.first(where: { $0.paymentPass?.primaryAccountNumberSuffix == last4 && $0.paymentPass?.passActivationState != .suspended && !$0.isRemotePass })
|
|
54
64
|
}
|
|
55
65
|
}()
|
|
56
|
-
|
|
66
|
+
|
|
67
|
+
let existingPassOnPairedDevices: PKPass? = {
|
|
68
|
+
if #available(iOS 13.4, *) {
|
|
69
|
+
return PKPassLibrary().remoteSecureElementPasses
|
|
70
|
+
.first(where: { $0.secureElementPass?.primaryAccountNumberSuffix == last4 && $0.secureElementPass?.passActivationState != .suspended })
|
|
71
|
+
} else {
|
|
72
|
+
return PKPassLibrary().remotePaymentPasses()
|
|
73
|
+
.first(where: { $0.paymentPass?.primaryAccountNumberSuffix == last4 && $0.paymentPass?.passActivationState != .suspended })
|
|
74
|
+
}
|
|
75
|
+
}()
|
|
76
|
+
|
|
77
|
+
return existingPassOnDevice != nil ? PaymentPassFinder.PassLocation.CURRENT_DEVICE : (existingPassOnPairedDevices != nil ? PaymentPassFinder.PassLocation.PAIRED_DEVICE : nil)
|
|
57
78
|
}
|
|
58
79
|
|
|
59
80
|
enum AddCardToWalletStatus: String {
|
|
60
81
|
case UNSUPPORTED_DEVICE
|
|
61
82
|
case MISSING_CONFIGURATION
|
|
62
83
|
case CARD_ALREADY_EXISTS
|
|
84
|
+
case CARD_EXISTS_ON_CURRENT_DEVICE
|
|
85
|
+
case CARD_EXISTS_ON_PAIRED_DEVICE
|
|
63
86
|
}
|
|
64
87
|
}
|
package/ios/StripeSdk.m
CHANGED
|
@@ -19,6 +19,35 @@ RCT_EXTERN_METHOD(
|
|
|
19
19
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
20
20
|
rejecter: (RCTPromiseRejectBlock)reject)
|
|
21
21
|
|
|
22
|
+
RCT_EXTERN_METHOD(
|
|
23
|
+
isPlatformPaySupported:(NSDictionary *)params
|
|
24
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
25
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
26
|
+
|
|
27
|
+
RCT_EXTERN_METHOD(
|
|
28
|
+
createPlatformPayPaymentMethod:(NSDictionary *)params
|
|
29
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
30
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
31
|
+
|
|
32
|
+
RCT_EXTERN_METHOD(
|
|
33
|
+
confirmPlatformPay:(NSString *)clientSecret
|
|
34
|
+
params:(NSDictionary *)params
|
|
35
|
+
isPaymentIntent:(BOOL)isPaymentIntent
|
|
36
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
37
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
RCT_EXTERN_METHOD(
|
|
41
|
+
dismissPlatformPay: (RCTPromiseResolveBlock)resolve
|
|
42
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
43
|
+
|
|
44
|
+
RCT_EXTERN_METHOD(
|
|
45
|
+
updatePlatformPaySheet:(NSArray *)summaryItems
|
|
46
|
+
shippingMethods:(NSArray *)summaryItems
|
|
47
|
+
errors: (NSArray *)errors
|
|
48
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
49
|
+
rejecter: (RCTPromiseRejectBlock)reject)
|
|
50
|
+
|
|
22
51
|
RCT_EXTERN_METHOD(
|
|
23
52
|
presentApplePay:(NSDictionary *)params
|
|
24
53
|
resolver: (RCTPromiseResolveBlock)resolve
|
package/ios/StripeSdk.swift
CHANGED
|
@@ -4,7 +4,7 @@ import StripePaymentSheet
|
|
|
4
4
|
import StripeFinancialConnections
|
|
5
5
|
|
|
6
6
|
@objc(StripeSdk)
|
|
7
|
-
class StripeSdk: RCTEventEmitter,
|
|
7
|
+
class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdaptivePresentationControllerDelegate {
|
|
8
8
|
public var cardFieldView: CardFieldView? = nil
|
|
9
9
|
public var cardFormView: CardFormView? = nil
|
|
10
10
|
|
|
@@ -14,19 +14,49 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
14
14
|
private var paymentSheetFlowController: PaymentSheet.FlowController?
|
|
15
15
|
|
|
16
16
|
var urlScheme: String? = nil
|
|
17
|
-
|
|
18
|
-
var applePayCompletionCallback: STPIntentClientSecretCompletionBlock? = nil
|
|
19
|
-
var applePayRequestResolver: RCTPromiseResolveBlock? = nil
|
|
20
|
-
var applePayRequestRejecter: RCTPromiseRejectBlock? = nil
|
|
21
|
-
var applePayCompletionRejecter: RCTPromiseRejectBlock? = nil
|
|
22
|
-
var confirmApplePayPaymentResolver: RCTPromiseResolveBlock? = nil
|
|
17
|
+
|
|
23
18
|
var confirmPaymentResolver: RCTPromiseResolveBlock? = nil
|
|
24
19
|
|
|
20
|
+
var applePayCompletionCallback: STPIntentClientSecretCompletionBlock? = nil
|
|
21
|
+
var deprecatedApplePayRequestResolver: RCTPromiseResolveBlock? = nil
|
|
22
|
+
var deprecatedApplePayRequestRejecter: RCTPromiseRejectBlock? = nil
|
|
23
|
+
var deprecatedApplePayCompletionRejecter: RCTPromiseRejectBlock? = nil
|
|
24
|
+
var deprecatedConfirmApplePayPaymentResolver: RCTPromiseResolveBlock? = nil
|
|
25
|
+
|
|
26
|
+
var confirmApplePayResolver: RCTPromiseResolveBlock? = nil
|
|
27
|
+
var confirmApplePayPaymentClientSecret: String? = nil
|
|
28
|
+
var confirmApplePaySetupClientSecret: String? = nil
|
|
29
|
+
|
|
30
|
+
var applePaymentAuthorizationController: PKPaymentAuthorizationViewController? = nil
|
|
31
|
+
var createPlatformPayPaymentMethodResolver: RCTPromiseResolveBlock? = nil
|
|
32
|
+
var applePaymentMethodFlowCanBeCanceled = false
|
|
33
|
+
|
|
25
34
|
var confirmPaymentClientSecret: String? = nil
|
|
26
35
|
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
|
|
36
|
+
var shippingMethodUpdateCompletion: ((PKPaymentRequestShippingMethodUpdate) -> Void)? = nil
|
|
37
|
+
var shippingContactUpdateCompletion: ((PKPaymentRequestShippingContactUpdate) -> Void)? = nil
|
|
38
|
+
@available(iOS 15.0, *)
|
|
39
|
+
var couponCodeUpdateCompletion: ((PKPaymentRequestCouponCodeUpdate) -> Void)? {
|
|
40
|
+
get { _couponCodeUpdateCompletion as? ((PKPaymentRequestCouponCodeUpdate) -> Void) }
|
|
41
|
+
set { _couponCodeUpdateCompletion = newValue }
|
|
42
|
+
}
|
|
43
|
+
private var _couponCodeUpdateCompletion: Any? = nil
|
|
44
|
+
var shippingMethodUpdateJSCallback: RCTDirectEventBlock? = nil
|
|
45
|
+
var shippingContactUpdateJSCallback: RCTDirectEventBlock? = nil
|
|
46
|
+
var couponCodeEnteredJSCallback: RCTDirectEventBlock? = nil
|
|
47
|
+
var applePaySummaryItems: [PKPaymentSummaryItem] = []
|
|
48
|
+
var applePayShippingMethods: [PKShippingMethod] = []
|
|
49
|
+
var applePayShippingAddressErrors: [Error]? = nil
|
|
50
|
+
var applePayCouponCodeErrors: [Error]? = nil
|
|
51
|
+
|
|
52
|
+
var hasLegacyApplePayListeners = false
|
|
53
|
+
override func startObserving() {
|
|
54
|
+
hasLegacyApplePayListeners = true
|
|
55
|
+
}
|
|
56
|
+
override func stopObserving() {
|
|
57
|
+
hasLegacyApplePayListeners = false
|
|
58
|
+
}
|
|
59
|
+
|
|
30
60
|
override func supportedEvents() -> [String]! {
|
|
31
61
|
return ["onDidSetShippingMethod", "onDidSetShippingContact"]
|
|
32
62
|
}
|
|
@@ -364,9 +394,56 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
364
394
|
}
|
|
365
395
|
}
|
|
366
396
|
|
|
397
|
+
@objc(updatePlatformPaySheet:shippingMethods:errors:resolver:rejecter:)
|
|
398
|
+
func updatePlatformPaySheet(summaryItems: NSArray,
|
|
399
|
+
shippingMethods: NSArray,
|
|
400
|
+
errors: [NSDictionary],
|
|
401
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
402
|
+
rejecter reject: @escaping RCTPromiseRejectBlock)
|
|
403
|
+
{
|
|
404
|
+
let couponUpdateHandlerIsNil: Bool = {
|
|
405
|
+
if #available(iOS 15.0, *), self.couponCodeUpdateCompletion == nil {
|
|
406
|
+
return true
|
|
407
|
+
}
|
|
408
|
+
return false
|
|
409
|
+
}()
|
|
410
|
+
|
|
411
|
+
if (shippingMethodUpdateCompletion == nil && shippingContactUpdateCompletion == nil && couponUpdateHandlerIsNil) {
|
|
412
|
+
resolve(Errors.createError(ErrorType.Failed, "You can use this method only after either onShippingContactSelected, onShippingMethodSelected, or onCouponCodeEntered callbacks are triggered"))
|
|
413
|
+
return
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
do {
|
|
417
|
+
applePaySummaryItems = try ApplePayUtils.buildPaymentSummaryItems(items: summaryItems as? [[String : Any]])
|
|
418
|
+
} catch {
|
|
419
|
+
resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
|
|
420
|
+
return
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
applePayShippingMethods = ApplePayUtils.buildShippingMethods(items: shippingMethods as? [[String : Any]])
|
|
424
|
+
|
|
425
|
+
do {
|
|
426
|
+
(applePayShippingAddressErrors, applePayCouponCodeErrors) = try ApplePayUtils.buildApplePayErrors(errorItems: errors)
|
|
427
|
+
} catch {
|
|
428
|
+
resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
|
|
429
|
+
return
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
shippingMethodUpdateCompletion?(PKPaymentRequestShippingMethodUpdate.init(paymentSummaryItems: applePaySummaryItems))
|
|
434
|
+
shippingContactUpdateCompletion?(PKPaymentRequestShippingContactUpdate.init(errors: applePayShippingAddressErrors, paymentSummaryItems: applePaySummaryItems, shippingMethods: applePayShippingMethods))
|
|
435
|
+
if #available(iOS 15.0, *) {
|
|
436
|
+
couponCodeUpdateCompletion?(PKPaymentRequestCouponCodeUpdate.init(errors: applePayCouponCodeErrors, paymentSummaryItems: applePaySummaryItems, shippingMethods: applePayShippingMethods))
|
|
437
|
+
self.couponCodeUpdateCompletion = nil
|
|
438
|
+
}
|
|
439
|
+
self.shippingMethodUpdateCompletion = nil
|
|
440
|
+
self.shippingContactUpdateCompletion = nil
|
|
441
|
+
resolve([])
|
|
442
|
+
}
|
|
443
|
+
|
|
367
444
|
@objc(updateApplePaySummaryItems:errorAddressFields:resolver:rejecter:)
|
|
368
445
|
func updateApplePaySummaryItems(summaryItems: NSArray, errorAddressFields: [NSDictionary], resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
369
|
-
if (
|
|
446
|
+
if (shippingMethodUpdateCompletion == nil && shippingContactUpdateCompletion == nil) {
|
|
370
447
|
resolve(Errors.createError(ErrorType.Failed, "You can use this method only after either onDidSetShippingMethod or onDidSetShippingContact events emitted"))
|
|
371
448
|
return
|
|
372
449
|
}
|
|
@@ -386,88 +463,26 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
386
463
|
shippingAddressErrors.append(PKPaymentRequest.paymentShippingAddressInvalidError(withKey: field, localizedDescription: message))
|
|
387
464
|
}
|
|
388
465
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
self.
|
|
392
|
-
self.
|
|
466
|
+
shippingMethodUpdateCompletion?(PKPaymentRequestShippingMethodUpdate.init(paymentSummaryItems: paymentSummaryItems))
|
|
467
|
+
shippingContactUpdateCompletion?(PKPaymentRequestShippingContactUpdate.init(errors: shippingAddressErrors, paymentSummaryItems: paymentSummaryItems, shippingMethods: []))
|
|
468
|
+
self.shippingMethodUpdateCompletion = nil
|
|
469
|
+
self.shippingContactUpdateCompletion = nil
|
|
393
470
|
resolve([])
|
|
394
471
|
}
|
|
395
472
|
|
|
396
473
|
@objc(openApplePaySetup:rejecter:)
|
|
397
474
|
func openApplePaySetup(resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
library.openPaymentSetup()
|
|
401
|
-
resolve([])
|
|
402
|
-
} else {
|
|
403
|
-
resolve(Errors.createError(ErrorType.Failed, "Cannot open payment setup"))
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
func applePayContext(_ context: STPApplePayContext, didSelect shippingMethod: PKShippingMethod, handler: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) {
|
|
409
|
-
self.shippingMethodUpdateHandler = handler
|
|
410
|
-
sendEvent(withName: "onDidSetShippingMethod", body: ["shippingMethod": Mappers.mapFromShippingMethod(shippingMethod: shippingMethod)])
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
func applePayContext(_ context: STPApplePayContext, didSelectShippingContact contact: PKContact, handler: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) {
|
|
414
|
-
self.shippingContactUpdateHandler = handler
|
|
415
|
-
sendEvent(withName: "onDidSetShippingContact", body: ["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact)])
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
func applePayContext(_ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: STPPaymentMethod, paymentInformation: PKPayment, completion: @escaping STPIntentClientSecretCompletionBlock) {
|
|
419
|
-
self.applePayCompletionCallback = completion
|
|
420
|
-
|
|
421
|
-
let address = paymentMethod.billingDetails?.address?.line1?.split(whereSeparator: \.isNewline)
|
|
422
|
-
if (address?.indices.contains(0) == true) {
|
|
423
|
-
paymentMethod.billingDetails?.address?.line1 = String(address?[0] ?? "")
|
|
424
|
-
}
|
|
425
|
-
if (address?.indices.contains(1) == true) {
|
|
426
|
-
paymentMethod.billingDetails?.address?.line2 = String(address?[1] ?? "")
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
let method = Mappers.mapFromPaymentMethod(paymentMethod)
|
|
430
|
-
self.applePayRequestResolver?(Mappers.createResult("paymentMethod", method))
|
|
431
|
-
self.applePayRequestRejecter = nil
|
|
475
|
+
PKPassLibrary.init().openPaymentSetup()
|
|
476
|
+
resolve([])
|
|
432
477
|
}
|
|
433
478
|
|
|
434
479
|
@objc(confirmApplePayPayment:resolver:rejecter:)
|
|
435
480
|
func confirmApplePayPayment(clientSecret: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
436
|
-
self.
|
|
437
|
-
self.
|
|
481
|
+
self.deprecatedApplePayCompletionRejecter = reject
|
|
482
|
+
self.deprecatedConfirmApplePayPaymentResolver = resolve
|
|
438
483
|
self.applePayCompletionCallback?(clientSecret, nil)
|
|
439
484
|
}
|
|
440
485
|
|
|
441
|
-
func applePayContext(_ context: STPApplePayContext, didCompleteWith status: STPPaymentStatus, error: Error?) {
|
|
442
|
-
switch status {
|
|
443
|
-
case .success:
|
|
444
|
-
applePayCompletionRejecter = nil
|
|
445
|
-
applePayRequestRejecter = nil
|
|
446
|
-
confirmApplePayPaymentResolver?([])
|
|
447
|
-
break
|
|
448
|
-
case .error:
|
|
449
|
-
let message = "Payment not completed"
|
|
450
|
-
applePayCompletionRejecter?(ErrorType.Failed, message, nil)
|
|
451
|
-
applePayRequestRejecter?(ErrorType.Failed, message, nil)
|
|
452
|
-
applePayCompletionRejecter = nil
|
|
453
|
-
applePayRequestRejecter = nil
|
|
454
|
-
break
|
|
455
|
-
case .userCancellation:
|
|
456
|
-
let message = "The payment has been canceled"
|
|
457
|
-
applePayCompletionRejecter?(ErrorType.Canceled, message, nil)
|
|
458
|
-
applePayRequestRejecter?(ErrorType.Canceled, message, nil)
|
|
459
|
-
applePayCompletionRejecter = nil
|
|
460
|
-
applePayRequestRejecter = nil
|
|
461
|
-
break
|
|
462
|
-
@unknown default:
|
|
463
|
-
let message = "Payment not completed"
|
|
464
|
-
applePayCompletionRejecter?(ErrorType.Unknown, message, nil)
|
|
465
|
-
applePayRequestRejecter?(ErrorType.Unknown, message, nil)
|
|
466
|
-
applePayCompletionRejecter = nil
|
|
467
|
-
applePayRequestRejecter = nil
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
486
|
@objc(isApplePaySupported:rejecter:)
|
|
472
487
|
func isApplePaySupported(resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
473
488
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
@@ -496,65 +511,110 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
496
511
|
func presentApplePay(params: NSDictionary,
|
|
497
512
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
498
513
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
499
|
-
|
|
500
|
-
|
|
514
|
+
self.deprecatedApplePayRequestResolver = resolve
|
|
515
|
+
self.deprecatedApplePayRequestRejecter = reject
|
|
516
|
+
|
|
517
|
+
let (error, paymentRequest) = ApplePayUtils.createPaymentRequest(merchantIdentifier: merchantIdentifier, params: params)
|
|
518
|
+
guard let paymentRequest = paymentRequest else {
|
|
519
|
+
resolve(error)
|
|
501
520
|
return
|
|
502
521
|
}
|
|
503
|
-
|
|
504
|
-
if (
|
|
505
|
-
|
|
522
|
+
|
|
523
|
+
if let applePayContext = STPApplePayContext(paymentRequest: paymentRequest, delegate: self) {
|
|
524
|
+
DispatchQueue.main.async {
|
|
525
|
+
applePayContext.presentApplePay(completion: nil)
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
resolve(Errors.createError(ErrorType.Failed, "Payment not completed"))
|
|
506
529
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
@objc(isPlatformPaySupported:resolver:rejecter:)
|
|
533
|
+
func isPlatformPaySupported(params: NSDictionary,
|
|
534
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
535
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
536
|
+
resolve(StripeAPI.deviceSupportsApplePay())
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
@objc(createPlatformPayPaymentMethod:resolver:rejecter:)
|
|
540
|
+
func createPlatformPayPaymentMethod(params: NSDictionary,
|
|
541
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
542
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
543
|
+
guard let applePayPatams = params["applePay"] as? NSDictionary else {
|
|
544
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide the `applePay` parameter."))
|
|
510
545
|
return
|
|
511
546
|
}
|
|
512
|
-
|
|
513
|
-
|
|
547
|
+
let (error, paymentRequest) = ApplePayUtils.createPaymentRequest(merchantIdentifier: merchantIdentifier, params: applePayPatams)
|
|
548
|
+
guard let paymentRequest = paymentRequest else {
|
|
549
|
+
resolve(error)
|
|
514
550
|
return
|
|
515
551
|
}
|
|
516
|
-
|
|
517
|
-
|
|
552
|
+
|
|
553
|
+
self.applePaySummaryItems = paymentRequest.paymentSummaryItems
|
|
554
|
+
self.applePayShippingMethods = paymentRequest.shippingMethods ?? []
|
|
555
|
+
self.applePayShippingAddressErrors = nil
|
|
556
|
+
self.applePayCouponCodeErrors = nil
|
|
557
|
+
applePaymentMethodFlowCanBeCanceled = true
|
|
558
|
+
createPlatformPayPaymentMethodResolver = resolve
|
|
559
|
+
self.applePaymentAuthorizationController = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest)
|
|
560
|
+
if let applePaymentAuthorizationController = self.applePaymentAuthorizationController {
|
|
561
|
+
applePaymentAuthorizationController.delegate = self
|
|
562
|
+
DispatchQueue.main.async {
|
|
563
|
+
let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
|
|
564
|
+
vc.present(
|
|
565
|
+
applePaymentAuthorizationController,
|
|
566
|
+
animated: true,
|
|
567
|
+
completion: nil
|
|
568
|
+
)
|
|
569
|
+
}
|
|
570
|
+
} else {
|
|
571
|
+
resolve(Errors.createError(ErrorType.Failed, "Invalid in-app payment request. Search the iOS logs for `NSUnderlyingError` to get more information."))
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
@objc(dismissPlatformPay:rejecter:)
|
|
576
|
+
func dismissPlatformPay(resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
577
|
+
let didDismiss = maybeDismissApplePay()
|
|
578
|
+
resolve(didDismiss)
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
@objc(confirmPlatformPay:params:isPaymentIntent:resolver:rejecter:)
|
|
582
|
+
func confirmPlatformPay(
|
|
583
|
+
clientSecret: String?,
|
|
584
|
+
params: NSDictionary,
|
|
585
|
+
isPaymentIntent: Bool,
|
|
586
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
587
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
588
|
+
) -> Void {
|
|
589
|
+
guard let applePayPatams = params["applePay"] as? NSDictionary else {
|
|
590
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide the `applePay` parameter."))
|
|
518
591
|
return
|
|
519
592
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
let merchantIdentifier = self.merchantIdentifier ?? ""
|
|
525
|
-
let paymentRequest = StripeAPI.paymentRequest(withMerchantIdentifier: merchantIdentifier, country: country, currency: currency)
|
|
526
|
-
|
|
527
|
-
let requiredShippingAddressFields = params["requiredShippingAddressFields"] as? NSArray ?? NSArray()
|
|
528
|
-
let requiredBillingContactFields = params["requiredBillingContactFields"] as? NSArray ?? NSArray()
|
|
529
|
-
let shippingMethods = params["shippingMethods"] as? NSArray ?? NSArray()
|
|
530
|
-
|
|
531
|
-
paymentRequest.requiredShippingContactFields = Set(requiredShippingAddressFields.map {
|
|
532
|
-
Mappers.mapToPKContactField(field: $0 as! String)
|
|
533
|
-
})
|
|
534
|
-
|
|
535
|
-
paymentRequest.requiredBillingContactFields = Set(requiredBillingContactFields.map {
|
|
536
|
-
Mappers.mapToPKContactField(field: $0 as! String)
|
|
537
|
-
})
|
|
538
|
-
|
|
539
|
-
paymentRequest.shippingMethods = Mappers.mapToShippingMethods(shippingMethods: shippingMethods)
|
|
540
|
-
|
|
541
|
-
do {
|
|
542
|
-
paymentRequest.paymentSummaryItems = try ApplePayUtils
|
|
543
|
-
.buildPaymentSummaryItems(items: summaryItems as? [[String : Any]])
|
|
544
|
-
} catch {
|
|
545
|
-
resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
|
|
593
|
+
let (error, paymentRequest) = ApplePayUtils.createPaymentRequest(merchantIdentifier: merchantIdentifier, params: applePayPatams)
|
|
594
|
+
guard let paymentRequest = paymentRequest else {
|
|
595
|
+
resolve(error)
|
|
546
596
|
return
|
|
547
597
|
}
|
|
548
598
|
|
|
599
|
+
self.applePaySummaryItems = paymentRequest.paymentSummaryItems
|
|
600
|
+
self.applePayShippingMethods = paymentRequest.shippingMethods ?? []
|
|
601
|
+
self.applePayShippingAddressErrors = nil
|
|
602
|
+
self.applePayCouponCodeErrors = nil
|
|
603
|
+
self.confirmApplePayResolver = resolve
|
|
604
|
+
if (isPaymentIntent) {
|
|
605
|
+
self.confirmApplePayPaymentClientSecret = clientSecret
|
|
606
|
+
} else {
|
|
607
|
+
self.confirmApplePaySetupClientSecret = clientSecret
|
|
608
|
+
}
|
|
549
609
|
if let applePayContext = STPApplePayContext(paymentRequest: paymentRequest, delegate: self) {
|
|
550
610
|
DispatchQueue.main.async {
|
|
551
611
|
applePayContext.presentApplePay(completion: nil)
|
|
552
612
|
}
|
|
553
613
|
} else {
|
|
554
|
-
|
|
614
|
+
resolve(Errors.createError(ErrorType.Failed, "Payment not completed"))
|
|
555
615
|
}
|
|
556
616
|
}
|
|
557
|
-
|
|
617
|
+
|
|
558
618
|
func configure3dSecure(_ params: NSDictionary) {
|
|
559
619
|
let threeDSCustomizationSettings = STPPaymentHandler.shared().threeDSCustomizationSettings
|
|
560
620
|
let uiCustomization = Mappers.mapUICustomization(params)
|
|
@@ -1056,13 +1116,17 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1056
1116
|
resolve(Errors.createError(ErrorType.Failed, "You must provide `cardLastFour`"))
|
|
1057
1117
|
return
|
|
1058
1118
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
"
|
|
1064
|
-
|
|
1065
|
-
|
|
1119
|
+
PushProvisioningUtils.canAddCardToWallet(
|
|
1120
|
+
last4: last4,
|
|
1121
|
+
primaryAccountIdentifier: params["primaryAccountIdentifier"] as? String ?? "",
|
|
1122
|
+
testEnv: params["testEnv"] as? Bool ?? false,
|
|
1123
|
+
hasPairedAppleWatch: params["hasPairedAppleWatch"] as? Bool ?? false)
|
|
1124
|
+
{ canAddCard, status in
|
|
1125
|
+
resolve([
|
|
1126
|
+
"canAddCard": canAddCard,
|
|
1127
|
+
"details": ["status": status?.rawValue],
|
|
1128
|
+
])
|
|
1129
|
+
}
|
|
1066
1130
|
}
|
|
1067
1131
|
|
|
1068
1132
|
@objc(isCardInWallet:resolver:rejecter:)
|
|
@@ -1075,7 +1139,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
1075
1139
|
resolve(Errors.createError(ErrorType.Failed, "You must provide `cardLastFour`"))
|
|
1076
1140
|
return
|
|
1077
1141
|
}
|
|
1078
|
-
resolve(["isInWallet": PushProvisioningUtils.
|
|
1142
|
+
resolve(["isInWallet": PushProvisioningUtils.getPassLocation(last4: last4) != nil])
|
|
1079
1143
|
}
|
|
1080
1144
|
|
|
1081
1145
|
@objc(collectBankAccountToken:resolver:rejecter:)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import XCTest
|
|
9
9
|
@testable import stripe_react_native
|
|
10
|
-
import
|
|
10
|
+
import StripePaymentSheet
|
|
11
11
|
|
|
12
12
|
class AddressSheetUtilsTests: XCTestCase {
|
|
13
13
|
let testCity = "testCity"
|
|
@@ -202,9 +202,6 @@ class AddressSheetUtilsTests: XCTestCase {
|
|
|
202
202
|
XCTAssertEqual(
|
|
203
203
|
result.phone, .hidden
|
|
204
204
|
)
|
|
205
|
-
XCTAssertEqual(
|
|
206
|
-
result.name, .required
|
|
207
|
-
)
|
|
208
205
|
XCTAssertEqual(
|
|
209
206
|
result.checkboxLabel, nil
|
|
210
207
|
)
|
|
@@ -219,9 +216,6 @@ class AddressSheetUtilsTests: XCTestCase {
|
|
|
219
216
|
XCTAssertEqual(
|
|
220
217
|
result.phone, .optional
|
|
221
218
|
)
|
|
222
|
-
XCTAssertEqual(
|
|
223
|
-
result.name, .hidden
|
|
224
|
-
)
|
|
225
219
|
XCTAssertEqual(
|
|
226
220
|
result.checkboxLabel, testCheckboxLabel
|
|
227
221
|
)
|
|
@@ -11,19 +11,22 @@ import XCTest
|
|
|
11
11
|
|
|
12
12
|
class PushProvisioningTests: XCTestCase {
|
|
13
13
|
func testCanAddCardToWalletInTestMode() throws {
|
|
14
|
-
|
|
14
|
+
PushProvisioningUtils.canAddCardToWallet(last4: "4242",
|
|
15
15
|
primaryAccountIdentifier: "",
|
|
16
|
-
testEnv: true)
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
testEnv: true, hasPairedAppleWatch: false) { canAddCard, status in
|
|
17
|
+
XCTAssertEqual(canAddCard, true)
|
|
18
|
+
XCTAssertEqual(status, nil)
|
|
19
|
+
}
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
func testCanAddCardToWalletInLiveMode() throws {
|
|
22
|
-
|
|
23
|
+
PushProvisioningUtils.canAddCardToWallet(last4: "4242",
|
|
23
24
|
primaryAccountIdentifier: "",
|
|
24
|
-
testEnv: false
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
testEnv: false,
|
|
26
|
+
hasPairedAppleWatch: false) { canAddCard, status in
|
|
27
|
+
XCTAssertEqual(canAddCard, false)
|
|
28
|
+
XCTAssertEqual(status, PushProvisioningUtils.AddCardToWalletStatus.MISSING_CONFIGURATION)
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
func testCanAddPaymentPassInTestMode() throws {
|
|
@@ -42,8 +45,8 @@ class PushProvisioningTests: XCTestCase {
|
|
|
42
45
|
|
|
43
46
|
func testCheckIfPassExists() throws {
|
|
44
47
|
XCTAssertEqual(
|
|
45
|
-
PushProvisioningUtils.
|
|
46
|
-
|
|
48
|
+
PushProvisioningUtils.getPassLocation(last4: "4242"),
|
|
49
|
+
nil
|
|
47
50
|
)
|
|
48
51
|
}
|
|
49
52
|
}
|
package/jest/mock.js
CHANGED
|
@@ -22,6 +22,27 @@ const mockFunctions = {
|
|
|
22
22
|
paymentMethod: {},
|
|
23
23
|
error: null,
|
|
24
24
|
})),
|
|
25
|
+
isPlatformPaySupported: jest.fn(async () => true),
|
|
26
|
+
confirmPlatformPaySetupIntent: jest.fn(async () => ({
|
|
27
|
+
setupIntent: {},
|
|
28
|
+
error: null,
|
|
29
|
+
})),
|
|
30
|
+
confirmPlatformPayPayment: jest.fn(async () => ({
|
|
31
|
+
paymentIntent: {},
|
|
32
|
+
error: null,
|
|
33
|
+
})),
|
|
34
|
+
dismissPlatformPay: jest.fn(async () => true),
|
|
35
|
+
createPlatformPayPaymentMethod: jest.fn(async () => ({
|
|
36
|
+
paymentMethod: {},
|
|
37
|
+
token: {},
|
|
38
|
+
error: null,
|
|
39
|
+
})),
|
|
40
|
+
updatePlatformPaySheet: jest.fn(async () => ({
|
|
41
|
+
error: null,
|
|
42
|
+
})),
|
|
43
|
+
openPlatformPaySetup: jest.fn(async () => {
|
|
44
|
+
return;
|
|
45
|
+
}),
|
|
25
46
|
isApplePaySupported: jest.fn(async () => true),
|
|
26
47
|
presentApplePay: jest.fn(async () => ({
|
|
27
48
|
error: null,
|
|
@@ -141,6 +162,28 @@ const mockHooks = {
|
|
|
141
162
|
...mockFunctions.openApplePaySetup(),
|
|
142
163
|
})),
|
|
143
164
|
})),
|
|
165
|
+
usePlatformPay: jest.fn(() => ({
|
|
166
|
+
loading: false,
|
|
167
|
+
isPlatformPaySupported: true,
|
|
168
|
+
confirmPlatformPaySetupIntent: jest.fn(async () => ({
|
|
169
|
+
...mockFunctions.confirmPlatformPaySetupIntent(),
|
|
170
|
+
})),
|
|
171
|
+
confirmPlatformPayPayment: jest.fn(async () => ({
|
|
172
|
+
...mockFunctions.confirmPlatformPayPayment(),
|
|
173
|
+
})),
|
|
174
|
+
dismissPlatformPay: jest.fn(async () => ({
|
|
175
|
+
...mockFunctions.dismissPlatformPay(),
|
|
176
|
+
})),
|
|
177
|
+
createPlatformPayPaymentMethod: jest.fn(async () => ({
|
|
178
|
+
...mockFunctions.createPlatformPayPaymentMethod(),
|
|
179
|
+
})),
|
|
180
|
+
updatePlatformPaySheet: jest.fn(async () => ({
|
|
181
|
+
...mockFunctions.updatePlatformPaySheet(),
|
|
182
|
+
})),
|
|
183
|
+
openPlatformPaySetup: jest.fn(async () => ({
|
|
184
|
+
...mockFunctions.openPlatformPaySetup(),
|
|
185
|
+
})),
|
|
186
|
+
})),
|
|
144
187
|
usePaymentSheet: jest.fn(() => ({
|
|
145
188
|
loading: false,
|
|
146
189
|
initPaymentSheet: jest.fn(async () => ({
|
|
@@ -175,5 +218,6 @@ module.exports = {
|
|
|
175
218
|
AuBECSDebitForm: () => 'AuBECSDebitForm',
|
|
176
219
|
GooglePayButton: () => 'GooglePayButton',
|
|
177
220
|
AddToWalletButton: () => 'AddToWalletButton',
|
|
221
|
+
PlatformPayButton: () => 'PlatformPayButton',
|
|
178
222
|
useStripe: jest.fn(() => mockHooks),
|
|
179
223
|
};
|