@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
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
@_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(STP) @_spi(PaymentMethodOptionsSetupFutureUsagePreview) @_spi(CustomPaymentMethodsBeta) @_spi(ConfirmationTokensPublicPreview) import StripePaymentSheet
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
extension StripeSdkImpl {
|
|
13
12
|
internal func buildPaymentSheetConfiguration(
|
|
14
13
|
params: NSDictionary
|
|
@@ -30,7 +29,7 @@ extension StripeSdkImpl {
|
|
|
30
29
|
configuration.applePay = try ApplePayUtils.buildPaymentSheetApplePayConfig(
|
|
31
30
|
merchantIdentifier: self.merchantIdentifier,
|
|
32
31
|
merchantCountryCode: applePayParams["merchantCountryCode"] as? String,
|
|
33
|
-
paymentSummaryItems: applePayParams["cartItems"] as? [[String
|
|
32
|
+
paymentSummaryItems: applePayParams["cartItems"] as? [[String: Any]],
|
|
34
33
|
buttonType: applePayParams["buttonType"] as? NSNumber,
|
|
35
34
|
customHandlers: buildCustomerHandlersForPaymentSheet(applePayParams: applePayParams)
|
|
36
35
|
)
|
|
@@ -106,7 +105,7 @@ extension StripeSdkImpl {
|
|
|
106
105
|
if let customerEphemeralKeySecret, let customerClientSecret {
|
|
107
106
|
return(error: Errors.createError(ErrorType.Failed, "`customerEphemeralKeySecret` and `customerSessionClientSecret cannot both be set"), configuration: nil)
|
|
108
107
|
} else if let customerEphemeralKeySecret {
|
|
109
|
-
if
|
|
108
|
+
if !Errors.isEKClientSecretValid(clientSecret: customerEphemeralKeySecret) {
|
|
110
109
|
return(error: Errors.createError(ErrorType.Failed, "`customerEphemeralKeySecret` format does not match expected client secret formatting."), configuration: nil)
|
|
111
110
|
}
|
|
112
111
|
configuration.customer = .init(id: customerId, ephemeralKeySecret: customerEphemeralKeySecret)
|
|
@@ -115,7 +114,7 @@ extension StripeSdkImpl {
|
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
if let preferredNetworksAsInts = params["preferredNetworks"] as?
|
|
117
|
+
if let preferredNetworksAsInts = params["preferredNetworks"] as? [Int] {
|
|
119
118
|
configuration.preferredNetworks = preferredNetworksAsInts.map(Mappers.intToCardBrand).compactMap { $0 }
|
|
120
119
|
}
|
|
121
120
|
|
|
@@ -123,20 +122,20 @@ extension StripeSdkImpl {
|
|
|
123
122
|
configuration.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
if let paymentMethodOrder = params["paymentMethodOrder"] as?
|
|
125
|
+
if let paymentMethodOrder = params["paymentMethodOrder"] as? [String] {
|
|
127
126
|
configuration.paymentMethodOrder = paymentMethodOrder
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
switch params["paymentMethodLayout"] as? String? {
|
|
131
|
-
|
|
130
|
+
case "Horizontal":
|
|
132
131
|
configuration.paymentMethodLayout = .horizontal
|
|
133
|
-
|
|
132
|
+
case "Vertical":
|
|
134
133
|
configuration.paymentMethodLayout = .vertical
|
|
135
|
-
|
|
134
|
+
default:
|
|
136
135
|
configuration.paymentMethodLayout = .automatic
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
configuration.cardBrandAcceptance = computeCardBrandAcceptance(params: params)
|
|
138
|
+
configuration.cardBrandAcceptance = StripeSdkImpl.computeCardBrandAcceptance(params: params)
|
|
140
139
|
|
|
141
140
|
// Parse custom payment method configuration
|
|
142
141
|
if let customPaymentMethodConfig = params["customPaymentMethodConfiguration"] as? [String: Any] {
|
|
@@ -145,7 +144,7 @@ extension StripeSdkImpl {
|
|
|
145
144
|
sdkImpl: self
|
|
146
145
|
)
|
|
147
146
|
}
|
|
148
|
-
|
|
147
|
+
|
|
149
148
|
return (nil, configuration)
|
|
150
149
|
}
|
|
151
150
|
|
|
@@ -162,11 +161,11 @@ extension StripeSdkImpl {
|
|
|
162
161
|
resolve(Errors.createError(ErrorType.Failed, error as NSError))
|
|
163
162
|
case .success(let paymentSheetFlowController):
|
|
164
163
|
self.paymentSheetFlowController = paymentSheetFlowController
|
|
165
|
-
var result: NSDictionary?
|
|
164
|
+
var result: NSDictionary?
|
|
166
165
|
if let paymentOption = stripeSdk?.paymentSheetFlowController?.paymentOption {
|
|
167
166
|
result = [
|
|
168
167
|
"label": paymentOption.label,
|
|
169
|
-
"image": paymentOption.image.pngData()?.base64EncodedString() ?? ""
|
|
168
|
+
"image": paymentOption.image.pngData()?.base64EncodedString() ?? "",
|
|
170
169
|
]
|
|
171
170
|
}
|
|
172
171
|
resolve(Mappers.createResult("paymentOption", result))
|
|
@@ -174,7 +173,7 @@ extension StripeSdkImpl {
|
|
|
174
173
|
}
|
|
175
174
|
|
|
176
175
|
if let paymentIntentClientSecret = params["paymentIntentClientSecret"] as? String {
|
|
177
|
-
if
|
|
176
|
+
if !Errors.isPIClientSecretValid(clientSecret: paymentIntentClientSecret) {
|
|
178
177
|
resolve(Errors.createError(ErrorType.Failed, "`secret` format does not match expected client secret formatting."))
|
|
179
178
|
return
|
|
180
179
|
}
|
|
@@ -189,7 +188,7 @@ extension StripeSdkImpl {
|
|
|
189
188
|
resolve([])
|
|
190
189
|
}
|
|
191
190
|
} else if let setupIntentClientSecret = params["setupIntentClientSecret"] as? String {
|
|
192
|
-
if
|
|
191
|
+
if !Errors.isSetiClientSecretValid(clientSecret: setupIntentClientSecret) {
|
|
193
192
|
resolve(Errors.createError(ErrorType.Failed, "`secret` format does not match expected client secret formatting."))
|
|
194
193
|
return
|
|
195
194
|
}
|
|
@@ -228,7 +227,8 @@ extension StripeSdkImpl {
|
|
|
228
227
|
let intentConfig = buildIntentConfiguration(
|
|
229
228
|
modeParams: modeParams,
|
|
230
229
|
paymentMethodTypes: intentConfiguration["paymentMethodTypes"] as? [String],
|
|
231
|
-
|
|
230
|
+
onBehalfOf: intentConfiguration["onBehalfOf"] as? String,
|
|
231
|
+
captureMethod: StripeSdkImpl.mapCaptureMethod(captureMethodString),
|
|
232
232
|
useConfirmationTokenCallback: hasConfirmationTokenHandler
|
|
233
233
|
)
|
|
234
234
|
|
|
@@ -246,7 +246,7 @@ extension StripeSdkImpl {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
internal func computeCardBrandAcceptance(params: NSDictionary) -> PaymentSheet.CardBrandAcceptance {
|
|
249
|
+
internal static func computeCardBrandAcceptance(params: NSDictionary) -> PaymentSheet.CardBrandAcceptance {
|
|
250
250
|
if let cardBrandAcceptanceParams = params["cardBrandAcceptance"] as? NSDictionary {
|
|
251
251
|
if let filter = cardBrandAcceptanceParams["filter"] as? String {
|
|
252
252
|
switch filter {
|
|
@@ -271,7 +271,7 @@ extension StripeSdkImpl {
|
|
|
271
271
|
return .all
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
private func mapToCardBrandCategory(brand: String) -> PaymentSheet.CardBrandAcceptance.BrandCategory? {
|
|
274
|
+
private static func mapToCardBrandCategory(brand: String) -> PaymentSheet.CardBrandAcceptance.BrandCategory? {
|
|
275
275
|
switch brand {
|
|
276
276
|
case "visa":
|
|
277
277
|
return .visa
|
|
@@ -286,7 +286,7 @@ extension StripeSdkImpl {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
func mapCaptureMethod(_ captureMethod: String?) -> PaymentSheet.IntentConfiguration.CaptureMethod {
|
|
289
|
+
static func mapCaptureMethod(_ captureMethod: String?) -> PaymentSheet.IntentConfiguration.CaptureMethod {
|
|
290
290
|
if let captureMethod = captureMethod {
|
|
291
291
|
switch captureMethod {
|
|
292
292
|
case "Automatic": return PaymentSheet.IntentConfiguration.CaptureMethod.automatic
|
|
@@ -301,6 +301,7 @@ extension StripeSdkImpl {
|
|
|
301
301
|
func buildIntentConfiguration(
|
|
302
302
|
modeParams: NSDictionary,
|
|
303
303
|
paymentMethodTypes: [String]?,
|
|
304
|
+
onBehalfOf: String?,
|
|
304
305
|
captureMethod: PaymentSheet.IntentConfiguration.CaptureMethod,
|
|
305
306
|
useConfirmationTokenCallback: Bool
|
|
306
307
|
) -> PaymentSheet.IntentConfiguration {
|
|
@@ -309,9 +310,9 @@ extension StripeSdkImpl {
|
|
|
309
310
|
mode = PaymentSheet.IntentConfiguration.Mode.payment(
|
|
310
311
|
amount: amount,
|
|
311
312
|
currency: modeParams["currencyCode"] as? String ?? "",
|
|
312
|
-
setupFutureUsage: setupFutureUsageFromString(from: modeParams["setupFutureUsage"] as? String ?? ""),
|
|
313
|
+
setupFutureUsage: StripeSdkImpl.setupFutureUsageFromString(from: modeParams["setupFutureUsage"] as? String ?? ""),
|
|
313
314
|
captureMethod: captureMethod,
|
|
314
|
-
paymentMethodOptions: buildPaymentMethodOptions(paymentMethodOptionsParams: modeParams["paymentMethodOptions"] as? NSDictionary ?? [:])
|
|
315
|
+
paymentMethodOptions: StripeSdkImpl.buildPaymentMethodOptions(paymentMethodOptionsParams: modeParams["paymentMethodOptions"] as? NSDictionary ?? [:])
|
|
315
316
|
)
|
|
316
317
|
} else {
|
|
317
318
|
mode = PaymentSheet.IntentConfiguration.Mode.setup(
|
|
@@ -324,8 +325,9 @@ extension StripeSdkImpl {
|
|
|
324
325
|
return PaymentSheet.IntentConfiguration.init(
|
|
325
326
|
mode: mode,
|
|
326
327
|
paymentMethodTypes: paymentMethodTypes,
|
|
328
|
+
onBehalfOf: onBehalfOf,
|
|
327
329
|
confirmationTokenConfirmHandler: { confirmationToken in
|
|
328
|
-
return try await withCheckedThrowingContinuation { continuation in
|
|
330
|
+
return try await withCheckedThrowingContinuation { continuation in
|
|
329
331
|
self.paymentSheetConfirmationTokenIntentCreationCallback = { result in
|
|
330
332
|
switch result {
|
|
331
333
|
case .success(let clientSecret):
|
|
@@ -343,26 +345,27 @@ extension StripeSdkImpl {
|
|
|
343
345
|
return PaymentSheet.IntentConfiguration.init(
|
|
344
346
|
mode: mode,
|
|
345
347
|
paymentMethodTypes: paymentMethodTypes,
|
|
348
|
+
onBehalfOf: onBehalfOf,
|
|
346
349
|
confirmHandler: { paymentMethod, shouldSavePaymentMethod, intentCreationCallback in
|
|
347
350
|
self.paymentSheetIntentCreationCallback = intentCreationCallback
|
|
348
351
|
self.emitter?.emitOnConfirmHandlerCallback([
|
|
349
352
|
"paymentMethod": Mappers.mapFromPaymentMethod(paymentMethod) ?? NSNull(),
|
|
350
|
-
"shouldSavePaymentMethod": shouldSavePaymentMethod
|
|
353
|
+
"shouldSavePaymentMethod": shouldSavePaymentMethod,
|
|
351
354
|
])
|
|
352
355
|
})
|
|
353
356
|
}
|
|
354
357
|
}
|
|
355
|
-
|
|
356
|
-
func buildPaymentMethodOptions(paymentMethodOptionsParams: NSDictionary) -> PaymentSheet.IntentConfiguration.Mode.PaymentMethodOptions? {
|
|
358
|
+
|
|
359
|
+
static func buildPaymentMethodOptions(paymentMethodOptionsParams: NSDictionary) -> PaymentSheet.IntentConfiguration.Mode.PaymentMethodOptions? {
|
|
357
360
|
if let sfuDictionary = paymentMethodOptionsParams["setupFutureUsageValues"] as? NSDictionary {
|
|
358
361
|
var setupFutureUsageValues: [STPPaymentMethodType: PaymentSheet.IntentConfiguration.SetupFutureUsage] = [:]
|
|
359
|
-
|
|
362
|
+
|
|
360
363
|
for (paymentMethodCode, sfuValue) in sfuDictionary {
|
|
361
364
|
if let paymentMethodCode = paymentMethodCode as? String,
|
|
362
365
|
let sfuString = sfuValue as? String {
|
|
363
366
|
let setupFutureUsage = setupFutureUsageFromString(from: sfuString)
|
|
364
367
|
let paymentMethodType = STPPaymentMethodType.fromIdentifier(paymentMethodCode)
|
|
365
|
-
|
|
368
|
+
|
|
366
369
|
if let setupFutureUsage = setupFutureUsage {
|
|
367
370
|
if paymentMethodType != .unknown {
|
|
368
371
|
setupFutureUsageValues[paymentMethodType] = setupFutureUsage
|
|
@@ -370,7 +373,7 @@ extension StripeSdkImpl {
|
|
|
370
373
|
}
|
|
371
374
|
}
|
|
372
375
|
}
|
|
373
|
-
|
|
376
|
+
|
|
374
377
|
if !setupFutureUsageValues.isEmpty {
|
|
375
378
|
return PaymentSheet.IntentConfiguration.Mode.PaymentMethodOptions(setupFutureUsageValues: setupFutureUsageValues)
|
|
376
379
|
}
|
|
@@ -378,8 +381,8 @@ extension StripeSdkImpl {
|
|
|
378
381
|
|
|
379
382
|
return nil
|
|
380
383
|
}
|
|
381
|
-
|
|
382
|
-
func setupFutureUsageFromString(from string: String) -> PaymentSheet.IntentConfiguration.SetupFutureUsage? {
|
|
384
|
+
|
|
385
|
+
static func setupFutureUsageFromString(from string: String) -> PaymentSheet.IntentConfiguration.SetupFutureUsage? {
|
|
383
386
|
switch string {
|
|
384
387
|
case "OnSession":
|
|
385
388
|
return PaymentSheet.IntentConfiguration.SetupFutureUsage.onSession
|
|
@@ -393,7 +396,7 @@ extension StripeSdkImpl {
|
|
|
393
396
|
}
|
|
394
397
|
|
|
395
398
|
func buildCustomerHandlersForPaymentSheet(applePayParams: NSDictionary) -> PaymentSheet.ApplePayConfiguration.Handlers? {
|
|
396
|
-
if
|
|
399
|
+
if applePayParams["request"] == nil {
|
|
397
400
|
return nil
|
|
398
401
|
}
|
|
399
402
|
let authorizationResultHandler: PaymentSheet.ApplePayConfiguration.Handlers.AuthorizationResultHandler? = {
|
|
@@ -457,7 +460,7 @@ extension StripeSdkImpl {
|
|
|
457
460
|
return .automatic
|
|
458
461
|
}
|
|
459
462
|
}
|
|
460
|
-
|
|
463
|
+
|
|
461
464
|
// MARK: - Common Custom Payment Method Helper
|
|
462
465
|
|
|
463
466
|
// Simple data structure for parsed custom payment method data
|
|
@@ -545,7 +548,7 @@ extension StripeSdkImpl {
|
|
|
545
548
|
let billingDetailsDict = Mappers.mapFromBillingDetails(billingDetails: billingDetails)
|
|
546
549
|
let payload: [String: Any] = [
|
|
547
550
|
"customPaymentMethod": customPaymentMethodDict,
|
|
548
|
-
"billingDetails": billingDetailsDict
|
|
551
|
+
"billingDetails": billingDetailsDict,
|
|
549
552
|
]
|
|
550
553
|
|
|
551
554
|
// Use async/await with continuation instead of blocking semaphore
|
|
@@ -555,11 +558,10 @@ extension StripeSdkImpl {
|
|
|
555
558
|
sdkImpl?.customPaymentMethodResultCallback = nil
|
|
556
559
|
continuation.resume(returning: result)
|
|
557
560
|
}
|
|
558
|
-
|
|
561
|
+
|
|
559
562
|
// Emit event to JavaScript
|
|
560
563
|
sdkImpl?.emitter?.emitOnCustomPaymentMethodConfirmHandlerCallback(payload)
|
|
561
564
|
}
|
|
562
565
|
}
|
|
563
566
|
}
|
|
564
567
|
}
|
|
565
|
-
|