@stripe/stripe-react-native 0.44.0 → 0.45.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/.clang-format +90 -0
- package/.editorconfig +3 -0
- package/CHANGELOG.md +7 -1
- package/android/build.gradle +89 -18
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +15 -6
- package/android/src/main/java/com/reactnativestripesdk/CardChangeEvent.kt +56 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -4
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +55 -45
- package/android/src/main/java/com/reactnativestripesdk/{CardFocusEvent.kt → CardFocusChangeEvent.kt} +2 -2
- package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +17 -16
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +5 -5
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +39 -33
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +4 -2
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +182 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +231 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +8 -5
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +14 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +17 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +266 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +8 -13
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +106 -59
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +34 -4
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +33 -27
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +49 -24
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +16 -3
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +11 -29
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +36 -12
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +5 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +21 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerDelegate.java +49 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerInterface.java +25 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerDelegate.java +64 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerInterface.java +30 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +41 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +20 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerDelegate.java +36 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerInterface.java +20 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerDelegate.java +73 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerInterface.java +31 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerDelegate.java +67 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerInterface.java +29 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +49 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +21 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +38 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +19 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerDelegate.java +32 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerInterface.java +17 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +311 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +21 -19
- package/ios/AddressSheet/AddressSheetView.swift +23 -17
- package/ios/ApplePayButtonManager.m +0 -1
- package/ios/ApplePayButtonManager.swift +1 -3
- package/ios/ApplePayButtonView.swift +25 -20
- package/ios/ApplePayViewController.swift +22 -22
- package/ios/AuBECSDebitFormView.swift +14 -8
- package/ios/CardFieldManager.swift +1 -4
- package/ios/CardFieldView.swift +28 -25
- package/ios/CardFormManager.swift +1 -4
- package/ios/CardFormView.swift +25 -16
- package/ios/CustomerSheet/CustomerSheetUtils.swift +12 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +8 -8
- package/ios/EmbeddedPaymentElementManager.m +6 -0
- package/ios/EmbeddedPaymentElementView.swift +48 -0
- package/ios/NewArch/AddToWalletButtonComponentView.h +10 -0
- package/ios/NewArch/AddToWalletButtonComponentView.mm +93 -0
- package/ios/NewArch/AddressSheetViewComponentView.h +10 -0
- package/ios/NewArch/AddressSheetViewComponentView.mm +109 -0
- package/ios/NewArch/ApplePayButtonComponentView.h +10 -0
- package/ios/NewArch/ApplePayButtonComponentView.mm +124 -0
- package/ios/NewArch/AuBECSDebitFormComponentView.h +10 -0
- package/ios/NewArch/AuBECSDebitFormComponentView.mm +95 -0
- package/ios/NewArch/CardFieldComponentView.h +10 -0
- package/ios/NewArch/CardFieldComponentView.mm +125 -0
- package/ios/NewArch/CardFormComponentView.h +10 -0
- package/ios/NewArch/CardFormComponentView.mm +108 -0
- package/ios/NewArch/StripeContainerComponentView.h +10 -0
- package/ios/NewArch/StripeContainerComponentView.mm +74 -0
- package/ios/NewArch/StripeNewArchConversions.h +20 -0
- package/ios/NewArch/StripeNewArchConversions.mm +47 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +27 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +105 -0
- package/ios/PaymentOptionDisplayData+ReactNative.swift +55 -0
- package/ios/PaymentSheetAppearance.swift +194 -1
- package/ios/PushProvisioning/AddToWalletButtonView.swift +19 -13
- package/ios/StripeContainerView.swift +5 -3
- package/ios/StripeSdk.h +21 -0
- package/ios/StripeSdk.mm +415 -0
- package/ios/StripeSdkEmitter.swift +19 -0
- package/ios/{StripeSdk+CustomerSheet.swift → StripeSdkImpl+CustomerSheet.swift} +24 -25
- package/ios/StripeSdkImpl+Embedded.swift +327 -0
- package/ios/{StripeSdk+PaymentSheet.swift → StripeSdkImpl+PaymentSheet.swift} +18 -29
- package/ios/{StripeSdk.swift → StripeSdkImpl.swift} +50 -72
- package/ios/StripeSwiftInterop.h +25 -0
- package/ios/stripe_react_native.h +2 -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/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.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/events.js +2 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +2 -0
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -0
- package/lib/commonjs/specs/NativeAddressSheet.js +2 -0
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -0
- package/lib/commonjs/specs/NativeApplePayButton.js +2 -0
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -0
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +2 -0
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -0
- package/lib/commonjs/specs/NativeCardField.js +2 -0
- package/lib/commonjs/specs/NativeCardField.js.map +1 -0
- package/lib/commonjs/specs/NativeCardForm.js +2 -0
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +2 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -0
- package/lib/commonjs/specs/NativeGooglePayButton.js +2 -0
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +2 -0
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -0
- package/lib/commonjs/specs/utils.js +2 -0
- package/lib/commonjs/specs/utils.js.map +1 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js +2 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -0
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.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/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.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/events.js +2 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +2 -0
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -0
- package/lib/module/specs/NativeAddressSheet.js +2 -0
- package/lib/module/specs/NativeAddressSheet.js.map +1 -0
- package/lib/module/specs/NativeApplePayButton.js +2 -0
- package/lib/module/specs/NativeApplePayButton.js.map +1 -0
- package/lib/module/specs/NativeAuBECSDebitForm.js +2 -0
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -0
- package/lib/module/specs/NativeCardField.js +2 -0
- package/lib/module/specs/NativeCardField.js.map +1 -0
- package/lib/module/specs/NativeCardForm.js +2 -0
- package/lib/module/specs/NativeCardForm.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +2 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -0
- package/lib/module/specs/NativeGooglePayButton.js +2 -0
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +2 -0
- package/lib/module/specs/NativeStripeContainer.js.map +1 -0
- package/lib/module/specs/NativeStripeSdkModule.js +2 -0
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -0
- package/lib/module/specs/utils.js +2 -0
- package/lib/module/specs/utils.js.map +1 -0
- package/lib/module/types/EmbeddedPaymentElement.js +2 -0
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -0
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -1
- package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -1
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -1
- package/lib/typescript/src/components/CardField.d.ts +1 -1
- package/lib/typescript/src/components/CardField.d.ts.map +1 -1
- package/lib/typescript/src/components/CardForm.d.ts +1 -1
- package/lib/typescript/src/components/CardForm.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +13 -0
- package/lib/typescript/src/events.d.ts.map +1 -0
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -4
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
- package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts +27 -0
- package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAddressSheet.d.ts +34 -0
- package/lib/typescript/src/specs/NativeAddressSheet.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts +28 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts +19 -0
- package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCardField.d.ts +33 -0
- package/lib/typescript/src/specs/NativeCardField.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCardForm.d.ts +31 -0
- package/lib/typescript/src/specs/NativeCardForm.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +22 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeGooglePayButton.d.ts +11 -0
- package/lib/typescript/src/specs/NativeGooglePayButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeContainer.d.ts +8 -0
- package/lib/typescript/src/specs/NativeStripeContainer.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +93 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/utils.d.ts +20 -0
- package/lib/typescript/src/specs/utils.d.ts.map +1 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +1 -5
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +161 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +97 -4
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +3 -2
- package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -1
- package/lib/typescript/src/types/components/CardFormView.d.ts +3 -1
- package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -1
- package/package.json +20 -1
- package/src/components/AddToWalletButton.tsx +2 -5
- package/src/components/AddressSheet.tsx +5 -16
- package/src/components/AuBECSDebitForm.tsx +3 -12
- package/src/components/CardField.tsx +20 -30
- package/src/components/CardForm.tsx +14 -29
- package/src/components/CustomerSheet.tsx +23 -25
- package/src/components/PlatformPayButton.tsx +6 -6
- package/src/components/StripeContainer.tsx +5 -12
- package/src/components/StripeProvider.tsx +1 -1
- package/src/events.ts +49 -0
- package/src/functions.ts +13 -24
- package/src/hooks/useFinancialConnectionsSheet.tsx +2 -2
- package/src/hooks/useStripe.tsx +2 -2
- package/src/index.tsx +3 -0
- package/src/specs/NativeAddToWalletButton.ts +40 -0
- package/src/specs/NativeAddressSheet.ts +50 -0
- package/src/specs/NativeApplePayButton.ts +40 -0
- package/src/specs/NativeAuBECSDebitForm.ts +24 -0
- package/src/specs/NativeCardField.ts +51 -0
- package/src/specs/NativeCardForm.ts +43 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +37 -0
- package/src/specs/NativeGooglePayButton.ts +20 -0
- package/src/specs/NativeStripeContainer.ts +12 -0
- package/src/specs/NativeStripeSdkModule.ts +219 -0
- package/src/specs/utils.ts +22 -0
- package/src/types/CustomerSheet.ts +1 -5
- package/src/types/EmbeddedPaymentElement.tsx +467 -0
- package/src/types/PaymentSheet.ts +114 -4
- package/src/types/components/CardFieldInput.ts +1 -2
- package/src/types/components/CardFormView.ts +1 -1
- package/stripe-react-native.podspec +27 -2
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +0 -54
- package/ios/StripeSdk.m +0 -244
- package/lib/commonjs/NativeStripeSdk.js +0 -2
- package/lib/commonjs/NativeStripeSdk.js.map +0 -1
- package/lib/commonjs/components/ApplePayButtonNative.js +0 -2
- package/lib/commonjs/components/ApplePayButtonNative.js.map +0 -1
- package/lib/commonjs/components/GooglePayButtonNative.js +0 -2
- package/lib/commonjs/components/GooglePayButtonNative.js.map +0 -1
- package/lib/module/NativeStripeSdk.js +0 -2
- package/lib/module/NativeStripeSdk.js.map +0 -1
- package/lib/module/components/ApplePayButtonNative.js +0 -2
- package/lib/module/components/ApplePayButtonNative.js.map +0 -1
- package/lib/module/components/GooglePayButtonNative.js +0 -2
- package/lib/module/components/GooglePayButtonNative.js.map +0 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +0 -58
- package/lib/typescript/src/NativeStripeSdk.d.ts.map +0 -1
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +0 -4
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +0 -1
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +0 -4
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +0 -1
- package/src/NativeStripeSdk.tsx +0 -159
- package/src/components/ApplePayButtonNative.tsx +0 -5
- package/src/components/GooglePayButtonNative.tsx +0 -7
|
@@ -44,11 +44,9 @@ class FinancialConnectionsSheetFragment : Fragment() {
|
|
|
44
44
|
super.onCreate(savedInstanceState)
|
|
45
45
|
|
|
46
46
|
val stripeSdkModule: StripeSdkModule? = context.getNativeModule(StripeSdkModule::class.java)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
stripeSdkModule.sendEvent(context, "onFinancialConnectionsEvent", params)
|
|
51
|
-
}
|
|
47
|
+
FinancialConnections.setEventListener { event ->
|
|
48
|
+
val params = mapFromFinancialConnectionsEvent(event)
|
|
49
|
+
stripeSdkModule?.emitOnFinancialConnectionsEvent(params)
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
|
|
@@ -70,6 +68,7 @@ class FinancialConnectionsSheetFragment : Fragment() {
|
|
|
70
68
|
::onFinancialConnectionsSheetForTokenResult,
|
|
71
69
|
).present(configuration = configuration)
|
|
72
70
|
}
|
|
71
|
+
|
|
73
72
|
Mode.ForSession -> {
|
|
74
73
|
FinancialConnectionsSheet
|
|
75
74
|
.create(this, ::onFinancialConnectionsSheetForDataResult)
|
|
@@ -90,9 +89,11 @@ class FinancialConnectionsSheetFragment : Fragment() {
|
|
|
90
89
|
is FinancialConnectionsSheetForTokenResult.Canceled -> {
|
|
91
90
|
promise.resolve(createError(ErrorType.Canceled.toString(), "The flow has been canceled"))
|
|
92
91
|
}
|
|
92
|
+
|
|
93
93
|
is FinancialConnectionsSheetForTokenResult.Failed -> {
|
|
94
94
|
promise.resolve(createError(ErrorType.Failed.toString(), result.error))
|
|
95
95
|
}
|
|
96
|
+
|
|
96
97
|
is FinancialConnectionsSheetForTokenResult.Completed -> {
|
|
97
98
|
promise.resolve(createTokenResult(result))
|
|
98
99
|
(context.currentActivity as? FragmentActivity)
|
|
@@ -109,9 +110,11 @@ class FinancialConnectionsSheetFragment : Fragment() {
|
|
|
109
110
|
is FinancialConnectionsSheetResult.Canceled -> {
|
|
110
111
|
promise.resolve(createError(ErrorType.Canceled.toString(), "The flow has been canceled"))
|
|
111
112
|
}
|
|
113
|
+
|
|
112
114
|
is FinancialConnectionsSheetResult.Failed -> {
|
|
113
115
|
promise.resolve(createError(ErrorType.Failed.toString(), result.error))
|
|
114
116
|
}
|
|
117
|
+
|
|
115
118
|
is FinancialConnectionsSheetResult.Completed -> {
|
|
116
119
|
promise.resolve(
|
|
117
120
|
WritableNativeMap().also {
|
|
@@ -4,11 +4,21 @@ import com.facebook.react.module.annotations.ReactModule
|
|
|
4
4
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
5
5
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
6
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
|
+
import com.facebook.react.viewmanagers.GooglePayButtonManagerDelegate
|
|
8
|
+
import com.facebook.react.viewmanagers.GooglePayButtonManagerInterface
|
|
7
9
|
|
|
8
10
|
@ReactModule(name = GooglePayButtonManager.REACT_CLASS)
|
|
9
|
-
class GooglePayButtonManager :
|
|
11
|
+
class GooglePayButtonManager :
|
|
12
|
+
SimpleViewManager<GooglePayButtonView>(),
|
|
13
|
+
GooglePayButtonManagerInterface<GooglePayButtonView> {
|
|
14
|
+
private val delegate = GooglePayButtonManagerDelegate(this)
|
|
15
|
+
|
|
10
16
|
override fun getName() = REACT_CLASS
|
|
11
17
|
|
|
18
|
+
override fun getDelegate() = delegate
|
|
19
|
+
|
|
20
|
+
override fun createViewInstance(reactContext: ThemedReactContext): GooglePayButtonView = GooglePayButtonView(reactContext)
|
|
21
|
+
|
|
12
22
|
override fun onAfterUpdateTransaction(view: GooglePayButtonView) {
|
|
13
23
|
super.onAfterUpdateTransaction(view)
|
|
14
24
|
|
|
@@ -16,7 +26,7 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
|
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
@ReactProp(name = "type")
|
|
19
|
-
fun
|
|
29
|
+
override fun setType(
|
|
20
30
|
view: GooglePayButtonView,
|
|
21
31
|
buttonType: Int,
|
|
22
32
|
) {
|
|
@@ -24,7 +34,7 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
|
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
@ReactProp(name = "appearance")
|
|
27
|
-
fun
|
|
37
|
+
override fun setAppearance(
|
|
28
38
|
view: GooglePayButtonView,
|
|
29
39
|
appearance: Int,
|
|
30
40
|
) {
|
|
@@ -32,15 +42,13 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
|
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
@ReactProp(name = "borderRadius")
|
|
35
|
-
fun
|
|
45
|
+
override fun setBorderRadius(
|
|
36
46
|
view: GooglePayButtonView,
|
|
37
47
|
borderRadius: Int,
|
|
38
48
|
) {
|
|
39
49
|
view.setBorderRadius(borderRadius)
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
override fun createViewInstance(reactContext: ThemedReactContext): GooglePayButtonView = GooglePayButtonView(reactContext)
|
|
43
|
-
|
|
44
52
|
companion object {
|
|
45
53
|
const val REACT_CLASS = "GooglePayButton"
|
|
46
54
|
}
|
|
@@ -19,7 +19,7 @@ import com.stripe.android.model.PaymentMethodOptionsParams
|
|
|
19
19
|
|
|
20
20
|
class PaymentMethodCreateParamsFactory(
|
|
21
21
|
private val paymentMethodData: ReadableMap?,
|
|
22
|
-
private val options: ReadableMap
|
|
22
|
+
private val options: ReadableMap?,
|
|
23
23
|
private val cardFieldView: CardFieldView?,
|
|
24
24
|
private val cardFormView: CardFormView?,
|
|
25
25
|
) {
|
|
@@ -267,6 +267,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
267
267
|
PaymentMethod.Type.Card -> createCardStripeIntentParams(clientSecret, isPaymentIntent)
|
|
268
268
|
PaymentMethod.Type.USBankAccount ->
|
|
269
269
|
createUSBankAccountStripeIntentParams(clientSecret, isPaymentIntent)
|
|
270
|
+
|
|
270
271
|
PaymentMethod.Type.Affirm -> createAffirmStripeIntentParams(clientSecret, isPaymentIntent)
|
|
271
272
|
PaymentMethod.Type.Ideal,
|
|
272
273
|
PaymentMethod.Type.Alipay,
|
|
@@ -304,6 +305,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
304
305
|
)
|
|
305
306
|
}
|
|
306
307
|
}
|
|
308
|
+
|
|
307
309
|
null -> ConfirmPaymentIntentParams.create(clientSecret)
|
|
308
310
|
else -> {
|
|
309
311
|
throw Exception("This paymentMethodType is not supported yet")
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import com.facebook.react.bridge.Arguments
|
|
2
|
+
import com.facebook.react.bridge.WritableMap
|
|
3
|
+
import com.reactnativestripesdk.utils.mapFromPaymentSheetBillingDetails
|
|
4
|
+
import com.stripe.android.paymentelement.EmbeddedPaymentElement
|
|
5
|
+
import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Serialize Stripe's PaymentOptionDisplayData into a WritableMap
|
|
9
|
+
* that can be sent over the RN bridge.
|
|
10
|
+
*/
|
|
11
|
+
@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
|
|
12
|
+
fun EmbeddedPaymentElement.PaymentOptionDisplayData.toWritableMap(): WritableMap =
|
|
13
|
+
Arguments.createMap().apply {
|
|
14
|
+
putString("label", label)
|
|
15
|
+
putString("paymentMethodType", paymentMethodType)
|
|
16
|
+
putMap("billingDetails", mapFromPaymentSheetBillingDetails(billingDetails))
|
|
17
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.content.Context
|
|
5
|
+
import android.content.res.Configuration
|
|
4
6
|
import android.graphics.Color
|
|
5
7
|
import android.os.Bundle
|
|
6
8
|
import com.reactnativestripesdk.utils.PaymentSheetAppearanceException
|
|
9
|
+
import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
|
|
7
10
|
import com.stripe.android.paymentsheet.PaymentSheet
|
|
8
11
|
|
|
12
|
+
@SuppressLint("RestrictedApi")
|
|
9
13
|
fun buildPaymentSheetAppearance(
|
|
10
14
|
userParams: Bundle?,
|
|
11
15
|
context: Context,
|
|
@@ -14,6 +18,28 @@ fun buildPaymentSheetAppearance(
|
|
|
14
18
|
val lightColorParams = colorParams?.getBundle(PaymentSheetAppearanceKeys.LIGHT) ?: colorParams
|
|
15
19
|
val darkColorParams = colorParams?.getBundle(PaymentSheetAppearanceKeys.DARK) ?: colorParams
|
|
16
20
|
|
|
21
|
+
val embeddedAppearance =
|
|
22
|
+
buildEmbeddedAppearance(
|
|
23
|
+
userParams?.getBundle(PaymentSheetAppearanceKeys.EMBEDDED_PAYMENT_ELEMENT),
|
|
24
|
+
lightColorParams,
|
|
25
|
+
context,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
embeddedAppearance?.let {
|
|
29
|
+
return PaymentSheet.Appearance(
|
|
30
|
+
typography = buildTypography(userParams?.getBundle(PaymentSheetAppearanceKeys.FONT), context),
|
|
31
|
+
colorsLight = buildColors(lightColorParams, PaymentSheet.Colors.defaultLight),
|
|
32
|
+
colorsDark = buildColors(darkColorParams, PaymentSheet.Colors.defaultDark),
|
|
33
|
+
shapes = buildShapes(userParams?.getBundle(PaymentSheetAppearanceKeys.SHAPES)),
|
|
34
|
+
primaryButton =
|
|
35
|
+
buildPrimaryButton(
|
|
36
|
+
userParams?.getBundle(PaymentSheetAppearanceKeys.PRIMARY_BUTTON),
|
|
37
|
+
context,
|
|
38
|
+
),
|
|
39
|
+
embeddedAppearance = embeddedAppearance,
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
17
43
|
return PaymentSheet.Appearance(
|
|
18
44
|
typography = buildTypography(userParams?.getBundle(PaymentSheetAppearanceKeys.FONT), context),
|
|
19
45
|
colorsLight = buildColors(lightColorParams, PaymentSheet.Colors.defaultLight),
|
|
@@ -213,6 +239,205 @@ private fun buildPrimaryButtonColors(
|
|
|
213
239
|
),
|
|
214
240
|
)
|
|
215
241
|
|
|
242
|
+
@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
|
|
243
|
+
@SuppressLint("RestrictedApi")
|
|
244
|
+
@Throws(PaymentSheetAppearanceException::class)
|
|
245
|
+
private fun buildEmbeddedAppearance(
|
|
246
|
+
embeddedParams: Bundle?,
|
|
247
|
+
defaultColorsBundle: Bundle?,
|
|
248
|
+
context: Context,
|
|
249
|
+
): PaymentSheet.Appearance.Embedded? {
|
|
250
|
+
if (embeddedParams == null) {
|
|
251
|
+
return null
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
val rowParams =
|
|
255
|
+
getBundleOrNull(embeddedParams, PaymentSheetAppearanceKeys.ROW)
|
|
256
|
+
?: return null
|
|
257
|
+
|
|
258
|
+
val defaultColors = buildColors(defaultColorsBundle, PaymentSheet.Colors.defaultLight)
|
|
259
|
+
|
|
260
|
+
// Default style
|
|
261
|
+
val styleString = rowParams.getString(PaymentSheetAppearanceKeys.STYLE, "flatWithRadio")
|
|
262
|
+
|
|
263
|
+
val defaultAdditionalInsetsDp = 6.0f
|
|
264
|
+
val defaultSeparatorThicknessDp = 1.0f
|
|
265
|
+
val defaultSpacingDp = 12.0f
|
|
266
|
+
val defaultCheckmarkInsetDp = 0f
|
|
267
|
+
|
|
268
|
+
val additionalInsets = getFloatOr(rowParams, PaymentSheetAppearanceKeys.ADDITIONAL_INSETS, defaultAdditionalInsetsDp)
|
|
269
|
+
|
|
270
|
+
val rowStyle: PaymentSheet.Appearance.Embedded.RowStyle =
|
|
271
|
+
when (styleString) {
|
|
272
|
+
"flatWithRadio" -> {
|
|
273
|
+
val flatParams = getBundleOrNull(rowParams, PaymentSheetAppearanceKeys.FLAT)
|
|
274
|
+
val radioParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.RADIO)
|
|
275
|
+
val separatorInsetsParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_INSETS)
|
|
276
|
+
|
|
277
|
+
// Default separator insets specific to FlatWithRadio
|
|
278
|
+
val defaultSeparatorStartInsetDp = 30.0f
|
|
279
|
+
val defaultSeparatorEndInsetDp = 0.0f
|
|
280
|
+
|
|
281
|
+
// Parse dimensions as Floats
|
|
282
|
+
val separatorThickness = getFloatOr(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_THICKNESS, defaultSeparatorThicknessDp)
|
|
283
|
+
val startSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.LEFT, defaultSeparatorStartInsetDp)
|
|
284
|
+
val endSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.RIGHT, defaultSeparatorEndInsetDp)
|
|
285
|
+
|
|
286
|
+
// Parse booleans
|
|
287
|
+
val topEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.TOP_SEPARATOR_ENABLED, true)
|
|
288
|
+
val bottomEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.BOTTOM_SEPARATOR_ENABLED, true)
|
|
289
|
+
|
|
290
|
+
// Parse individual colors using default colors
|
|
291
|
+
val parsedSeparatorColor =
|
|
292
|
+
dynamicColorFromParams(
|
|
293
|
+
context,
|
|
294
|
+
flatParams,
|
|
295
|
+
PaymentSheetAppearanceKeys.SEPARATOR_COLOR,
|
|
296
|
+
defaultColors.componentBorder,
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
val parsedSelectedColor =
|
|
300
|
+
dynamicColorFromParams(
|
|
301
|
+
context,
|
|
302
|
+
radioParams,
|
|
303
|
+
PaymentSheetAppearanceKeys.SELECTED_COLOR,
|
|
304
|
+
defaultColors.primary,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
val parsedUnselectedColor =
|
|
308
|
+
dynamicColorFromParams(
|
|
309
|
+
context,
|
|
310
|
+
radioParams,
|
|
311
|
+
PaymentSheetAppearanceKeys.UNSELECTED_COLOR,
|
|
312
|
+
defaultColors.componentBorder,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
val flatRadioColors =
|
|
316
|
+
PaymentSheet.Appearance.Embedded.RowStyle.FlatWithRadio.Colors(
|
|
317
|
+
separatorColor = parsedSeparatorColor,
|
|
318
|
+
unselectedColor = parsedUnselectedColor,
|
|
319
|
+
selectedColor = parsedSelectedColor,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
PaymentSheet.Appearance.Embedded.RowStyle.FlatWithRadio(
|
|
323
|
+
separatorThicknessDp = separatorThickness,
|
|
324
|
+
startSeparatorInsetDp = startSeparatorInset,
|
|
325
|
+
endSeparatorInsetDp = endSeparatorInset,
|
|
326
|
+
topSeparatorEnabled = topEnabled,
|
|
327
|
+
bottomSeparatorEnabled = bottomEnabled,
|
|
328
|
+
additionalVerticalInsetsDp = additionalInsets,
|
|
329
|
+
horizontalInsetsDp = 0.0F, // We do not have an iOS equal for this API so it's not configurable in React Native
|
|
330
|
+
colorsLight = flatRadioColors,
|
|
331
|
+
colorsDark = flatRadioColors,
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
"flatWithCheckmark" -> {
|
|
335
|
+
val flatParams = getBundleOrNull(rowParams, PaymentSheetAppearanceKeys.FLAT)
|
|
336
|
+
val checkmarkParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.CHECKMARK)
|
|
337
|
+
val separatorInsetsParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_INSETS)
|
|
338
|
+
|
|
339
|
+
// Default separator insets specific to FlatWithCheckmark
|
|
340
|
+
val defaultSeparatorStartInsetDp = 0.0f
|
|
341
|
+
val defaultSeparatorEndInsetDp = 0.0f
|
|
342
|
+
|
|
343
|
+
// Parse dimensions as Floats
|
|
344
|
+
val separatorThickness = getFloatOr(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_THICKNESS, defaultSeparatorThicknessDp)
|
|
345
|
+
val startSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.LEFT, defaultSeparatorStartInsetDp)
|
|
346
|
+
val endSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.RIGHT, defaultSeparatorEndInsetDp)
|
|
347
|
+
val checkmarkInset = getFloatOr(checkmarkParams, PaymentSheetAppearanceKeys.CHECKMARK_INSET, defaultCheckmarkInsetDp)
|
|
348
|
+
|
|
349
|
+
// Parse booleans
|
|
350
|
+
val topEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.TOP_SEPARATOR_ENABLED, true)
|
|
351
|
+
val bottomEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.BOTTOM_SEPARATOR_ENABLED, true)
|
|
352
|
+
|
|
353
|
+
// Parse individual colors using root defaults
|
|
354
|
+
val parsedSeparatorColor =
|
|
355
|
+
dynamicColorFromParams(
|
|
356
|
+
context,
|
|
357
|
+
flatParams,
|
|
358
|
+
PaymentSheetAppearanceKeys.SEPARATOR_COLOR,
|
|
359
|
+
defaultColors.componentBorder,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
val parsedCheckmarkColor =
|
|
363
|
+
dynamicColorFromParams(
|
|
364
|
+
context,
|
|
365
|
+
checkmarkParams,
|
|
366
|
+
PaymentSheetAppearanceKeys.COLOR,
|
|
367
|
+
defaultColors.primary,
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
// Create the required Colors object
|
|
371
|
+
val flatCheckmarkColors =
|
|
372
|
+
PaymentSheet.Appearance.Embedded.RowStyle.FlatWithCheckmark.Colors(
|
|
373
|
+
separatorColor = parsedSeparatorColor,
|
|
374
|
+
checkmarkColor = parsedCheckmarkColor,
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
PaymentSheet.Appearance.Embedded.RowStyle.FlatWithCheckmark(
|
|
378
|
+
separatorThicknessDp = separatorThickness,
|
|
379
|
+
startSeparatorInsetDp = startSeparatorInset,
|
|
380
|
+
endSeparatorInsetDp = endSeparatorInset,
|
|
381
|
+
topSeparatorEnabled = topEnabled,
|
|
382
|
+
bottomSeparatorEnabled = bottomEnabled,
|
|
383
|
+
checkmarkInsetDp = checkmarkInset,
|
|
384
|
+
additionalVerticalInsetsDp = additionalInsets,
|
|
385
|
+
horizontalInsetsDp = 0.0F, // We do not have an iOS equal for this API so it's not configurable in React Native
|
|
386
|
+
colorsLight = flatCheckmarkColors,
|
|
387
|
+
colorsDark = flatCheckmarkColors,
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
"floatingButton" -> {
|
|
391
|
+
val floatingParams = getBundleOrNull(rowParams, PaymentSheetAppearanceKeys.FLOATING)
|
|
392
|
+
PaymentSheet.Appearance.Embedded.RowStyle.FloatingButton(
|
|
393
|
+
additionalInsetsDp = additionalInsets,
|
|
394
|
+
spacingDp = getFloatOr(floatingParams, PaymentSheetAppearanceKeys.SPACING, defaultSpacingDp),
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
else -> {
|
|
398
|
+
System.err.println("WARN: Unsupported embedded payment element row style received: $styleString. Falling back to default.")
|
|
399
|
+
return null
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return PaymentSheet.Appearance.Embedded(style = rowStyle)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Pulls a light/dark hex‑string map out of [params],
|
|
408
|
+
* chooses the right one based on the current UI mode,
|
|
409
|
+
* and parses it (falling back to [defaultColor]).
|
|
410
|
+
*/
|
|
411
|
+
private fun dynamicColorFromParams(
|
|
412
|
+
context: Context,
|
|
413
|
+
params: Bundle?,
|
|
414
|
+
key: String,
|
|
415
|
+
defaultColor: Int,
|
|
416
|
+
): Int {
|
|
417
|
+
// Expect a nested Bundle { "light": "#RRGGBB", "dark": "#RRGGBB" }
|
|
418
|
+
val colorBundle = params?.getBundle(key)
|
|
419
|
+
if (colorBundle != null) {
|
|
420
|
+
val isDark =
|
|
421
|
+
(
|
|
422
|
+
context.resources.configuration.uiMode
|
|
423
|
+
and Configuration.UI_MODE_NIGHT_MASK
|
|
424
|
+
) == Configuration.UI_MODE_NIGHT_YES
|
|
425
|
+
|
|
426
|
+
// Pick the hex for current mode, or null
|
|
427
|
+
val hex =
|
|
428
|
+
if (isDark) {
|
|
429
|
+
colorBundle.getString(PaymentSheetAppearanceKeys.DARK)
|
|
430
|
+
} else {
|
|
431
|
+
colorBundle.getString(PaymentSheetAppearanceKeys.LIGHT)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return colorFromHexOrDefault(hex, defaultColor)
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// no override bundle → just use default
|
|
438
|
+
return defaultColor
|
|
439
|
+
}
|
|
440
|
+
|
|
216
441
|
private fun getDoubleOrNull(
|
|
217
442
|
bundle: Bundle?,
|
|
218
443
|
key: String,
|
|
@@ -250,6 +475,22 @@ private fun getFloatOr(
|
|
|
250
475
|
return defaultValue
|
|
251
476
|
}
|
|
252
477
|
|
|
478
|
+
private fun getBundleOrNull(
|
|
479
|
+
bundle: Bundle?,
|
|
480
|
+
key: String,
|
|
481
|
+
): Bundle? = bundle?.getBundle(key)
|
|
482
|
+
|
|
483
|
+
private fun getBooleanOr(
|
|
484
|
+
bundle: Bundle?,
|
|
485
|
+
key: String,
|
|
486
|
+
defaultValue: Boolean,
|
|
487
|
+
): Boolean =
|
|
488
|
+
if (bundle?.containsKey(key) == true) {
|
|
489
|
+
bundle.getBoolean(key)
|
|
490
|
+
} else {
|
|
491
|
+
defaultValue
|
|
492
|
+
}
|
|
493
|
+
|
|
253
494
|
private fun getFloatOrNull(
|
|
254
495
|
bundle: Bundle?,
|
|
255
496
|
key: String,
|
|
@@ -327,5 +568,30 @@ private class PaymentSheetAppearanceKeys {
|
|
|
327
568
|
const val PRIMARY_BUTTON = "primaryButton"
|
|
328
569
|
const val TEXT = "text"
|
|
329
570
|
const val BORDER = "border"
|
|
571
|
+
|
|
572
|
+
const val EMBEDDED_PAYMENT_ELEMENT = "embeddedPaymentElement"
|
|
573
|
+
const val ROW = "row"
|
|
574
|
+
const val STYLE = "style"
|
|
575
|
+
const val ADDITIONAL_INSETS = "additionalInsets"
|
|
576
|
+
|
|
577
|
+
const val FLAT = "flat"
|
|
578
|
+
const val SEPARATOR_THICKNESS = "separatorThickness"
|
|
579
|
+
const val SEPARATOR_COLOR = "separatorColor"
|
|
580
|
+
const val SEPARATOR_INSETS = "separatorInsets"
|
|
581
|
+
const val TOP_SEPARATOR_ENABLED = "topSeparatorEnabled"
|
|
582
|
+
const val BOTTOM_SEPARATOR_ENABLED = "bottomSeparatorEnabled"
|
|
583
|
+
const val RADIO = "radio"
|
|
584
|
+
const val SELECTED_COLOR = "selectedColor"
|
|
585
|
+
const val UNSELECTED_COLOR = "unselectedColor"
|
|
586
|
+
const val CHECKMARK = "checkmark"
|
|
587
|
+
const val COLOR = "color"
|
|
588
|
+
const val CHECKMARK_INSET = "inset"
|
|
589
|
+
|
|
590
|
+
const val FLOATING = "floating"
|
|
591
|
+
const val SPACING = "spacing"
|
|
592
|
+
|
|
593
|
+
// Keys for EdgeInsetsConfig
|
|
594
|
+
const val LEFT = "left"
|
|
595
|
+
const val RIGHT = "right"
|
|
330
596
|
}
|
|
331
597
|
}
|
|
@@ -163,11 +163,13 @@ class PaymentSheetFragment(
|
|
|
163
163
|
),
|
|
164
164
|
)
|
|
165
165
|
}
|
|
166
|
+
|
|
166
167
|
is PaymentSheetResult.Failed -> {
|
|
167
168
|
resolvePaymentResult(
|
|
168
169
|
createError(PaymentSheetErrorType.Failed.toString(), paymentResult.error),
|
|
169
170
|
)
|
|
170
171
|
}
|
|
172
|
+
|
|
171
173
|
is PaymentSheetResult.Completed -> {
|
|
172
174
|
resolvePaymentResult(WritableNativeMap())
|
|
173
175
|
// Remove the fragment now, we can be sure it won't be needed again if an intent is
|
|
@@ -183,22 +185,13 @@ class PaymentSheetFragment(
|
|
|
183
185
|
val createIntentCallback =
|
|
184
186
|
CreateIntentCallback { paymentMethod, shouldSavePaymentMethod ->
|
|
185
187
|
val stripeSdkModule: StripeSdkModule? = context.getNativeModule(StripeSdkModule::class.java)
|
|
186
|
-
if (stripeSdkModule == null || stripeSdkModule.eventListenerCount == 0) {
|
|
187
|
-
return@CreateIntentCallback CreateIntentResult.Failure(
|
|
188
|
-
cause =
|
|
189
|
-
Exception(
|
|
190
|
-
"Tried to call confirmHandler, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues",
|
|
191
|
-
),
|
|
192
|
-
displayMessage = "An unexpected error occurred",
|
|
193
|
-
)
|
|
194
|
-
}
|
|
195
188
|
val params =
|
|
196
189
|
Arguments.createMap().apply {
|
|
197
190
|
putMap("paymentMethod", mapFromPaymentMethod(paymentMethod))
|
|
198
191
|
putBoolean("shouldSavePaymentMethod", shouldSavePaymentMethod)
|
|
199
192
|
}
|
|
200
193
|
|
|
201
|
-
stripeSdkModule
|
|
194
|
+
stripeSdkModule?.emitOnConfirmHandlerCallback(params)
|
|
202
195
|
|
|
203
196
|
val resultFromJavascript = paymentSheetIntentCreationCallback.await()
|
|
204
197
|
// reset the completable
|
|
@@ -352,7 +345,8 @@ class PaymentSheetFragment(
|
|
|
352
345
|
override fun onActivitySaveInstanceState(
|
|
353
346
|
activity: Activity,
|
|
354
347
|
outState: Bundle,
|
|
355
|
-
) {
|
|
348
|
+
) {
|
|
349
|
+
}
|
|
356
350
|
|
|
357
351
|
override fun onActivityDestroyed(activity: Activity) {
|
|
358
352
|
paymentSheetActivity = null
|
|
@@ -509,7 +503,7 @@ class PaymentSheetFragment(
|
|
|
509
503
|
}
|
|
510
504
|
|
|
511
505
|
@Throws(PaymentSheetException::class)
|
|
512
|
-
|
|
506
|
+
internal fun buildIntentConfiguration(intentConfigurationParams: Bundle?): PaymentSheet.IntentConfiguration? {
|
|
513
507
|
if (intentConfigurationParams == null) {
|
|
514
508
|
return null
|
|
515
509
|
}
|
|
@@ -556,7 +550,7 @@ class PaymentSheetFragment(
|
|
|
556
550
|
|
|
557
551
|
@OptIn(ExperimentalCustomerSessionApi::class)
|
|
558
552
|
@Throws(PaymentSheetException::class)
|
|
559
|
-
|
|
553
|
+
internal fun buildCustomerConfiguration(bundle: Bundle?): PaymentSheet.CustomerConfiguration? {
|
|
560
554
|
val customerId = bundle?.getString("customerId").orEmpty()
|
|
561
555
|
val customerEphemeralKeySecret = bundle?.getString("customerEphemeralKeySecret").orEmpty()
|
|
562
556
|
val customerSessionClientSecret = bundle?.getString("customerSessionClientSecret").orEmpty()
|
|
@@ -638,6 +632,7 @@ fun mapToAddressCollectionMode(str: String?): PaymentSheet.BillingDetailsCollect
|
|
|
638
632
|
when (str) {
|
|
639
633
|
"automatic" ->
|
|
640
634
|
PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
|
|
635
|
+
|
|
641
636
|
"never" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Never
|
|
642
637
|
"full" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Full
|
|
643
638
|
else -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
|
|
@@ -4,20 +4,28 @@ import com.facebook.react.module.annotations.ReactModule
|
|
|
4
4
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
5
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
6
6
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
7
|
+
import com.facebook.react.viewmanagers.StripeContainerManagerDelegate
|
|
8
|
+
import com.facebook.react.viewmanagers.StripeContainerManagerInterface
|
|
7
9
|
|
|
8
10
|
@ReactModule(name = StripeContainerManager.REACT_CLASS)
|
|
9
|
-
class StripeContainerManager :
|
|
11
|
+
class StripeContainerManager :
|
|
12
|
+
ViewGroupManager<StripeContainerView>(),
|
|
13
|
+
StripeContainerManagerInterface<StripeContainerView> {
|
|
14
|
+
private val delegate = StripeContainerManagerDelegate(this)
|
|
15
|
+
|
|
10
16
|
override fun getName() = REACT_CLASS
|
|
11
17
|
|
|
18
|
+
override fun getDelegate() = delegate
|
|
19
|
+
|
|
12
20
|
@ReactProp(name = "keyboardShouldPersistTaps")
|
|
13
|
-
fun setKeyboardShouldPersistTaps(
|
|
21
|
+
override fun setKeyboardShouldPersistTaps(
|
|
14
22
|
view: StripeContainerView,
|
|
15
23
|
keyboardShouldPersistTaps: Boolean,
|
|
16
24
|
) {
|
|
17
25
|
view.setKeyboardShouldPersistTaps(keyboardShouldPersistTaps)
|
|
18
26
|
}
|
|
19
27
|
|
|
20
|
-
override fun createViewInstance(reactContext: ThemedReactContext)
|
|
28
|
+
override fun createViewInstance(reactContext: ThemedReactContext) = StripeContainerView(reactContext)
|
|
21
29
|
|
|
22
30
|
companion object {
|
|
23
31
|
const val REACT_CLASS = "StripeContainer"
|