@stripe/stripe-react-native 0.56.0 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +76 -118
- package/android/gradle.properties +1 -1
- package/android/settings.gradle +2 -0
- package/android/spotless.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +24 -20
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +20 -17
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +28 -32
- package/android/src/main/java/com/reactnativestripesdk/{CollectBankAccountLauncherFragment.kt → CollectBankAccountLauncherManager.kt} +23 -44
- package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +4 -11
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +52 -132
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +0 -8
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
- package/android/src/main/java/com/reactnativestripesdk/{FinancialConnectionsSheetFragment.kt → FinancialConnectionsSheetManager.kt} +43 -92
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +107 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherManager.kt +37 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +7 -5
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt +31 -0
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +120 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +228 -0
- package/android/src/main/java/com/reactnativestripesdk/{PaymentLauncherFragment.kt → PaymentLauncherManager.kt} +40 -77
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +11 -20
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +409 -483
- package/android/src/main/java/com/reactnativestripesdk/{PaymentSheetFragment.kt → PaymentSheetManager.kt} +65 -300
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +227 -232
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +78 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +52 -39
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/{CustomerSheetFragment.kt → CustomerSheetManager.kt} +64 -99
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -3
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +5 -10
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +90 -77
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +6 -4
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +13 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +87 -11
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +178 -185
- package/android/src/main/java/com/reactnativestripesdk/utils/StripeUIManager.kt +62 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +118 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +922 -0
- package/android/src/test/java/com/facebook/testutils/shadows/ShadowArguments.kt +29 -0
- package/android/src/test/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManagerTest.kt +163 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +976 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetAppearanceTest.kt +801 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +523 -0
- package/android/src/test/java/com/reactnativestripesdk/addresssheet/AddressSheetViewTest.kt +551 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +567 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +456 -0
- package/android/src/test/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +43 -0
- package/android/src/test/resources/robolectric.properties +2 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +3 -3
- package/ios/AddressSheet/AddressSheetView.swift +26 -26
- package/ios/AddressSheet/AddressSheetViewManager.swift +2 -2
- package/ios/ApplePayButtonManager.swift +1 -1
- package/ios/ApplePayButtonView.swift +9 -10
- package/ios/ApplePayUtils.swift +51 -51
- package/ios/ApplePayViewController.swift +25 -29
- package/ios/AuBECSDebitFormManager.swift +1 -1
- package/ios/AuBECSDebitFormView.swift +13 -15
- package/ios/CardFieldManager.swift +4 -4
- package/ios/CardFieldView.swift +9 -9
- package/ios/CardFormManager.swift +3 -3
- package/ios/CardFormView.swift +28 -28
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingView.swift +97 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +133 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.m +16 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.swift +17 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +15 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +19 -19
- package/ios/EmbeddedPaymentElementView.swift +2 -2
- package/ios/Errors.swift +22 -23
- package/ios/FinancialConnections.swift +37 -37
- package/ios/Mappers.swift +212 -75
- package/ios/NavigationBarManager.m +13 -0
- package/ios/NavigationBarManager.swift +17 -0
- package/ios/NavigationBarView.swift +65 -0
- package/ios/NewArch/NavigationBarComponentView.h +10 -0
- package/ios/NewArch/NavigationBarComponentView.mm +86 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
- package/ios/PaymentMethodFactory.swift +24 -41
- package/ios/PaymentOptionDisplayData+ReactNative.swift +4 -4
- package/ios/PaymentPassFinder.swift +9 -10
- package/ios/PaymentSheetAppearance.swift +137 -138
- package/ios/PushProvisioning/AddToWalletButtonManager.swift +2 -2
- package/ios/PushProvisioning/AddToWalletButtonView.swift +16 -18
- package/ios/PushProvisioning/PushProvisioningUtils.swift +11 -11
- package/ios/StripeContainerManager.swift +1 -1
- package/ios/StripeContainerView.swift +3 -3
- package/ios/StripeOnrampSdk.h +17 -0
- package/ios/StripeOnrampSdk.mm +158 -0
- package/ios/StripeSdk.mm +8 -0
- package/ios/StripeSdkEmitter.swift +4 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +31 -26
- package/ios/StripeSdkImpl+Embedded.swift +11 -9
- package/ios/StripeSdkImpl+PaymentSheet.swift +51 -42
- package/ios/StripeSdkImpl.swift +919 -191
- package/ios/UIColorExtension.swift +72 -0
- 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/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/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/connect/Components.js +2 -0
- package/lib/commonjs/connect/Components.js.map +1 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js +2 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/commonjs/connect/EmbeddedComponent.js +19 -0
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -0
- package/lib/commonjs/connect/ModalCloseButton.js +2 -0
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -0
- package/lib/commonjs/connect/NavigationBar.js +2 -0
- package/lib/commonjs/connect/NavigationBar.js.map +1 -0
- package/lib/commonjs/connect/connectTypes.js +2 -0
- package/lib/commonjs/connect/connectTypes.js.map +1 -0
- package/lib/commonjs/events.js +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/hooks/useOnramp.js +2 -0
- package/lib/commonjs/hooks/useOnramp.js.map +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withStripe.js +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +2 -0
- package/lib/commonjs/specs/NativeNavigationBar.js.map +1 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.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/Onramp.js +2 -0
- package/lib/commonjs/types/Onramp.js.map +1 -0
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.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/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/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/connect/Components.js +2 -0
- package/lib/module/connect/Components.js.map +1 -0
- package/lib/module/connect/ConnectComponentsProvider.js +2 -0
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/module/connect/EmbeddedComponent.js +19 -0
- package/lib/module/connect/EmbeddedComponent.js.map +1 -0
- package/lib/module/connect/ModalCloseButton.js +2 -0
- package/lib/module/connect/ModalCloseButton.js.map +1 -0
- package/lib/module/connect/NavigationBar.js +2 -0
- package/lib/module/connect/NavigationBar.js.map +1 -0
- package/lib/module/connect/connectTypes.js +2 -0
- package/lib/module/connect/connectTypes.js.map +1 -0
- package/lib/module/events.js +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/hooks/useOnramp.js +2 -0
- package/lib/module/hooks/useOnramp.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withStripe.js +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js.map +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js.map +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/module/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/module/specs/NativeNavigationBar.js +2 -0
- package/lib/module/specs/NativeNavigationBar.js.map +1 -0
- package/lib/module/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.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/Onramp.js +2 -0
- package/lib/module/types/Onramp.js.map +1 -0
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentSheet.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/components/StripeProvider.d.ts.map +1 -1
- package/lib/typescript/src/connect/Components.d.ts +23 -0
- package/lib/typescript/src/connect/Components.d.ts.map +1 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +22 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts +18 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts +7 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts.map +1 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts +8 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/connect/connectTypes.d.ts +464 -0
- package/lib/typescript/src/connect/connectTypes.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +3 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/helpers.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +158 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/plugin/withStripe.d.ts +15 -0
- package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts +14 -0
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts +11 -0
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +28 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/Errors.d.ts +5 -0
- package/lib/typescript/src/types/Errors.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +275 -0
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentIntent.d.ts +1 -9
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts +2 -8
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +7 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +24 -12
- package/src/components/StripeProvider.tsx +5 -0
- package/src/connect/Components.tsx +279 -0
- package/src/connect/ConnectComponentsProvider.tsx +93 -0
- package/src/connect/EmbeddedComponent.tsx +407 -0
- package/src/connect/ModalCloseButton.tsx +44 -0
- package/src/connect/NavigationBar.tsx +29 -0
- package/src/connect/connectTypes.ts +626 -0
- package/src/events.ts +22 -0
- package/src/hooks/useOnramp.tsx +334 -0
- package/src/index.tsx +13 -0
- package/src/plugin/withStripe.ts +104 -7
- package/src/specs/NativeConnectAccountOnboardingView.ts +19 -0
- package/src/specs/NativeNavigationBar.ts +16 -0
- package/src/specs/NativeOnrampSdkModule.ts +47 -0
- package/src/specs/NativeStripeSdkModule.ts +5 -0
- package/src/types/Errors.ts +6 -0
- package/src/types/Onramp.ts +317 -0
- package/src/types/PaymentIntent.ts +0 -10
- package/src/types/PaymentMethod.ts +0 -9
- package/src/types/PaymentSheet.ts +7 -0
- package/src/types/index.ts +8 -0
- package/stripe-react-native.podspec +21 -8
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -703
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +0 -146
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +0 -68
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +0 -102
- package/android/src/main/java/com/reactnativestripesdk/utils/StripeFragment.kt +0 -52
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import androidx.activity.ComponentActivity
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.reactnativestripesdk.utils.ConfirmPaymentErrorType
|
|
7
7
|
import com.reactnativestripesdk.utils.ConfirmSetupIntentErrorType
|
|
8
|
-
import com.reactnativestripesdk.utils.
|
|
9
|
-
import com.reactnativestripesdk.utils.StripeFragment
|
|
8
|
+
import com.reactnativestripesdk.utils.StripeUIManager
|
|
10
9
|
import com.reactnativestripesdk.utils.createError
|
|
11
|
-
import com.reactnativestripesdk.utils.createMissingActivityError
|
|
12
10
|
import com.reactnativestripesdk.utils.createResult
|
|
13
11
|
import com.reactnativestripesdk.utils.mapFromPaymentIntentResult
|
|
14
12
|
import com.reactnativestripesdk.utils.mapFromSetupIntentResult
|
|
15
|
-
import com.reactnativestripesdk.utils.removeFragment
|
|
16
13
|
import com.stripe.android.ApiResultCallback
|
|
17
14
|
import com.stripe.android.Stripe
|
|
15
|
+
import com.stripe.android.core.reactnative.ReactNativeSdkInternal
|
|
18
16
|
import com.stripe.android.model.ConfirmPaymentIntentParams
|
|
19
17
|
import com.stripe.android.model.ConfirmSetupIntentParams
|
|
20
18
|
import com.stripe.android.model.PaymentIntent
|
|
@@ -24,12 +22,13 @@ import com.stripe.android.payments.paymentlauncher.PaymentLauncher
|
|
|
24
22
|
import com.stripe.android.payments.paymentlauncher.PaymentResult
|
|
25
23
|
|
|
26
24
|
/** Instances of this class should only be initialized with the companion's helper methods. */
|
|
27
|
-
class
|
|
28
|
-
|
|
25
|
+
@OptIn(ReactNativeSdkInternal::class)
|
|
26
|
+
class PaymentLauncherManager(
|
|
27
|
+
context: ReactApplicationContext,
|
|
28
|
+
) : StripeUIManager(context) {
|
|
29
29
|
private lateinit var stripe: Stripe
|
|
30
30
|
private lateinit var publishableKey: String
|
|
31
31
|
private var stripeAccountId: String? = null
|
|
32
|
-
private lateinit var promise: Promise
|
|
33
32
|
|
|
34
33
|
// Used when confirming a payment intent
|
|
35
34
|
private var paymentIntentClientSecret: String? = null
|
|
@@ -52,20 +51,17 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
52
51
|
stripe: Stripe,
|
|
53
52
|
publishableKey: String,
|
|
54
53
|
stripeAccountId: String?,
|
|
55
|
-
promise: Promise,
|
|
56
54
|
paymentIntentClientSecret: String? = null,
|
|
57
55
|
confirmPaymentParams: ConfirmPaymentIntentParams? = null,
|
|
58
56
|
setupIntentClientSecret: String? = null,
|
|
59
57
|
confirmSetupParams: ConfirmSetupIntentParams? = null,
|
|
60
58
|
handleNextActionPaymentIntentClientSecret: String? = null,
|
|
61
59
|
handleNextActionSetupIntentClientSecret: String? = null,
|
|
62
|
-
):
|
|
63
|
-
val instance =
|
|
64
|
-
instance.context = context
|
|
60
|
+
): PaymentLauncherManager {
|
|
61
|
+
val instance = PaymentLauncherManager(context)
|
|
65
62
|
instance.stripe = stripe
|
|
66
63
|
instance.publishableKey = publishableKey
|
|
67
64
|
instance.stripeAccountId = stripeAccountId
|
|
68
|
-
instance.promise = promise
|
|
69
65
|
instance.paymentIntentClientSecret = paymentIntentClientSecret
|
|
70
66
|
instance.confirmPaymentParams = confirmPaymentParams
|
|
71
67
|
instance.setupIntentClientSecret = setupIntentClientSecret
|
|
@@ -81,21 +77,18 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
81
77
|
stripe: Stripe,
|
|
82
78
|
publishableKey: String,
|
|
83
79
|
stripeAccountId: String?,
|
|
84
|
-
promise: Promise,
|
|
85
80
|
paymentIntentClientSecret: String,
|
|
86
81
|
confirmPaymentParams: ConfirmPaymentIntentParams,
|
|
87
|
-
):
|
|
82
|
+
): PaymentLauncherManager {
|
|
88
83
|
val paymentLauncherFragment =
|
|
89
84
|
create(
|
|
90
85
|
context,
|
|
91
86
|
stripe,
|
|
92
87
|
publishableKey,
|
|
93
88
|
stripeAccountId,
|
|
94
|
-
promise,
|
|
95
89
|
paymentIntentClientSecret = paymentIntentClientSecret,
|
|
96
90
|
confirmPaymentParams = confirmPaymentParams,
|
|
97
91
|
)
|
|
98
|
-
addFragment(paymentLauncherFragment, context, promise)
|
|
99
92
|
return paymentLauncherFragment
|
|
100
93
|
}
|
|
101
94
|
|
|
@@ -105,21 +98,18 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
105
98
|
stripe: Stripe,
|
|
106
99
|
publishableKey: String,
|
|
107
100
|
stripeAccountId: String?,
|
|
108
|
-
promise: Promise,
|
|
109
101
|
setupIntentClientSecret: String,
|
|
110
102
|
confirmSetupParams: ConfirmSetupIntentParams,
|
|
111
|
-
):
|
|
103
|
+
): PaymentLauncherManager {
|
|
112
104
|
val paymentLauncherFragment =
|
|
113
105
|
create(
|
|
114
106
|
context,
|
|
115
107
|
stripe,
|
|
116
108
|
publishableKey,
|
|
117
109
|
stripeAccountId,
|
|
118
|
-
promise,
|
|
119
110
|
setupIntentClientSecret = setupIntentClientSecret,
|
|
120
111
|
confirmSetupParams = confirmSetupParams,
|
|
121
112
|
)
|
|
122
|
-
addFragment(paymentLauncherFragment, context, promise)
|
|
123
113
|
return paymentLauncherFragment
|
|
124
114
|
}
|
|
125
115
|
|
|
@@ -129,19 +119,16 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
129
119
|
stripe: Stripe,
|
|
130
120
|
publishableKey: String,
|
|
131
121
|
stripeAccountId: String?,
|
|
132
|
-
promise: Promise,
|
|
133
122
|
handleNextActionPaymentIntentClientSecret: String,
|
|
134
|
-
):
|
|
123
|
+
): PaymentLauncherManager {
|
|
135
124
|
val paymentLauncherFragment =
|
|
136
125
|
create(
|
|
137
126
|
context,
|
|
138
127
|
stripe,
|
|
139
128
|
publishableKey,
|
|
140
129
|
stripeAccountId,
|
|
141
|
-
promise,
|
|
142
130
|
handleNextActionPaymentIntentClientSecret = handleNextActionPaymentIntentClientSecret,
|
|
143
131
|
)
|
|
144
|
-
addFragment(paymentLauncherFragment, context, promise)
|
|
145
132
|
return paymentLauncherFragment
|
|
146
133
|
}
|
|
147
134
|
|
|
@@ -151,44 +138,23 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
151
138
|
stripe: Stripe,
|
|
152
139
|
publishableKey: String,
|
|
153
140
|
stripeAccountId: String?,
|
|
154
|
-
promise: Promise,
|
|
155
141
|
handleNextActionSetupIntentClientSecret: String,
|
|
156
|
-
):
|
|
142
|
+
): PaymentLauncherManager {
|
|
157
143
|
val paymentLauncherFragment =
|
|
158
144
|
create(
|
|
159
145
|
context,
|
|
160
146
|
stripe,
|
|
161
147
|
publishableKey,
|
|
162
148
|
stripeAccountId,
|
|
163
|
-
promise,
|
|
164
149
|
handleNextActionSetupIntentClientSecret = handleNextActionSetupIntentClientSecret,
|
|
165
150
|
)
|
|
166
|
-
addFragment(paymentLauncherFragment, context, promise)
|
|
167
151
|
return paymentLauncherFragment
|
|
168
152
|
}
|
|
169
|
-
|
|
170
|
-
private fun addFragment(
|
|
171
|
-
fragment: PaymentLauncherFragment,
|
|
172
|
-
context: ReactApplicationContext,
|
|
173
|
-
promise: Promise,
|
|
174
|
-
) {
|
|
175
|
-
(context.currentActivity as? FragmentActivity)?.let {
|
|
176
|
-
try {
|
|
177
|
-
it.supportFragmentManager
|
|
178
|
-
.beginTransaction()
|
|
179
|
-
.add(fragment, TAG)
|
|
180
|
-
.commit()
|
|
181
|
-
} catch (error: IllegalStateException) {
|
|
182
|
-
promise.resolve(createError(ErrorType.Failed.toString(), error.message))
|
|
183
|
-
}
|
|
184
|
-
} ?: run { promise.resolve(createMissingActivityError()) }
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
internal const val TAG = "payment_launcher_fragment"
|
|
188
153
|
}
|
|
189
154
|
|
|
190
|
-
override fun
|
|
191
|
-
|
|
155
|
+
override fun onPresent() {
|
|
156
|
+
val activity = getCurrentActivityOrResolveWithError(promise) ?: return
|
|
157
|
+
paymentLauncher = createPaymentLauncher(activity)
|
|
192
158
|
if (paymentIntentClientSecret != null && confirmPaymentParams != null) {
|
|
193
159
|
paymentLauncher.confirm(confirmPaymentParams!!)
|
|
194
160
|
} else if (setupIntentClientSecret != null && confirmSetupParams != null) {
|
|
@@ -204,8 +170,9 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
204
170
|
}
|
|
205
171
|
}
|
|
206
172
|
|
|
207
|
-
private fun createPaymentLauncher(): PaymentLauncher =
|
|
208
|
-
|
|
173
|
+
private fun createPaymentLauncher(activity: ComponentActivity): PaymentLauncher =
|
|
174
|
+
@SuppressLint("RestrictedApi")
|
|
175
|
+
PaymentLauncher.create(activity, signal, publishableKey, stripeAccountId) { paymentResult ->
|
|
209
176
|
when (paymentResult) {
|
|
210
177
|
is PaymentResult.Completed -> {
|
|
211
178
|
paymentIntentClientSecret?.let {
|
|
@@ -219,14 +186,12 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
219
186
|
} ?: throw Exception("Failed to create Payment Launcher. No client secret provided.")
|
|
220
187
|
}
|
|
221
188
|
is PaymentResult.Canceled -> {
|
|
222
|
-
promise
|
|
223
|
-
removeFragment(context)
|
|
189
|
+
promise?.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), message = null))
|
|
224
190
|
}
|
|
225
191
|
is PaymentResult.Failed -> {
|
|
226
|
-
promise
|
|
192
|
+
promise?.resolve(
|
|
227
193
|
createError(ConfirmPaymentErrorType.Failed.toString(), paymentResult.throwable),
|
|
228
194
|
)
|
|
229
|
-
removeFragment(context)
|
|
230
195
|
}
|
|
231
196
|
}
|
|
232
197
|
}
|
|
@@ -241,8 +206,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
241
206
|
expand = listOf("payment_method"),
|
|
242
207
|
object : ApiResultCallback<SetupIntent> {
|
|
243
208
|
override fun onError(e: Exception) {
|
|
244
|
-
promise
|
|
245
|
-
removeFragment(context)
|
|
209
|
+
promise?.resolve(createError(ConfirmSetupIntentErrorType.Failed.toString(), e))
|
|
246
210
|
}
|
|
247
211
|
|
|
248
212
|
override fun onSuccess(result: SetupIntent) {
|
|
@@ -252,19 +216,19 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
252
216
|
StripeIntent.Status.RequiresConfirmation,
|
|
253
217
|
StripeIntent.Status.RequiresCapture,
|
|
254
218
|
-> {
|
|
255
|
-
promise
|
|
219
|
+
promise?.resolve(createResult("setupIntent", mapFromSetupIntentResult(result)))
|
|
256
220
|
}
|
|
257
221
|
StripeIntent.Status.RequiresAction -> {
|
|
258
222
|
if (isNextActionSuccessState(result.nextActionType)) {
|
|
259
|
-
promise
|
|
223
|
+
promise?.resolve(createResult("setupIntent", mapFromSetupIntentResult(result)))
|
|
260
224
|
} else {
|
|
261
225
|
(result.lastSetupError)?.let {
|
|
262
|
-
promise
|
|
226
|
+
promise?.resolve(
|
|
263
227
|
createError(ConfirmSetupIntentErrorType.Canceled.toString(), it),
|
|
264
228
|
)
|
|
265
229
|
}
|
|
266
230
|
?: run {
|
|
267
|
-
promise
|
|
231
|
+
promise?.resolve(
|
|
268
232
|
createError(
|
|
269
233
|
ConfirmSetupIntentErrorType.Canceled.toString(),
|
|
270
234
|
"Setup has been canceled",
|
|
@@ -274,7 +238,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
274
238
|
}
|
|
275
239
|
}
|
|
276
240
|
StripeIntent.Status.RequiresPaymentMethod -> {
|
|
277
|
-
promise
|
|
241
|
+
promise?.resolve(
|
|
278
242
|
createError(
|
|
279
243
|
ConfirmSetupIntentErrorType.Failed.toString(),
|
|
280
244
|
result.lastSetupError,
|
|
@@ -282,7 +246,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
282
246
|
)
|
|
283
247
|
}
|
|
284
248
|
StripeIntent.Status.Canceled -> {
|
|
285
|
-
promise
|
|
249
|
+
promise?.resolve(
|
|
286
250
|
createError(
|
|
287
251
|
ConfirmSetupIntentErrorType.Canceled.toString(),
|
|
288
252
|
result.lastSetupError,
|
|
@@ -290,7 +254,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
290
254
|
)
|
|
291
255
|
}
|
|
292
256
|
else -> {
|
|
293
|
-
promise
|
|
257
|
+
promise?.resolve(
|
|
294
258
|
createError(
|
|
295
259
|
ConfirmSetupIntentErrorType.Unknown.toString(),
|
|
296
260
|
"unhandled error: ${result.status}",
|
|
@@ -298,7 +262,6 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
298
262
|
)
|
|
299
263
|
}
|
|
300
264
|
}
|
|
301
|
-
removeFragment(context)
|
|
302
265
|
}
|
|
303
266
|
},
|
|
304
267
|
)
|
|
@@ -314,8 +277,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
314
277
|
expand = listOf("payment_method"),
|
|
315
278
|
object : ApiResultCallback<PaymentIntent> {
|
|
316
279
|
override fun onError(e: Exception) {
|
|
317
|
-
promise
|
|
318
|
-
removeFragment(context)
|
|
280
|
+
promise?.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), e))
|
|
319
281
|
}
|
|
320
282
|
|
|
321
283
|
override fun onSuccess(result: PaymentIntent) {
|
|
@@ -325,17 +287,17 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
325
287
|
StripeIntent.Status.RequiresConfirmation,
|
|
326
288
|
StripeIntent.Status.RequiresCapture,
|
|
327
289
|
-> {
|
|
328
|
-
promise
|
|
290
|
+
promise?.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(result)))
|
|
329
291
|
}
|
|
330
292
|
StripeIntent.Status.RequiresAction -> {
|
|
331
293
|
if (isNextActionSuccessState(result.nextActionType)) {
|
|
332
|
-
promise
|
|
294
|
+
promise?.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(result)))
|
|
333
295
|
} else {
|
|
334
296
|
(result.lastPaymentError)?.let {
|
|
335
|
-
promise
|
|
297
|
+
promise?.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), it))
|
|
336
298
|
}
|
|
337
299
|
?: run {
|
|
338
|
-
promise
|
|
300
|
+
promise?.resolve(
|
|
339
301
|
createError(
|
|
340
302
|
ConfirmPaymentErrorType.Canceled.toString(),
|
|
341
303
|
"The payment has been canceled",
|
|
@@ -345,12 +307,12 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
345
307
|
}
|
|
346
308
|
}
|
|
347
309
|
StripeIntent.Status.RequiresPaymentMethod -> {
|
|
348
|
-
promise
|
|
310
|
+
promise?.resolve(
|
|
349
311
|
createError(ConfirmPaymentErrorType.Failed.toString(), result.lastPaymentError),
|
|
350
312
|
)
|
|
351
313
|
}
|
|
352
314
|
StripeIntent.Status.Canceled -> {
|
|
353
|
-
promise
|
|
315
|
+
promise?.resolve(
|
|
354
316
|
createError(
|
|
355
317
|
ConfirmPaymentErrorType.Canceled.toString(),
|
|
356
318
|
result.lastPaymentError,
|
|
@@ -358,7 +320,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
358
320
|
)
|
|
359
321
|
}
|
|
360
322
|
else -> {
|
|
361
|
-
promise
|
|
323
|
+
promise?.resolve(
|
|
362
324
|
createError(
|
|
363
325
|
ConfirmPaymentErrorType.Unknown.toString(),
|
|
364
326
|
"unhandled error: ${result.status}",
|
|
@@ -366,7 +328,6 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
366
328
|
)
|
|
367
329
|
}
|
|
368
330
|
}
|
|
369
|
-
removeFragment(context)
|
|
370
331
|
}
|
|
371
332
|
},
|
|
372
333
|
)
|
|
@@ -381,6 +342,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
381
342
|
StripeIntent.NextActionType.DisplayOxxoDetails,
|
|
382
343
|
StripeIntent.NextActionType.DisplayBoletoDetails,
|
|
383
344
|
StripeIntent.NextActionType.DisplayKonbiniDetails,
|
|
345
|
+
StripeIntent.NextActionType.DisplayPayNowDetails,
|
|
384
346
|
StripeIntent.NextActionType.VerifyWithMicrodeposits,
|
|
385
347
|
StripeIntent.NextActionType.DisplayMultibancoDetails,
|
|
386
348
|
StripeIntent.NextActionType.DisplayPayNowDetails,
|
|
@@ -394,6 +356,7 @@ class PaymentLauncherFragment : StripeFragment() {
|
|
|
394
356
|
StripeIntent.NextActionType.UpiAwaitNotification,
|
|
395
357
|
StripeIntent.NextActionType.CashAppRedirect,
|
|
396
358
|
StripeIntent.NextActionType.SwishRedirect,
|
|
359
|
+
StripeIntent.NextActionType.DisplayPromptPayDetails,
|
|
397
360
|
null,
|
|
398
361
|
-> false
|
|
399
362
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReadableMap
|
|
4
|
-
import com.reactnativestripesdk.utils.
|
|
5
|
-
import com.reactnativestripesdk.utils.getMapOrNull
|
|
4
|
+
import com.reactnativestripesdk.utils.getBooleanOr
|
|
6
5
|
import com.reactnativestripesdk.utils.getValOr
|
|
7
6
|
import com.reactnativestripesdk.utils.mapToBillingDetails
|
|
8
7
|
import com.reactnativestripesdk.utils.mapToMetadata
|
|
9
8
|
import com.reactnativestripesdk.utils.mapToPaymentIntentFutureUsage
|
|
9
|
+
import com.reactnativestripesdk.utils.mapToShippingDetails
|
|
10
10
|
import com.reactnativestripesdk.utils.mapToUSBankAccountHolderType
|
|
11
11
|
import com.reactnativestripesdk.utils.mapToUSBankAccountType
|
|
12
12
|
import com.stripe.android.model.ConfirmPaymentIntentParams
|
|
@@ -25,11 +25,11 @@ class PaymentMethodCreateParamsFactory(
|
|
|
25
25
|
) {
|
|
26
26
|
private val billingDetailsParams =
|
|
27
27
|
mapToBillingDetails(
|
|
28
|
-
|
|
28
|
+
paymentMethodData?.getMap("billingDetails"),
|
|
29
29
|
cardFieldView?.cardAddress ?: cardFormView?.cardAddress,
|
|
30
30
|
)
|
|
31
31
|
private val metadataParams: Map<String, String>? =
|
|
32
|
-
mapToMetadata(
|
|
32
|
+
mapToMetadata(paymentMethodData?.getMap("metadata"))
|
|
33
33
|
|
|
34
34
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
35
35
|
fun createPaymentMethodParams(paymentMethodType: PaymentMethod.Type): PaymentMethodCreateParams {
|
|
@@ -43,7 +43,6 @@ class PaymentMethodCreateParamsFactory(
|
|
|
43
43
|
PaymentMethod.Type.Billie -> createBillieParams()
|
|
44
44
|
PaymentMethod.Type.SepaDebit -> createSepaParams()
|
|
45
45
|
PaymentMethod.Type.Oxxo -> createOXXOParams()
|
|
46
|
-
PaymentMethod.Type.Giropay -> createGiropayParams()
|
|
47
46
|
PaymentMethod.Type.Eps -> createEPSParams()
|
|
48
47
|
PaymentMethod.Type.GrabPay -> createGrabPayParams()
|
|
49
48
|
PaymentMethod.Type.P24 -> createP24Params()
|
|
@@ -132,15 +131,6 @@ class PaymentMethodCreateParamsFactory(
|
|
|
132
131
|
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
@Throws(PaymentMethodCreateParamsException::class)
|
|
136
|
-
private fun createGiropayParams(): PaymentMethodCreateParams {
|
|
137
|
-
billingDetailsParams?.let {
|
|
138
|
-
return PaymentMethodCreateParams.createGiropay(billingDetails = it, metadata = metadataParams)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
throw PaymentMethodCreateParamsException("You must provide billing details")
|
|
142
|
-
}
|
|
143
|
-
|
|
144
134
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
145
135
|
private fun createEPSParams(): PaymentMethodCreateParams {
|
|
146
136
|
billingDetailsParams?.let {
|
|
@@ -167,7 +157,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
167
157
|
|
|
168
158
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
169
159
|
private fun createFpxParams(): PaymentMethodCreateParams {
|
|
170
|
-
val bank =
|
|
160
|
+
val bank = paymentMethodData.getBooleanOr("testOfflineBank", false).let { "test_offline_bank" }
|
|
171
161
|
return PaymentMethodCreateParams.create(
|
|
172
162
|
PaymentMethodCreateParams.Fpx(bank),
|
|
173
163
|
metadata = metadataParams,
|
|
@@ -189,7 +179,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
189
179
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
190
180
|
private fun createAuBecsDebitParams(): PaymentMethodCreateParams {
|
|
191
181
|
val formDetails =
|
|
192
|
-
|
|
182
|
+
paymentMethodData?.getMap("formDetails")
|
|
193
183
|
?: run { throw PaymentMethodCreateParamsException("You must provide form details") }
|
|
194
184
|
|
|
195
185
|
val bsbNumber = getValOr(formDetails, "bsbNumber") as String
|
|
@@ -266,7 +256,6 @@ class PaymentMethodCreateParamsFactory(
|
|
|
266
256
|
PaymentMethod.Type.Billie,
|
|
267
257
|
PaymentMethod.Type.SepaDebit,
|
|
268
258
|
PaymentMethod.Type.Oxxo,
|
|
269
|
-
PaymentMethod.Type.Giropay,
|
|
270
259
|
PaymentMethod.Type.Eps,
|
|
271
260
|
PaymentMethod.Type.GrabPay,
|
|
272
261
|
PaymentMethod.Type.P24,
|
|
@@ -415,10 +404,12 @@ class PaymentMethodCreateParamsFactory(
|
|
|
415
404
|
}
|
|
416
405
|
|
|
417
406
|
val params = createAffirmParams()
|
|
407
|
+
val shippingDetails = mapToShippingDetails(paymentMethodData?.getMap("shippingDetails"))
|
|
418
408
|
|
|
419
409
|
return ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
|
|
420
410
|
paymentMethodCreateParams = params,
|
|
421
411
|
clientSecret = clientSecret,
|
|
412
|
+
shipping = shippingDetails,
|
|
422
413
|
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
|
|
423
414
|
mandateData = buildMandateDataParams(),
|
|
424
415
|
)
|
|
@@ -455,9 +446,9 @@ class PaymentMethodCreateParamsFactory(
|
|
|
455
446
|
}
|
|
456
447
|
|
|
457
448
|
private fun buildMandateDataParams(): MandateDataParams? {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
449
|
+
paymentMethodData?.getMap("mandateData")?.let { mandateData ->
|
|
450
|
+
mandateData.getMap("customerAcceptance")?.let { customerAcceptance ->
|
|
451
|
+
customerAcceptance.getMap("online")?.let { onlineParams ->
|
|
461
452
|
return MandateDataParams(
|
|
462
453
|
MandateDataParams.Type.Online(
|
|
463
454
|
ipAddress = getValOr(onlineParams, "ipAddress", "") ?: "",
|
|
@@ -11,8 +11,6 @@ import androidx.compose.ui.text.style.TextDecoration
|
|
|
11
11
|
import androidx.compose.ui.unit.TextUnit
|
|
12
12
|
import com.facebook.react.bridge.Arguments
|
|
13
13
|
import com.facebook.react.bridge.WritableMap
|
|
14
|
-
import com.reactnativestripesdk.getBase64FromBitmap
|
|
15
|
-
import com.reactnativestripesdk.getBitmapFromDrawable
|
|
16
14
|
import com.reactnativestripesdk.utils.mapFromPaymentSheetBillingDetails
|
|
17
15
|
import com.stripe.android.paymentelement.EmbeddedPaymentElement
|
|
18
16
|
import kotlinx.coroutines.Dispatchers
|
|
@@ -50,7 +48,7 @@ suspend fun EmbeddedPaymentElement.PaymentOptionDisplayData.toWritableMap(): Wri
|
|
|
50
48
|
getBase64FromBitmap(bitmap)
|
|
51
49
|
} ?: ""
|
|
52
50
|
}
|
|
53
|
-
} catch (
|
|
51
|
+
} catch (_: Exception) {
|
|
54
52
|
// If imageLoader fails or times out, return empty string
|
|
55
53
|
""
|
|
56
54
|
}
|
|
@@ -120,17 +118,17 @@ fun AnnotatedString.toHtmlString(): String {
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
AnnotationType.STRING_ANNOTATION -> {
|
|
123
|
-
val stringAnnotation = annotation.data as AnnotatedString.Range
|
|
121
|
+
val stringAnnotation = annotation.data as AnnotatedString.Range<*>
|
|
124
122
|
when (stringAnnotation.tag) {
|
|
125
123
|
"URL", "LINK_TAG" -> {
|
|
126
124
|
val url = stringAnnotation.item
|
|
127
|
-
htmlBuilder.append("<a href=\"${escapeHtml(url)}\">")
|
|
125
|
+
htmlBuilder.append("<a href=\"${escapeHtml(url as String)}\">")
|
|
128
126
|
openTags.add(TagInfo(annotation.end, "</a>"))
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
AnnotationType.LINK_ANNOTATION -> {
|
|
133
|
-
val linkAnnotation = annotation.data as AnnotatedString.Range
|
|
131
|
+
val linkAnnotation = annotation.data as AnnotatedString.Range<*>
|
|
134
132
|
when (val linkItem = linkAnnotation.item) {
|
|
135
133
|
is LinkAnnotation.Url -> {
|
|
136
134
|
htmlBuilder.append("<a href=\"${escapeHtml(linkItem.url)}\">")
|