@stripe/stripe-react-native 0.65.0 → 0.65.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/README.md +2 -2
- package/android/detekt/detekt-baseline.xml +1 -66
- package/android/gradle.properties +3 -3
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementView.kt +26 -0
- package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementViewManager.kt +42 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +105 -49
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +72 -12
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +8 -4
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +26 -11
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +14 -5
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementViewManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +8 -4
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +9 -3
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +110 -29
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +190 -24
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutAddressUpdate.kt +45 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutMappers.kt +101 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +4 -2
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +29 -13
- package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +2 -1
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +6 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerDelegate.java +35 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerInterface.java +18 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +8 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +60 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +38 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +9 -4
- package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutMappersTest.kt +89 -0
- package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutTestFixtures.java +49 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +6 -8
- package/ios/CurrencySelectorElementManager.m +9 -0
- package/ios/CurrencySelectorElementManager.swift +12 -0
- package/ios/CurrencySelectorElementView.swift +24 -0
- package/ios/Mappers+Checkout.swift +193 -0
- package/ios/NewArch/EmbeddedPaymentElementViewComponentView.mm +16 -2
- package/ios/NewArch/StripeCurrencySelectorElementComponentView.h +10 -0
- package/ios/NewArch/StripeCurrencySelectorElementComponentView.mm +75 -0
- package/ios/StripeSdk.mm +123 -0
- package/ios/StripeSdkImpl+Checkout.swift +308 -0
- package/ios/StripeSdkImpl+Embedded.swift +108 -27
- package/ios/StripeSdkImpl+PaymentSheet.swift +18 -2
- package/ios/StripeSdkImpl.swift +3 -1
- package/jest/mock.js +13 -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/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/CurrencySelectorElement.js +2 -0
- package/lib/commonjs/components/CurrencySelectorElement.js.map +1 -0
- package/lib/commonjs/components/PaymentMethodMessagingElement.js +1 -1
- package/lib/commonjs/components/PaymentMethodMessagingElement.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/connect/Components.js +1 -1
- package/lib/commonjs/connect/Components.js.map +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -1
- package/lib/commonjs/connect/NavigationBar.js +1 -1
- package/lib/commonjs/connect/NavigationBar.js.map +1 -1
- package/lib/commonjs/events.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/hooks/useCheckout.js +1 -1
- package/lib/commonjs/hooks/useCheckout.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +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 +1 -1
- package/lib/commonjs/specs/NativeCurrencySelectorElement.js +2 -0
- package/lib/commonjs/specs/NativeCurrencySelectorElement.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/NativeNavigationBar.js +1 -1
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js +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/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/CurrencySelectorElement.js +2 -0
- package/lib/module/components/CurrencySelectorElement.js.map +1 -0
- package/lib/module/components/PaymentMethodMessagingElement.js +1 -1
- package/lib/module/components/PaymentMethodMessagingElement.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/connect/Components.js +1 -1
- package/lib/module/connect/Components.js.map +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/module/connect/EmbeddedComponent.js +1 -1
- package/lib/module/connect/EmbeddedComponent.js.map +1 -1
- package/lib/module/connect/ModalCloseButton.js +1 -1
- package/lib/module/connect/ModalCloseButton.js.map +1 -1
- package/lib/module/connect/NavigationBar.js +1 -1
- package/lib/module/connect/NavigationBar.js.map +1 -1
- package/lib/module/events.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/hooks/useCheckout.js +1 -1
- package/lib/module/hooks/useCheckout.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +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 +1 -1
- package/lib/module/specs/NativeCurrencySelectorElement.js +2 -0
- package/lib/module/specs/NativeCurrencySelectorElement.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/NativeNavigationBar.js +1 -1
- package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js +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/typescript/src/components/CurrencySelectorElement.d.ts +62 -0
- package/lib/typescript/src/components/CurrencySelectorElement.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +11 -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/hooks/useCheckout.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts +25 -0
- package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +5 -1
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/Checkout.d.ts +2 -2
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +36 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/package.json +14 -3
- package/src/components/CurrencySelectorElement.tsx +95 -0
- package/src/events.ts +11 -0
- package/src/functions.ts +30 -1
- package/src/hooks/useCheckout.tsx +114 -75
- package/src/specs/NativeCurrencySelectorElement.ts +35 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +12 -2
- package/src/specs/NativeStripeSdkModule.ts +8 -1
- package/src/types/Checkout.ts +2 -2
- package/src/types/EmbeddedPaymentElement.tsx +117 -26
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -835
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -17
- 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/README.md
CHANGED
|
@@ -75,8 +75,8 @@ to your `app.json` file, where `merchantIdentifier` is the Apple merchant ID obt
|
|
|
75
75
|
|
|
76
76
|
#### Android
|
|
77
77
|
|
|
78
|
-
- Android
|
|
79
|
-
- Your `compileSdkVersion` must be `
|
|
78
|
+
- Android 6.0 (API level 23) and above
|
|
79
|
+
- Your `compileSdkVersion` must be `36` or higher.
|
|
80
80
|
- Android gradle plugin 4.x and above
|
|
81
81
|
- Kotlin 2.x and above. See [this issue](https://github.com/stripe/stripe-react-native/issues/1924#issuecomment-2867227374) for how to update the Kotlin version when using react-native 0.77 and below or Expo SDK 52.
|
|
82
82
|
|
|
@@ -46,71 +46,6 @@
|
|
|
46
46
|
<ID>LongMethod:PaymentSheetAppearanceTest.kt:PaymentSheetAppearanceTest$@Test fun testPartialAppearanceConfiguration</ID>
|
|
47
47
|
<ID>LongMethod:PaymentSheetManager.kt:PaymentSheetManager$fun configure</ID>
|
|
48
48
|
<ID>LongMethod:StripeSdkModule.kt:StripeSdkModule$@ReactMethod override fun confirmPlatformPay</ID>
|
|
49
|
-
<ID>MagicNumber:CardFieldView.kt:CardFieldView$20</ID>
|
|
50
|
-
<ID>MagicNumber:EmbeddedPaymentElementView.kt:EmbeddedPaymentElementView$100</ID>
|
|
51
|
-
<ID>MagicNumber:FinancialConnectionsSheetManager.kt:FinancialConnectionsSheetManager.Companion$1000.0</ID>
|
|
52
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$1000</ID>
|
|
53
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$1001</ID>
|
|
54
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$11</ID>
|
|
55
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$4</ID>
|
|
56
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$5</ID>
|
|
57
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$6</ID>
|
|
58
|
-
<ID>MagicNumber:GooglePayButtonView.kt:GooglePayButtonView$7</ID>
|
|
59
|
-
<ID>MagicNumber:Mappers.kt:1000</ID>
|
|
60
|
-
<ID>MagicNumber:Mappers.kt:3</ID>
|
|
61
|
-
<ID>MagicNumber:Mappers.kt:4</ID>
|
|
62
|
-
<ID>MagicNumber:Mappers.kt:5</ID>
|
|
63
|
-
<ID>MagicNumber:Mappers.kt:6</ID>
|
|
64
|
-
<ID>MagicNumber:Mappers.kt:7</ID>
|
|
65
|
-
<ID>MagicNumber:Mappers.kt:8</ID>
|
|
66
|
-
<ID>MagicNumber:NavigationBarView.kt:NavigationBarView$16</ID>
|
|
67
|
-
<ID>MagicNumber:NavigationBarView.kt:NavigationBarView$17f</ID>
|
|
68
|
-
<ID>MagicNumber:NavigationBarView.kt:NavigationBarView$4f</ID>
|
|
69
|
-
<ID>MagicNumber:NavigationBarView.kt:NavigationBarView$56</ID>
|
|
70
|
-
<ID>MagicNumber:PaymentMethodMessagingElementConfig.kt:16.0</ID>
|
|
71
|
-
<ID>MagicNumber:PaymentMethodMessagingElementConfig.kt:6</ID>
|
|
72
|
-
<ID>MagicNumber:PaymentMethodMessagingElementConfig.kt:8</ID>
|
|
73
|
-
<ID>MagicNumber:PaymentOptionDisplayDataMapper.kt:0xFFFFFF</ID>
|
|
74
|
-
<ID>MagicNumber:PaymentOptionDisplayDataMapper.kt:16f</ID>
|
|
75
|
-
<ID>MagicNumber:PaymentOptionDisplayDataMapper.kt:5_000L</ID>
|
|
76
|
-
<ID>MagicNumber:PaymentSheetAppearance.kt:6</ID>
|
|
77
|
-
<ID>MagicNumber:PaymentSheetAppearance.kt:8</ID>
|
|
78
|
-
<ID>MagicNumber:PaymentSheetManager.kt:100</ID>
|
|
79
|
-
<ID>MagicNumber:PaymentSheetManager.kt:PaymentSheetManager$100</ID>
|
|
80
|
-
<ID>MagicNumber:StripeSdkModule.kt:StripeSdkModule$3000</ID>
|
|
81
|
-
<ID>MaxLineLength:AddToWalletButtonManager.kt:AddToWalletButtonManager$override fun createViewInstance: AddToWalletButtonView</ID>
|
|
82
|
-
<ID>MaxLineLength:AddressLauncherManager.kt:AddressLauncherManager$"No publishable key set. Stripe has not been initialized. Initialize Stripe in your app with the StripeProvider component or the initStripe method."</ID>
|
|
83
|
-
<ID>MaxLineLength:AddressSheetView.kt:AddressSheetView.Companion$internal</ID>
|
|
84
|
-
<ID>MaxLineLength:AuBECSDebitFormView.kt:AuBECSDebitFormView$UIManagerHelper.getEventDispatcherForReactTag(context, id)?.dispatchEvent(FormCompleteEvent(context.surfaceId, id, formDetails))</ID>
|
|
85
|
-
<ID>MaxLineLength:AuBECSDebitFormViewManager.kt:AuBECSDebitFormViewManager$override fun createViewInstance: AuBECSDebitFormView</ID>
|
|
86
|
-
<ID>MaxLineLength:CustomerSheetManager.kt:CustomerSheetManager.Companion$internal</ID>
|
|
87
|
-
<ID>MaxLineLength:EmbeddedPaymentElementView.kt:EmbeddedPaymentElementView$"Tried to call confirmHandler, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues"</ID>
|
|
88
|
-
<ID>MaxLineLength:EmbeddedPaymentElementView.kt:EmbeddedPaymentElementView$"Tried to call confirmationTokenConfirmHandler, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues"</ID>
|
|
89
|
-
<ID>MaxLineLength:Errors.kt:"Stripe has not been initialized. Initialize Stripe in your app with the StripeProvider component or the initStripe method."</ID>
|
|
90
|
-
<ID>MaxLineLength:Errors.kt:internal fun createCanceledError: WritableMap</ID>
|
|
91
|
-
<ID>MaxLineLength:Extensions.kt:)</ID>
|
|
92
|
-
<ID>MaxLineLength:FinancialConnectionsSheetManager.kt:FinancialConnectionsSheetManager.Companion$private</ID>
|
|
93
|
-
<ID>MaxLineLength:GooglePayButtonManager.kt:GooglePayButtonManager$override fun createViewInstance: GooglePayButtonView</ID>
|
|
94
|
-
<ID>MaxLineLength:GooglePayLauncherManager.kt:GooglePayLauncherManager$"Google Pay is not available on this device. You can use isPlatformPaySupported to preemptively check for Google Pay support."</ID>
|
|
95
|
-
<ID>MaxLineLength:Mappers.kt:internal</ID>
|
|
96
|
-
<ID>MaxLineLength:Mappers.kt:val disableBillingDetailCollection = customPaymentMethodMap.getBooleanOr("disableBillingDetailCollection", false)</ID>
|
|
97
|
-
<ID>MaxLineLength:NavigationBarView.kt:NavigationBarView$drawable?.setColorFilter(android.graphics.BlendModeColorFilter(Color.BLACK, android.graphics.BlendMode.SRC_IN))</ID>
|
|
98
|
-
<ID>MaxLineLength:PaymentElementConfig.kt:internal</ID>
|
|
99
|
-
<ID>MaxLineLength:PaymentLauncherManager.kt:PaymentLauncherManager$"Invalid parameters provided to PaymentLauncher. Ensure that you are providing the correct client secret and setup params (if necessary)."</ID>
|
|
100
|
-
<ID>MaxLineLength:PaymentMethodCreateParamsFactory.kt:PaymentMethodCreateParamsFactory$private</ID>
|
|
101
|
-
<ID>MaxLineLength:PaymentMethodMessagingElementViewManager.kt:PaymentMethodMessagingElementViewManager$override fun createViewInstance: PaymentMethodMessagingElementView</ID>
|
|
102
|
-
<ID>MaxLineLength:PaymentOptionDisplayDataMapperTest.kt:PaymentOptionDisplayDataMapperTest$"By continuing, you agree to <b><font color=\"#0000FF\"><u><a href=\"https://stripe.com/terms\">Terms</a></u></font></b> and <i><font color=\"#FF0000\"><a href=\"https://stripe.com/privacy\">Privacy</a></font></i>. Important details are <span style=\"background-color: #FFFF00;\">highlighted</span>."</ID>
|
|
103
|
-
<ID>MaxLineLength:PaymentOptionDisplayDataMapperTest.kt:PaymentOptionDisplayDataMapperTest$"By continuing, you agree to our <a href=\"https://stripe.com/privacy\">Privacy Policy</a> and <a href=\"https://stripe.com/terms\">Terms of Service</a>."</ID>
|
|
104
|
-
<ID>MaxLineLength:PaymentOptionDisplayDataMapperTest.kt:PaymentOptionDisplayDataMapperTest$"Check <b><a href=\"https://stripe.com\">Stripe</a></b> and <i><font color=\"#00FF00\"><a href=\"https://github.com\">GitHub</a></font></i>"</ID>
|
|
105
|
-
<ID>MaxLineLength:PaymentOptionDisplayDataMapperTest.kt:PaymentOptionDisplayDataMapperTest$"Visit our <b><font color=\"#0000FF\"><a href=\"https://stripe.com/privacy\">Privacy Policy</a></font></b> for details"</ID>
|
|
106
|
-
<ID>MaxLineLength:PaymentSheetAppearance.kt:"$fontErrorPrefix appearance.font.$key should only contain lowercase alphanumeric characters on Android, but received '$fontFileName'. This value must match the filename in android/app/src/main/res/font"</ID>
|
|
107
|
-
<ID>MaxLineLength:PaymentSheetAppearance.kt:System.err.println("WARN: Unsupported embedded payment element row style received: $styleString. Falling back to default.")</ID>
|
|
108
|
-
<ID>MaxLineLength:PaymentSheetManager.kt:internal</ID>
|
|
109
|
-
<ID>MaxLineLength:PostalCodeUtilities.kt:PostalCodeUtilities.Companion$internal fun isValidGlobalPostalCodeCharacter: Boolean</ID>
|
|
110
|
-
<ID>MaxLineLength:ReactNativeCustomerAdapter.kt:ReactNativeCustomerAdapter$override suspend</ID>
|
|
111
|
-
<ID>MaxLineLength:ReactNativeCustomerSessionProvider.kt:ReactNativeCustomerSessionProvider$override suspend fun intentConfiguration: Result<CustomerSheet.IntentConfiguration></ID>
|
|
112
|
-
<ID>MaxLineLength:StripeSdkModule.kt:StripeSdkModule$composeCompatView</ID>
|
|
113
|
-
<ID>MaxLineLength:StripeSdkModule.kt:StripeSdkModule$reactApplicationContext.currentActivity?.application?.unregisterActivityLifecycleCallbacks(activityLifecycleCallbacks)</ID>
|
|
114
49
|
<ID>RethrowCaughtException:PaymentMethodCreateParamsFactory.kt:PaymentMethodCreateParamsFactory$throw error</ID>
|
|
115
50
|
<ID>SwallowedException:StripeSdkModule.kt:StripeSdkModule$e: Exception</ID>
|
|
116
51
|
<ID>ThrowsCount:PaymentSheetAppearance.kt:@Throws(PaymentSheetAppearanceException::class) internal fun getFontResId: Int?</ID>
|
|
@@ -125,7 +60,7 @@
|
|
|
125
60
|
<ID>TooGenericExceptionCaught:StripeSdkModule.kt:StripeSdkModule$e: Exception</ID>
|
|
126
61
|
<ID>TooGenericExceptionCaught:TapAndPayProxy.kt:TapAndPayProxy$e: Exception</ID>
|
|
127
62
|
<ID>TooGenericExceptionThrown:EmbeddedPaymentElementViewManager.kt:EmbeddedPaymentElementViewManager$throw Error()</ID>
|
|
128
|
-
<ID>TooGenericExceptionThrown:PaymentLauncherManager.kt:PaymentLauncherManager$throw Exception( "Invalid parameters provided to PaymentLauncher. Ensure that you are providing the correct client secret and setup params (if necessary).", )</ID>
|
|
63
|
+
<ID>TooGenericExceptionThrown:PaymentLauncherManager.kt:PaymentLauncherManager$throw Exception( "Invalid parameters provided to PaymentLauncher. Ensure that you are providing the correct client " + "secret and setup params (if necessary).", )</ID>
|
|
129
64
|
<ID>TooGenericExceptionThrown:PaymentLauncherManager.kt:PaymentLauncherManager$throw Exception("Failed to create Payment Launcher. No client secret provided.")</ID>
|
|
130
65
|
<ID>TooGenericExceptionThrown:PaymentMethodCreateParamsFactory.kt:PaymentMethodCreateParamsFactory$throw Exception("This paymentMethodType is not supported yet")</ID>
|
|
131
66
|
<ID>TooManyFunctions:AddToWalletButtonManager.kt:AddToWalletButtonManager : SimpleViewManagerAddToWalletButtonManagerInterface</ID>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
StripeSdk_kotlinVersion=2.2.21
|
|
2
|
-
StripeSdk_compileSdkVersion=
|
|
3
|
-
StripeSdk_targetSdkVersion=
|
|
4
|
-
StripeSdk_minSdkVersion=
|
|
2
|
+
StripeSdk_compileSdkVersion=36
|
|
3
|
+
StripeSdk_targetSdkVersion=36
|
|
4
|
+
StripeSdk_minSdkVersion=23
|
|
5
5
|
# Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
|
|
6
6
|
StripeSdk_stripeVersion=23.6.+
|
|
@@ -109,7 +109,9 @@ class AuBECSDebitFormView(
|
|
|
109
109
|
"email" to billingDetails["email"] as String,
|
|
110
110
|
)
|
|
111
111
|
|
|
112
|
-
UIManagerHelper.getEventDispatcherForReactTag(context, id)?.dispatchEvent(
|
|
112
|
+
UIManagerHelper.getEventDispatcherForReactTag(context, id)?.dispatchEvent(
|
|
113
|
+
FormCompleteEvent(context.surfaceId, id, formDetails)
|
|
114
|
+
)
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
private fun setListeners() {
|
|
@@ -41,7 +41,8 @@ class AuBECSDebitFormViewManager :
|
|
|
41
41
|
view.setFormStyle(style.asMapOrNull())
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
override fun createViewInstance(reactContext: ThemedReactContext): AuBECSDebitFormView =
|
|
44
|
+
override fun createViewInstance(reactContext: ThemedReactContext): AuBECSDebitFormView =
|
|
45
|
+
AuBECSDebitFormView(reactContext)
|
|
45
46
|
|
|
46
47
|
companion object {
|
|
47
48
|
const val REACT_CLASS = "AuBECSDebitForm"
|
|
@@ -169,7 +169,7 @@ class CardFieldView(
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
mCardWidget.setPadding(
|
|
172
|
+
mCardWidget.setPadding(CARD_WIDGET_HORIZONTAL_PADDING, 0, CARD_WIDGET_HORIZONTAL_PADDING, 0)
|
|
173
173
|
mCardWidget.background =
|
|
174
174
|
MaterialShapeDrawable(
|
|
175
175
|
ShapeAppearanceModel()
|
|
@@ -530,4 +530,8 @@ class CardFieldView(
|
|
|
530
530
|
)
|
|
531
531
|
layout(left, top, right, bottom)
|
|
532
532
|
}
|
|
533
|
+
|
|
534
|
+
private companion object {
|
|
535
|
+
const val CARD_WIDGET_HORIZONTAL_PADDING = 20
|
|
536
|
+
}
|
|
533
537
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.reactnativestripesdk
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.widget.FrameLayout
|
|
5
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Minimal stub so the JS-side `CurrencySelectorElement` codegen mapping
|
|
9
|
+
* resolves at app launch. The full Compose-based implementation that hosts
|
|
10
|
+
* `Checkout.CurrencySelectorContent()` lives on the feature branch and will
|
|
11
|
+
* replace this once that lands.
|
|
12
|
+
*/
|
|
13
|
+
@SuppressLint("ViewConstructor")
|
|
14
|
+
class CurrencySelectorElementView(
|
|
15
|
+
context: ThemedReactContext,
|
|
16
|
+
) : FrameLayout(context) {
|
|
17
|
+
@Suppress("UnusedParameter")
|
|
18
|
+
fun setSessionKey(value: String?) {
|
|
19
|
+
// no-op stub
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Suppress("UnusedParameter")
|
|
23
|
+
fun setDisabled(value: Boolean) {
|
|
24
|
+
// no-op stub
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package com.reactnativestripesdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.uimanager.ViewGroupManager
|
|
6
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
|
+
import com.facebook.react.viewmanagers.StripeCurrencySelectorElementManagerDelegate
|
|
8
|
+
import com.facebook.react.viewmanagers.StripeCurrencySelectorElementManagerInterface
|
|
9
|
+
|
|
10
|
+
@ReactModule(name = CurrencySelectorElementViewManager.NAME)
|
|
11
|
+
class CurrencySelectorElementViewManager :
|
|
12
|
+
ViewGroupManager<CurrencySelectorElementView>(),
|
|
13
|
+
StripeCurrencySelectorElementManagerInterface<CurrencySelectorElementView> {
|
|
14
|
+
companion object {
|
|
15
|
+
const val NAME = "StripeCurrencySelectorElement"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private val delegate = StripeCurrencySelectorElementManagerDelegate(this)
|
|
19
|
+
|
|
20
|
+
override fun getName() = NAME
|
|
21
|
+
|
|
22
|
+
override fun getDelegate() = delegate
|
|
23
|
+
|
|
24
|
+
override fun createViewInstance(ctx: ThemedReactContext): CurrencySelectorElementView =
|
|
25
|
+
CurrencySelectorElementView(ctx)
|
|
26
|
+
|
|
27
|
+
@ReactProp(name = "sessionKey")
|
|
28
|
+
override fun setSessionKey(
|
|
29
|
+
view: CurrencySelectorElementView,
|
|
30
|
+
value: String?,
|
|
31
|
+
) {
|
|
32
|
+
view.setSessionKey(value)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactProp(name = "disabled")
|
|
36
|
+
override fun setDisabled(
|
|
37
|
+
view: CurrencySelectorElementView,
|
|
38
|
+
value: Boolean,
|
|
39
|
+
) {
|
|
40
|
+
view.setDisabled(value)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -25,7 +25,9 @@ import com.reactnativestripesdk.utils.KeepJsAwakeTask
|
|
|
25
25
|
import com.reactnativestripesdk.utils.mapFromConfirmationToken
|
|
26
26
|
import com.reactnativestripesdk.utils.mapFromCustomPaymentMethod
|
|
27
27
|
import com.reactnativestripesdk.utils.mapFromPaymentMethod
|
|
28
|
+
import com.stripe.android.checkout.Checkout
|
|
28
29
|
import com.stripe.android.model.PaymentMethod
|
|
30
|
+
import com.stripe.android.paymentelement.CheckoutSessionPreview
|
|
29
31
|
import com.stripe.android.paymentelement.CustomPaymentMethodResult
|
|
30
32
|
import com.stripe.android.paymentelement.CustomPaymentMethodResultHandler
|
|
31
33
|
import com.stripe.android.paymentelement.EmbeddedPaymentElement
|
|
@@ -43,6 +45,7 @@ enum class RowSelectionBehaviorType {
|
|
|
43
45
|
ImmediateAction,
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
@OptIn(CheckoutSessionPreview::class)
|
|
46
49
|
class EmbeddedPaymentElementView(
|
|
47
50
|
context: Context,
|
|
48
51
|
) : StripeAbstractComposeView(context) {
|
|
@@ -52,10 +55,19 @@ class EmbeddedPaymentElementView(
|
|
|
52
55
|
val intentConfiguration: PaymentSheet.IntentConfiguration,
|
|
53
56
|
) : Event
|
|
54
57
|
|
|
58
|
+
data class ConfigureWithCheckout(
|
|
59
|
+
val configuration: EmbeddedPaymentElement.Configuration,
|
|
60
|
+
val checkout: Checkout,
|
|
61
|
+
) : Event
|
|
62
|
+
|
|
55
63
|
data class Update(
|
|
56
64
|
val intentConfiguration: PaymentSheet.IntentConfiguration,
|
|
57
65
|
) : Event
|
|
58
66
|
|
|
67
|
+
data class UpdateWithCheckout(
|
|
68
|
+
val checkout: Checkout,
|
|
69
|
+
) : Event
|
|
70
|
+
|
|
59
71
|
data object Confirm : Event
|
|
60
72
|
|
|
61
73
|
data object ClearPaymentOption : Event
|
|
@@ -63,6 +75,7 @@ class EmbeddedPaymentElementView(
|
|
|
63
75
|
|
|
64
76
|
var latestIntentConfig: PaymentSheet.IntentConfiguration? = null
|
|
65
77
|
var latestElementConfig: EmbeddedPaymentElement.Configuration? = null
|
|
78
|
+
var latestCheckout: Checkout? = null
|
|
66
79
|
|
|
67
80
|
val rowSelectionBehaviorType = mutableStateOf<RowSelectionBehaviorType?>(null)
|
|
68
81
|
val useConfirmationTokenCallback = mutableStateOf(false)
|
|
@@ -115,7 +128,7 @@ class EmbeddedPaymentElementView(
|
|
|
115
128
|
coroutineScope.launch {
|
|
116
129
|
try {
|
|
117
130
|
// Give the CustomPaymentMethodActivity a moment to fully initialize
|
|
118
|
-
delay(
|
|
131
|
+
delay(CUSTOM_PAYMENT_METHOD_INIT_DELAY_MS)
|
|
119
132
|
|
|
120
133
|
// Emit event so JS can show the Alert and eventually respond via `customPaymentMethodResultCallback`.
|
|
121
134
|
stripeSdkModule.eventEmitter.emitOnCustomPaymentMethodConfirmHandlerCallback(
|
|
@@ -199,7 +212,9 @@ class EmbeddedPaymentElementView(
|
|
|
199
212
|
return@Builder CreateIntentResult.Failure(
|
|
200
213
|
cause =
|
|
201
214
|
Exception(
|
|
202
|
-
"Tried to call confirmationTokenConfirmHandler, but no callback was
|
|
215
|
+
"Tried to call confirmationTokenConfirmHandler, but no callback was " +
|
|
216
|
+
"found. Please file an issue: " +
|
|
217
|
+
"https://github.com/stripe/stripe-react-native/issues",
|
|
203
218
|
),
|
|
204
219
|
displayMessage = "An unexpected error occurred",
|
|
205
220
|
)
|
|
@@ -245,7 +260,8 @@ class EmbeddedPaymentElementView(
|
|
|
245
260
|
return@Builder CreateIntentResult.Failure(
|
|
246
261
|
cause =
|
|
247
262
|
Exception(
|
|
248
|
-
"Tried to call confirmHandler, but no callback was found. Please
|
|
263
|
+
"Tried to call confirmHandler, but no callback was found. Please " +
|
|
264
|
+
"file an issue: https://github.com/stripe/stripe-react-native/issues",
|
|
249
265
|
),
|
|
250
266
|
displayMessage = "An unexpected error occurred",
|
|
251
267
|
)
|
|
@@ -300,40 +316,25 @@ class EmbeddedPaymentElementView(
|
|
|
300
316
|
events.consumeAsFlow().collect { ev ->
|
|
301
317
|
when (ev) {
|
|
302
318
|
is Event.Configure -> {
|
|
303
|
-
|
|
304
|
-
val result =
|
|
319
|
+
handleConfigureResult(
|
|
305
320
|
embedded.configure(
|
|
306
321
|
intentConfiguration = ev.intentConfiguration,
|
|
307
322
|
configuration = ev.configuration,
|
|
308
|
-
)
|
|
323
|
+
),
|
|
324
|
+
)
|
|
325
|
+
}
|
|
309
326
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
val payload =
|
|
318
|
-
Arguments.createMap().apply {
|
|
319
|
-
putString("message", msg)
|
|
320
|
-
}
|
|
321
|
-
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementLoadingFailed(payload)
|
|
322
|
-
}
|
|
323
|
-
}
|
|
327
|
+
is Event.ConfigureWithCheckout -> {
|
|
328
|
+
handleConfigureResult(
|
|
329
|
+
embedded.configure(
|
|
330
|
+
checkout = ev.checkout,
|
|
331
|
+
configuration = ev.configuration,
|
|
332
|
+
),
|
|
333
|
+
)
|
|
324
334
|
}
|
|
325
335
|
|
|
326
336
|
is Event.Update -> {
|
|
327
|
-
val elemConfig = latestElementConfig
|
|
328
|
-
if (elemConfig == null) {
|
|
329
|
-
val payload =
|
|
330
|
-
Arguments.createMap().apply {
|
|
331
|
-
putString("message", "Cannot update: no element configuration exists")
|
|
332
|
-
}
|
|
333
|
-
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementLoadingFailed(payload)
|
|
334
|
-
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementUpdateComplete(null)
|
|
335
|
-
return@collect
|
|
336
|
-
}
|
|
337
|
+
val elemConfig = latestElementConfig ?: return@collect emitUpdateMissingConfiguration()
|
|
337
338
|
|
|
338
339
|
val result =
|
|
339
340
|
embedded.configure(
|
|
@@ -341,29 +342,25 @@ class EmbeddedPaymentElementView(
|
|
|
341
342
|
configuration = elemConfig,
|
|
342
343
|
)
|
|
343
344
|
|
|
344
|
-
|
|
345
|
-
is EmbeddedPaymentElement.ConfigureResult.Succeeded -> {
|
|
346
|
-
val payload =
|
|
347
|
-
Arguments.createMap().apply {
|
|
348
|
-
putString("status", "succeeded")
|
|
349
|
-
}
|
|
350
|
-
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementUpdateComplete(payload)
|
|
351
|
-
}
|
|
352
|
-
is EmbeddedPaymentElement.ConfigureResult.Failed -> {
|
|
353
|
-
val err = result.error
|
|
354
|
-
val msg = err.localizedMessage ?: err.toString()
|
|
355
|
-
val failPayload =
|
|
356
|
-
Arguments.createMap().apply {
|
|
357
|
-
putString("message", msg)
|
|
358
|
-
}
|
|
359
|
-
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementLoadingFailed(failPayload)
|
|
360
|
-
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementUpdateComplete(null)
|
|
361
|
-
}
|
|
362
|
-
}
|
|
345
|
+
handleUpdateResult(result)
|
|
363
346
|
|
|
364
347
|
latestIntentConfig = ev.intentConfiguration
|
|
365
348
|
}
|
|
366
349
|
|
|
350
|
+
is Event.UpdateWithCheckout -> {
|
|
351
|
+
val elemConfig = latestElementConfig ?: return@collect emitUpdateMissingConfiguration()
|
|
352
|
+
|
|
353
|
+
val result =
|
|
354
|
+
embedded.configure(
|
|
355
|
+
checkout = ev.checkout,
|
|
356
|
+
configuration = elemConfig,
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
handleUpdateResult(result)
|
|
360
|
+
|
|
361
|
+
latestCheckout = ev.checkout
|
|
362
|
+
}
|
|
363
|
+
|
|
367
364
|
is Event.Confirm -> {
|
|
368
365
|
embedded.confirm()
|
|
369
366
|
}
|
|
@@ -446,6 +443,50 @@ class EmbeddedPaymentElementView(
|
|
|
446
443
|
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementDidUpdateHeight(params)
|
|
447
444
|
}
|
|
448
445
|
|
|
446
|
+
private fun handleConfigureResult(result: EmbeddedPaymentElement.ConfigureResult) {
|
|
447
|
+
when (result) {
|
|
448
|
+
is EmbeddedPaymentElement.ConfigureResult.Succeeded -> reportHeightChange(1f)
|
|
449
|
+
is EmbeddedPaymentElement.ConfigureResult.Failed -> {
|
|
450
|
+
val err = result.error
|
|
451
|
+
val msg = err.localizedMessage ?: err.toString()
|
|
452
|
+
val payload =
|
|
453
|
+
Arguments.createMap().apply {
|
|
454
|
+
putString("message", msg)
|
|
455
|
+
}
|
|
456
|
+
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementLoadingFailed(payload)
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
private fun handleUpdateResult(result: EmbeddedPaymentElement.ConfigureResult) {
|
|
462
|
+
when (result) {
|
|
463
|
+
is EmbeddedPaymentElement.ConfigureResult.Succeeded -> {
|
|
464
|
+
val payload =
|
|
465
|
+
Arguments.createMap().apply {
|
|
466
|
+
putString("status", "succeeded")
|
|
467
|
+
}
|
|
468
|
+
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementUpdateComplete(payload)
|
|
469
|
+
}
|
|
470
|
+
is EmbeddedPaymentElement.ConfigureResult.Failed -> {
|
|
471
|
+
emitUpdateFailed(result.error)
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
private fun emitUpdateMissingConfiguration() {
|
|
477
|
+
emitUpdateFailed(IllegalStateException("Cannot update: no element configuration exists"))
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
private fun emitUpdateFailed(error: Throwable) {
|
|
481
|
+
val msg = error.localizedMessage ?: error.toString()
|
|
482
|
+
val payload =
|
|
483
|
+
Arguments.createMap().apply {
|
|
484
|
+
putString("message", msg)
|
|
485
|
+
}
|
|
486
|
+
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementLoadingFailed(payload)
|
|
487
|
+
requireStripeSdkModule().eventEmitter.emitEmbeddedPaymentElementUpdateComplete(null)
|
|
488
|
+
}
|
|
489
|
+
|
|
449
490
|
// APIs
|
|
450
491
|
fun configure(
|
|
451
492
|
config: EmbeddedPaymentElement.Configuration,
|
|
@@ -454,10 +495,21 @@ class EmbeddedPaymentElementView(
|
|
|
454
495
|
events.trySend(Event.Configure(config, intentConfig))
|
|
455
496
|
}
|
|
456
497
|
|
|
498
|
+
fun configureWithCheckout(
|
|
499
|
+
config: EmbeddedPaymentElement.Configuration,
|
|
500
|
+
checkout: Checkout,
|
|
501
|
+
) {
|
|
502
|
+
events.trySend(Event.ConfigureWithCheckout(config, checkout))
|
|
503
|
+
}
|
|
504
|
+
|
|
457
505
|
fun update(intentConfig: PaymentSheet.IntentConfiguration) {
|
|
458
506
|
events.trySend(Event.Update(intentConfig))
|
|
459
507
|
}
|
|
460
508
|
|
|
509
|
+
fun updateWithCheckout(checkout: Checkout) {
|
|
510
|
+
events.trySend(Event.UpdateWithCheckout(checkout))
|
|
511
|
+
}
|
|
512
|
+
|
|
461
513
|
fun confirm() {
|
|
462
514
|
events.trySend(Event.Confirm)
|
|
463
515
|
}
|
|
@@ -467,4 +519,8 @@ class EmbeddedPaymentElementView(
|
|
|
467
519
|
}
|
|
468
520
|
|
|
469
521
|
private fun requireStripeSdkModule() = requireNotNull(reactContext.getNativeModule(StripeSdkModule::class.java))
|
|
522
|
+
|
|
523
|
+
private companion object {
|
|
524
|
+
const val CUSTOM_PAYMENT_METHOD_INIT_DELAY_MS = 100L
|
|
525
|
+
}
|
|
470
526
|
}
|
|
@@ -23,6 +23,7 @@ import com.reactnativestripesdk.utils.getStringList
|
|
|
23
23
|
import com.reactnativestripesdk.utils.mapToPreferredNetworks
|
|
24
24
|
import com.reactnativestripesdk.utils.parseCustomPaymentMethods
|
|
25
25
|
import com.stripe.android.ExperimentalAllowsRemovalOfLastSavedPaymentMethodApi
|
|
26
|
+
import com.stripe.android.paymentelement.CheckoutSessionPreview
|
|
26
27
|
import com.stripe.android.paymentelement.EmbeddedPaymentElement
|
|
27
28
|
import com.stripe.android.paymentsheet.CardFundingFilteringPrivatePreview
|
|
28
29
|
import com.stripe.android.paymentsheet.PaymentSheet
|
|
@@ -30,6 +31,8 @@ import org.json.JSONArray
|
|
|
30
31
|
import org.json.JSONObject
|
|
31
32
|
|
|
32
33
|
@ReactModule(name = EmbeddedPaymentElementViewManager.NAME)
|
|
34
|
+
@OptIn(CheckoutSessionPreview::class)
|
|
35
|
+
@Suppress("TooManyFunctions")
|
|
33
36
|
class EmbeddedPaymentElementViewManager :
|
|
34
37
|
ViewGroupManager<EmbeddedPaymentElementView>(),
|
|
35
38
|
EmbeddedPaymentElementViewManagerInterface<EmbeddedPaymentElementView> {
|
|
@@ -66,9 +69,7 @@ class EmbeddedPaymentElementViewManager :
|
|
|
66
69
|
|
|
67
70
|
val elementConfig = parseElementConfiguration(readableMap, view.context)
|
|
68
71
|
view.latestElementConfig = elementConfig
|
|
69
|
-
|
|
70
|
-
view.latestIntentConfig?.let { intentCfg ->
|
|
71
|
-
view.configure(elementConfig, intentCfg)
|
|
72
|
+
if (configureIfReady(view, elementConfig)) {
|
|
72
73
|
view.post {
|
|
73
74
|
view.requestLayout()
|
|
74
75
|
view.invalidate()
|
|
@@ -81,18 +82,55 @@ class EmbeddedPaymentElementViewManager :
|
|
|
81
82
|
view: EmbeddedPaymentElementView,
|
|
82
83
|
cfg: Dynamic,
|
|
83
84
|
) {
|
|
84
|
-
val readableMap = cfg.asMapOrNull()
|
|
85
|
-
|
|
85
|
+
val readableMap = cfg.asMapOrNull() ?: return
|
|
86
|
+
|
|
87
|
+
view.setUseConfirmationTokenCallback(readableMap.hasKey("confirmationTokenConfirmHandler"))
|
|
88
|
+
|
|
89
|
+
view.latestIntentConfig = parseIntentConfiguration(readableMap)
|
|
90
|
+
view.latestElementConfig?.let { configureIfReady(view, it) }
|
|
91
|
+
}
|
|
86
92
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
view
|
|
93
|
+
@ReactProp(name = "checkout")
|
|
94
|
+
override fun setCheckout(
|
|
95
|
+
view: EmbeddedPaymentElementView,
|
|
96
|
+
cfg: Dynamic,
|
|
97
|
+
) {
|
|
98
|
+
val sessionKey = cfg.asMapOrNull()?.getString("sessionKey") ?: return
|
|
90
99
|
|
|
91
|
-
val
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
val stripeSdkModule =
|
|
101
|
+
(view.context as ThemedReactContext).getNativeModule(StripeSdkModule::class.java)
|
|
102
|
+
val checkout = stripeSdkModule?.checkoutInstances?.get(sessionKey)
|
|
103
|
+
if (checkout == null) {
|
|
104
|
+
val payload =
|
|
105
|
+
Arguments.createMap().apply {
|
|
106
|
+
putString("message", "Checkout session not found.")
|
|
107
|
+
}
|
|
108
|
+
stripeSdkModule?.eventEmitter?.emitEmbeddedPaymentElementLoadingFailed(payload)
|
|
109
|
+
return
|
|
95
110
|
}
|
|
111
|
+
|
|
112
|
+
view.latestCheckout = checkout
|
|
113
|
+
view.latestElementConfig?.let { configureIfReady(view, it) }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Configures the embedded element once both the element config and an
|
|
118
|
+
* intent source (intent configuration or checkout) have arrived. Returns
|
|
119
|
+
* `true` when a configure was dispatched.
|
|
120
|
+
*/
|
|
121
|
+
private fun configureIfReady(
|
|
122
|
+
view: EmbeddedPaymentElementView,
|
|
123
|
+
elementConfig: EmbeddedPaymentElement.Configuration,
|
|
124
|
+
): Boolean {
|
|
125
|
+
view.latestCheckout?.let { checkout ->
|
|
126
|
+
view.configureWithCheckout(elementConfig, checkout)
|
|
127
|
+
return true
|
|
128
|
+
}
|
|
129
|
+
view.latestIntentConfig?.let { intentCfg ->
|
|
130
|
+
view.configure(elementConfig, intentCfg)
|
|
131
|
+
return true
|
|
132
|
+
}
|
|
133
|
+
return false
|
|
96
134
|
}
|
|
97
135
|
|
|
98
136
|
@SuppressLint("RestrictedApi")
|
|
@@ -206,6 +244,28 @@ class EmbeddedPaymentElementViewManager :
|
|
|
206
244
|
}
|
|
207
245
|
}
|
|
208
246
|
|
|
247
|
+
override fun updateWithCheckout(
|
|
248
|
+
view: EmbeddedPaymentElementView,
|
|
249
|
+
sessionKey: String?,
|
|
250
|
+
) {
|
|
251
|
+
if (sessionKey == null) return
|
|
252
|
+
|
|
253
|
+
val stripeSdkModule =
|
|
254
|
+
(view.context as ThemedReactContext).getNativeModule(StripeSdkModule::class.java)
|
|
255
|
+
val checkout = stripeSdkModule?.checkoutInstances?.get(sessionKey)
|
|
256
|
+
if (checkout == null) {
|
|
257
|
+
val payload =
|
|
258
|
+
Arguments.createMap().apply {
|
|
259
|
+
putString("message", "Checkout session not found.")
|
|
260
|
+
}
|
|
261
|
+
stripeSdkModule?.eventEmitter?.emitEmbeddedPaymentElementLoadingFailed(payload)
|
|
262
|
+
stripeSdkModule?.eventEmitter?.emitEmbeddedPaymentElementUpdateComplete(null)
|
|
263
|
+
return
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
view.updateWithCheckout(checkout)
|
|
267
|
+
}
|
|
268
|
+
|
|
209
269
|
private fun jsonToWritableMap(json: JSONObject): WritableMap {
|
|
210
270
|
val map = Arguments.createMap()
|
|
211
271
|
val keys = json.keys()
|
|
@@ -138,7 +138,7 @@ class FinancialConnectionsSheetManager(
|
|
|
138
138
|
map.putString("status", mapFromStatus(account.status))
|
|
139
139
|
map.putString("institutionName", account.institutionName)
|
|
140
140
|
map.putString("last4", account.last4)
|
|
141
|
-
map.putDouble("created", account.created *
|
|
141
|
+
map.putDouble("created", account.created * SECONDS_TO_MILLIS)
|
|
142
142
|
map.putMap("balance", mapFromAccountBalance(account.balance))
|
|
143
143
|
map.putMap("balanceRefresh", mapFromAccountBalanceRefresh(account.balanceRefresh))
|
|
144
144
|
map.putString("category", mapFromCategory(account.category))
|
|
@@ -166,7 +166,7 @@ class FinancialConnectionsSheetManager(
|
|
|
166
166
|
return null
|
|
167
167
|
}
|
|
168
168
|
val map = Arguments.createMap()
|
|
169
|
-
map.putDouble("asOf", balance.asOf *
|
|
169
|
+
map.putDouble("asOf", balance.asOf * SECONDS_TO_MILLIS)
|
|
170
170
|
map.putString("type", mapFromBalanceType(balance.type))
|
|
171
171
|
Arguments.createMap().also {
|
|
172
172
|
for (entry in balance.current.entries) {
|
|
@@ -210,7 +210,7 @@ class FinancialConnectionsSheetManager(
|
|
|
210
210
|
}
|
|
211
211
|
val map = Arguments.createMap()
|
|
212
212
|
map.putString("status", mapFromBalanceRefreshStatus(balanceRefresh.status))
|
|
213
|
-
map.putDouble("lastAttemptedAt", balanceRefresh.lastAttemptedAt *
|
|
213
|
+
map.putDouble("lastAttemptedAt", balanceRefresh.lastAttemptedAt * SECONDS_TO_MILLIS)
|
|
214
214
|
return map
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -252,7 +252,9 @@ class FinancialConnectionsSheetManager(
|
|
|
252
252
|
FinancialConnectionsAccount.Permissions.UNKNOWN -> "unparsable"
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
private fun mapFromSupportedPaymentMethodTypes(
|
|
255
|
+
private fun mapFromSupportedPaymentMethodTypes(
|
|
256
|
+
type: FinancialConnectionsAccount.SupportedPaymentMethodTypes
|
|
257
|
+
): String =
|
|
256
258
|
when (type) {
|
|
257
259
|
FinancialConnectionsAccount.SupportedPaymentMethodTypes.US_BANK_ACCOUNT -> "usBankAccount"
|
|
258
260
|
FinancialConnectionsAccount.SupportedPaymentMethodTypes.LINK -> "link"
|
|
@@ -274,6 +276,8 @@ class FinancialConnectionsSheetManager(
|
|
|
274
276
|
BalanceRefresh.BalanceRefreshStatus.UNKNOWN -> "unparsable"
|
|
275
277
|
null -> "null"
|
|
276
278
|
}
|
|
279
|
+
|
|
280
|
+
private const val SECONDS_TO_MILLIS = 1000.0
|
|
277
281
|
}
|
|
278
282
|
}
|
|
279
283
|
|
|
@@ -17,7 +17,8 @@ class GooglePayButtonManager :
|
|
|
17
17
|
|
|
18
18
|
override fun getDelegate() = delegate
|
|
19
19
|
|
|
20
|
-
override fun createViewInstance(reactContext: ThemedReactContext): GooglePayButtonView =
|
|
20
|
+
override fun createViewInstance(reactContext: ThemedReactContext): GooglePayButtonView =
|
|
21
|
+
GooglePayButtonView(reactContext)
|
|
21
22
|
|
|
22
23
|
override fun onAfterUpdateTransaction(view: GooglePayButtonView) {
|
|
23
24
|
super.onAfterUpdateTransaction(view)
|