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