@stripe/stripe-react-native 0.42.0 → 0.44.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 +26 -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 +8 -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 +422 -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 +656 -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 +13 -7
- package/ios/FinancialConnections.swift +6 -2
- package/ios/StripeSdk+CustomerSheet.swift +3 -1
- package/ios/StripeSdk+PaymentSheet.swift +86 -21
- 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 +16 -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 +91 -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/helpers.ts +2 -1
- package/src/types/Common.ts +3 -0
- package/src/types/CustomerSheet.ts +11 -0
- package/src/types/FinancialConnections.ts +3 -0
- package/src/types/PaymentMethod.ts +5 -1
- package/src/types/PaymentSheet.ts +85 -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
|
@@ -3,20 +3,45 @@ package com.reactnativestripesdk.utils
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.os.Bundle
|
|
5
5
|
import android.util.Log
|
|
6
|
-
import com.facebook.react.bridge
|
|
7
|
-
import com.
|
|
6
|
+
import com.facebook.react.bridge.Arguments
|
|
7
|
+
import com.facebook.react.bridge.ReadableArray
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
9
|
+
import com.facebook.react.bridge.ReadableType
|
|
10
|
+
import com.facebook.react.bridge.WritableArray
|
|
11
|
+
import com.facebook.react.bridge.WritableMap
|
|
12
|
+
import com.facebook.react.bridge.WritableNativeMap
|
|
8
13
|
import com.stripe.android.PaymentAuthConfig
|
|
9
|
-
import com.stripe.android.
|
|
10
|
-
import com.stripe.android.model.
|
|
14
|
+
import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent
|
|
15
|
+
import com.stripe.android.model.Address
|
|
16
|
+
import com.stripe.android.model.BankAccount
|
|
17
|
+
import com.stripe.android.model.BankAccountTokenParams
|
|
18
|
+
import com.stripe.android.model.Card
|
|
19
|
+
import com.stripe.android.model.CardBrand
|
|
20
|
+
import com.stripe.android.model.ConfirmPaymentIntentParams
|
|
21
|
+
import com.stripe.android.model.GooglePayResult
|
|
22
|
+
import com.stripe.android.model.MicrodepositType
|
|
23
|
+
import com.stripe.android.model.PaymentIntent
|
|
24
|
+
import com.stripe.android.model.PaymentMethod
|
|
25
|
+
import com.stripe.android.model.SetupIntent
|
|
26
|
+
import com.stripe.android.model.StripeIntent
|
|
11
27
|
import com.stripe.android.model.StripeIntent.NextActionData
|
|
28
|
+
import com.stripe.android.model.StripeIntent.NextActionType
|
|
29
|
+
import com.stripe.android.model.Token
|
|
12
30
|
|
|
13
|
-
internal fun createResult(
|
|
31
|
+
internal fun createResult(
|
|
32
|
+
key: String,
|
|
33
|
+
value: WritableMap,
|
|
34
|
+
): WritableMap {
|
|
14
35
|
val map = WritableNativeMap()
|
|
15
36
|
map.putMap(key, value)
|
|
16
37
|
return map
|
|
17
38
|
}
|
|
18
39
|
|
|
19
|
-
internal fun createCanAddCardResult(
|
|
40
|
+
internal fun createCanAddCardResult(
|
|
41
|
+
canAddCard: Boolean,
|
|
42
|
+
status: String? = null,
|
|
43
|
+
token: WritableMap? = null,
|
|
44
|
+
): WritableNativeMap {
|
|
20
45
|
val result = WritableNativeMap()
|
|
21
46
|
val details = WritableNativeMap()
|
|
22
47
|
result.putBoolean("canAddCard", canAddCard)
|
|
@@ -30,8 +55,8 @@ internal fun createCanAddCardResult(canAddCard: Boolean, status: String? = null,
|
|
|
30
55
|
return result
|
|
31
56
|
}
|
|
32
57
|
|
|
33
|
-
internal fun mapIntentStatus(status: StripeIntent.Status?): String
|
|
34
|
-
|
|
58
|
+
internal fun mapIntentStatus(status: StripeIntent.Status?): String =
|
|
59
|
+
when (status) {
|
|
35
60
|
StripeIntent.Status.Succeeded -> "Succeeded"
|
|
36
61
|
StripeIntent.Status.RequiresPaymentMethod -> "RequiresPaymentMethod"
|
|
37
62
|
StripeIntent.Status.RequiresConfirmation -> "RequiresConfirmation"
|
|
@@ -41,24 +66,20 @@ internal fun mapIntentStatus(status: StripeIntent.Status?): String {
|
|
|
41
66
|
StripeIntent.Status.RequiresCapture -> "RequiresCapture"
|
|
42
67
|
else -> "Unknown"
|
|
43
68
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
69
|
|
|
47
|
-
internal fun mapCaptureMethod(captureMethod: PaymentIntent.CaptureMethod?): String
|
|
48
|
-
|
|
70
|
+
internal fun mapCaptureMethod(captureMethod: PaymentIntent.CaptureMethod?): String =
|
|
71
|
+
when (captureMethod) {
|
|
49
72
|
PaymentIntent.CaptureMethod.Automatic -> "Automatic"
|
|
50
73
|
PaymentIntent.CaptureMethod.Manual -> "Manual"
|
|
51
74
|
else -> "Unknown"
|
|
52
75
|
}
|
|
53
|
-
}
|
|
54
76
|
|
|
55
|
-
internal fun mapConfirmationMethod(captureMethod: PaymentIntent.ConfirmationMethod?): String
|
|
56
|
-
|
|
77
|
+
internal fun mapConfirmationMethod(captureMethod: PaymentIntent.ConfirmationMethod?): String =
|
|
78
|
+
when (captureMethod) {
|
|
57
79
|
PaymentIntent.ConfirmationMethod.Automatic -> "Automatic"
|
|
58
80
|
PaymentIntent.ConfirmationMethod.Manual -> "Manual"
|
|
59
81
|
else -> "Unknown"
|
|
60
82
|
}
|
|
61
|
-
}
|
|
62
83
|
|
|
63
84
|
internal fun mapToReturnURL(urlScheme: String?): String? {
|
|
64
85
|
if (urlScheme != null) {
|
|
@@ -86,8 +107,8 @@ internal fun mapIntentShipping(shipping: PaymentIntent.Shipping): WritableMap {
|
|
|
86
107
|
return map
|
|
87
108
|
}
|
|
88
109
|
|
|
89
|
-
internal fun mapCardBrand(brand: CardBrand?): String
|
|
90
|
-
|
|
110
|
+
internal fun mapCardBrand(brand: CardBrand?): String =
|
|
111
|
+
when (brand) {
|
|
91
112
|
CardBrand.AmericanExpress -> "AmericanExpress"
|
|
92
113
|
CardBrand.DinersClub -> "DinersClub"
|
|
93
114
|
CardBrand.Discover -> "Discover"
|
|
@@ -98,10 +119,9 @@ internal fun mapCardBrand(brand: CardBrand?): String {
|
|
|
98
119
|
CardBrand.Unknown -> "Unknown"
|
|
99
120
|
else -> "Unknown"
|
|
100
121
|
}
|
|
101
|
-
}
|
|
102
122
|
|
|
103
|
-
internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String
|
|
104
|
-
|
|
123
|
+
internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String =
|
|
124
|
+
when (type) {
|
|
105
125
|
PaymentMethod.Type.AfterpayClearpay -> "AfterpayClearpay"
|
|
106
126
|
PaymentMethod.Type.Alipay -> "Alipay"
|
|
107
127
|
PaymentMethod.Type.AuBecsDebit -> "AuBecsDebit"
|
|
@@ -129,10 +149,9 @@ internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String {
|
|
|
129
149
|
PaymentMethod.Type.RevolutPay -> "RevolutPay"
|
|
130
150
|
else -> "Unknown"
|
|
131
151
|
}
|
|
132
|
-
}
|
|
133
152
|
|
|
134
|
-
internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type?
|
|
135
|
-
|
|
153
|
+
internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? =
|
|
154
|
+
when (type) {
|
|
136
155
|
"Card" -> PaymentMethod.Type.Card
|
|
137
156
|
"Ideal" -> PaymentMethod.Type.Ideal
|
|
138
157
|
"Alipay" -> PaymentMethod.Type.Alipay
|
|
@@ -160,7 +179,6 @@ internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? {
|
|
|
160
179
|
"RevolutPay" -> PaymentMethod.Type.RevolutPay
|
|
161
180
|
else -> null
|
|
162
181
|
}
|
|
163
|
-
}
|
|
164
182
|
|
|
165
183
|
internal fun mapFromBillingDetails(billingDatails: PaymentMethod.BillingDetails?): WritableMap {
|
|
166
184
|
val details: WritableMap = WritableNativeMap()
|
|
@@ -181,8 +199,8 @@ internal fun mapFromBillingDetails(billingDatails: PaymentMethod.BillingDetails?
|
|
|
181
199
|
return details
|
|
182
200
|
}
|
|
183
201
|
|
|
184
|
-
internal fun mapTokenType(type: Token.Type): String
|
|
185
|
-
|
|
202
|
+
internal fun mapTokenType(type: Token.Type): String =
|
|
203
|
+
when (type) {
|
|
186
204
|
Token.Type.Account -> "Account"
|
|
187
205
|
Token.Type.BankAccount -> "BankAccount"
|
|
188
206
|
Token.Type.Card -> "Card"
|
|
@@ -191,26 +209,23 @@ internal fun mapTokenType(type: Token.Type): String {
|
|
|
191
209
|
Token.Type.Pii -> "Pii"
|
|
192
210
|
else -> "Unknown"
|
|
193
211
|
}
|
|
194
|
-
}
|
|
195
212
|
|
|
196
|
-
internal fun mapFromBankAccountType(type: BankAccount.Type?): String
|
|
197
|
-
|
|
213
|
+
internal fun mapFromBankAccountType(type: BankAccount.Type?): String =
|
|
214
|
+
when (type) {
|
|
198
215
|
BankAccount.Type.Company -> "Company"
|
|
199
216
|
BankAccount.Type.Individual -> "Individual"
|
|
200
217
|
else -> "Unknown"
|
|
201
218
|
}
|
|
202
|
-
}
|
|
203
219
|
|
|
204
|
-
internal fun mapToBankAccountType(type: String?): BankAccountTokenParams.Type
|
|
205
|
-
|
|
220
|
+
internal fun mapToBankAccountType(type: String?): BankAccountTokenParams.Type =
|
|
221
|
+
when (type) {
|
|
206
222
|
"Company" -> BankAccountTokenParams.Type.Company
|
|
207
223
|
"Individual" -> BankAccountTokenParams.Type.Individual
|
|
208
224
|
else -> BankAccountTokenParams.Type.Individual
|
|
209
225
|
}
|
|
210
|
-
}
|
|
211
226
|
|
|
212
|
-
internal fun mapFromBankAccountStatus(status: BankAccount.Status?): String
|
|
213
|
-
|
|
227
|
+
internal fun mapFromBankAccountStatus(status: BankAccount.Status?): String =
|
|
228
|
+
when (status) {
|
|
214
229
|
BankAccount.Status.Errored -> "Errored"
|
|
215
230
|
BankAccount.Status.New -> "New"
|
|
216
231
|
BankAccount.Status.Validated -> "Validated"
|
|
@@ -218,7 +233,6 @@ internal fun mapFromBankAccountStatus(status: BankAccount.Status?): String {
|
|
|
218
233
|
BankAccount.Status.Verified -> "Verified"
|
|
219
234
|
else -> "Unknown"
|
|
220
235
|
}
|
|
221
|
-
}
|
|
222
236
|
|
|
223
237
|
internal fun mapFromBankAccount(bankAccount: BankAccount?): WritableMap? {
|
|
224
238
|
if (bankAccount == null) {
|
|
@@ -229,7 +243,10 @@ internal fun mapFromBankAccount(bankAccount: BankAccount?): WritableMap? {
|
|
|
229
243
|
bankAccountMap.putString("id", bankAccount.id)
|
|
230
244
|
bankAccountMap.putString("bankName", bankAccount.bankName)
|
|
231
245
|
bankAccountMap.putString("accountHolderName", bankAccount.accountHolderName)
|
|
232
|
-
bankAccountMap.putString(
|
|
246
|
+
bankAccountMap.putString(
|
|
247
|
+
"accountHolderType",
|
|
248
|
+
mapFromBankAccountType(bankAccount.accountHolderType),
|
|
249
|
+
)
|
|
233
250
|
bankAccountMap.putString("currency", bankAccount.currency)
|
|
234
251
|
bankAccountMap.putString("country", bankAccount.countryCode)
|
|
235
252
|
bankAccountMap.putString("routingNumber", bankAccount.routingNumber)
|
|
@@ -240,37 +257,33 @@ internal fun mapFromBankAccount(bankAccount: BankAccount?): WritableMap? {
|
|
|
240
257
|
return bankAccountMap
|
|
241
258
|
}
|
|
242
259
|
|
|
243
|
-
internal fun mapToUSBankAccountHolderType(type: String?): PaymentMethod.USBankAccount.USBankAccountHolderType
|
|
244
|
-
|
|
260
|
+
internal fun mapToUSBankAccountHolderType(type: String?): PaymentMethod.USBankAccount.USBankAccountHolderType =
|
|
261
|
+
when (type) {
|
|
245
262
|
"Company" -> PaymentMethod.USBankAccount.USBankAccountHolderType.COMPANY
|
|
246
263
|
"Individual" -> PaymentMethod.USBankAccount.USBankAccountHolderType.INDIVIDUAL
|
|
247
264
|
else -> PaymentMethod.USBankAccount.USBankAccountHolderType.INDIVIDUAL
|
|
248
265
|
}
|
|
249
|
-
}
|
|
250
266
|
|
|
251
|
-
internal fun mapFromUSBankAccountHolderType(type: PaymentMethod.USBankAccount.USBankAccountHolderType?): String
|
|
252
|
-
|
|
267
|
+
internal fun mapFromUSBankAccountHolderType(type: PaymentMethod.USBankAccount.USBankAccountHolderType?): String =
|
|
268
|
+
when (type) {
|
|
253
269
|
PaymentMethod.USBankAccount.USBankAccountHolderType.COMPANY -> "Company"
|
|
254
270
|
PaymentMethod.USBankAccount.USBankAccountHolderType.INDIVIDUAL -> "Individual"
|
|
255
271
|
else -> "Unknown"
|
|
256
272
|
}
|
|
257
|
-
}
|
|
258
273
|
|
|
259
|
-
internal fun mapToUSBankAccountType(type: String?): PaymentMethod.USBankAccount.USBankAccountType
|
|
260
|
-
|
|
274
|
+
internal fun mapToUSBankAccountType(type: String?): PaymentMethod.USBankAccount.USBankAccountType =
|
|
275
|
+
when (type) {
|
|
261
276
|
"Savings" -> PaymentMethod.USBankAccount.USBankAccountType.SAVINGS
|
|
262
277
|
"Checking" -> PaymentMethod.USBankAccount.USBankAccountType.CHECKING
|
|
263
278
|
else -> PaymentMethod.USBankAccount.USBankAccountType.CHECKING
|
|
264
279
|
}
|
|
265
|
-
}
|
|
266
280
|
|
|
267
|
-
internal fun mapFromUSBankAccountType(type: PaymentMethod.USBankAccount.USBankAccountType?): String
|
|
268
|
-
|
|
281
|
+
internal fun mapFromUSBankAccountType(type: PaymentMethod.USBankAccount.USBankAccountType?): String =
|
|
282
|
+
when (type) {
|
|
269
283
|
PaymentMethod.USBankAccount.USBankAccountType.CHECKING -> "Checking"
|
|
270
284
|
PaymentMethod.USBankAccount.USBankAccountType.SAVINGS -> "Savings"
|
|
271
285
|
else -> "Unknown"
|
|
272
286
|
}
|
|
273
|
-
}
|
|
274
287
|
|
|
275
288
|
internal fun mapFromCard(card: Card?): WritableMap? {
|
|
276
289
|
val cardMap: WritableMap = WritableNativeMap()
|
|
@@ -285,17 +298,9 @@ internal fun mapFromCard(card: Card?): WritableMap? {
|
|
|
285
298
|
cardMap.putString("brand", mapCardBrand(card.brand))
|
|
286
299
|
cardMap.putString("currency", card.currency)
|
|
287
300
|
|
|
288
|
-
(card.expMonth)?.let {
|
|
289
|
-
cardMap.putInt("expMonth", it)
|
|
290
|
-
} ?: run {
|
|
291
|
-
cardMap.putNull("expMonth")
|
|
292
|
-
}
|
|
301
|
+
(card.expMonth)?.let { cardMap.putInt("expMonth", it) } ?: run { cardMap.putNull("expMonth") }
|
|
293
302
|
|
|
294
|
-
(card.expYear)?.let {
|
|
295
|
-
cardMap.putInt("expYear", it)
|
|
296
|
-
} ?: run {
|
|
297
|
-
cardMap.putNull("expYear")
|
|
298
|
-
}
|
|
303
|
+
(card.expYear)?.let { cardMap.putInt("expYear", it) } ?: run { cardMap.putNull("expYear") }
|
|
299
304
|
|
|
300
305
|
cardMap.putString("id", card.id)
|
|
301
306
|
cardMap.putString("last4", card.last4)
|
|
@@ -314,7 +319,6 @@ internal fun mapFromCard(card: Card?): WritableMap? {
|
|
|
314
319
|
return cardMap
|
|
315
320
|
}
|
|
316
321
|
|
|
317
|
-
|
|
318
322
|
internal fun mapFromToken(token: Token): WritableMap {
|
|
319
323
|
val tokenMap: WritableMap = WritableNativeMap()
|
|
320
324
|
tokenMap.putString("id", token.id)
|
|
@@ -336,66 +340,102 @@ internal fun mapFromPaymentMethod(paymentMethod: PaymentMethod): WritableMap {
|
|
|
336
340
|
pm.putBoolean("livemode", paymentMethod.liveMode)
|
|
337
341
|
pm.putString("customerId", paymentMethod.customerId)
|
|
338
342
|
pm.putMap("billingDetails", mapFromBillingDetails(paymentMethod.billingDetails))
|
|
339
|
-
pm.putMap(
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
it.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
it.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
pm.putMap(
|
|
343
|
+
pm.putMap(
|
|
344
|
+
"Card",
|
|
345
|
+
WritableNativeMap().also {
|
|
346
|
+
it.putString("brand", mapCardBrand(paymentMethod.card?.brand))
|
|
347
|
+
it.putString("country", paymentMethod.card?.country)
|
|
348
|
+
paymentMethod.card?.expiryYear?.let { year -> it.putInt("expYear", year) }
|
|
349
|
+
paymentMethod.card?.expiryMonth?.let { month -> it.putInt("expMonth", month) }
|
|
350
|
+
it.putString("funding", paymentMethod.card?.funding)
|
|
351
|
+
it.putString("last4", paymentMethod.card?.last4)
|
|
352
|
+
it.putString("fingerprint", paymentMethod.card?.fingerprint)
|
|
353
|
+
it.putString("preferredNetwork", paymentMethod.card?.networks?.preferred)
|
|
354
|
+
it.putArray(
|
|
355
|
+
"availableNetworks",
|
|
356
|
+
paymentMethod.card
|
|
357
|
+
?.networks
|
|
358
|
+
?.available
|
|
359
|
+
?.toList() as? ReadableArray,
|
|
360
|
+
)
|
|
361
|
+
it.putMap(
|
|
362
|
+
"threeDSecureUsage",
|
|
363
|
+
WritableNativeMap().also { threeDSecureUsageMap ->
|
|
364
|
+
threeDSecureUsageMap.putBoolean(
|
|
365
|
+
"isSupported",
|
|
366
|
+
paymentMethod.card?.threeDSecureUsage?.isSupported ?: false,
|
|
367
|
+
)
|
|
368
|
+
},
|
|
369
|
+
)
|
|
370
|
+
},
|
|
371
|
+
)
|
|
372
|
+
pm.putMap(
|
|
373
|
+
"SepaDebit",
|
|
374
|
+
WritableNativeMap().also {
|
|
375
|
+
it.putString("bankCode", paymentMethod.sepaDebit?.bankCode)
|
|
376
|
+
it.putString("country", paymentMethod.sepaDebit?.country)
|
|
377
|
+
it.putString("fingerprint", paymentMethod.sepaDebit?.fingerprint)
|
|
378
|
+
it.putString("last4", paymentMethod.sepaDebit?.branchCode)
|
|
379
|
+
},
|
|
380
|
+
)
|
|
381
|
+
pm.putMap(
|
|
382
|
+
"BacsDebit",
|
|
383
|
+
WritableNativeMap().also {
|
|
384
|
+
it.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
|
|
385
|
+
it.putString("last4", paymentMethod.bacsDebit?.last4)
|
|
386
|
+
it.putString("sortCode", paymentMethod.bacsDebit?.sortCode)
|
|
387
|
+
},
|
|
388
|
+
)
|
|
389
|
+
pm.putMap(
|
|
390
|
+
"AuBecsDebit",
|
|
369
391
|
WritableNativeMap().also {
|
|
370
392
|
it.putString("bsbNumber", paymentMethod.bacsDebit?.sortCode)
|
|
371
393
|
it.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
|
|
372
394
|
it.putString("last4", paymentMethod.bacsDebit?.last4)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
},
|
|
396
|
+
)
|
|
397
|
+
pm.putMap(
|
|
398
|
+
"Sofort",
|
|
399
|
+
WritableNativeMap().also { it.putString("country", paymentMethod.sofort?.country) },
|
|
400
|
+
)
|
|
401
|
+
pm.putMap(
|
|
402
|
+
"Ideal",
|
|
403
|
+
WritableNativeMap().also {
|
|
404
|
+
it.putString("bankName", paymentMethod.ideal?.bank)
|
|
405
|
+
it.putString("bankIdentifierCode", paymentMethod.ideal?.bankIdentifierCode)
|
|
406
|
+
},
|
|
407
|
+
)
|
|
408
|
+
pm.putMap(
|
|
409
|
+
"Fpx",
|
|
410
|
+
WritableNativeMap().also {
|
|
411
|
+
it.putString("accountHolderType", paymentMethod.fpx?.accountHolderType)
|
|
412
|
+
it.putString("bank", paymentMethod.fpx?.bank)
|
|
413
|
+
},
|
|
414
|
+
)
|
|
415
|
+
pm.putMap("Upi", WritableNativeMap().also { it.putString("vpa", paymentMethod.upi?.vpa) })
|
|
416
|
+
pm.putMap(
|
|
417
|
+
"USBankAccount",
|
|
418
|
+
WritableNativeMap().also {
|
|
419
|
+
it.putString("routingNumber", paymentMethod.usBankAccount?.routingNumber)
|
|
420
|
+
it.putString(
|
|
421
|
+
"accountType",
|
|
422
|
+
mapFromUSBankAccountType(paymentMethod.usBankAccount?.accountType),
|
|
423
|
+
)
|
|
424
|
+
it.putString(
|
|
425
|
+
"accountHolderType",
|
|
426
|
+
mapFromUSBankAccountHolderType(paymentMethod.usBankAccount?.accountHolderType),
|
|
427
|
+
)
|
|
428
|
+
it.putString("last4", paymentMethod.usBankAccount?.last4)
|
|
429
|
+
it.putString("bankName", paymentMethod.usBankAccount?.bankName)
|
|
430
|
+
it.putString("linkedAccount", paymentMethod.usBankAccount?.financialConnectionsAccount)
|
|
431
|
+
it.putString("fingerprint", paymentMethod.usBankAccount?.fingerprint)
|
|
432
|
+
it.putString("preferredNetworks", paymentMethod.usBankAccount?.networks?.preferred)
|
|
433
|
+
it.putArray(
|
|
434
|
+
"supportedNetworks",
|
|
435
|
+
paymentMethod.usBankAccount?.networks?.supported as? ReadableArray,
|
|
436
|
+
)
|
|
437
|
+
},
|
|
438
|
+
)
|
|
399
439
|
|
|
400
440
|
return pm
|
|
401
441
|
}
|
|
@@ -406,11 +446,10 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
|
|
|
406
446
|
map.putString("clientSecret", paymentIntent.clientSecret)
|
|
407
447
|
map.putBoolean("livemode", paymentIntent.isLiveMode)
|
|
408
448
|
map.putString("paymentMethodId", paymentIntent.paymentMethodId)
|
|
409
|
-
map.putMap(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
})
|
|
449
|
+
map.putMap(
|
|
450
|
+
"paymentMethod",
|
|
451
|
+
paymentIntent.paymentMethod?.let { mapFromPaymentMethod(it) } ?: run { null },
|
|
452
|
+
)
|
|
414
453
|
map.putString("receiptEmail", paymentIntent.receiptEmail)
|
|
415
454
|
map.putString("currency", paymentIntent.currency)
|
|
416
455
|
map.putString("status", mapIntentStatus(paymentIntent.status))
|
|
@@ -419,7 +458,10 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
|
|
|
419
458
|
map.putString("created", convertToUnixTimestamp(paymentIntent.created))
|
|
420
459
|
map.putString("captureMethod", mapCaptureMethod(paymentIntent.captureMethod))
|
|
421
460
|
map.putString("confirmationMethod", mapConfirmationMethod(paymentIntent.confirmationMethod))
|
|
422
|
-
map.putMap(
|
|
461
|
+
map.putMap(
|
|
462
|
+
"nextAction",
|
|
463
|
+
mapNextAction(paymentIntent.nextActionType, paymentIntent.nextActionData),
|
|
464
|
+
)
|
|
423
465
|
map.putNull("lastPaymentError")
|
|
424
466
|
map.putNull("shipping")
|
|
425
467
|
map.putNull("amount")
|
|
@@ -438,28 +480,26 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
|
|
|
438
480
|
map.putMap("lastPaymentError", paymentError)
|
|
439
481
|
}
|
|
440
482
|
|
|
441
|
-
paymentIntent.shipping?.let {
|
|
442
|
-
map.putMap("shipping", mapIntentShipping(it))
|
|
443
|
-
}
|
|
483
|
+
paymentIntent.shipping?.let { map.putMap("shipping", mapIntentShipping(it)) }
|
|
444
484
|
|
|
445
|
-
paymentIntent.amount?.let {
|
|
446
|
-
map.putDouble("amount", it.toDouble())
|
|
447
|
-
}
|
|
485
|
+
paymentIntent.amount?.let { map.putDouble("amount", it.toDouble()) }
|
|
448
486
|
map.putString("canceledAt", convertToUnixTimestamp(paymentIntent.canceledAt))
|
|
449
487
|
return map
|
|
450
488
|
}
|
|
451
489
|
|
|
452
490
|
@SuppressLint("RestrictedApi")
|
|
453
|
-
internal fun mapFromMicrodepositType(type: MicrodepositType): String
|
|
454
|
-
|
|
491
|
+
internal fun mapFromMicrodepositType(type: MicrodepositType): String =
|
|
492
|
+
when (type) {
|
|
455
493
|
MicrodepositType.AMOUNTS -> "amounts"
|
|
456
494
|
MicrodepositType.DESCRIPTOR_CODE -> "descriptorCode"
|
|
457
495
|
else -> "unknown"
|
|
458
496
|
}
|
|
459
|
-
}
|
|
460
497
|
|
|
461
498
|
@SuppressLint("RestrictedApi")
|
|
462
|
-
internal fun mapNextAction(
|
|
499
|
+
internal fun mapNextAction(
|
|
500
|
+
type: NextActionType?,
|
|
501
|
+
data: NextActionData?,
|
|
502
|
+
): WritableNativeMap? {
|
|
463
503
|
val nextActionMap = WritableNativeMap()
|
|
464
504
|
when (type) {
|
|
465
505
|
NextActionType.RedirectToUrl -> {
|
|
@@ -493,7 +533,12 @@ internal fun mapNextAction(type: NextActionType?, data: NextActionData?): Writab
|
|
|
493
533
|
NextActionType.AlipayRedirect -> { // TODO: Can't access, private
|
|
494
534
|
return null
|
|
495
535
|
}
|
|
496
|
-
NextActionType.CashAppRedirect,
|
|
536
|
+
NextActionType.CashAppRedirect,
|
|
537
|
+
NextActionType.BlikAuthorize,
|
|
538
|
+
NextActionType.UseStripeSdk,
|
|
539
|
+
NextActionType.UpiAwaitNotification,
|
|
540
|
+
null,
|
|
541
|
+
-> {
|
|
497
542
|
return null
|
|
498
543
|
}
|
|
499
544
|
NextActionType.DisplayBoletoDetails -> {
|
|
@@ -524,8 +569,8 @@ internal fun mapNextAction(type: NextActionType?, data: NextActionData?): Writab
|
|
|
524
569
|
return nextActionMap
|
|
525
570
|
}
|
|
526
571
|
|
|
527
|
-
internal fun mapFromPaymentIntentLastErrorType(errorType: PaymentIntent.Error.Type?): String?
|
|
528
|
-
|
|
572
|
+
internal fun mapFromPaymentIntentLastErrorType(errorType: PaymentIntent.Error.Type?): String? =
|
|
573
|
+
when (errorType) {
|
|
529
574
|
PaymentIntent.Error.Type.ApiConnectionError -> "api_connection_error"
|
|
530
575
|
PaymentIntent.Error.Type.AuthenticationError -> "authentication_error"
|
|
531
576
|
PaymentIntent.Error.Type.ApiError -> "api_error"
|
|
@@ -535,10 +580,9 @@ internal fun mapFromPaymentIntentLastErrorType(errorType: PaymentIntent.Error.Ty
|
|
|
535
580
|
PaymentIntent.Error.Type.RateLimitError -> "rate_limit_error"
|
|
536
581
|
else -> null
|
|
537
582
|
}
|
|
538
|
-
}
|
|
539
583
|
|
|
540
|
-
internal fun mapFromSetupIntentLastErrorType(errorType: SetupIntent.Error.Type?): String?
|
|
541
|
-
|
|
584
|
+
internal fun mapFromSetupIntentLastErrorType(errorType: SetupIntent.Error.Type?): String? =
|
|
585
|
+
when (errorType) {
|
|
542
586
|
SetupIntent.Error.Type.ApiConnectionError -> "api_connection_error"
|
|
543
587
|
SetupIntent.Error.Type.AuthenticationError -> "authentication_error"
|
|
544
588
|
SetupIntent.Error.Type.ApiError -> "api_error"
|
|
@@ -548,15 +592,20 @@ internal fun mapFromSetupIntentLastErrorType(errorType: SetupIntent.Error.Type?)
|
|
|
548
592
|
SetupIntent.Error.Type.RateLimitError -> "rate_limit_error"
|
|
549
593
|
else -> null
|
|
550
594
|
}
|
|
551
|
-
}
|
|
552
595
|
|
|
553
|
-
fun getValOr(
|
|
554
|
-
|
|
596
|
+
fun getValOr(
|
|
597
|
+
map: ReadableMap?,
|
|
598
|
+
key: String,
|
|
599
|
+
default: String? = "",
|
|
600
|
+
): String? =
|
|
601
|
+
map?.let {
|
|
555
602
|
if (it.hasKey(key)) it.getString(key) else default
|
|
556
603
|
} ?: default
|
|
557
|
-
}
|
|
558
604
|
|
|
559
|
-
internal fun mapToAddress(
|
|
605
|
+
internal fun mapToAddress(
|
|
606
|
+
addressMap: ReadableMap?,
|
|
607
|
+
cardAddress: Address?,
|
|
608
|
+
): Address {
|
|
560
609
|
val address = Address.Builder()
|
|
561
610
|
|
|
562
611
|
addressMap?.let {
|
|
@@ -581,12 +630,15 @@ internal fun mapToAddress(addressMap: ReadableMap?, cardAddress: Address?): Addr
|
|
|
581
630
|
return address.build()
|
|
582
631
|
}
|
|
583
632
|
|
|
584
|
-
internal fun mapToBillingDetails(
|
|
633
|
+
internal fun mapToBillingDetails(
|
|
634
|
+
billingDetails: ReadableMap?,
|
|
635
|
+
cardAddress: Address?,
|
|
636
|
+
): PaymentMethod.BillingDetails? {
|
|
585
637
|
if (billingDetails == null && cardAddress == null) {
|
|
586
638
|
return null
|
|
587
639
|
}
|
|
588
640
|
val address = mapToAddress(getMapOrNull(billingDetails, "address"), cardAddress)
|
|
589
|
-
val paymentMethodBillingDetailsBuilder =
|
|
641
|
+
val paymentMethodBillingDetailsBuilder = PaymentMethod.BillingDetails.Builder()
|
|
590
642
|
|
|
591
643
|
if (billingDetails != null) {
|
|
592
644
|
paymentMethodBillingDetailsBuilder
|
|
@@ -599,9 +651,7 @@ internal fun mapToBillingDetails(billingDetails: ReadableMap?, cardAddress: Addr
|
|
|
599
651
|
return paymentMethodBillingDetailsBuilder.build()
|
|
600
652
|
}
|
|
601
653
|
|
|
602
|
-
internal fun mapToMetadata(metadata: ReadableMap?): Map<String, String>? {
|
|
603
|
-
return metadata?.toHashMap()?.mapValues { it.value.toString() }
|
|
604
|
-
}
|
|
654
|
+
internal fun mapToMetadata(metadata: ReadableMap?): Map<String, String>? = metadata?.toHashMap()?.mapValues { it.value.toString() }
|
|
605
655
|
|
|
606
656
|
internal fun mapToShippingDetails(shippingDetails: ReadableMap?): ConfirmPaymentIntentParams.Shipping? {
|
|
607
657
|
if (shippingDetails == null) {
|
|
@@ -612,29 +662,31 @@ internal fun mapToShippingDetails(shippingDetails: ReadableMap?): ConfirmPayment
|
|
|
612
662
|
|
|
613
663
|
return ConfirmPaymentIntentParams.Shipping(
|
|
614
664
|
name = getValOr(shippingDetails, "name") ?: "",
|
|
615
|
-
address = address
|
|
665
|
+
address = address,
|
|
616
666
|
)
|
|
617
667
|
}
|
|
618
668
|
|
|
619
|
-
private fun getStringOrNull(
|
|
620
|
-
|
|
621
|
-
|
|
669
|
+
private fun getStringOrNull(
|
|
670
|
+
map: ReadableMap?,
|
|
671
|
+
key: String,
|
|
672
|
+
): String? = if (map?.hasKey(key) == true) map.getString(key) else null
|
|
622
673
|
|
|
623
|
-
fun getIntOrNull(
|
|
624
|
-
|
|
625
|
-
|
|
674
|
+
fun getIntOrNull(
|
|
675
|
+
map: ReadableMap?,
|
|
676
|
+
key: String,
|
|
677
|
+
): Int? = if (map?.hasKey(key) == true) map.getInt(key) else null
|
|
626
678
|
|
|
627
|
-
fun getMapOrNull(
|
|
628
|
-
|
|
629
|
-
|
|
679
|
+
fun getMapOrNull(
|
|
680
|
+
map: ReadableMap?,
|
|
681
|
+
key: String,
|
|
682
|
+
): ReadableMap? = if (map?.hasKey(key) == true) map.getMap(key) else null
|
|
630
683
|
|
|
631
|
-
fun getBooleanOrFalse(
|
|
632
|
-
|
|
633
|
-
|
|
684
|
+
fun getBooleanOrFalse(
|
|
685
|
+
map: ReadableMap?,
|
|
686
|
+
key: String,
|
|
687
|
+
): Boolean = if (map?.hasKey(key) == true) map.getBoolean(key) else false
|
|
634
688
|
|
|
635
|
-
private fun convertToUnixTimestamp(timestamp: Long): String
|
|
636
|
-
return (timestamp * 1000).toString()
|
|
637
|
-
}
|
|
689
|
+
private fun convertToUnixTimestamp(timestamp: Long): String = (timestamp * 1000).toString()
|
|
638
690
|
|
|
639
691
|
fun mapToUICustomization(params: ReadableMap): PaymentAuthConfig.Stripe3ds2UiCustomization {
|
|
640
692
|
val labelCustomization = getMapOrNull(params, "label")
|
|
@@ -656,35 +708,35 @@ fun mapToUICustomization(params: ReadableMap): PaymentAuthConfig.Stripe3ds2UiCus
|
|
|
656
708
|
val continueButtonCustomizationBuilder = PaymentAuthConfig.Stripe3ds2ButtonCustomization.Builder()
|
|
657
709
|
val resendButtonCustomizationBuilder = PaymentAuthConfig.Stripe3ds2ButtonCustomization.Builder()
|
|
658
710
|
|
|
659
|
-
getStringOrNull(labelCustomization,"headingTextColor")?.let {
|
|
711
|
+
getStringOrNull(labelCustomization, "headingTextColor")?.let {
|
|
660
712
|
labelCustomizationBuilder.setHeadingTextColor(it)
|
|
661
713
|
}
|
|
662
|
-
getStringOrNull(labelCustomization,"textColor")?.let {
|
|
714
|
+
getStringOrNull(labelCustomization, "textColor")?.let {
|
|
663
715
|
labelCustomizationBuilder.setTextColor(it)
|
|
664
716
|
}
|
|
665
|
-
getIntOrNull(labelCustomization,"headingFontSize")?.let {
|
|
717
|
+
getIntOrNull(labelCustomization, "headingFontSize")?.let {
|
|
666
718
|
labelCustomizationBuilder.setHeadingTextFontSize(it)
|
|
667
719
|
}
|
|
668
|
-
getIntOrNull(labelCustomization,"textFontSize")?.let {
|
|
720
|
+
getIntOrNull(labelCustomization, "textFontSize")?.let {
|
|
669
721
|
labelCustomizationBuilder.setTextFontSize(it)
|
|
670
722
|
}
|
|
671
723
|
|
|
672
|
-
getStringOrNull(navigationBarCustomization,"headerText")?.let {
|
|
724
|
+
getStringOrNull(navigationBarCustomization, "headerText")?.let {
|
|
673
725
|
toolbarCustomizationBuilder.setHeaderText(it)
|
|
674
726
|
}
|
|
675
|
-
getStringOrNull(navigationBarCustomization,"buttonText")?.let {
|
|
727
|
+
getStringOrNull(navigationBarCustomization, "buttonText")?.let {
|
|
676
728
|
toolbarCustomizationBuilder.setButtonText(it)
|
|
677
729
|
}
|
|
678
|
-
getStringOrNull(navigationBarCustomization,"textColor")?.let {
|
|
730
|
+
getStringOrNull(navigationBarCustomization, "textColor")?.let {
|
|
679
731
|
toolbarCustomizationBuilder.setTextColor(it)
|
|
680
732
|
}
|
|
681
|
-
getStringOrNull(navigationBarCustomization,"statusBarColor")?.let {
|
|
733
|
+
getStringOrNull(navigationBarCustomization, "statusBarColor")?.let {
|
|
682
734
|
toolbarCustomizationBuilder.setStatusBarColor(it)
|
|
683
735
|
}
|
|
684
|
-
getStringOrNull(navigationBarCustomization,"backgroundColor")?.let {
|
|
736
|
+
getStringOrNull(navigationBarCustomization, "backgroundColor")?.let {
|
|
685
737
|
toolbarCustomizationBuilder.setBackgroundColor(it)
|
|
686
738
|
}
|
|
687
|
-
getIntOrNull(navigationBarCustomization,"textFontSize")?.let {
|
|
739
|
+
getIntOrNull(navigationBarCustomization, "textFontSize")?.let {
|
|
688
740
|
toolbarCustomizationBuilder.setTextFontSize(it)
|
|
689
741
|
}
|
|
690
742
|
|
|
@@ -774,39 +826,29 @@ fun mapToUICustomization(params: ReadableMap): PaymentAuthConfig.Stripe3ds2UiCus
|
|
|
774
826
|
resendButtonCustomizationBuilder.setTextFontSize(it)
|
|
775
827
|
}
|
|
776
828
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.CANCEL
|
|
801
|
-
)
|
|
802
|
-
.setButtonCustomization(
|
|
803
|
-
resendButtonCustomizationBuilder.build(),
|
|
804
|
-
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.RESEND
|
|
805
|
-
)
|
|
806
|
-
|
|
807
|
-
getStringOrNull(params, "accentColor")?.let {
|
|
808
|
-
uiCustomization.setAccentColor(it)
|
|
809
|
-
}
|
|
829
|
+
val uiCustomization =
|
|
830
|
+
PaymentAuthConfig.Stripe3ds2UiCustomization
|
|
831
|
+
.Builder()
|
|
832
|
+
.setLabelCustomization(labelCustomizationBuilder.build())
|
|
833
|
+
.setToolbarCustomization(toolbarCustomizationBuilder.build())
|
|
834
|
+
.setButtonCustomization(
|
|
835
|
+
submitButtonCustomizationBuilder.build(),
|
|
836
|
+
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.SUBMIT,
|
|
837
|
+
).setButtonCustomization(
|
|
838
|
+
continueButtonCustomizationBuilder.build(),
|
|
839
|
+
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.CONTINUE,
|
|
840
|
+
).setButtonCustomization(
|
|
841
|
+
nextButtonCustomizationBuilder.build(),
|
|
842
|
+
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.SELECT,
|
|
843
|
+
).setButtonCustomization(
|
|
844
|
+
cancelButtonCustomizationBuilder.build(),
|
|
845
|
+
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.CANCEL,
|
|
846
|
+
).setButtonCustomization(
|
|
847
|
+
resendButtonCustomizationBuilder.build(),
|
|
848
|
+
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.RESEND,
|
|
849
|
+
)
|
|
850
|
+
|
|
851
|
+
getStringOrNull(params, "accentColor")?.let { uiCustomization.setAccentColor(it) }
|
|
810
852
|
|
|
811
853
|
return uiCustomization.build()
|
|
812
854
|
}
|
|
@@ -820,11 +862,10 @@ internal fun mapFromSetupIntentResult(setupIntent: SetupIntent): WritableMap {
|
|
|
820
862
|
map.putBoolean("livemode", setupIntent.isLiveMode)
|
|
821
863
|
map.putString("clientSecret", setupIntent.clientSecret)
|
|
822
864
|
map.putString("paymentMethodId", setupIntent.paymentMethodId)
|
|
823
|
-
map.putMap(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
})
|
|
865
|
+
map.putMap(
|
|
866
|
+
"paymentMethod",
|
|
867
|
+
setupIntent.paymentMethod?.let { mapFromPaymentMethod(it) } ?: run { null },
|
|
868
|
+
)
|
|
828
869
|
map.putString("usage", mapSetupIntentUsage(setupIntent.usage))
|
|
829
870
|
map.putString("created", convertToUnixTimestamp(setupIntent.created))
|
|
830
871
|
map.putMap("nextAction", mapNextAction(setupIntent.nextActionType, setupIntent.nextActionData))
|
|
@@ -852,22 +893,20 @@ internal fun mapFromSetupIntentResult(setupIntent: SetupIntent): WritableMap {
|
|
|
852
893
|
return map
|
|
853
894
|
}
|
|
854
895
|
|
|
855
|
-
internal fun mapSetupIntentUsage(type: StripeIntent.Usage?): String
|
|
856
|
-
|
|
896
|
+
internal fun mapSetupIntentUsage(type: StripeIntent.Usage?): String =
|
|
897
|
+
when (type) {
|
|
857
898
|
StripeIntent.Usage.OffSession -> "OffSession"
|
|
858
899
|
StripeIntent.Usage.OnSession -> "OnSession"
|
|
859
900
|
StripeIntent.Usage.OneTime -> "OneTime"
|
|
860
901
|
else -> "Unknown"
|
|
861
902
|
}
|
|
862
|
-
}
|
|
863
903
|
|
|
864
|
-
fun mapToPaymentIntentFutureUsage(type: String?): ConfirmPaymentIntentParams.SetupFutureUsage?
|
|
865
|
-
|
|
866
|
-
"OffSession" ->
|
|
867
|
-
"OnSession" ->
|
|
868
|
-
else ->
|
|
904
|
+
fun mapToPaymentIntentFutureUsage(type: String?): ConfirmPaymentIntentParams.SetupFutureUsage? =
|
|
905
|
+
when (type) {
|
|
906
|
+
"OffSession" -> ConfirmPaymentIntentParams.SetupFutureUsage.OffSession
|
|
907
|
+
"OnSession" -> ConfirmPaymentIntentParams.SetupFutureUsage.OnSession
|
|
908
|
+
else -> null
|
|
869
909
|
}
|
|
870
|
-
}
|
|
871
910
|
|
|
872
911
|
fun toBundleObject(readableMap: ReadableMap?): Bundle {
|
|
873
912
|
val result = Bundle()
|
|
@@ -880,17 +919,18 @@ fun toBundleObject(readableMap: ReadableMap?): Bundle {
|
|
|
880
919
|
when (readableMap.getType(key)) {
|
|
881
920
|
ReadableType.Null -> result.putString(key, null)
|
|
882
921
|
ReadableType.Boolean -> result.putBoolean(key, readableMap.getBoolean(key))
|
|
883
|
-
ReadableType.Number ->
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
922
|
+
ReadableType.Number ->
|
|
923
|
+
try {
|
|
924
|
+
val numAsInt = readableMap.getInt(key)
|
|
925
|
+
val numAsDouble = readableMap.getDouble(key)
|
|
926
|
+
if (numAsDouble - numAsInt != 0.0) {
|
|
927
|
+
result.putDouble(key, numAsDouble)
|
|
928
|
+
} else {
|
|
929
|
+
result.putInt(key, numAsInt)
|
|
930
|
+
}
|
|
931
|
+
} catch (e: Exception) {
|
|
932
|
+
Log.e("toBundleException", "Failed to add number to bundle. Failed on: $key.")
|
|
890
933
|
}
|
|
891
|
-
} catch (e: Exception) {
|
|
892
|
-
Log.e("toBundleException", "Failed to add number to bundle. Failed on: $key.")
|
|
893
|
-
}
|
|
894
934
|
ReadableType.String -> result.putString(key, readableMap.getString(key))
|
|
895
935
|
ReadableType.Map -> result.putBundle(key, toBundleObject(readableMap.getMap(key)))
|
|
896
936
|
ReadableType.Array -> {
|
|
@@ -903,7 +943,11 @@ fun toBundleObject(readableMap: ReadableMap?): Bundle {
|
|
|
903
943
|
when (list.first()) {
|
|
904
944
|
is String -> result.putStringArrayList(key, list as java.util.ArrayList<String>)
|
|
905
945
|
is Int -> result.putIntegerArrayList(key, list as java.util.ArrayList<Int>)
|
|
906
|
-
else ->
|
|
946
|
+
else ->
|
|
947
|
+
Log.e(
|
|
948
|
+
"toBundleException",
|
|
949
|
+
"Cannot put arrays of objects into bundles. Failed on: $key.",
|
|
950
|
+
)
|
|
907
951
|
}
|
|
908
952
|
}
|
|
909
953
|
}
|
|
@@ -920,11 +964,8 @@ internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableM
|
|
|
920
964
|
googlePayResult.name
|
|
921
965
|
name.putString("givenName", googlePayResult.shippingInformation?.name)
|
|
922
966
|
map.putMap("name", name)
|
|
923
|
-
googlePayResult.shippingInformation?.phone?.let {
|
|
924
|
-
map.putString("phoneNumber",
|
|
925
|
-
} ?: run {
|
|
926
|
-
map.putString("phoneNumber", googlePayResult.phoneNumber)
|
|
927
|
-
}
|
|
967
|
+
googlePayResult.shippingInformation?.phone?.let { map.putString("phoneNumber", it) }
|
|
968
|
+
?: run { map.putString("phoneNumber", googlePayResult.phoneNumber) }
|
|
928
969
|
val postalAddress = WritableNativeMap()
|
|
929
970
|
postalAddress.putString("city", googlePayResult.shippingInformation?.address?.city)
|
|
930
971
|
postalAddress.putString("country", googlePayResult.shippingInformation?.address?.country)
|
|
@@ -932,9 +973,7 @@ internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableM
|
|
|
932
973
|
postalAddress.putString("state", googlePayResult.shippingInformation?.address?.state)
|
|
933
974
|
val line1: String? = googlePayResult.shippingInformation?.address?.line1
|
|
934
975
|
val line2: String? = googlePayResult.shippingInformation?.address?.line2
|
|
935
|
-
val street =
|
|
936
|
-
(if (line1 != null) "$line1" else "") +
|
|
937
|
-
(if (line2 != null) "\n$line2" else "")
|
|
976
|
+
val street = (if (line1 != null) "$line1" else "") + (if (line2 != null) "\n$line2" else "")
|
|
938
977
|
postalAddress.putString("street", street)
|
|
939
978
|
postalAddress.putString("isoCountryCode", googlePayResult.shippingInformation?.address?.country)
|
|
940
979
|
map.putMap("postalAddress", postalAddress)
|
|
@@ -946,29 +985,27 @@ internal fun mapToPreferredNetworks(networksAsInts: ArrayList<Int>?): List<CardB
|
|
|
946
985
|
return emptyList()
|
|
947
986
|
}
|
|
948
987
|
|
|
949
|
-
val intToCardBrand =
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
988
|
+
val intToCardBrand =
|
|
989
|
+
mapOf(
|
|
990
|
+
0 to CardBrand.JCB,
|
|
991
|
+
1 to CardBrand.AmericanExpress,
|
|
992
|
+
2 to CardBrand.CartesBancaires,
|
|
993
|
+
3 to CardBrand.DinersClub,
|
|
994
|
+
4 to CardBrand.Discover,
|
|
995
|
+
5 to CardBrand.MasterCard,
|
|
996
|
+
6 to CardBrand.UnionPay,
|
|
997
|
+
7 to CardBrand.Visa,
|
|
998
|
+
8 to CardBrand.Unknown,
|
|
999
|
+
)
|
|
960
1000
|
|
|
961
|
-
return networksAsInts.mapNotNull {
|
|
962
|
-
intToCardBrand[it]
|
|
963
|
-
}
|
|
1001
|
+
return networksAsInts.mapNotNull { intToCardBrand[it] }
|
|
964
1002
|
}
|
|
965
1003
|
|
|
966
|
-
internal fun mapFromFinancialConnectionsEvent(event: FinancialConnectionsEvent): WritableMap
|
|
967
|
-
|
|
1004
|
+
internal fun mapFromFinancialConnectionsEvent(event: FinancialConnectionsEvent): WritableMap =
|
|
1005
|
+
Arguments.createMap().apply {
|
|
968
1006
|
putString("name", event.name.value)
|
|
969
1007
|
putMap("metadata", event.metadata.toMap().toReadableMap())
|
|
970
1008
|
}
|
|
971
|
-
}
|
|
972
1009
|
|
|
973
1010
|
private fun List<Any?>.toWritableArray(): WritableArray {
|
|
974
1011
|
val writableArray = Arguments.createArray()
|