@stripe/stripe-react-native 0.57.0 → 0.57.2
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 +0 -8
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +1029 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +19 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +76 -118
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/settings.gradle +2 -0
- package/android/spotless.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +20 -17
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +13 -11
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +17 -21
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherManager.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +53 -11
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +105 -117
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -8
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +13 -15
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +7 -5
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt +31 -0
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +120 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +228 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +73 -30
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +19 -245
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +52 -14
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +4 -4
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +15 -35
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +5 -10
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +90 -77
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +6 -4
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +13 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +41 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +92 -44
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +3 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +118 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +922 -0
- package/android/src/test/java/com/facebook/testutils/shadows/ShadowArguments.kt +29 -0
- package/android/src/test/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManagerTest.kt +163 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +976 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetAppearanceTest.kt +801 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +523 -0
- package/android/src/test/java/com/reactnativestripesdk/addresssheet/AddressSheetViewTest.kt +551 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +567 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +456 -0
- package/android/src/test/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +43 -0
- package/android/src/test/resources/robolectric.properties +2 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +3 -3
- package/ios/AddressSheet/AddressSheetView.swift +25 -25
- package/ios/AddressSheet/AddressSheetViewManager.swift +2 -2
- package/ios/ApplePayButtonManager.swift +1 -1
- package/ios/ApplePayButtonView.swift +9 -10
- package/ios/ApplePayUtils.swift +51 -51
- package/ios/ApplePayViewController.swift +25 -29
- package/ios/AuBECSDebitFormManager.swift +1 -1
- package/ios/AuBECSDebitFormView.swift +13 -15
- package/ios/CardFieldManager.swift +4 -4
- package/ios/CardFieldView.swift +9 -9
- package/ios/CardFormManager.swift +3 -3
- package/ios/CardFormView.swift +28 -28
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingView.swift +97 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +133 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.m +16 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.swift +17 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +15 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +19 -19
- package/ios/EmbeddedPaymentElementView.swift +2 -2
- package/ios/Errors.swift +22 -23
- package/ios/FinancialConnections.swift +37 -37
- package/ios/Mappers.swift +210 -71
- package/ios/NavigationBarManager.m +13 -0
- package/ios/NavigationBarManager.swift +17 -0
- package/ios/NavigationBarView.swift +65 -0
- package/ios/NewArch/NavigationBarComponentView.h +10 -0
- package/ios/NewArch/NavigationBarComponentView.mm +86 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
- package/ios/PaymentMethodFactory.swift +24 -24
- package/ios/PaymentOptionDisplayData+ReactNative.swift +4 -4
- package/ios/PaymentPassFinder.swift +9 -10
- package/ios/PaymentSheetAppearance.swift +137 -138
- package/ios/PushProvisioning/AddToWalletButtonManager.swift +2 -2
- package/ios/PushProvisioning/AddToWalletButtonView.swift +15 -17
- package/ios/PushProvisioning/PushProvisioningUtils.swift +11 -11
- package/ios/StripeContainerManager.swift +1 -1
- package/ios/StripeContainerView.swift +3 -3
- package/ios/StripeOnrampSdk.h +17 -0
- package/ios/StripeOnrampSdk.mm +158 -0
- package/ios/StripeSdk.mm +8 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/tianzhao.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/tianzhao.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
- package/ios/StripeSdkEmitter.swift +4 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +30 -25
- package/ios/StripeSdkImpl+Embedded.swift +11 -9
- package/ios/StripeSdkImpl+PaymentSheet.swift +36 -34
- package/ios/StripeSdkImpl.swift +913 -185
- package/ios/UIColorExtension.swift +72 -0
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/connect/Components.js +2 -0
- package/lib/commonjs/connect/Components.js.map +1 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js +2 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/commonjs/connect/EmbeddedComponent.js +19 -0
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -0
- package/lib/commonjs/connect/ModalCloseButton.js +2 -0
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -0
- package/lib/commonjs/connect/NavigationBar.js +2 -0
- package/lib/commonjs/connect/NavigationBar.js.map +1 -0
- package/lib/commonjs/connect/connectTypes.js +2 -0
- package/lib/commonjs/connect/connectTypes.js.map +1 -0
- package/lib/commonjs/events.js +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/hooks/useOnramp.js +2 -0
- package/lib/commonjs/hooks/useOnramp.js.map +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withStripe.js +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +2 -0
- package/lib/commonjs/specs/NativeNavigationBar.js.map +1 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/Onramp.js +2 -0
- package/lib/commonjs/types/Onramp.js.map +1 -0
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/connect/Components.js +2 -0
- package/lib/module/connect/Components.js.map +1 -0
- package/lib/module/connect/ConnectComponentsProvider.js +2 -0
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/module/connect/EmbeddedComponent.js +19 -0
- package/lib/module/connect/EmbeddedComponent.js.map +1 -0
- package/lib/module/connect/ModalCloseButton.js +2 -0
- package/lib/module/connect/ModalCloseButton.js.map +1 -0
- package/lib/module/connect/NavigationBar.js +2 -0
- package/lib/module/connect/NavigationBar.js.map +1 -0
- package/lib/module/connect/connectTypes.js +2 -0
- package/lib/module/connect/connectTypes.js.map +1 -0
- package/lib/module/events.js +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/hooks/useOnramp.js +2 -0
- package/lib/module/hooks/useOnramp.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withStripe.js +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js.map +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js.map +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/module/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/module/specs/NativeNavigationBar.js +2 -0
- package/lib/module/specs/NativeNavigationBar.js.map +1 -0
- package/lib/module/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/Onramp.js +2 -0
- package/lib/module/types/Onramp.js.map +1 -0
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
- package/lib/typescript/src/connect/Components.d.ts +23 -0
- package/lib/typescript/src/connect/Components.d.ts.map +1 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +22 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts +18 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts +7 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts.map +1 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts +8 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/connect/connectTypes.d.ts +464 -0
- package/lib/typescript/src/connect/connectTypes.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +4 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/helpers.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +158 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/plugin/withStripe.d.ts +15 -0
- package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts +14 -0
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts +11 -0
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +28 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/Errors.d.ts +5 -0
- package/lib/typescript/src/types/Errors.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +275 -0
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +7 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +25 -14
- package/src/components/StripeProvider.tsx +5 -0
- package/src/connect/Components.tsx +279 -0
- package/src/connect/ConnectComponentsProvider.tsx +93 -0
- package/src/connect/EmbeddedComponent.tsx +407 -0
- package/src/connect/ModalCloseButton.tsx +44 -0
- package/src/connect/NavigationBar.tsx +29 -0
- package/src/connect/connectTypes.ts +626 -0
- package/src/events.ts +23 -0
- package/src/hooks/useOnramp.tsx +334 -0
- package/src/index.tsx +13 -0
- package/src/plugin/withStripe.ts +104 -7
- package/src/specs/NativeConnectAccountOnboardingView.ts +19 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +5 -1
- package/src/specs/NativeNavigationBar.ts +16 -0
- package/src/specs/NativeOnrampSdkModule.ts +47 -0
- package/src/specs/NativeStripeSdkModule.ts +5 -0
- package/src/types/EmbeddedPaymentElement.tsx +24 -3
- package/src/types/Errors.ts +6 -0
- package/src/types/Onramp.ts +317 -0
- package/src/types/PaymentSheet.ts +7 -0
- package/src/types/index.ts +8 -0
- package/stripe-react-native.podspec +20 -7
|
@@ -16,7 +16,7 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
16
16
|
var overridesFetchSelectedPaymentOption: Bool
|
|
17
17
|
var overridesSetupIntentClientSecretForCustomerAttach: Bool
|
|
18
18
|
var stripeSdk: StripeSdkImpl
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
init(
|
|
21
21
|
fetchPaymentMethods: Bool,
|
|
22
22
|
attachPaymentMethod: Bool,
|
|
@@ -36,7 +36,7 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
36
36
|
self.overridesFetchSelectedPaymentOption = fetchSelectedPaymentOption
|
|
37
37
|
self.overridesSetupIntentClientSecretForCustomerAttach = setupIntentClientSecretForCustomerAttach
|
|
38
38
|
self.stripeSdk = stripeSdk
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
if let setupIntentClientSecret = setupIntentClientSecret {
|
|
41
41
|
super.init(
|
|
42
42
|
customerEphemeralKeyProvider: {
|
|
@@ -54,9 +54,9 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
override func fetchPaymentMethods() async throws -> [STPPaymentMethod] {
|
|
59
|
-
if
|
|
59
|
+
if self.overridesFetchPaymentMethods {
|
|
60
60
|
return await withCheckedContinuation({ continuation in
|
|
61
61
|
fetchPaymentMethods { paymentMethods in
|
|
62
62
|
continuation.resume(returning: paymentMethods)
|
|
@@ -66,9 +66,9 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
66
66
|
return try await super.fetchPaymentMethods()
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
override func attachPaymentMethod(_ paymentMethodId: String) async throws {
|
|
71
|
-
if
|
|
71
|
+
if self.overridesAttachPaymentMethod {
|
|
72
72
|
return await withCheckedContinuation({ continuation in
|
|
73
73
|
attachPaymentMethod(paymentMethodId) {
|
|
74
74
|
continuation.resume(returning: ())
|
|
@@ -78,9 +78,9 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
78
78
|
return try await super.attachPaymentMethod(paymentMethodId)
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
override func detachPaymentMethod(paymentMethodId: String) async throws {
|
|
83
|
-
if
|
|
83
|
+
if self.overridesDetachPaymentMethod {
|
|
84
84
|
return await withCheckedContinuation({ continuation in
|
|
85
85
|
detachPaymentMethod(paymentMethodId) {
|
|
86
86
|
continuation.resume(returning: ())
|
|
@@ -90,9 +90,9 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
90
90
|
return try await super.detachPaymentMethod(paymentMethodId: paymentMethodId)
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
override func setSelectedPaymentOption(paymentOption: CustomerPaymentOption?) async throws {
|
|
95
|
-
if
|
|
95
|
+
if self.overridesSetSelectedPaymentOption {
|
|
96
96
|
return await withCheckedContinuation({ continuation in
|
|
97
97
|
setSelectedPaymentOption(paymentOption) {
|
|
98
98
|
continuation.resume(returning: ())
|
|
@@ -102,9 +102,9 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
102
102
|
return try await super.setSelectedPaymentOption(paymentOption: paymentOption)
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
override func fetchSelectedPaymentOption() async throws -> CustomerPaymentOption? {
|
|
107
|
-
if
|
|
107
|
+
if self.overridesFetchSelectedPaymentOption {
|
|
108
108
|
return await withCheckedContinuation({ continuation in
|
|
109
109
|
fetchSelectedPaymentOption { paymentOption in
|
|
110
110
|
continuation.resume(returning: paymentOption)
|
|
@@ -114,9 +114,9 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
|
|
|
114
114
|
return try await super.fetchSelectedPaymentOption()
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
override func setupIntentClientSecretForCustomerAttach() async throws -> String {
|
|
119
|
-
if
|
|
119
|
+
if self.overridesSetupIntentClientSecretForCustomerAttach {
|
|
120
120
|
return await withCheckedContinuation({ continuation in
|
|
121
121
|
setupIntentClientSecretForCustomerAttach { clientSecret in
|
|
122
122
|
continuation.resume(returning: clientSecret)
|
|
@@ -135,35 +135,35 @@ extension ReactNativeCustomerAdapter {
|
|
|
135
135
|
self.stripeSdk.emitter?.emitOnCustomerAdapterFetchPaymentMethodsCallback()
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
func attachPaymentMethod(_ paymentMethodId: String, completion: @escaping () -> Void) {
|
|
140
140
|
DispatchQueue.main.async {
|
|
141
141
|
self.stripeSdk.attachPaymentMethodCallback = completion
|
|
142
142
|
self.stripeSdk.emitter?.emitOnCustomerAdapterAttachPaymentMethodCallback(["paymentMethodId": paymentMethodId])
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
|
|
146
146
|
func detachPaymentMethod(_ paymentMethodId: String, completion: @escaping () -> Void) {
|
|
147
147
|
DispatchQueue.main.async {
|
|
148
148
|
self.stripeSdk.detachPaymentMethodCallback = completion
|
|
149
149
|
self.stripeSdk.emitter?.emitOnCustomerAdapterDetachPaymentMethodCallback(["paymentMethodId": paymentMethodId])
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
func setSelectedPaymentOption(_ paymentOption: CustomerPaymentOption?, completion: @escaping () -> Void) {
|
|
154
154
|
DispatchQueue.main.async {
|
|
155
155
|
self.stripeSdk.setSelectedPaymentOptionCallback = completion
|
|
156
156
|
self.stripeSdk.emitter?.emitOnCustomerAdapterSetSelectedPaymentOptionCallback(["paymentOption": paymentOption?.value])
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
func fetchSelectedPaymentOption(completion: @escaping (CustomerPaymentOption?) -> Void) {
|
|
161
161
|
DispatchQueue.main.async {
|
|
162
162
|
self.stripeSdk.fetchSelectedPaymentOptionCallback = completion
|
|
163
163
|
self.stripeSdk.emitter?.emitOnCustomerAdapterFetchSelectedPaymentOptionCallback()
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
func setupIntentClientSecretForCustomerAttach(completion: @escaping (String) -> Void) {
|
|
168
168
|
DispatchQueue.main.async {
|
|
169
169
|
self.stripeSdk.setupIntentClientSecretForCustomerAttachCallback = completion
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
|
-
import UIKit
|
|
10
9
|
@_spi(EmbeddedPaymentElementPrivateBeta) import StripePaymentSheet
|
|
10
|
+
import UIKit
|
|
11
11
|
|
|
12
12
|
@objc(EmbeddedPaymentElementView)
|
|
13
13
|
class EmbeddedPaymentElementView: RCTViewManager {
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
override static func requiresMainQueueSetup() -> Bool {
|
|
16
16
|
return true
|
|
17
17
|
}
|
package/ios/Errors.swift
CHANGED
|
@@ -21,21 +21,21 @@ class Errors {
|
|
|
21
21
|
|
|
22
22
|
class func isPIClientSecretValid(clientSecret: String) -> Bool {
|
|
23
23
|
return (Errors.isPIClientSecretValidRegex?.numberOfMatches(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
in: clientSecret,
|
|
25
|
+
options: .anchored,
|
|
26
|
+
range: NSRange(location: 0, length: clientSecret.count))) == 1
|
|
27
27
|
}
|
|
28
28
|
class func isSetiClientSecretValid(clientSecret: String) -> Bool {
|
|
29
29
|
return (Errors.isSetiClientSecretValidRegex?.numberOfMatches(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
in: clientSecret,
|
|
31
|
+
options: .anchored,
|
|
32
|
+
range: NSRange(location: 0, length: clientSecret.count))) == 1
|
|
33
33
|
}
|
|
34
34
|
class func isEKClientSecretValid(clientSecret: String) -> Bool {
|
|
35
35
|
return (Errors.isEKClientSecretValidRegex?.numberOfMatches(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
in: clientSecret,
|
|
37
|
+
options: .anchored,
|
|
38
|
+
range: NSRange(location: 0, length: clientSecret.count))) == 1
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
class func createError (_ code: String, _ message: String?) -> NSDictionary {
|
|
@@ -45,12 +45,12 @@ class Errors {
|
|
|
45
45
|
"localizedMessage": message ?? NSNull(),
|
|
46
46
|
"declineCode": NSNull(),
|
|
47
47
|
"stripeErrorCode": NSNull(),
|
|
48
|
-
"type": NSNull()
|
|
48
|
+
"type": NSNull(),
|
|
49
49
|
]
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
return ["error": value]
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
class func createError (_ code: String, _ error: NSError?) -> NSDictionary {
|
|
55
55
|
let rootError = getRootError(error)
|
|
56
56
|
|
|
@@ -62,7 +62,7 @@ class Errors {
|
|
|
62
62
|
"stripeErrorCode": rootError?.userInfo[STPError.stripeErrorCodeKey] ?? NSNull(),
|
|
63
63
|
"type": rootError?.userInfo[STPError.stripeErrorTypeKey] ?? NSNull(),
|
|
64
64
|
]
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
return ["error": value]
|
|
67
67
|
}
|
|
68
68
|
class func createError (_ code: String, _ error: STPSetupIntentLastSetupError?) -> NSDictionary {
|
|
@@ -72,12 +72,12 @@ class Errors {
|
|
|
72
72
|
"localizedMessage": error?.message ?? NSNull(),
|
|
73
73
|
"declineCode": error?.declineCode ?? NSNull(),
|
|
74
74
|
"stripeErrorCode": error?.code ?? NSNull(),
|
|
75
|
-
"type": Mappers.mapFromSetupIntentLastPaymentErrorType(error?.type) ?? NSNull()
|
|
75
|
+
"type": Mappers.mapFromSetupIntentLastPaymentErrorType(error?.type) ?? NSNull(),
|
|
76
76
|
]
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
return ["error": value]
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
class func createError (_ code: String, _ error: STPPaymentIntentLastPaymentError?) -> NSDictionary {
|
|
82
82
|
let value: NSDictionary = [
|
|
83
83
|
"code": code,
|
|
@@ -85,20 +85,20 @@ class Errors {
|
|
|
85
85
|
"localizedMessage": error?.message ?? NSNull(),
|
|
86
86
|
"declineCode": error?.declineCode ?? NSNull(),
|
|
87
87
|
"stripeErrorCode": error?.code ?? NSNull(),
|
|
88
|
-
"type": Mappers.mapFromPaymentIntentLastPaymentErrorType(error?.type) ?? NSNull()
|
|
88
|
+
"type": Mappers.mapFromPaymentIntentLastPaymentErrorType(error?.type) ?? NSNull(),
|
|
89
89
|
]
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
return ["error": value]
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
class func createError(_ code: String, _ error: Error) -> NSDictionary {
|
|
95
95
|
if let stripeError = error as? StripeError {
|
|
96
96
|
return createError(code, NSError.stp_error(from: stripeError))
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
return createError(code, error as NSError?)
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
class func getRootError(_ error: NSError?) -> NSError? {
|
|
103
103
|
// Dig and find the underlying error, otherwise we'll throw errors like "Try again"
|
|
104
104
|
if let underlyingError = error?.userInfo[NSUnderlyingErrorKey] as? NSError {
|
|
@@ -106,7 +106,6 @@ class Errors {
|
|
|
106
106
|
}
|
|
107
107
|
return error
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
static let MISSING_INIT_ERROR = Errors.createError(ErrorType.Failed, "Stripe has not been initialized. Initialize Stripe in your app with the StripeProvider component or the initStripe method.")
|
|
111
111
|
}
|
|
112
|
-
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
|
-
import StripeFinancialConnections
|
|
10
9
|
import Stripe
|
|
10
|
+
import StripeFinancialConnections
|
|
11
11
|
|
|
12
12
|
class FinancialConnections {
|
|
13
13
|
|
|
@@ -17,26 +17,26 @@ class FinancialConnections {
|
|
|
17
17
|
configuration: FinancialConnectionsSheet.Configuration? = nil,
|
|
18
18
|
onEvent: ((FinancialConnectionsEvent) -> Void)? = nil,
|
|
19
19
|
resolve: @escaping RCTPromiseResolveBlock
|
|
20
|
-
)
|
|
20
|
+
) {
|
|
21
21
|
DispatchQueue.main.async {
|
|
22
22
|
let financialConnectionsSheet = FinancialConnectionsSheet(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
financialConnectionsSessionClientSecret: withClientSecret,
|
|
24
|
+
returnURL: returnURL,
|
|
25
|
+
configuration: configuration ?? .init()
|
|
26
26
|
)
|
|
27
27
|
financialConnectionsSheet.onEvent = onEvent
|
|
28
28
|
financialConnectionsSheet.present(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
|
|
30
|
+
completion: { result in
|
|
31
|
+
switch result {
|
|
32
|
+
case .completed(session: let session):
|
|
33
|
+
resolve([ "session": mapFromSessionResult(session) ])
|
|
34
|
+
case .canceled:
|
|
35
|
+
resolve(Errors.createError(ErrorType.Canceled, "The flow has been canceled."))
|
|
36
|
+
case .failed(let error):
|
|
37
|
+
resolve(Errors.createError(ErrorType.Failed, error))
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -46,31 +46,31 @@ class FinancialConnections {
|
|
|
46
46
|
configuration: FinancialConnectionsSheet.Configuration? = nil,
|
|
47
47
|
onEvent: ((FinancialConnectionsEvent) -> Void)? = nil,
|
|
48
48
|
resolve: @escaping RCTPromiseResolveBlock
|
|
49
|
-
)
|
|
49
|
+
) {
|
|
50
50
|
DispatchQueue.main.async {
|
|
51
51
|
let financialConnectionsSheet = FinancialConnectionsSheet(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
financialConnectionsSessionClientSecret: withClientSecret,
|
|
53
|
+
returnURL: returnURL,
|
|
54
|
+
configuration: configuration ?? .init()
|
|
55
55
|
)
|
|
56
56
|
financialConnectionsSheet.onEvent = onEvent
|
|
57
57
|
financialConnectionsSheet.presentForToken(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
|
|
59
|
+
completion: { result in
|
|
60
|
+
switch result {
|
|
61
|
+
case .completed(result: let result):
|
|
62
|
+
resolve(
|
|
63
|
+
[
|
|
64
|
+
"session": mapFromSessionResult(result.session),
|
|
65
|
+
"token": mapFromTokenResult(result.token),
|
|
66
|
+
]
|
|
67
|
+
)
|
|
68
|
+
case .canceled:
|
|
69
|
+
resolve(Errors.createError(ErrorType.Canceled, "The flow has been canceled."))
|
|
70
|
+
case .failed(let error):
|
|
71
|
+
resolve(Errors.createError(ErrorType.Failed, error))
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -81,7 +81,7 @@ class FinancialConnections {
|
|
|
81
81
|
"id": session.id,
|
|
82
82
|
"clientSecret": session.clientSecret,
|
|
83
83
|
"livemode": session.livemode,
|
|
84
|
-
"accounts": mapFromAccountsList(accounts: session.accounts)
|
|
84
|
+
"accounts": mapFromAccountsList(accounts: session.accounts),
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
|