@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
package/ios/Mappers.swift
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import Contacts
|
|
1
2
|
import Stripe
|
|
2
|
-
import StripePaymentSheet
|
|
3
3
|
@_spi(ConfirmationTokensPublicPreview) import StripePayments
|
|
4
|
-
|
|
4
|
+
#if canImport(StripeCryptoOnramp)
|
|
5
|
+
@_spi(STP) import StripeCryptoOnramp
|
|
6
|
+
@_spi(STP) import StripePaymentSheet
|
|
7
|
+
#else
|
|
8
|
+
import StripePaymentSheet
|
|
9
|
+
#endif
|
|
5
10
|
|
|
6
11
|
class Mappers {
|
|
7
12
|
class func createResult(_ key: String, _ value: NSDictionary?, additionalFields: [String: Any]? = nil) -> NSDictionary {
|
|
@@ -70,13 +75,13 @@ class Mappers {
|
|
|
70
75
|
"routingNumber": bankAccount.routingNumber ?? NSNull(),
|
|
71
76
|
"status": mapFromBankAccountStatus(bankAccount.status) ?? NSNull(),
|
|
72
77
|
"fingerprint": bankAccount.fingerprint ?? NSNull(),
|
|
73
|
-
"last4": bankAccount.last4 ?? NSNull()
|
|
78
|
+
"last4": bankAccount.last4 ?? NSNull(),
|
|
74
79
|
]
|
|
75
80
|
return result
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
class func mapFromCard(_ card: STPCard?) -> NSDictionary? {
|
|
79
|
-
if
|
|
84
|
+
if card == nil {
|
|
80
85
|
return nil
|
|
81
86
|
}
|
|
82
87
|
let cardMap: NSDictionary = [
|
|
@@ -163,7 +168,7 @@ class Mappers {
|
|
|
163
168
|
class func mapToShippingMethods(shippingMethods: NSArray?) -> [PKShippingMethod] {
|
|
164
169
|
var shippingMethodsList: [PKShippingMethod] = []
|
|
165
170
|
|
|
166
|
-
if let methods = shippingMethods as? [[String
|
|
171
|
+
if let methods = shippingMethods as? [[String: Any]] {
|
|
167
172
|
for method in methods {
|
|
168
173
|
let label = method["label"] as? String ?? ""
|
|
169
174
|
let amount = NSDecimalNumber(string: method["amount"] as? String ?? "")
|
|
@@ -190,7 +195,7 @@ class Mappers {
|
|
|
190
195
|
"identifier": shippingMethod.identifier ?? "",
|
|
191
196
|
"amount": shippingMethod.amount.stringValue,
|
|
192
197
|
"isPending": shippingMethod.type == .pending,
|
|
193
|
-
"label": shippingMethod.label
|
|
198
|
+
"label": shippingMethod.label,
|
|
194
199
|
]
|
|
195
200
|
|
|
196
201
|
if #available(iOS 15.0, *) {
|
|
@@ -237,21 +242,21 @@ class Mappers {
|
|
|
237
242
|
|
|
238
243
|
class func mapAddressFields(_ addressFields: [String]) -> [String] {
|
|
239
244
|
return addressFields.map {
|
|
240
|
-
if
|
|
245
|
+
if $0 == "street" {
|
|
241
246
|
return CNPostalAddressStreetKey
|
|
242
|
-
} else if
|
|
247
|
+
} else if $0 == "city" {
|
|
243
248
|
return CNPostalAddressCityKey
|
|
244
|
-
} else if
|
|
249
|
+
} else if $0 == "subAdministrativeArea" {
|
|
245
250
|
return CNPostalAddressSubAdministrativeAreaKey
|
|
246
|
-
} else if
|
|
251
|
+
} else if $0 == "state" {
|
|
247
252
|
return CNPostalAddressStateKey
|
|
248
|
-
} else if
|
|
253
|
+
} else if $0 == "postalCode" {
|
|
249
254
|
return CNPostalAddressPostalCodeKey
|
|
250
|
-
} else if
|
|
255
|
+
} else if $0 == "country" {
|
|
251
256
|
return CNPostalAddressCountryKey
|
|
252
|
-
} else if
|
|
257
|
+
} else if $0 == "countryCode" {
|
|
253
258
|
return CNPostalAddressISOCountryCodeKey
|
|
254
|
-
} else if
|
|
259
|
+
} else if $0 == "subLocality" {
|
|
255
260
|
return CNPostalAddressSubLocalityKey
|
|
256
261
|
}
|
|
257
262
|
return ""
|
|
@@ -369,7 +374,7 @@ class Mappers {
|
|
|
369
374
|
"state": address.state ?? NSNull(),
|
|
370
375
|
"country": address.country ?? NSNull(),
|
|
371
376
|
"line1": address.line1 ?? NSNull(),
|
|
372
|
-
"line2":address.line2 ?? NSNull(),
|
|
377
|
+
"line2": address.line2 ?? NSNull(),
|
|
373
378
|
"postalCode": address.postalCode ?? NSNull(),
|
|
374
379
|
]
|
|
375
380
|
}
|
|
@@ -410,7 +415,7 @@ class Mappers {
|
|
|
410
415
|
"message": lastPaymentError.message ?? NSNull(),
|
|
411
416
|
"type": mapFromPaymentIntentLastPaymentErrorType(lastPaymentError.type) ?? NSNull(),
|
|
412
417
|
"declineCode": lastPaymentError.declineCode ?? NSNull(),
|
|
413
|
-
"paymentMethod": mapFromPaymentMethod(lastPaymentError.paymentMethod) ?? NSNull()
|
|
418
|
+
"paymentMethod": mapFromPaymentMethod(lastPaymentError.paymentMethod) ?? NSNull(),
|
|
414
419
|
]
|
|
415
420
|
|
|
416
421
|
intent.setValue(paymentError, forKey: "lastPaymentError")
|
|
@@ -424,7 +429,7 @@ class Mappers {
|
|
|
424
429
|
intent.setValue(convertDateToUnixTimestampMilliseconds(date: canceledAt), forKey: "canceledAt")
|
|
425
430
|
}
|
|
426
431
|
|
|
427
|
-
return intent
|
|
432
|
+
return intent
|
|
428
433
|
}
|
|
429
434
|
|
|
430
435
|
class func mapNextAction(nextAction: STPIntentAction?) -> NSDictionary? {
|
|
@@ -440,12 +445,12 @@ class Mappers {
|
|
|
440
445
|
case .redirectToURL:
|
|
441
446
|
return [
|
|
442
447
|
"type": "urlRedirect",
|
|
443
|
-
"redirectUrl": it.redirectToURL?.url.absoluteString ?? NSNull()
|
|
448
|
+
"redirectUrl": it.redirectToURL?.url.absoluteString ?? NSNull(),
|
|
444
449
|
]
|
|
445
450
|
case .weChatPayRedirectToApp:
|
|
446
451
|
return [
|
|
447
452
|
"type": "weChatRedirect",
|
|
448
|
-
"redirectUrl": it.weChatPayRedirectToApp?.nativeURL?.absoluteString ?? NSNull()
|
|
453
|
+
"redirectUrl": it.weChatPayRedirectToApp?.nativeURL?.absoluteString ?? NSNull(),
|
|
449
454
|
]
|
|
450
455
|
case .alipayHandleRedirect:
|
|
451
456
|
return [
|
|
@@ -610,7 +615,7 @@ class Mappers {
|
|
|
610
615
|
if let brand = brand {
|
|
611
616
|
switch brand {
|
|
612
617
|
case "Visa": return STPCardBrand.visa
|
|
613
|
-
case "AmericanExpress"
|
|
618
|
+
case "AmericanExpress": return STPCardBrand.amex
|
|
614
619
|
case "MasterCard": return STPCardBrand.mastercard
|
|
615
620
|
case "Discover": return STPCardBrand.discover
|
|
616
621
|
case "JCB": return STPCardBrand.JCB
|
|
@@ -638,7 +643,7 @@ class Mappers {
|
|
|
638
643
|
"preferredNetwork": paymentMethod.card?.networks?.preferred ?? NSNull(),
|
|
639
644
|
"availableNetworks": paymentMethod.card?.networks?.available ?? NSNull(),
|
|
640
645
|
"threeDSecureUsage": [
|
|
641
|
-
|
|
646
|
+
"isSupported": paymentMethod.card?.threeDSecureUsage?.supported ?? false
|
|
642
647
|
],
|
|
643
648
|
]
|
|
644
649
|
|
|
@@ -651,12 +656,12 @@ class Mappers {
|
|
|
651
656
|
let bacsDebit: NSDictionary = [
|
|
652
657
|
"fingerprint": paymentMethod.bacsDebit?.fingerprint ?? NSNull(),
|
|
653
658
|
"last4": paymentMethod.bacsDebit?.last4 ?? NSNull(),
|
|
654
|
-
"sortCode": paymentMethod.bacsDebit?.sortCode ?? NSNull()
|
|
659
|
+
"sortCode": paymentMethod.bacsDebit?.sortCode ?? NSNull(),
|
|
655
660
|
]
|
|
656
661
|
let auBECSDebit: NSDictionary = [
|
|
657
662
|
"bsbNumber": paymentMethod.auBECSDebit?.bsbNumber ?? NSNull(),
|
|
658
663
|
"fingerprint": paymentMethod.auBECSDebit?.fingerprint ?? NSNull(),
|
|
659
|
-
"last4": paymentMethod.auBECSDebit?.last4 ?? NSNull()
|
|
664
|
+
"last4": paymentMethod.auBECSDebit?.last4 ?? NSNull(),
|
|
660
665
|
]
|
|
661
666
|
let USBankAccount: NSDictionary = [
|
|
662
667
|
"routingNumber": paymentMethod.usBankAccount?.routingNumber ?? NSNull(),
|
|
@@ -678,7 +683,7 @@ class Mappers {
|
|
|
678
683
|
"Card": card,
|
|
679
684
|
"Ideal": [
|
|
680
685
|
"bankIdentifierCode": paymentMethod.iDEAL?.bankIdentifierCode ?? "",
|
|
681
|
-
"bankName": paymentMethod.iDEAL?.bankName ?? ""
|
|
686
|
+
"bankName": paymentMethod.iDEAL?.bankName ?? "",
|
|
682
687
|
],
|
|
683
688
|
"Fpx": [
|
|
684
689
|
"bank": paymentMethod.fpx?.bankIdentifierCode ?? "",
|
|
@@ -689,7 +694,7 @@ class Mappers {
|
|
|
689
694
|
"Upi": [
|
|
690
695
|
"vpa": paymentMethod.upi?.vpa
|
|
691
696
|
],
|
|
692
|
-
"USBankAccount": USBankAccount
|
|
697
|
+
"USBankAccount": USBankAccount,
|
|
693
698
|
]
|
|
694
699
|
return method
|
|
695
700
|
}
|
|
@@ -699,18 +704,18 @@ class Mappers {
|
|
|
699
704
|
return nil
|
|
700
705
|
}
|
|
701
706
|
|
|
702
|
-
var paymentMethodPreview: NSDictionary?
|
|
707
|
+
var paymentMethodPreview: NSDictionary?
|
|
703
708
|
if let preview = confirmationToken.paymentMethodPreview {
|
|
704
709
|
paymentMethodPreview = [
|
|
705
710
|
"type": Mappers.mapPaymentMethodType(type: preview.type),
|
|
706
711
|
"billingDetails": Mappers.mapFromBillingDetails(billingDetails: preview.billingDetails),
|
|
707
712
|
"allowRedisplay": mapFromAllowRedisplay(allowRedisplay: preview.allowRedisplay) ?? NSNull(),
|
|
708
713
|
"customerId": preview.customerId ?? NSNull(),
|
|
709
|
-
"allResponseFields": preview.allResponseFields
|
|
714
|
+
"allResponseFields": preview.allResponseFields,
|
|
710
715
|
]
|
|
711
716
|
}
|
|
712
717
|
|
|
713
|
-
var shipping: NSDictionary?
|
|
718
|
+
var shipping: NSDictionary?
|
|
714
719
|
if let shippingDetails = confirmationToken.shipping {
|
|
715
720
|
var addressDetails: NSDictionary = [:]
|
|
716
721
|
if let address = shippingDetails.address {
|
|
@@ -726,7 +731,7 @@ class Mappers {
|
|
|
726
731
|
shipping = [
|
|
727
732
|
"address": addressDetails,
|
|
728
733
|
"name": shippingDetails.name ?? NSNull(),
|
|
729
|
-
"phone": shippingDetails.phone ?? NSNull()
|
|
734
|
+
"phone": shippingDetails.phone ?? NSNull(),
|
|
730
735
|
]
|
|
731
736
|
}
|
|
732
737
|
|
|
@@ -741,7 +746,7 @@ class Mappers {
|
|
|
741
746
|
"setupFutureUsage": mapFromSetupFutureUsage(setupFutureUsage: confirmationToken.setupFutureUsage) ?? NSNull(),
|
|
742
747
|
"paymentMethodPreview": paymentMethodPreview ?? NSNull(),
|
|
743
748
|
"shipping": shipping ?? NSNull(),
|
|
744
|
-
"allResponseFields": confirmationToken.allResponseFields
|
|
749
|
+
"allResponseFields": confirmationToken.allResponseFields,
|
|
745
750
|
]
|
|
746
751
|
return token
|
|
747
752
|
}
|
|
@@ -835,7 +840,6 @@ class Mappers {
|
|
|
835
840
|
"nextAction": mapNextAction(nextAction: setupIntent.nextAction) ?? NSNull(),
|
|
836
841
|
]
|
|
837
842
|
|
|
838
|
-
|
|
839
843
|
let types = setupIntent.paymentMethodTypes.map {
|
|
840
844
|
mapPaymentMethodType(type: $0)
|
|
841
845
|
}
|
|
@@ -849,7 +853,7 @@ class Mappers {
|
|
|
849
853
|
"message": lastSetupError.message ?? NSNull(),
|
|
850
854
|
"type": mapFromSetupIntentLastPaymentErrorType(lastSetupError.type) ?? NSNull(),
|
|
851
855
|
"declineCode": lastSetupError.declineCode ?? NSNull(),
|
|
852
|
-
"paymentMethod": mapFromPaymentMethod(lastSetupError.paymentMethod) ?? NSNull()
|
|
856
|
+
"paymentMethod": mapFromPaymentMethod(lastSetupError.paymentMethod) ?? NSNull(),
|
|
853
857
|
]
|
|
854
858
|
intent.setValue(setupError, forKey: "lastSetupError")
|
|
855
859
|
}
|
|
@@ -876,7 +880,7 @@ class Mappers {
|
|
|
876
880
|
|
|
877
881
|
class func mapUICustomization(_ params: NSDictionary) -> STPThreeDSUICustomization {
|
|
878
882
|
let uiCustomization = STPThreeDSUICustomization()
|
|
879
|
-
if let labelSettings = params["label"] as?
|
|
883
|
+
if let labelSettings = params["label"] as? [String: Any?] {
|
|
880
884
|
if let headingTextColor = labelSettings["headingTextColor"] as? String {
|
|
881
885
|
uiCustomization.labelCustomization.headingTextColor = UIColor(hexString: headingTextColor)
|
|
882
886
|
}
|
|
@@ -891,7 +895,7 @@ class Mappers {
|
|
|
891
895
|
}
|
|
892
896
|
}
|
|
893
897
|
|
|
894
|
-
if let navigationBarSettings = params["navigationBar"] as?
|
|
898
|
+
if let navigationBarSettings = params["navigationBar"] as? [String: Any?] {
|
|
895
899
|
if let barTintColor = navigationBarSettings["barTintColor"] as? String {
|
|
896
900
|
uiCustomization.navigationBarCustomization.barTintColor = UIColor(hexString: barTintColor)
|
|
897
901
|
}
|
|
@@ -915,7 +919,7 @@ class Mappers {
|
|
|
915
919
|
}
|
|
916
920
|
}
|
|
917
921
|
|
|
918
|
-
if let textFieldSettings = params["textField"] as?
|
|
922
|
+
if let textFieldSettings = params["textField"] as? [String: Any?] {
|
|
919
923
|
if let borderColor = textFieldSettings["borderColor"] as? String {
|
|
920
924
|
uiCustomization.textFieldCustomization.borderColor = UIColor(hexString: borderColor)
|
|
921
925
|
}
|
|
@@ -933,7 +937,7 @@ class Mappers {
|
|
|
933
937
|
}
|
|
934
938
|
}
|
|
935
939
|
|
|
936
|
-
if let footerSettings = params["footer"] as?
|
|
940
|
+
if let footerSettings = params["footer"] as? [String: Any?] {
|
|
937
941
|
if let backgroundColor = footerSettings["backgroundColor"] as? String {
|
|
938
942
|
uiCustomization.footerCustomization.backgroundColor = UIColor(hexString: backgroundColor)
|
|
939
943
|
}
|
|
@@ -948,7 +952,7 @@ class Mappers {
|
|
|
948
952
|
}
|
|
949
953
|
}
|
|
950
954
|
|
|
951
|
-
if let submitButtonSettings = params["submitButton"] as?
|
|
955
|
+
if let submitButtonSettings = params["submitButton"] as? [String: Any?] {
|
|
952
956
|
let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.submit)
|
|
953
957
|
|
|
954
958
|
if let backgroundColor = submitButtonSettings["backgroundColor"] as? String {
|
|
@@ -967,7 +971,7 @@ class Mappers {
|
|
|
967
971
|
uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.submit)
|
|
968
972
|
}
|
|
969
973
|
|
|
970
|
-
if let submitButtonSettings = params["cancelButton"] as?
|
|
974
|
+
if let submitButtonSettings = params["cancelButton"] as? [String: Any?] {
|
|
971
975
|
let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.cancel)
|
|
972
976
|
|
|
973
977
|
if let backgroundColor = submitButtonSettings["backgroundColor"] as? String {
|
|
@@ -986,7 +990,7 @@ class Mappers {
|
|
|
986
990
|
uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.cancel)
|
|
987
991
|
}
|
|
988
992
|
|
|
989
|
-
if let submitButtonSettings = params["continueButton"] as?
|
|
993
|
+
if let submitButtonSettings = params["continueButton"] as? [String: Any?] {
|
|
990
994
|
let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.continue)
|
|
991
995
|
|
|
992
996
|
if let backgroundColor = submitButtonSettings["backgroundColor"] as? String {
|
|
@@ -1005,7 +1009,7 @@ class Mappers {
|
|
|
1005
1009
|
uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.continue)
|
|
1006
1010
|
}
|
|
1007
1011
|
|
|
1008
|
-
if let submitButtonSettings = params["nextButton"] as?
|
|
1012
|
+
if let submitButtonSettings = params["nextButton"] as? [String: Any?] {
|
|
1009
1013
|
let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.next)
|
|
1010
1014
|
|
|
1011
1015
|
if let backgroundColor = submitButtonSettings["backgroundColor"] as? String {
|
|
@@ -1024,7 +1028,7 @@ class Mappers {
|
|
|
1024
1028
|
uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.next)
|
|
1025
1029
|
}
|
|
1026
1030
|
|
|
1027
|
-
if let submitButtonSettings = params["resendButton"] as?
|
|
1031
|
+
if let submitButtonSettings = params["resendButton"] as? [String: Any?] {
|
|
1028
1032
|
let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.resend)
|
|
1029
1033
|
|
|
1030
1034
|
if let backgroundColor = submitButtonSettings["backgroundColor"] as? String {
|
|
@@ -1047,7 +1051,6 @@ class Mappers {
|
|
|
1047
1051
|
uiCustomization.backgroundColor = UIColor(hexString: backgroundColor)
|
|
1048
1052
|
}
|
|
1049
1053
|
|
|
1050
|
-
|
|
1051
1054
|
return uiCustomization
|
|
1052
1055
|
}
|
|
1053
1056
|
|
|
@@ -1059,7 +1062,6 @@ class Mappers {
|
|
|
1059
1062
|
return nil
|
|
1060
1063
|
}
|
|
1061
1064
|
|
|
1062
|
-
|
|
1063
1065
|
class func mapFromCardValidationState(state: STPCardValidationState?) -> String {
|
|
1064
1066
|
if let state = state {
|
|
1065
1067
|
switch state {
|
|
@@ -1074,7 +1076,7 @@ class Mappers {
|
|
|
1074
1076
|
|
|
1075
1077
|
class func mapToPKAddPassButtonStyle(style: String?) -> PKAddPassButtonStyle {
|
|
1076
1078
|
if let style = style {
|
|
1077
|
-
if
|
|
1079
|
+
if style == "onDarkBackground" {
|
|
1078
1080
|
return .blackOutline
|
|
1079
1081
|
}
|
|
1080
1082
|
}
|
|
@@ -1084,9 +1086,9 @@ class Mappers {
|
|
|
1084
1086
|
class func mapFromUSBankAccountHolderType(type: STPPaymentMethodUSBankAccountHolderType?) -> String {
|
|
1085
1087
|
if let type = type {
|
|
1086
1088
|
switch type {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1089
|
+
case STPPaymentMethodUSBankAccountHolderType.company: return "Company"
|
|
1090
|
+
case STPPaymentMethodUSBankAccountHolderType.individual: return "Individual"
|
|
1091
|
+
case STPPaymentMethodUSBankAccountHolderType.unknown: return "Unknown"
|
|
1090
1092
|
}
|
|
1091
1093
|
}
|
|
1092
1094
|
return "Unknown"
|
|
@@ -1094,18 +1096,18 @@ class Mappers {
|
|
|
1094
1096
|
|
|
1095
1097
|
class func mapToUSBankAccountHolderType(type: String?) -> STPPaymentMethodUSBankAccountHolderType {
|
|
1096
1098
|
switch type {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1099
|
+
case "Company": return STPPaymentMethodUSBankAccountHolderType.company
|
|
1100
|
+
case "Individual": return STPPaymentMethodUSBankAccountHolderType.individual
|
|
1101
|
+
default: return STPPaymentMethodUSBankAccountHolderType.individual
|
|
1100
1102
|
}
|
|
1101
1103
|
}
|
|
1102
1104
|
|
|
1103
1105
|
class func mapFromUSBankAccountType(type: STPPaymentMethodUSBankAccountType?) -> String {
|
|
1104
1106
|
if let type = type {
|
|
1105
1107
|
switch type {
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1108
|
+
case STPPaymentMethodUSBankAccountType.savings: return "Savings"
|
|
1109
|
+
case STPPaymentMethodUSBankAccountType.checking: return "Checking"
|
|
1110
|
+
case STPPaymentMethodUSBankAccountType.unknown: return "Unknown"
|
|
1109
1111
|
}
|
|
1110
1112
|
}
|
|
1111
1113
|
return "Unknown"
|
|
@@ -1113,9 +1115,9 @@ class Mappers {
|
|
|
1113
1115
|
|
|
1114
1116
|
class func mapToUSBankAccountType(type: String?) -> STPPaymentMethodUSBankAccountType {
|
|
1115
1117
|
switch type {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1118
|
+
case "Savings": return STPPaymentMethodUSBankAccountType.savings
|
|
1119
|
+
case "Checking": return STPPaymentMethodUSBankAccountType.checking
|
|
1120
|
+
default: return STPPaymentMethodUSBankAccountType.checking
|
|
1119
1121
|
}
|
|
1120
1122
|
}
|
|
1121
1123
|
|
|
@@ -1145,25 +1147,162 @@ class Mappers {
|
|
|
1145
1147
|
}
|
|
1146
1148
|
|
|
1147
1149
|
class func financialConnectionsEventToMap(_ event: FinancialConnectionsEvent) -> [String: Any] {
|
|
1148
|
-
|
|
1150
|
+
var metadata: [String: Any] = [:]
|
|
1149
1151
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1152
|
+
if let manualEntry = event.metadata.manualEntry {
|
|
1153
|
+
metadata["manualEntry"] = manualEntry
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
if let institutionName = event.metadata.institutionName {
|
|
1157
|
+
metadata["institutionName"] = institutionName
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
if let errorCode = event.metadata.errorCode {
|
|
1161
|
+
metadata["errorCode"] = errorCode.rawValue
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
let mappedEvent: [String: Any] = [
|
|
1165
|
+
"name": event.name.rawValue,
|
|
1166
|
+
"metadata": metadata,
|
|
1167
|
+
]
|
|
1168
|
+
|
|
1169
|
+
return mappedEvent
|
|
1170
|
+
}
|
|
1153
1171
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1172
|
+
#if canImport(StripeCryptoOnramp)
|
|
1173
|
+
class func mapToLinkAppearance(_ params: [String: Any?]) -> LinkAppearance {
|
|
1174
|
+
let darkColors = params["darkColors"] as? [String: Any?]
|
|
1175
|
+
let lightColors = params["lightColors"] as? [String: Any?]
|
|
1157
1176
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1177
|
+
let darkPrimaryHex = darkColors?["primary"] as? String
|
|
1178
|
+
let lightPrimaryHex = lightColors?["primary"] as? String
|
|
1179
|
+
let darkSelectedBorderHex = darkColors?["borderSelected"] as? String
|
|
1180
|
+
let lightSelectedBorderHex = lightColors?["borderSelected"] as? String
|
|
1181
|
+
|
|
1182
|
+
let darkPrimary = darkPrimaryHex.flatMap { UIColor(hexString: $0) }
|
|
1183
|
+
let lightPrimary = lightPrimaryHex.flatMap { UIColor(hexString: $0) }
|
|
1184
|
+
|
|
1185
|
+
let darkSelectedBorder = darkSelectedBorderHex.flatMap { UIColor(hexString: $0) }
|
|
1186
|
+
let lightSelectedBorder = lightSelectedBorderHex.flatMap { UIColor(hexString: $0) }
|
|
1187
|
+
|
|
1188
|
+
let primary: UIColor? = if let darkPrimary, let lightPrimary {
|
|
1189
|
+
UIColor { trait in
|
|
1190
|
+
trait.userInterfaceStyle == .dark ? darkPrimary : lightPrimary
|
|
1191
|
+
}
|
|
1192
|
+
} else {
|
|
1193
|
+
darkPrimary ?? lightPrimary
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
let selectedBorder: UIColor? = if let darkSelectedBorder, let lightSelectedBorder {
|
|
1197
|
+
UIColor { trait in
|
|
1198
|
+
trait.userInterfaceStyle == .dark ? darkSelectedBorder : lightSelectedBorder
|
|
1199
|
+
}
|
|
1200
|
+
} else {
|
|
1201
|
+
darkSelectedBorder ?? lightSelectedBorder
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
let colors: LinkAppearance.Colors? = if primary != nil || selectedBorder != nil {
|
|
1205
|
+
.init(primary: primary, selectedBorder: selectedBorder)
|
|
1206
|
+
} else {
|
|
1207
|
+
nil
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
let primaryButtonConfiguration: LinkAppearance.PrimaryButtonConfiguration? =
|
|
1211
|
+
if let primaryButton = params["primaryButton"] as? [String: CGFloat],
|
|
1212
|
+
let cornerRadius = primaryButton["cornerRadius"],
|
|
1213
|
+
let height = primaryButton["height"] {
|
|
1214
|
+
.init(cornerRadius: cornerRadius, height: height)
|
|
1215
|
+
} else {
|
|
1216
|
+
nil
|
|
1217
|
+
}
|
|
1161
1218
|
|
|
1162
|
-
|
|
1163
|
-
"
|
|
1164
|
-
"
|
|
1165
|
-
|
|
1219
|
+
let style: PaymentSheet.UserInterfaceStyle = switch params["style"] as? String ?? "" {
|
|
1220
|
+
case "ALWAYS_LIGHT": .alwaysLight
|
|
1221
|
+
case "ALWAYS_DARK": .alwaysDark
|
|
1222
|
+
default: .automatic
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
return LinkAppearance(
|
|
1226
|
+
colors: colors,
|
|
1227
|
+
primaryButton: primaryButtonConfiguration,
|
|
1228
|
+
style: style,
|
|
1229
|
+
reduceLinkBranding: true
|
|
1230
|
+
)
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
class func mapToKycAddress(_ params: [String: String]) -> Address {
|
|
1234
|
+
return Address(
|
|
1235
|
+
city: params["city"],
|
|
1236
|
+
country: params["country"],
|
|
1237
|
+
line1: params["line1"],
|
|
1238
|
+
line2: params["line2"],
|
|
1239
|
+
postalCode: params["postalCode"],
|
|
1240
|
+
state: params["state"]
|
|
1241
|
+
)
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
class func mapToKycInfo(_ params: [String: Any?]) throws -> KycInfo {
|
|
1245
|
+
guard let firstName = params["firstName"] as? String, !firstName.isEmpty else {
|
|
1246
|
+
throw KycInfoError.missingRequiredField("firstName")
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
guard let lastName = params["lastName"] as? String, !lastName.isEmpty else {
|
|
1250
|
+
throw KycInfoError.missingRequiredField("lastName")
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
guard let idNumber = params["idNumber"] as? String, !idNumber.isEmpty else {
|
|
1254
|
+
throw KycInfoError.missingRequiredField("idNumber")
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
guard let dateOfBirthParams = params["dateOfBirth"] as? [String: Int] else {
|
|
1258
|
+
throw KycInfoError.missingRequiredField("dateOfBirth")
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
guard let day = dateOfBirthParams["day"] else {
|
|
1262
|
+
throw KycInfoError.missingRequiredField("dateOfBirth.day")
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
guard let month = dateOfBirthParams["month"] else {
|
|
1266
|
+
throw KycInfoError.missingRequiredField("dateOfBirth.month")
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
guard let year = dateOfBirthParams["year"] else {
|
|
1270
|
+
throw KycInfoError.missingRequiredField("dateOfBirth.year")
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
let dateOfBirth = KycInfo.DateOfBirth(day: day, month: month, year: year)
|
|
1274
|
+
|
|
1275
|
+
// All address parameters are optional, so we don’t guard.
|
|
1276
|
+
let address = if let addressParams = params["address"] as? [String: String] {
|
|
1277
|
+
mapToKycAddress(addressParams)
|
|
1278
|
+
} else {
|
|
1279
|
+
Address()
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
return KycInfo(
|
|
1283
|
+
firstName: firstName,
|
|
1284
|
+
lastName: lastName,
|
|
1285
|
+
idNumber: idNumber,
|
|
1286
|
+
address: address,
|
|
1287
|
+
dateOfBirth: dateOfBirth
|
|
1288
|
+
)
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
class func paymentMethodDisplayDataToMap(_ paymentMethodDisplayData: PaymentMethodDisplayData) -> [String: String] {
|
|
1292
|
+
var result = [
|
|
1293
|
+
"icon": "data:image/png;base64," + (paymentMethodDisplayData.icon.pngData()?.base64EncodedString(options: []) ?? ""),
|
|
1294
|
+
"label": paymentMethodDisplayData.label,
|
|
1295
|
+
]
|
|
1296
|
+
|
|
1297
|
+
if let sublabel = paymentMethodDisplayData.sublabel {
|
|
1298
|
+
result["sublabel"] = sublabel
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
return result
|
|
1302
|
+
}
|
|
1166
1303
|
|
|
1167
|
-
|
|
1304
|
+
enum KycInfoError: Swift.Error {
|
|
1305
|
+
case missingRequiredField(String)
|
|
1168
1306
|
}
|
|
1307
|
+
#endif
|
|
1169
1308
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NavigationBarManager.m
|
|
3
|
+
// stripe-react-native
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
#import <Foundation/Foundation.h>
|
|
7
|
+
#import <React/RCTBridgeModule.h>
|
|
8
|
+
#import <React/RCTViewManager.h>
|
|
9
|
+
|
|
10
|
+
@interface RCT_EXTERN_MODULE(NavigationBarManager, RCTViewManager)
|
|
11
|
+
RCT_EXPORT_VIEW_PROPERTY(title, NSString)
|
|
12
|
+
RCT_EXPORT_VIEW_PROPERTY(onCloseButtonPress, RCTDirectEventBlock)
|
|
13
|
+
@end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NavigationBarManager.swift
|
|
3
|
+
// stripe-react-native
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import Foundation
|
|
7
|
+
|
|
8
|
+
@objc(NavigationBarManager)
|
|
9
|
+
class NavigationBarManager: RCTViewManager {
|
|
10
|
+
override func view() -> UIView! {
|
|
11
|
+
return NavigationBarView()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override class func requiresMainQueueSetup() -> Bool {
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NavigationBarView.swift
|
|
3
|
+
// stripe-react-native
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import Foundation
|
|
7
|
+
import UIKit
|
|
8
|
+
|
|
9
|
+
@objc(NavigationBarView)
|
|
10
|
+
public class NavigationBarView: UIView {
|
|
11
|
+
@objc public var onCloseButtonPress: RCTDirectEventBlock?
|
|
12
|
+
|
|
13
|
+
private var navigationBar: UINavigationBar!
|
|
14
|
+
private var navigationItem: UINavigationItem!
|
|
15
|
+
|
|
16
|
+
@objc public var title: NSString? {
|
|
17
|
+
didSet {
|
|
18
|
+
navigationItem.title = title as String?
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override public init(frame: CGRect) {
|
|
23
|
+
super.init(frame: frame)
|
|
24
|
+
setupNavigationBar()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
required init?(coder: NSCoder) {
|
|
28
|
+
fatalError("init(coder:) has not been implemented")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private func setupNavigationBar() {
|
|
32
|
+
// Create navigation bar
|
|
33
|
+
navigationBar = UINavigationBar(frame: .zero)
|
|
34
|
+
navigationBar.translatesAutoresizingMaskIntoConstraints = false
|
|
35
|
+
|
|
36
|
+
// Create navigation item
|
|
37
|
+
navigationItem = UINavigationItem()
|
|
38
|
+
navigationBar.items = [navigationItem]
|
|
39
|
+
|
|
40
|
+
// Add close button on the right
|
|
41
|
+
let closeButton = UIBarButtonItem(
|
|
42
|
+
barButtonSystemItem: .close,
|
|
43
|
+
target: self,
|
|
44
|
+
action: #selector(closeButtonTapped)
|
|
45
|
+
)
|
|
46
|
+
navigationItem.rightBarButtonItem = closeButton
|
|
47
|
+
|
|
48
|
+
// Add to view
|
|
49
|
+
addSubview(navigationBar)
|
|
50
|
+
|
|
51
|
+
// Setup constraints
|
|
52
|
+
NSLayoutConstraint.activate([
|
|
53
|
+
navigationBar.topAnchor.constraint(equalTo: topAnchor),
|
|
54
|
+
navigationBar.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
55
|
+
navigationBar.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
56
|
+
navigationBar.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
57
|
+
])
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@objc private func closeButtonTapped() {
|
|
61
|
+
if let onCloseButtonPress = onCloseButtonPress {
|
|
62
|
+
onCloseButtonPress([:])
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|