@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,11 +1,21 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReadableMap
|
|
4
|
-
import com.reactnativestripesdk.utils
|
|
4
|
+
import com.reactnativestripesdk.utils.getBooleanOrFalse
|
|
5
|
+
import com.reactnativestripesdk.utils.getMapOrNull
|
|
6
|
+
import com.reactnativestripesdk.utils.getValOr
|
|
5
7
|
import com.reactnativestripesdk.utils.mapToBillingDetails
|
|
8
|
+
import com.reactnativestripesdk.utils.mapToMetadata
|
|
9
|
+
import com.reactnativestripesdk.utils.mapToPaymentIntentFutureUsage
|
|
6
10
|
import com.reactnativestripesdk.utils.mapToUSBankAccountHolderType
|
|
7
11
|
import com.reactnativestripesdk.utils.mapToUSBankAccountType
|
|
8
|
-
import com.stripe.android.model
|
|
12
|
+
import com.stripe.android.model.ConfirmPaymentIntentParams
|
|
13
|
+
import com.stripe.android.model.ConfirmSetupIntentParams
|
|
14
|
+
import com.stripe.android.model.ConfirmStripeIntentParams
|
|
15
|
+
import com.stripe.android.model.MandateDataParams
|
|
16
|
+
import com.stripe.android.model.PaymentMethod
|
|
17
|
+
import com.stripe.android.model.PaymentMethodCreateParams
|
|
18
|
+
import com.stripe.android.model.PaymentMethodOptionsParams
|
|
9
19
|
|
|
10
20
|
class PaymentMethodCreateParamsFactory(
|
|
11
21
|
private val paymentMethodData: ReadableMap?,
|
|
@@ -13,7 +23,13 @@ class PaymentMethodCreateParamsFactory(
|
|
|
13
23
|
private val cardFieldView: CardFieldView?,
|
|
14
24
|
private val cardFormView: CardFormView?,
|
|
15
25
|
) {
|
|
16
|
-
private val billingDetailsParams =
|
|
26
|
+
private val billingDetailsParams =
|
|
27
|
+
mapToBillingDetails(
|
|
28
|
+
getMapOrNull(paymentMethodData, "billingDetails"),
|
|
29
|
+
cardFieldView?.cardAddress ?: cardFormView?.cardAddress,
|
|
30
|
+
)
|
|
31
|
+
private val metadataParams: Map<String, String>? =
|
|
32
|
+
mapToMetadata(getMapOrNull(paymentMethodData, "metadata"))
|
|
17
33
|
|
|
18
34
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
19
35
|
fun createPaymentMethodParams(paymentMethodType: PaymentMethod.Type): PaymentMethodCreateParams {
|
|
@@ -53,30 +69,38 @@ class PaymentMethodCreateParamsFactory(
|
|
|
53
69
|
val bankName = getValOr(paymentMethodData, "bankName", null)
|
|
54
70
|
|
|
55
71
|
val idealParams = PaymentMethodCreateParams.Ideal(bankName)
|
|
56
|
-
return PaymentMethodCreateParams.create(
|
|
72
|
+
return PaymentMethodCreateParams.create(
|
|
73
|
+
ideal = idealParams,
|
|
74
|
+
billingDetails = billingDetailsParams,
|
|
75
|
+
metadata = metadataParams,
|
|
76
|
+
)
|
|
57
77
|
}
|
|
58
78
|
|
|
59
79
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
60
|
-
private fun createAlipayParams(): PaymentMethodCreateParams
|
|
61
|
-
return PaymentMethodCreateParams.createAlipay()
|
|
62
|
-
}
|
|
80
|
+
private fun createAlipayParams(): PaymentMethodCreateParams = PaymentMethodCreateParams.createAlipay()
|
|
63
81
|
|
|
64
82
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
65
83
|
private fun createSofortParams(): PaymentMethodCreateParams {
|
|
66
|
-
val country =
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
val country =
|
|
85
|
+
getValOr(paymentMethodData, "country", null)
|
|
86
|
+
?: run {
|
|
87
|
+
throw PaymentMethodCreateParamsException("You must provide bank account country")
|
|
88
|
+
}
|
|
69
89
|
|
|
70
90
|
return PaymentMethodCreateParams.create(
|
|
71
91
|
PaymentMethodCreateParams.Sofort(country = country),
|
|
72
|
-
billingDetailsParams
|
|
92
|
+
billingDetailsParams,
|
|
93
|
+
metadata = metadataParams,
|
|
73
94
|
)
|
|
74
95
|
}
|
|
75
96
|
|
|
76
97
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
77
98
|
private fun createBancontactParams(): PaymentMethodCreateParams {
|
|
78
99
|
billingDetailsParams?.let {
|
|
79
|
-
return PaymentMethodCreateParams.createBancontact(
|
|
100
|
+
return PaymentMethodCreateParams.createBancontact(
|
|
101
|
+
billingDetails = it,
|
|
102
|
+
metadata = metadataParams,
|
|
103
|
+
)
|
|
80
104
|
}
|
|
81
105
|
|
|
82
106
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
@@ -85,13 +109,14 @@ class PaymentMethodCreateParamsFactory(
|
|
|
85
109
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
86
110
|
private fun createSepaParams(): PaymentMethodCreateParams {
|
|
87
111
|
billingDetailsParams?.let {
|
|
88
|
-
val iban =
|
|
89
|
-
|
|
90
|
-
|
|
112
|
+
val iban =
|
|
113
|
+
getValOr(paymentMethodData, "iban", null)
|
|
114
|
+
?: run { throw PaymentMethodCreateParamsException("You must provide IBAN") }
|
|
91
115
|
|
|
92
116
|
return PaymentMethodCreateParams.create(
|
|
93
117
|
sepaDebit = PaymentMethodCreateParams.SepaDebit(iban),
|
|
94
|
-
billingDetails = it
|
|
118
|
+
billingDetails = it,
|
|
119
|
+
metadata = metadataParams,
|
|
95
120
|
)
|
|
96
121
|
}
|
|
97
122
|
|
|
@@ -101,7 +126,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
101
126
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
102
127
|
private fun createOXXOParams(): PaymentMethodCreateParams {
|
|
103
128
|
billingDetailsParams?.let {
|
|
104
|
-
return PaymentMethodCreateParams.createOxxo(it)
|
|
129
|
+
return PaymentMethodCreateParams.createOxxo(billingDetails = it, metadata = metadataParams)
|
|
105
130
|
}
|
|
106
131
|
|
|
107
132
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
@@ -110,7 +135,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
110
135
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
111
136
|
private fun createGiropayParams(): PaymentMethodCreateParams {
|
|
112
137
|
billingDetailsParams?.let {
|
|
113
|
-
return PaymentMethodCreateParams.createGiropay(it)
|
|
138
|
+
return PaymentMethodCreateParams.createGiropay(billingDetails = it, metadata = metadataParams)
|
|
114
139
|
}
|
|
115
140
|
|
|
116
141
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
@@ -119,7 +144,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
119
144
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
120
145
|
private fun createEPSParams(): PaymentMethodCreateParams {
|
|
121
146
|
billingDetailsParams?.let {
|
|
122
|
-
return PaymentMethodCreateParams.createEps(it)
|
|
147
|
+
return PaymentMethodCreateParams.createEps(billingDetails = it, metadata = metadataParams)
|
|
123
148
|
}
|
|
124
149
|
|
|
125
150
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
@@ -134,7 +159,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
134
159
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
135
160
|
private fun createP24Params(): PaymentMethodCreateParams {
|
|
136
161
|
billingDetailsParams?.let {
|
|
137
|
-
return PaymentMethodCreateParams.createP24(it)
|
|
162
|
+
return PaymentMethodCreateParams.createP24(billingDetails = it, metadata = metadataParams)
|
|
138
163
|
}
|
|
139
164
|
|
|
140
165
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
@@ -144,14 +169,18 @@ class PaymentMethodCreateParamsFactory(
|
|
|
144
169
|
private fun createFpxParams(): PaymentMethodCreateParams {
|
|
145
170
|
val bank = getBooleanOrFalse(paymentMethodData, "testOfflineBank").let { "test_offline_bank" }
|
|
146
171
|
return PaymentMethodCreateParams.create(
|
|
147
|
-
PaymentMethodCreateParams.Fpx(bank)
|
|
172
|
+
PaymentMethodCreateParams.Fpx(bank),
|
|
173
|
+
metadata = metadataParams,
|
|
148
174
|
)
|
|
149
175
|
}
|
|
150
176
|
|
|
151
177
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
152
178
|
private fun createAfterpayClearpayParams(): PaymentMethodCreateParams {
|
|
153
179
|
billingDetailsParams?.let {
|
|
154
|
-
return PaymentMethodCreateParams.createAfterpayClearpay(
|
|
180
|
+
return PaymentMethodCreateParams.createAfterpayClearpay(
|
|
181
|
+
billingDetails = it,
|
|
182
|
+
metadata = metadataParams,
|
|
183
|
+
)
|
|
155
184
|
}
|
|
156
185
|
|
|
157
186
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
@@ -159,26 +188,30 @@ class PaymentMethodCreateParamsFactory(
|
|
|
159
188
|
|
|
160
189
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
161
190
|
private fun createAuBecsDebitParams(): PaymentMethodCreateParams {
|
|
162
|
-
val formDetails =
|
|
163
|
-
|
|
164
|
-
|
|
191
|
+
val formDetails =
|
|
192
|
+
getMapOrNull(paymentMethodData, "formDetails")
|
|
193
|
+
?: run { throw PaymentMethodCreateParamsException("You must provide form details") }
|
|
165
194
|
|
|
166
195
|
val bsbNumber = getValOr(formDetails, "bsbNumber") as String
|
|
167
196
|
val accountNumber = getValOr(formDetails, "accountNumber") as String
|
|
168
197
|
val name = getValOr(formDetails, "name") as String
|
|
169
198
|
val email = getValOr(formDetails, "email") as String
|
|
170
199
|
|
|
171
|
-
val billingDetails =
|
|
172
|
-
.
|
|
173
|
-
|
|
174
|
-
|
|
200
|
+
val billingDetails =
|
|
201
|
+
PaymentMethod.BillingDetails
|
|
202
|
+
.Builder()
|
|
203
|
+
.setName(name)
|
|
204
|
+
.setEmail(email)
|
|
205
|
+
.build()
|
|
175
206
|
|
|
176
207
|
return PaymentMethodCreateParams.create(
|
|
177
|
-
auBecsDebit =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
208
|
+
auBecsDebit =
|
|
209
|
+
PaymentMethodCreateParams.AuBecsDebit(
|
|
210
|
+
bsbNumber = bsbNumber,
|
|
211
|
+
accountNumber = accountNumber,
|
|
212
|
+
),
|
|
213
|
+
billingDetails = billingDetails,
|
|
214
|
+
metadata = metadataParams,
|
|
182
215
|
)
|
|
183
216
|
}
|
|
184
217
|
|
|
@@ -188,38 +221,52 @@ class PaymentMethodCreateParamsFactory(
|
|
|
188
221
|
billingDetailsParams.address?.country.isNullOrBlank() ||
|
|
189
222
|
billingDetailsParams.email.isNullOrBlank()
|
|
190
223
|
) {
|
|
191
|
-
throw PaymentMethodCreateParamsException(
|
|
224
|
+
throw PaymentMethodCreateParamsException(
|
|
225
|
+
"Klarna requires that you provide the following billing details: email, country",
|
|
226
|
+
)
|
|
192
227
|
}
|
|
193
228
|
|
|
194
|
-
return PaymentMethodCreateParams.createKlarna(
|
|
229
|
+
return PaymentMethodCreateParams.createKlarna(
|
|
230
|
+
billingDetails = billingDetailsParams,
|
|
231
|
+
metadata = metadataParams,
|
|
232
|
+
)
|
|
195
233
|
}
|
|
196
234
|
|
|
197
235
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
198
|
-
private fun createPayPalParams(): PaymentMethodCreateParams
|
|
199
|
-
return PaymentMethodCreateParams.createPayPal(null)
|
|
200
|
-
}
|
|
236
|
+
private fun createPayPalParams(): PaymentMethodCreateParams = PaymentMethodCreateParams.createPayPal(metadata = metadataParams)
|
|
201
237
|
|
|
202
238
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
203
|
-
private fun createAffirmParams(): PaymentMethodCreateParams
|
|
204
|
-
|
|
205
|
-
|
|
239
|
+
private fun createAffirmParams(): PaymentMethodCreateParams =
|
|
240
|
+
PaymentMethodCreateParams.createAffirm(
|
|
241
|
+
billingDetails = billingDetailsParams,
|
|
242
|
+
metadata = metadataParams,
|
|
243
|
+
)
|
|
206
244
|
|
|
207
245
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
208
|
-
private fun createCashAppParams(): PaymentMethodCreateParams
|
|
209
|
-
|
|
210
|
-
|
|
246
|
+
private fun createCashAppParams(): PaymentMethodCreateParams =
|
|
247
|
+
PaymentMethodCreateParams.createCashAppPay(
|
|
248
|
+
billingDetails = billingDetailsParams,
|
|
249
|
+
metadata = metadataParams,
|
|
250
|
+
)
|
|
211
251
|
|
|
212
252
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
213
|
-
private fun createRevolutPayParams(): PaymentMethodCreateParams
|
|
214
|
-
|
|
215
|
-
|
|
253
|
+
private fun createRevolutPayParams(): PaymentMethodCreateParams =
|
|
254
|
+
PaymentMethodCreateParams.createRevolutPay(
|
|
255
|
+
billingDetails = billingDetailsParams,
|
|
256
|
+
metadata = metadataParams,
|
|
257
|
+
)
|
|
216
258
|
|
|
217
259
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
218
|
-
fun createParams(
|
|
260
|
+
fun createParams(
|
|
261
|
+
clientSecret: String,
|
|
262
|
+
paymentMethodType: PaymentMethod.Type?,
|
|
263
|
+
isPaymentIntent: Boolean,
|
|
264
|
+
): ConfirmStripeIntentParams {
|
|
219
265
|
try {
|
|
220
266
|
return when (paymentMethodType) {
|
|
221
267
|
PaymentMethod.Type.Card -> createCardStripeIntentParams(clientSecret, isPaymentIntent)
|
|
222
|
-
PaymentMethod.Type.USBankAccount ->
|
|
268
|
+
PaymentMethod.Type.USBankAccount ->
|
|
269
|
+
createUSBankAccountStripeIntentParams(clientSecret, isPaymentIntent)
|
|
223
270
|
PaymentMethod.Type.Affirm -> createAffirmStripeIntentParams(clientSecret, isPaymentIntent)
|
|
224
271
|
PaymentMethod.Type.Ideal,
|
|
225
272
|
PaymentMethod.Type.Alipay,
|
|
@@ -237,22 +284,23 @@ class PaymentMethodCreateParamsFactory(
|
|
|
237
284
|
PaymentMethod.Type.Klarna,
|
|
238
285
|
PaymentMethod.Type.PayPal,
|
|
239
286
|
PaymentMethod.Type.CashAppPay,
|
|
240
|
-
PaymentMethod.Type.RevolutPay
|
|
287
|
+
PaymentMethod.Type.RevolutPay,
|
|
288
|
+
-> {
|
|
241
289
|
val params = createPaymentMethodParams(paymentMethodType)
|
|
242
290
|
|
|
243
291
|
return if (isPaymentIntent) {
|
|
244
|
-
ConfirmPaymentIntentParams
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
292
|
+
ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
|
|
293
|
+
paymentMethodCreateParams = params,
|
|
294
|
+
clientSecret = clientSecret,
|
|
295
|
+
setupFutureUsage =
|
|
296
|
+
mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
|
|
297
|
+
mandateData = buildMandateDataParams(),
|
|
298
|
+
)
|
|
251
299
|
} else {
|
|
252
300
|
ConfirmSetupIntentParams.create(
|
|
253
301
|
paymentMethodCreateParams = params,
|
|
254
302
|
clientSecret = clientSecret,
|
|
255
|
-
mandateData = buildMandateDataParams()
|
|
303
|
+
mandateData = buildMandateDataParams(),
|
|
256
304
|
)
|
|
257
305
|
}
|
|
258
306
|
}
|
|
@@ -283,7 +331,10 @@ class PaymentMethodCreateParamsFactory(
|
|
|
283
331
|
}
|
|
284
332
|
|
|
285
333
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
286
|
-
private fun createCardStripeIntentParams(
|
|
334
|
+
private fun createCardStripeIntentParams(
|
|
335
|
+
clientSecret: String,
|
|
336
|
+
isPaymentIntent: Boolean,
|
|
337
|
+
): ConfirmStripeIntentParams {
|
|
287
338
|
val paymentMethodId = getValOr(paymentMethodData, "paymentMethodId", null)
|
|
288
339
|
val setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage"))
|
|
289
340
|
|
|
@@ -293,45 +344,50 @@ class PaymentMethodCreateParamsFactory(
|
|
|
293
344
|
if (cvc != null) PaymentMethodOptionsParams.Card(cvc) else null
|
|
294
345
|
|
|
295
346
|
return (
|
|
296
|
-
if (isPaymentIntent)
|
|
347
|
+
if (isPaymentIntent) {
|
|
297
348
|
ConfirmPaymentIntentParams.createWithPaymentMethodId(
|
|
298
349
|
paymentMethodId,
|
|
299
350
|
paymentMethodOptions = paymentMethodOptionParams,
|
|
300
351
|
clientSecret = clientSecret,
|
|
301
|
-
setupFutureUsage = setupFutureUsage
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
352
|
+
setupFutureUsage = setupFutureUsage,
|
|
353
|
+
)
|
|
354
|
+
} else {
|
|
355
|
+
ConfirmSetupIntentParams.create(paymentMethodId, clientSecret)
|
|
356
|
+
}
|
|
357
|
+
)
|
|
307
358
|
} else {
|
|
308
359
|
val paymentMethodCreateParams = createCardPaymentMethodParams()
|
|
309
360
|
return (
|
|
310
|
-
if (isPaymentIntent)
|
|
311
|
-
ConfirmPaymentIntentParams
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
else
|
|
317
|
-
ConfirmSetupIntentParams
|
|
318
|
-
|
|
319
|
-
|
|
361
|
+
if (isPaymentIntent) {
|
|
362
|
+
ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
|
|
363
|
+
paymentMethodCreateParams,
|
|
364
|
+
clientSecret,
|
|
365
|
+
setupFutureUsage = setupFutureUsage,
|
|
366
|
+
)
|
|
367
|
+
} else {
|
|
368
|
+
ConfirmSetupIntentParams.create(paymentMethodCreateParams, clientSecret)
|
|
369
|
+
}
|
|
370
|
+
)
|
|
320
371
|
}
|
|
321
372
|
}
|
|
322
373
|
|
|
323
374
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
324
|
-
private fun createUSBankAccountStripeIntentParams(
|
|
375
|
+
private fun createUSBankAccountStripeIntentParams(
|
|
376
|
+
clientSecret: String,
|
|
377
|
+
isPaymentIntent: Boolean,
|
|
378
|
+
): ConfirmStripeIntentParams {
|
|
325
379
|
// If payment method data is supplied, assume they are passing in the bank details manually
|
|
326
380
|
paymentMethodData?.let {
|
|
327
381
|
if (billingDetailsParams?.name.isNullOrBlank()) {
|
|
328
|
-
throw PaymentMethodCreateParamsException(
|
|
382
|
+
throw PaymentMethodCreateParamsException(
|
|
383
|
+
"When creating a US bank account payment method, you must provide the following billing details: name",
|
|
384
|
+
)
|
|
329
385
|
}
|
|
330
386
|
return if (isPaymentIntent) {
|
|
331
387
|
ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
|
|
332
388
|
paymentMethodCreateParams = createUSBankAccountParams(paymentMethodData),
|
|
333
389
|
clientSecret,
|
|
334
|
-
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage"))
|
|
390
|
+
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
|
|
335
391
|
)
|
|
336
392
|
} else {
|
|
337
393
|
ConfirmSetupIntentParams.create(
|
|
@@ -339,37 +395,40 @@ class PaymentMethodCreateParamsFactory(
|
|
|
339
395
|
clientSecret = clientSecret,
|
|
340
396
|
)
|
|
341
397
|
}
|
|
342
|
-
} ?: run {
|
|
343
|
-
// Payment method is assumed to be already attached through via collectBankAccount
|
|
344
|
-
return if (isPaymentIntent) {
|
|
345
|
-
ConfirmPaymentIntentParams.create(
|
|
346
|
-
clientSecret = clientSecret,
|
|
347
|
-
paymentMethodType = PaymentMethod.Type.USBankAccount
|
|
348
|
-
)
|
|
349
|
-
} else {
|
|
350
|
-
ConfirmSetupIntentParams.create(
|
|
351
|
-
clientSecret = clientSecret,
|
|
352
|
-
paymentMethodType = PaymentMethod.Type.USBankAccount
|
|
353
|
-
)
|
|
354
|
-
}
|
|
355
398
|
}
|
|
399
|
+
?: run {
|
|
400
|
+
// Payment method is assumed to be already attached through via collectBankAccount
|
|
401
|
+
return if (isPaymentIntent) {
|
|
402
|
+
ConfirmPaymentIntentParams.create(
|
|
403
|
+
clientSecret = clientSecret,
|
|
404
|
+
paymentMethodType = PaymentMethod.Type.USBankAccount,
|
|
405
|
+
)
|
|
406
|
+
} else {
|
|
407
|
+
ConfirmSetupIntentParams.create(
|
|
408
|
+
clientSecret = clientSecret,
|
|
409
|
+
paymentMethodType = PaymentMethod.Type.USBankAccount,
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
}
|
|
356
413
|
}
|
|
357
414
|
|
|
358
415
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
359
|
-
private fun createAffirmStripeIntentParams(
|
|
416
|
+
private fun createAffirmStripeIntentParams(
|
|
417
|
+
clientSecret: String,
|
|
418
|
+
isPaymentIntent: Boolean,
|
|
419
|
+
): ConfirmStripeIntentParams {
|
|
360
420
|
if (!isPaymentIntent) {
|
|
361
421
|
throw PaymentMethodCreateParamsException("Affirm is not yet supported through SetupIntents.")
|
|
362
422
|
}
|
|
363
423
|
|
|
364
424
|
val params = createAffirmParams()
|
|
365
425
|
|
|
366
|
-
return ConfirmPaymentIntentParams
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
)
|
|
426
|
+
return ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
|
|
427
|
+
paymentMethodCreateParams = params,
|
|
428
|
+
clientSecret = clientSecret,
|
|
429
|
+
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
|
|
430
|
+
mandateData = buildMandateDataParams(),
|
|
431
|
+
)
|
|
373
432
|
}
|
|
374
433
|
|
|
375
434
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
@@ -378,30 +437,27 @@ class PaymentMethodCreateParamsFactory(
|
|
|
378
437
|
val routingNumber = getValOr(params, "routingNumber", null)
|
|
379
438
|
|
|
380
439
|
if (accountNumber.isNullOrBlank()) {
|
|
381
|
-
throw PaymentMethodCreateParamsException(
|
|
440
|
+
throw PaymentMethodCreateParamsException(
|
|
441
|
+
"When creating a US bank account payment method, you must provide the bank account number",
|
|
442
|
+
)
|
|
382
443
|
} else if (routingNumber.isNullOrBlank()) {
|
|
383
|
-
throw PaymentMethodCreateParamsException(
|
|
444
|
+
throw PaymentMethodCreateParamsException(
|
|
445
|
+
"When creating a US bank account payment method, you must provide the bank routing number",
|
|
446
|
+
)
|
|
384
447
|
}
|
|
385
448
|
|
|
386
|
-
val usBankAccount =
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
getValOr(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
null)),
|
|
394
|
-
mapToUSBankAccountHolderType(
|
|
395
|
-
getValOr(
|
|
396
|
-
params,
|
|
397
|
-
"accountHolderType",
|
|
398
|
-
null))
|
|
399
|
-
)
|
|
449
|
+
val usBankAccount =
|
|
450
|
+
PaymentMethodCreateParams.USBankAccount(
|
|
451
|
+
accountNumber,
|
|
452
|
+
routingNumber,
|
|
453
|
+
mapToUSBankAccountType(getValOr(params, "accountType", null)),
|
|
454
|
+
mapToUSBankAccountHolderType(getValOr(params, "accountHolderType", null)),
|
|
455
|
+
)
|
|
400
456
|
|
|
401
457
|
return PaymentMethodCreateParams.Companion.create(
|
|
402
458
|
usBankAccount,
|
|
403
459
|
billingDetailsParams,
|
|
404
|
-
|
|
460
|
+
metadataParams,
|
|
405
461
|
)
|
|
406
462
|
}
|
|
407
463
|
|
|
@@ -409,10 +465,12 @@ class PaymentMethodCreateParamsFactory(
|
|
|
409
465
|
getMapOrNull(paymentMethodData, "mandateData")?.let { mandateData ->
|
|
410
466
|
getMapOrNull(mandateData, "customerAcceptance")?.let { customerAcceptance ->
|
|
411
467
|
getMapOrNull(customerAcceptance, "online")?.let { onlineParams ->
|
|
412
|
-
return MandateDataParams(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
468
|
+
return MandateDataParams(
|
|
469
|
+
MandateDataParams.Type.Online(
|
|
470
|
+
ipAddress = getValOr(onlineParams, "ipAddress", "") ?: "",
|
|
471
|
+
userAgent = getValOr(onlineParams, "userAgent", "") ?: "",
|
|
472
|
+
),
|
|
473
|
+
)
|
|
416
474
|
}
|
|
417
475
|
}
|
|
418
476
|
}
|
|
@@ -420,4 +478,6 @@ class PaymentMethodCreateParamsFactory(
|
|
|
420
478
|
}
|
|
421
479
|
}
|
|
422
480
|
|
|
423
|
-
class PaymentMethodCreateParamsException(
|
|
481
|
+
class PaymentMethodCreateParamsException(
|
|
482
|
+
message: String,
|
|
483
|
+
) : Exception(message)
|