@stripe/stripe-react-native 0.41.0 → 0.43.0
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/.husky/pre-commit +0 -3
- package/CHANGELOG.md +27 -0
- package/README.md +3 -0
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +7 -1
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +4 -1
- package/android/gradlew +249 -0
- package/android/gradlew.bat +92 -0
- package/android/spotless.gradle +19 -0
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +30 -34
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +20 -10
- package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +12 -13
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +242 -105
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +58 -20
- package/android/src/main/java/com/reactnativestripesdk/CardFocusEvent.kt +8 -11
- package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +10 -12
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +135 -87
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +57 -22
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +53 -23
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +125 -83
- package/android/src/main/java/com/reactnativestripesdk/FormCompleteEvent.kt +9 -11
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +16 -9
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +36 -28
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +67 -43
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +21 -16
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +101 -56
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +244 -166
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +183 -123
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +181 -57
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +402 -258
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -4
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerView.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +654 -299
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +12 -14
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +42 -37
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetEvent.kt +12 -11
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +29 -29
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +50 -18
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +227 -147
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +15 -18
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +33 -15
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +63 -37
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletCompleteEvent.kt +9 -13
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/EphemeralKeyProvider.kt +15 -17
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +76 -60
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +71 -47
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +117 -51
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +39 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +337 -250
- package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +2 -11
- package/ios/CustomerSheet/CustomerSheetUtils.swift +3 -1
- package/ios/FinancialConnections.swift +18 -2
- package/ios/Mappers.swift +23 -0
- package/ios/PaymentMethodFactory.swift +31 -29
- package/ios/StripeSdk+CustomerSheet.swift +2 -1
- package/ios/StripeSdk+PaymentSheet.swift +42 -0
- package/ios/StripeSdk.m +2 -0
- package/ios/StripeSdk.swift +116 -24
- package/lib/commonjs/NativeStripeSdk.js +1 -1
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/ApplePayButtonNative.js +1 -1
- package/lib/commonjs/components/ApplePayButtonNative.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.js.map +1 -1
- package/lib/commonjs/components/GooglePayButtonNative.js +1 -1
- package/lib/commonjs/components/GooglePayButtonNative.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +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 +1 -1
- package/lib/commonjs/helpers.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 +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/plugin/withStripe.js +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 +1 -1
- package/lib/commonjs/types/Common.js.map +1 -1
- package/lib/commonjs/types/CustomerSheet.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 +1 -1
- package/lib/commonjs/types/FinancialConnections.js.map +1 -1
- package/lib/commonjs/types/NextAction.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js +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 +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/PushProvisioning.js +1 -1
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/ThreeDSecure.js +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 +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.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/ApplePayButtonNative.js +1 -1
- package/lib/module/components/ApplePayButtonNative.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.js.map +1 -1
- package/lib/module/components/GooglePayButtonNative.js +1 -1
- package/lib/module/components/GooglePayButtonNative.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js +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 +1 -1
- package/lib/module/helpers.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 +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/usePlatformPay.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/plugin/withStripe.js +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 +1 -1
- package/lib/module/types/Common.js.map +1 -1
- package/lib/module/types/CustomerSheet.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 +1 -1
- package/lib/module/types/FinancialConnections.js.map +1 -1
- package/lib/module/types/NextAction.js.map +1 -1
- package/lib/module/types/PaymentIntent.js +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 +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/PushProvisioning.js +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/SetupIntent.js +1 -1
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/module/types/ThreeDSecure.js +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 +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.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +5 -4
- package/lib/typescript/src/NativeStripeSdk.d.ts.map +1 -0
- package/lib/typescript/src/components/AddToWalletButton.d.ts +3 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -0
- package/lib/typescript/src/components/AddressSheet.d.ts +4 -2
- package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +1 -0
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +1 -0
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts +3 -1
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -0
- package/lib/typescript/src/components/CardField.d.ts +1 -0
- package/lib/typescript/src/components/CardField.d.ts.map +1 -0
- package/lib/typescript/src/components/CardForm.d.ts +1 -0
- package/lib/typescript/src/components/CardForm.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomerSheet.d.ts +2 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +1 -0
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +1 -0
- package/lib/typescript/src/components/PlatformPayButton.d.ts +3 -1
- package/lib/typescript/src/components/PlatformPayButton.d.ts.map +1 -0
- package/lib/typescript/src/components/StripeContainer.d.ts +2 -1
- package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -0
- package/lib/typescript/src/components/StripeProvider.d.ts +3 -2
- package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -0
- package/lib/typescript/src/functions.d.ts +12 -7
- package/lib/typescript/src/functions.d.ts.map +1 -0
- package/lib/typescript/src/helpers.d.ts +1 -0
- package/lib/typescript/src/helpers.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useConfirmPayment.d.ts +2 -1
- package/lib/typescript/src/hooks/useConfirmPayment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useConfirmSetupIntent.d.ts +1 -0
- package/lib/typescript/src/hooks/useConfirmSetupIntent.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +5 -2
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts +2 -1
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePlatformPay.d.ts +4 -3
- package/lib/typescript/src/hooks/usePlatformPay.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +11 -8
- package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/plugin/withStripe.d.ts +2 -1
- package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -0
- package/lib/typescript/src/types/ApplePay.d.ts +6 -5
- package/lib/typescript/src/types/ApplePay.d.ts.map +1 -0
- package/lib/typescript/src/types/Common.d.ts +4 -1
- package/lib/typescript/src/types/Common.d.ts.map +1 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +12 -4
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -0
- package/lib/typescript/src/types/Errors.d.ts +2 -1
- package/lib/typescript/src/types/Errors.d.ts.map +1 -0
- package/lib/typescript/src/types/FinancialConnections.d.ts +82 -14
- package/lib/typescript/src/types/FinancialConnections.d.ts.map +1 -0
- package/lib/typescript/src/types/NextAction.d.ts +9 -8
- package/lib/typescript/src/types/NextAction.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentIntent.d.ts +41 -14
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentMethod.d.ts +27 -15
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +72 -22
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -0
- package/lib/typescript/src/types/PlatformPay.d.ts +22 -21
- package/lib/typescript/src/types/PlatformPay.d.ts.map +1 -0
- package/lib/typescript/src/types/PushProvisioning.d.ts +5 -4
- package/lib/typescript/src/types/PushProvisioning.d.ts.map +1 -0
- package/lib/typescript/src/types/SetupIntent.d.ts +4 -3
- package/lib/typescript/src/types/SetupIntent.d.ts.map +1 -0
- package/lib/typescript/src/types/ThreeDSecure.d.ts +1 -0
- package/lib/typescript/src/types/ThreeDSecure.d.ts.map +1 -0
- package/lib/typescript/src/types/Token.d.ts +10 -9
- package/lib/typescript/src/types/Token.d.ts.map +1 -0
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts +3 -2
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/components/AuBECSDebitFormComponent.d.ts +1 -0
- package/lib/typescript/src/types/components/AuBECSDebitFormComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +8 -5
- package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -0
- package/lib/typescript/src/types/components/CardFormView.d.ts +9 -6
- package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -0
- package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts +1 -0
- package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +24 -23
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/package.json +33 -42
- package/src/NativeStripeSdk.tsx +5 -3
- package/src/components/CardField.tsx +1 -1
- package/src/components/CardForm.tsx +12 -9
- package/src/components/CustomerSheet.tsx +4 -6
- package/src/components/StripeProvider.tsx +17 -0
- package/src/functions.ts +70 -16
- package/src/hooks/useFinancialConnectionsSheet.tsx +12 -4
- package/src/hooks/useStripe.tsx +10 -4
- package/src/types/Common.ts +3 -0
- package/src/types/CustomerSheet.ts +7 -0
- package/src/types/FinancialConnections.ts +72 -0
- package/src/types/PaymentIntent.ts +30 -1
- package/src/types/PaymentMethod.ts +13 -1
- package/src/types/PaymentSheet.ts +65 -5
- package/src/types/components/CardFieldInput.ts +8 -4
- package/src/types/components/CardFormView.ts +8 -4
- package/stripe-react-native.podspec +2 -1
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
package com.reactnativestripesdk.utils
|
|
2
2
|
|
|
3
3
|
class PostalCodeUtilities {
|
|
4
|
-
|
|
5
4
|
companion object {
|
|
6
|
-
internal fun isValidGlobalPostalCodeCharacter(c: Char): Boolean
|
|
7
|
-
return Character.isLetterOrDigit(c)
|
|
8
|
-
|| c.isWhitespace()
|
|
9
|
-
|| c == '-'
|
|
10
|
-
}
|
|
5
|
+
internal fun isValidGlobalPostalCodeCharacter(c: Char): Boolean = Character.isLetterOrDigit(c) || c.isWhitespace() || c == '-'
|
|
11
6
|
|
|
12
|
-
internal fun isValidUsPostalCodeCharacter(c: Char): Boolean
|
|
13
|
-
return Character.isDigit(c)
|
|
14
|
-
|| c.isWhitespace()
|
|
15
|
-
|| c == '-'
|
|
16
|
-
}
|
|
7
|
+
internal fun isValidUsPostalCodeCharacter(c: Char): Boolean = Character.isDigit(c) || c.isWhitespace() || c == '-'
|
|
17
8
|
}
|
|
18
9
|
}
|
|
@@ -20,7 +20,8 @@ class CustomerSheetUtils {
|
|
|
20
20
|
billingDetailsCollectionConfiguration: NSDictionary?,
|
|
21
21
|
defaultBillingDetails: NSDictionary?,
|
|
22
22
|
preferredNetworks: Array<Int>?,
|
|
23
|
-
allowsRemovalOfLastSavedPaymentMethod: Bool
|
|
23
|
+
allowsRemovalOfLastSavedPaymentMethod: Bool?,
|
|
24
|
+
cardBrandAcceptance: PaymentSheet.CardBrandAcceptance
|
|
24
25
|
) -> CustomerSheet.Configuration {
|
|
25
26
|
var config = CustomerSheet.Configuration()
|
|
26
27
|
config.appearance = appearance
|
|
@@ -58,6 +59,7 @@ class CustomerSheetUtils {
|
|
|
58
59
|
if let allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod {
|
|
59
60
|
config.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
|
|
60
61
|
}
|
|
62
|
+
config.cardBrandAcceptance = cardBrandAcceptance
|
|
61
63
|
return config
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -14,10 +14,18 @@ class FinancialConnections {
|
|
|
14
14
|
internal static func present(
|
|
15
15
|
withClientSecret: String,
|
|
16
16
|
returnURL: String? = nil,
|
|
17
|
+
configuration: FinancialConnectionsSheet.Configuration? = nil,
|
|
18
|
+
onEvent: ((FinancialConnectionsEvent) -> Void)? = nil,
|
|
17
19
|
resolve: @escaping RCTPromiseResolveBlock
|
|
18
20
|
) -> Void {
|
|
19
21
|
DispatchQueue.main.async {
|
|
20
|
-
|
|
22
|
+
let financialConnectionsSheet = FinancialConnectionsSheet(
|
|
23
|
+
financialConnectionsSessionClientSecret: withClientSecret,
|
|
24
|
+
returnURL: returnURL,
|
|
25
|
+
configuration: configuration ?? .init()
|
|
26
|
+
)
|
|
27
|
+
financialConnectionsSheet.onEvent = onEvent
|
|
28
|
+
financialConnectionsSheet.present(
|
|
21
29
|
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
22
30
|
completion: { result in
|
|
23
31
|
switch result {
|
|
@@ -35,10 +43,18 @@ class FinancialConnections {
|
|
|
35
43
|
internal static func presentForToken(
|
|
36
44
|
withClientSecret: String,
|
|
37
45
|
returnURL: String? = nil,
|
|
46
|
+
configuration: FinancialConnectionsSheet.Configuration? = nil,
|
|
47
|
+
onEvent: ((FinancialConnectionsEvent) -> Void)? = nil,
|
|
38
48
|
resolve: @escaping RCTPromiseResolveBlock
|
|
39
49
|
) -> Void {
|
|
40
50
|
DispatchQueue.main.async {
|
|
41
|
-
|
|
51
|
+
let financialConnectionsSheet = FinancialConnectionsSheet(
|
|
52
|
+
financialConnectionsSessionClientSecret: withClientSecret,
|
|
53
|
+
returnURL: returnURL,
|
|
54
|
+
configuration: configuration ?? .init()
|
|
55
|
+
)
|
|
56
|
+
financialConnectionsSheet.onEvent = onEvent
|
|
57
|
+
financialConnectionsSheet.presentForToken(
|
|
42
58
|
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
43
59
|
completion: { result in
|
|
44
60
|
switch result {
|
package/ios/Mappers.swift
CHANGED
|
@@ -1050,4 +1050,27 @@ class Mappers {
|
|
|
1050
1050
|
return nil
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
1053
|
+
|
|
1054
|
+
class func financialConnectionsEventToMap(_ event: FinancialConnectionsEvent) -> [String: Any] {
|
|
1055
|
+
var metadata: [String: Any] = [:]
|
|
1056
|
+
|
|
1057
|
+
if let manualEntry = event.metadata.manualEntry {
|
|
1058
|
+
metadata["manualEntry"] = manualEntry
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
if let institutionName = event.metadata.institutionName {
|
|
1062
|
+
metadata["institutionName"] = institutionName
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
if let errorCode = event.metadata.errorCode {
|
|
1066
|
+
metadata["errorCode"] = errorCode.rawValue
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
let mappedEvent: [String: Any] = [
|
|
1070
|
+
"name": event.name.rawValue,
|
|
1071
|
+
"metadata": metadata
|
|
1072
|
+
]
|
|
1073
|
+
|
|
1074
|
+
return mappedEvent
|
|
1075
|
+
}
|
|
1053
1076
|
}
|
|
@@ -7,6 +7,7 @@ class PaymentMethodFactory {
|
|
|
7
7
|
var paymentMethodOptions: NSDictionary? = nil
|
|
8
8
|
var cardFieldView: CardFieldView? = nil
|
|
9
9
|
var cardFormView: CardFormView? = nil
|
|
10
|
+
var metadata: [String: String]? = nil
|
|
10
11
|
|
|
11
12
|
init(paymentMethodData: NSDictionary?, options: NSDictionary, cardFieldView: CardFieldView?, cardFormView: CardFormView?) {
|
|
12
13
|
self.paymentMethodData = paymentMethodData
|
|
@@ -14,6 +15,7 @@ class PaymentMethodFactory {
|
|
|
14
15
|
self.paymentMethodOptions = options
|
|
15
16
|
self.cardFieldView = cardFieldView
|
|
16
17
|
self.cardFormView = cardFormView
|
|
18
|
+
self.metadata = paymentMethodData?["metadata"] as? [String: String]
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
func createParams(paymentMethodType: STPPaymentMethodType) throws -> STPPaymentMethodParams? {
|
|
@@ -124,7 +126,7 @@ class PaymentMethodFactory {
|
|
|
124
126
|
|
|
125
127
|
// private func createWeChatPayPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
126
128
|
// let params = STPPaymentMethodWeChatPayParams()
|
|
127
|
-
// return STPPaymentMethodParams(weChatPay: params, billingDetails: billingDetailsParams, metadata:
|
|
129
|
+
// return STPPaymentMethodParams(weChatPay: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
128
130
|
// }
|
|
129
131
|
//
|
|
130
132
|
|
|
@@ -152,22 +154,22 @@ class PaymentMethodFactory {
|
|
|
152
154
|
if let bankName = self.paymentMethodData?["bankName"] as? String {
|
|
153
155
|
params.bankName = bankName
|
|
154
156
|
}
|
|
155
|
-
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
|
|
159
|
+
return STPPaymentMethodParams(iDEAL: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
private func createGrabpayPaymentMethodParams() -> STPPaymentMethodParams {
|
|
161
163
|
let params = STPPaymentMethodGrabPayParams()
|
|
162
164
|
|
|
163
|
-
|
|
165
|
+
return STPPaymentMethodParams(grabPay: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
private func createCardPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
167
169
|
if let token = paymentMethodData?["token"] as? String {
|
|
168
170
|
let methodParams = STPPaymentMethodCardParams()
|
|
169
171
|
methodParams.token = token
|
|
170
|
-
|
|
172
|
+
return STPPaymentMethodParams(card: methodParams, billingDetails: billingDetailsParams, metadata: metadata)
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
if let params = cardFieldView?.cardParams as? STPPaymentMethodParams {
|
|
@@ -197,7 +199,7 @@ class PaymentMethodFactory {
|
|
|
197
199
|
billingDetailsParams?.address?.country = address.country
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
|
-
return STPPaymentMethodParams(card: params, billingDetails: billingDetailsParams, metadata:
|
|
202
|
+
return STPPaymentMethodParams(card: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
throw PaymentMethodError.cardPaymentMissingParams
|
|
@@ -225,11 +227,11 @@ class PaymentMethodFactory {
|
|
|
225
227
|
params.rawBankString = "test_offline_bank"
|
|
226
228
|
}
|
|
227
229
|
|
|
228
|
-
|
|
230
|
+
return STPPaymentMethodParams(fpx: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
229
231
|
}
|
|
230
232
|
|
|
231
233
|
private func createAlipayPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
232
|
-
return STPPaymentMethodParams(alipay: STPPaymentMethodAlipayParams(), billingDetails: billingDetailsParams, metadata:
|
|
234
|
+
return STPPaymentMethodParams(alipay: STPPaymentMethodAlipayParams(), billingDetails: billingDetailsParams, metadata: metadata)
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
private func createP24PaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -239,7 +241,7 @@ class PaymentMethodFactory {
|
|
|
239
241
|
throw PaymentMethodError.p24PaymentMissingParams
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
return STPPaymentMethodParams(przelewy24: params, billingDetails: billingDetails, metadata:
|
|
244
|
+
return STPPaymentMethodParams(przelewy24: params, billingDetails: billingDetails, metadata: metadata)
|
|
243
245
|
}
|
|
244
246
|
|
|
245
247
|
private func createAlipayPaymentMethodOptions() throws -> STPConfirmPaymentMethodOptions {
|
|
@@ -255,7 +257,7 @@ class PaymentMethodFactory {
|
|
|
255
257
|
let params = STPPaymentMethodSofortParams()
|
|
256
258
|
params.country = country
|
|
257
259
|
|
|
258
|
-
return STPPaymentMethodParams(sofort: params, billingDetails: billingDetailsParams, metadata:
|
|
260
|
+
return STPPaymentMethodParams(sofort: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
private func createBancontactPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -265,7 +267,7 @@ class PaymentMethodFactory {
|
|
|
265
267
|
throw PaymentMethodError.bancontactPaymentMissingParams
|
|
266
268
|
}
|
|
267
269
|
|
|
268
|
-
return STPPaymentMethodParams(bancontact: params, billingDetails: billingDetails, metadata:
|
|
270
|
+
return STPPaymentMethodParams(bancontact: params, billingDetails: billingDetails, metadata: metadata)
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
private func createSepaPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -280,7 +282,7 @@ class PaymentMethodFactory {
|
|
|
280
282
|
|
|
281
283
|
params.iban = iban
|
|
282
284
|
|
|
283
|
-
return STPPaymentMethodParams(sepaDebit: params, billingDetails: billingDetails, metadata:
|
|
285
|
+
return STPPaymentMethodParams(sepaDebit: params, billingDetails: billingDetails, metadata: metadata)
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
private func createOXXOPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -290,7 +292,7 @@ class PaymentMethodFactory {
|
|
|
290
292
|
throw PaymentMethodError.bancontactPaymentMissingParams
|
|
291
293
|
}
|
|
292
294
|
|
|
293
|
-
return STPPaymentMethodParams(oxxo: params, billingDetails: billingDetails, metadata:
|
|
295
|
+
return STPPaymentMethodParams(oxxo: params, billingDetails: billingDetails, metadata: metadata)
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
private func createGiropayPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -300,7 +302,7 @@ class PaymentMethodFactory {
|
|
|
300
302
|
throw PaymentMethodError.giropayPaymentMissingParams
|
|
301
303
|
}
|
|
302
304
|
|
|
303
|
-
return STPPaymentMethodParams(giropay: params, billingDetails: billingDetails, metadata:
|
|
305
|
+
return STPPaymentMethodParams(giropay: params, billingDetails: billingDetails, metadata: metadata)
|
|
304
306
|
}
|
|
305
307
|
|
|
306
308
|
private func createEPSPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -310,7 +312,7 @@ class PaymentMethodFactory {
|
|
|
310
312
|
throw PaymentMethodError.epsPaymentMissingParams
|
|
311
313
|
}
|
|
312
314
|
|
|
313
|
-
return STPPaymentMethodParams(eps: params, billingDetails: billingDetails, metadata:
|
|
315
|
+
return STPPaymentMethodParams(eps: params, billingDetails: billingDetails, metadata: metadata)
|
|
314
316
|
}
|
|
315
317
|
|
|
316
318
|
private func createBECSDebitPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -324,7 +326,7 @@ class PaymentMethodFactory {
|
|
|
324
326
|
params.accountNumber = formDetails?["accountNumber"] as? String
|
|
325
327
|
params.bsbNumber = formDetails?["bsbNumber"] as? String
|
|
326
328
|
|
|
327
|
-
return STPPaymentMethodParams(aubecsDebit: params, billingDetails: billingDetails, metadata:
|
|
329
|
+
return STPPaymentMethodParams(aubecsDebit: params, billingDetails: billingDetails, metadata: metadata)
|
|
328
330
|
}
|
|
329
331
|
|
|
330
332
|
private func createAfterpayClearpayPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
@@ -334,19 +336,19 @@ class PaymentMethodFactory {
|
|
|
334
336
|
throw PaymentMethodError.afterpayClearpayPaymentMissingParams
|
|
335
337
|
}
|
|
336
338
|
|
|
337
|
-
return STPPaymentMethodParams(afterpayClearpay: params, billingDetails: billingDetails, metadata:
|
|
339
|
+
return STPPaymentMethodParams(afterpayClearpay: params, billingDetails: billingDetails, metadata: metadata)
|
|
338
340
|
}
|
|
339
341
|
|
|
340
342
|
private func createKlarnaPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
341
343
|
let params = STPPaymentMethodKlarnaParams()
|
|
342
344
|
|
|
343
345
|
if let billingDetails = billingDetailsParams, billingDetails.address?.country != nil, billingDetails.email != nil {
|
|
344
|
-
return STPPaymentMethodParams(klarna: params, billingDetails: billingDetails, metadata:
|
|
346
|
+
return STPPaymentMethodParams(klarna: params, billingDetails: billingDetails, metadata: metadata)
|
|
345
347
|
} else {
|
|
346
348
|
throw PaymentMethodError.klarnaPaymentMissingParams
|
|
347
349
|
}
|
|
348
350
|
}
|
|
349
|
-
|
|
351
|
+
|
|
350
352
|
private func createUSBankAccountPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
351
353
|
let params = STPPaymentMethodUSBankAccountParams()
|
|
352
354
|
|
|
@@ -363,36 +365,36 @@ class PaymentMethodFactory {
|
|
|
363
365
|
params.accountType = Mappers.mapToUSBankAccountType(type: self.paymentMethodData?["accountType"] as? String)
|
|
364
366
|
|
|
365
367
|
if let billingDetails = billingDetailsParams, billingDetails.name != nil {
|
|
366
|
-
return STPPaymentMethodParams(usBankAccount: params, billingDetails: billingDetails, metadata:
|
|
368
|
+
return STPPaymentMethodParams(usBankAccount: params, billingDetails: billingDetails, metadata: metadata)
|
|
367
369
|
} else {
|
|
368
370
|
throw PaymentMethodError.usBankAccountPaymentMissingParams
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
|
-
|
|
373
|
+
|
|
372
374
|
private func createPayPalPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
373
|
-
return STPPaymentMethodParams(payPal: STPPaymentMethodPayPalParams(), billingDetails: billingDetailsParams, metadata:
|
|
375
|
+
return STPPaymentMethodParams(payPal: STPPaymentMethodPayPalParams(), billingDetails: billingDetailsParams, metadata: metadata)
|
|
374
376
|
}
|
|
375
|
-
|
|
377
|
+
|
|
376
378
|
private func createAffirmPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
377
379
|
let params = STPPaymentMethodAffirmParams()
|
|
378
|
-
return STPPaymentMethodParams(affirm: params, metadata:
|
|
380
|
+
return STPPaymentMethodParams(affirm: params, metadata: metadata)
|
|
379
381
|
}
|
|
380
|
-
|
|
382
|
+
|
|
381
383
|
private func createCashAppPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
382
384
|
let params = STPPaymentMethodCashAppParams()
|
|
383
|
-
return STPPaymentMethodParams(cashApp: params, billingDetails: billingDetailsParams, metadata:
|
|
385
|
+
return STPPaymentMethodParams(cashApp: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
384
386
|
}
|
|
385
|
-
|
|
387
|
+
|
|
386
388
|
private func createRevolutPayPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
387
389
|
let params = STPPaymentMethodRevolutPayParams()
|
|
388
|
-
return STPPaymentMethodParams(revolutPay: params, billingDetails: billingDetailsParams, metadata:
|
|
390
|
+
return STPPaymentMethodParams(revolutPay: params, billingDetails: billingDetailsParams, metadata: metadata)
|
|
389
391
|
}
|
|
390
392
|
|
|
391
393
|
func createMandateData() -> STPMandateDataParams? {
|
|
392
394
|
if let mandateParams = paymentMethodData?["mandateData"] as? NSDictionary {
|
|
393
395
|
if let customerAcceptanceParams = mandateParams["customerAcceptance"] as? NSDictionary {
|
|
394
396
|
let mandate = STPMandateDataParams.init(customerAcceptance: STPMandateCustomerAcceptanceParams.init())
|
|
395
|
-
|
|
397
|
+
|
|
396
398
|
mandate.customerAcceptance.type = .online
|
|
397
399
|
if let onlineParams = customerAcceptanceParams["online"] as? NSDictionary {
|
|
398
400
|
mandate.customerAcceptance.onlineParams = .init(ipAddress: onlineParams["ipAddress"] as? String ?? "", userAgent: onlineParams["userAgent"] as? String ?? "")
|
|
@@ -24,7 +24,8 @@ extension StripeSdk {
|
|
|
24
24
|
billingDetailsCollectionConfiguration: params["billingDetailsCollectionConfiguration"] as? NSDictionary,
|
|
25
25
|
defaultBillingDetails: params["defaultBillingDetails"] as? NSDictionary,
|
|
26
26
|
preferredNetworks: params["preferredNetworks"] as? Array<Int>,
|
|
27
|
-
allowsRemovalOfLastSavedPaymentMethod: params["allowsRemovalOfLastSavedPaymentMethod"] as? Bool
|
|
27
|
+
allowsRemovalOfLastSavedPaymentMethod: params["allowsRemovalOfLastSavedPaymentMethod"] as? Bool,
|
|
28
|
+
cardBrandAcceptance: computeCardBrandAcceptance(params: params)
|
|
28
29
|
)
|
|
29
30
|
} catch {
|
|
30
31
|
resolve(
|
|
@@ -125,6 +125,8 @@ extension StripeSdk {
|
|
|
125
125
|
default:
|
|
126
126
|
configuration.paymentMethodLayout = .automatic
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
configuration.cardBrandAcceptance = computeCardBrandAcceptance(params: params)
|
|
128
130
|
|
|
129
131
|
return (nil, configuration)
|
|
130
132
|
}
|
|
@@ -216,6 +218,46 @@ extension StripeSdk {
|
|
|
216
218
|
}
|
|
217
219
|
}
|
|
218
220
|
}
|
|
221
|
+
|
|
222
|
+
internal func computeCardBrandAcceptance(params: NSDictionary) -> PaymentSheet.CardBrandAcceptance {
|
|
223
|
+
if let cardBrandAcceptanceParams = params["cardBrandAcceptance"] as? NSDictionary {
|
|
224
|
+
if let filter = cardBrandAcceptanceParams["filter"] as? String {
|
|
225
|
+
switch filter {
|
|
226
|
+
case "all":
|
|
227
|
+
return .all
|
|
228
|
+
case "allowed":
|
|
229
|
+
if let brands = cardBrandAcceptanceParams["brands"] as? [String] {
|
|
230
|
+
let cardBrands = brands.compactMap { mapToCardBrandCategory(brand: $0) }
|
|
231
|
+
return .allowed(brands: cardBrands)
|
|
232
|
+
}
|
|
233
|
+
case "disallowed":
|
|
234
|
+
if let brands = cardBrandAcceptanceParams["brands"] as? [String] {
|
|
235
|
+
let cardBrands = brands.compactMap { mapToCardBrandCategory(brand: $0) }
|
|
236
|
+
return .disallowed(brands: cardBrands)
|
|
237
|
+
}
|
|
238
|
+
default:
|
|
239
|
+
break
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return .all
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private func mapToCardBrandCategory(brand: String) -> PaymentSheet.CardBrandAcceptance.BrandCategory? {
|
|
248
|
+
switch brand {
|
|
249
|
+
case "visa":
|
|
250
|
+
return .visa
|
|
251
|
+
case "mastercard":
|
|
252
|
+
return .mastercard
|
|
253
|
+
case "amex":
|
|
254
|
+
return .amex
|
|
255
|
+
case "discover":
|
|
256
|
+
return .discover
|
|
257
|
+
default:
|
|
258
|
+
return nil
|
|
259
|
+
}
|
|
260
|
+
}
|
|
219
261
|
|
|
220
262
|
private func mapCaptureMethod(_ captureMethod: String?) -> PaymentSheet.IntentConfiguration.CaptureMethod {
|
|
221
263
|
if let captureMethod = captureMethod {
|
package/ios/StripeSdk.m
CHANGED
|
@@ -170,11 +170,13 @@ RCT_EXTERN_METHOD(
|
|
|
170
170
|
)
|
|
171
171
|
RCT_EXTERN_METHOD(
|
|
172
172
|
collectBankAccountToken:(NSString *)clientSecret
|
|
173
|
+
params:(NSDictionary *)params
|
|
173
174
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
174
175
|
rejecter: (RCTPromiseRejectBlock)reject
|
|
175
176
|
)
|
|
176
177
|
RCT_EXTERN_METHOD(
|
|
177
178
|
collectFinancialConnectionsAccounts:(NSString *)clientSecret
|
|
179
|
+
params:(NSDictionary *)params
|
|
178
180
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
179
181
|
rejecter: (RCTPromiseRejectBlock)reject
|
|
180
182
|
)
|
package/ios/StripeSdk.swift
CHANGED
|
@@ -71,7 +71,7 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
71
71
|
override func supportedEvents() -> [String]! {
|
|
72
72
|
return ["onOrderTrackingCallback", "onConfirmHandlerCallback", "onCustomerAdapterFetchPaymentMethodsCallback", "onCustomerAdapterAttachPaymentMethodCallback",
|
|
73
73
|
"onCustomerAdapterDetachPaymentMethodCallback", "onCustomerAdapterSetSelectedPaymentOptionCallback", "onCustomerAdapterFetchSelectedPaymentOptionCallback",
|
|
74
|
-
"onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback"]
|
|
74
|
+
"onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback", "onFinancialConnectionsEvent"]
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
@@ -129,7 +129,7 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
@objc(intentCreationCallback:resolver:rejecter:)
|
|
132
|
-
func intentCreationCallback(result: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
132
|
+
@MainActor func intentCreationCallback(result: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
133
133
|
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
134
134
|
guard let paymentSheetIntentCreationCallback = self.paymentSheetIntentCreationCallback else {
|
|
135
135
|
resolve(Errors.createError(ErrorType.Failed, "No intent creation callback was set"))
|
|
@@ -138,18 +138,18 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
138
138
|
if let clientSecret = result["clientSecret"] as? String {
|
|
139
139
|
paymentSheetIntentCreationCallback(.success(clientSecret))
|
|
140
140
|
} else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
141
|
+
struct ConfirmationError: Error, LocalizedError {
|
|
142
|
+
private var errorMessage: String
|
|
143
|
+
init(errorMessage: String) {
|
|
144
|
+
self.errorMessage = errorMessage
|
|
145
|
+
}
|
|
146
|
+
public var errorDescription: String? {
|
|
147
|
+
return errorMessage
|
|
149
148
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
}
|
|
150
|
+
let errorParams = result["error"] as? NSDictionary
|
|
151
|
+
let error = ConfirmationError.init(errorMessage: errorParams?["localizedMessage"] as? String ?? "An unknown error occurred.")
|
|
152
|
+
paymentSheetIntentCreationCallback(.failure(error))
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -730,16 +730,29 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
730
730
|
if let urlScheme = urlScheme {
|
|
731
731
|
connectionsReturnURL = Mappers.mapToFinancialConnectionsReturnURL(urlScheme: urlScheme)
|
|
732
732
|
} else {
|
|
733
|
-
|
|
733
|
+
connectionsReturnURL = nil
|
|
734
734
|
}
|
|
735
735
|
|
|
736
|
+
var onEvent: ((FinancialConnectionsEvent) -> Void)? = nil
|
|
737
|
+
|
|
738
|
+
if hasEventListeners {
|
|
739
|
+
onEvent = { [weak self] event in
|
|
740
|
+
let mappedEvent = Mappers.financialConnectionsEventToMap(event)
|
|
741
|
+
self?.sendEvent(withName: "onFinancialConnectionsEvent", body: mappedEvent)
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
let style = STPBankAccountCollectorUserInterfaceStyle(from: params)
|
|
746
|
+
let bankAccountCollector = STPBankAccountCollector(style: style)
|
|
747
|
+
|
|
736
748
|
if (isPaymentIntent) {
|
|
737
749
|
DispatchQueue.main.async {
|
|
738
|
-
|
|
750
|
+
bankAccountCollector.collectBankAccountForPayment(
|
|
739
751
|
clientSecret: clientSecret as String,
|
|
740
752
|
returnURL: connectionsReturnURL,
|
|
741
753
|
params: collectParams,
|
|
742
|
-
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
|
|
754
|
+
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
755
|
+
onEvent: onEvent
|
|
743
756
|
) { intent, error in
|
|
744
757
|
if let error = error {
|
|
745
758
|
resolve(Errors.createError(ErrorType.Failed, error as NSError))
|
|
@@ -761,11 +774,12 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
761
774
|
}
|
|
762
775
|
} else {
|
|
763
776
|
DispatchQueue.main.async {
|
|
764
|
-
|
|
777
|
+
bankAccountCollector.collectBankAccountForSetup(
|
|
765
778
|
clientSecret: clientSecret as String,
|
|
766
779
|
returnURL: connectionsReturnURL,
|
|
767
780
|
params: collectParams,
|
|
768
|
-
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
|
|
781
|
+
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
782
|
+
onEvent: onEvent
|
|
769
783
|
) { intent, error in
|
|
770
784
|
if let error = error {
|
|
771
785
|
resolve(Errors.createError(ErrorType.Failed, error as NSError))
|
|
@@ -1026,9 +1040,10 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
1026
1040
|
resolve(["isInWallet": PushProvisioningUtils.getPassLocation(last4: last4) != nil])
|
|
1027
1041
|
}
|
|
1028
1042
|
|
|
1029
|
-
@objc(collectBankAccountToken:resolver:rejecter:)
|
|
1043
|
+
@objc(collectBankAccountToken:params:resolver:rejecter:)
|
|
1030
1044
|
func collectBankAccountToken(
|
|
1031
1045
|
clientSecret: String,
|
|
1046
|
+
params: NSDictionary,
|
|
1032
1047
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
1033
1048
|
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
1034
1049
|
) -> Void {
|
|
@@ -1040,14 +1055,32 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
1040
1055
|
if let urlScheme = urlScheme {
|
|
1041
1056
|
returnURL = Mappers.mapToFinancialConnectionsReturnURL(urlScheme: urlScheme)
|
|
1042
1057
|
} else {
|
|
1043
|
-
|
|
1058
|
+
returnURL = nil
|
|
1044
1059
|
}
|
|
1045
|
-
|
|
1060
|
+
|
|
1061
|
+
let configuration = FinancialConnectionsSheet.Configuration(from: params)
|
|
1062
|
+
var onEvent: ((FinancialConnectionsEvent) -> Void)? = nil
|
|
1063
|
+
|
|
1064
|
+
if hasEventListeners {
|
|
1065
|
+
onEvent = { [weak self] event in
|
|
1066
|
+
let mappedEvent = Mappers.financialConnectionsEventToMap(event)
|
|
1067
|
+
self?.sendEvent(withName: "onFinancialConnectionsEvent", body: mappedEvent)
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
FinancialConnections.presentForToken(
|
|
1072
|
+
withClientSecret: clientSecret,
|
|
1073
|
+
returnURL: returnURL,
|
|
1074
|
+
configuration: configuration,
|
|
1075
|
+
onEvent: onEvent,
|
|
1076
|
+
resolve: resolve
|
|
1077
|
+
)
|
|
1046
1078
|
}
|
|
1047
1079
|
|
|
1048
|
-
@objc(collectFinancialConnectionsAccounts:resolver:rejecter:)
|
|
1080
|
+
@objc(collectFinancialConnectionsAccounts:params:resolver:rejecter:)
|
|
1049
1081
|
func collectFinancialConnectionsAccounts(
|
|
1050
1082
|
clientSecret: String,
|
|
1083
|
+
params: NSDictionary,
|
|
1051
1084
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
1052
1085
|
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
1053
1086
|
) -> Void {
|
|
@@ -1059,9 +1092,26 @@ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
|
|
|
1059
1092
|
if let urlScheme = urlScheme {
|
|
1060
1093
|
returnURL = Mappers.mapToFinancialConnectionsReturnURL(urlScheme: urlScheme)
|
|
1061
1094
|
} else {
|
|
1062
|
-
|
|
1095
|
+
returnURL = nil
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
let configuration = FinancialConnectionsSheet.Configuration(from: params)
|
|
1099
|
+
var onEvent: ((FinancialConnectionsEvent) -> Void)? = nil
|
|
1100
|
+
|
|
1101
|
+
if hasEventListeners {
|
|
1102
|
+
onEvent = { [weak self] event in
|
|
1103
|
+
let mappedEvent = Mappers.financialConnectionsEventToMap(event)
|
|
1104
|
+
self?.sendEvent(withName: "onFinancialConnectionsEvent", body: mappedEvent)
|
|
1105
|
+
}
|
|
1063
1106
|
}
|
|
1064
|
-
|
|
1107
|
+
|
|
1108
|
+
FinancialConnections.present(
|
|
1109
|
+
withClientSecret: clientSecret,
|
|
1110
|
+
returnURL: returnURL,
|
|
1111
|
+
configuration: configuration,
|
|
1112
|
+
onEvent: onEvent,
|
|
1113
|
+
resolve: resolve
|
|
1114
|
+
)
|
|
1065
1115
|
}
|
|
1066
1116
|
|
|
1067
1117
|
@objc(configureOrderTracking:orderIdentifier:webServiceUrl:authenticationToken:resolver:rejecter:)
|
|
@@ -1146,3 +1196,45 @@ extension StripeSdk: STPAuthenticationContext {
|
|
|
1146
1196
|
return findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
|
|
1147
1197
|
}
|
|
1148
1198
|
}
|
|
1199
|
+
|
|
1200
|
+
extension STPBankAccountCollectorUserInterfaceStyle {
|
|
1201
|
+
init(from params: NSDictionary) {
|
|
1202
|
+
guard let styleString = params["style"] as? String else {
|
|
1203
|
+
self = .automatic
|
|
1204
|
+
return
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
switch styleString {
|
|
1208
|
+
case "automatic":
|
|
1209
|
+
self = .automatic
|
|
1210
|
+
case "alwaysLight":
|
|
1211
|
+
self = .alwaysLight
|
|
1212
|
+
case "alwaysDark":
|
|
1213
|
+
self = .alwaysDark
|
|
1214
|
+
default:
|
|
1215
|
+
self = .automatic
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
extension FinancialConnectionsSheet.Configuration {
|
|
1221
|
+
init(from params: NSDictionary) {
|
|
1222
|
+
let style: FinancialConnectionsSheet.Configuration.UserInterfaceStyle = {
|
|
1223
|
+
guard let styleString = params["style"] as? String else {
|
|
1224
|
+
return .automatic
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
switch styleString {
|
|
1228
|
+
case "automatic":
|
|
1229
|
+
return .automatic
|
|
1230
|
+
case "alwaysLight":
|
|
1231
|
+
return .alwaysLight
|
|
1232
|
+
case "alwaysDark":
|
|
1233
|
+
return .alwaysDark
|
|
1234
|
+
default:
|
|
1235
|
+
return .automatic
|
|
1236
|
+
}
|
|
1237
|
+
}()
|
|
1238
|
+
self.init(style: style)
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var StripeSdk=_reactNative.NativeModules.StripeSdk;var _default=
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var StripeSdk=_reactNative.NativeModules.StripeSdk;var _default=exports.default=StripeSdk;
|
|
2
2
|
//# sourceMappingURL=NativeStripeSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StripeSdk","NativeModules"],"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","StripeSdk","NativeModules","_default","exports","default"],"sourceRoot":"../../src","sources":["NativeStripeSdk.tsx"],"mappings":"gFAAA,IAAAA,YAAA,CAAAC,OAAA,iBA4JA,GAAQ,CAAAC,SAAS,CAAKC,0BAAa,CAA3BD,SAAS,CAAmB,IAAAE,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAErBJ,SAAS","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/AddToWalletButton.tsx";var _excluded=["onComplete"];var AddToWalletButtonNative=(0,_reactNative.requireNativeComponent)('AddToWalletButton');function AddToWalletButton(_ref){var onComplete=_ref.onComplete,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return(0,_jsxRuntime.jsx)(AddToWalletButtonNative,Object.assign({},props,{onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);}}));}
|
|
2
2
|
//# sourceMappingURL=AddToWalletButton.js.map
|