@stripe/stripe-react-native 0.14.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +15 -0
- package/.husky/pre-commit +4 -0
- package/CHANGELOG.md +55 -0
- package/android/build.gradle +1 -6
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +27 -6
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +34 -3
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +10 -1
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +284 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +17 -7
- package/android/src/main/java/com/reactnativestripesdk/GooglePayFragment.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +12 -11
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +213 -367
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +45 -28
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +85 -46
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/{Errors.kt → utils/Errors.kt} +5 -1
- package/android/src/main/java/com/reactnativestripesdk/{Extensions.kt → utils/Extensions.kt} +12 -1
- package/android/src/main/java/com/reactnativestripesdk/{Mappers.kt → utils/Mappers.kt} +8 -5
- package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +18 -0
- package/android/src/main/res/{drawable-night/googlepay_button_background.xml → drawable/googlepay_button_background_dark.xml} +1 -1
- package/android/src/main/res/{drawable-night/googlepay_button_content.xml → drawable/googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-night/googlepay_button_overlay.xml → drawable/googlepay_button_overlay_dark.xml} +0 -0
- package/android/src/main/res/{drawable-night/pay_with_googlepay_button_content.xml → drawable/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-ar-night/pay_with_googlepay_button_content.xml → drawable-ar/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-bg-night/pay_with_googlepay_button_content.xml → drawable-bg/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-ca-night/pay_with_googlepay_button_content.xml → drawable-ca/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-cs-night/pay_with_googlepay_button_content.xml → drawable-cs/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-da-night/pay_with_googlepay_button_content.xml → drawable-da/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-de-night/pay_with_googlepay_button_content.xml → drawable-de/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-el-night/pay_with_googlepay_button_content.xml → drawable-el/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-es-night/pay_with_googlepay_button_content.xml → drawable-es/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-et-night/pay_with_googlepay_button_content.xml → drawable-et/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-fi-night/pay_with_googlepay_button_content.xml → drawable-fi/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-fr-night/pay_with_googlepay_button_content.xml → drawable-fr/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-night-hdpi/googlepay_button_background_image.9.png → drawable-hdpi/googlepay_button_background_image_dark.9.png} +0 -0
- package/android/src/main/res/{drawable-hr-night/pay_with_googlepay_button_content.xml → drawable-hr/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-id-night/pay_with_googlepay_button_content.xml → drawable-id/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-it-night/pay_with_googlepay_button_content.xml → drawable-it/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-ja-night/pay_with_googlepay_button_content.xml → drawable-ja/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-ko-night/pay_with_googlepay_button_content.xml → drawable-ko/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-night-mdpi/googlepay_button_background_image.9.png → drawable-mdpi/googlepay_button_background_image_dark.9.png} +0 -0
- package/android/src/main/res/{drawable-ms-night/pay_with_googlepay_button_content.xml → drawable-ms/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-nl-night/pay_with_googlepay_button_content.xml → drawable-nl/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-no-night/pay_with_googlepay_button_content.xml → drawable-no/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-pl-night/pay_with_googlepay_button_content.xml → drawable-pl/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-pt-night/pay_with_googlepay_button_content.xml → drawable-pt/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-ru-night/pay_with_googlepay_button_content.xml → drawable-ru/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-sk-night/pay_with_googlepay_button_content.xml → drawable-sk/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-sl-night/pay_with_googlepay_button_content.xml → drawable-sl/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-sr-night/pay_with_googlepay_button_content.xml → drawable-sr/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-sv-night/pay_with_googlepay_button_content.xml → drawable-sv/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-th-night/pay_with_googlepay_button_content.xml → drawable-th/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-tr-night/pay_with_googlepay_button_content.xml → drawable-tr/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-uk-night/pay_with_googlepay_button_content.xml → drawable-uk/pay_with_googlepay_button_content_dark.xml} +0 -0
- package/android/src/main/res/{drawable-night-v21/googlepay_button_background.xml → drawable-v21/googlepay_button_background_dark.xml} +1 -1
- package/android/src/main/res/{drawable-night-xhdpi/googlepay_button_background_image.9.png → drawable-xhdpi/googlepay_button_background_image_dark.9.png} +0 -0
- package/android/src/main/res/{drawable-night-xxhdpi/googlepay_button_background_image.9.png → drawable-xxhdpi/googlepay_button_background_image_dark.9.png} +0 -0
- package/android/src/main/res/{drawable-night-xxxhdpi/googlepay_button_background_image.9.png → drawable-xxxhdpi/googlepay_button_background_image_dark.9.png} +0 -0
- package/android/src/main/res/{layout-night/googlepay_button.xml → layout/googlepay_button_dark.xml} +4 -4
- package/android/src/main/res/{layout-night/pay_with_googlepay_button.xml → layout/pay_with_googlepay_button_dark.xml} +4 -4
- package/ios/ApplePayUtils.swift +159 -0
- package/ios/CardFormView.swift +20 -0
- package/ios/Errors.swift +11 -0
- package/ios/FinancialConnections.swift +258 -0
- package/ios/Mappers.swift +20 -22
- package/ios/PaymentMethodFactory.swift +9 -0
- package/ios/StripeSdk.m +10 -1
- package/ios/StripeSdk.swift +67 -44
- package/ios/Tests/ApplePayUtilsTests.swift +214 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/ApplePayButton.js +1 -1
- package/lib/commonjs/components/ApplePayButton.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/GooglePayButton.js +1 -1
- package/lib/commonjs/components/GooglePayButton.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/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useApplePay.js +1 -1
- package/lib/commonjs/hooks/useApplePay.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmPayment.js +1 -1
- package/lib/commonjs/hooks/useConfirmPayment.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmSetupIntent.js +1 -1
- package/lib/commonjs/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +2 -0
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -0
- package/lib/commonjs/hooks/useGooglePay.js +1 -1
- package/lib/commonjs/hooks/useGooglePay.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- 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/types/FinancialConnections.js +2 -0
- package/lib/commonjs/types/FinancialConnections.js.map +1 -0
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.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/ApplePayButton.js +1 -1
- package/lib/module/components/ApplePayButton.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/GooglePayButton.js +1 -1
- package/lib/module/components/GooglePayButton.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/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useApplePay.js +1 -1
- package/lib/module/hooks/useApplePay.js.map +1 -1
- package/lib/module/hooks/useConfirmPayment.js +1 -1
- package/lib/module/hooks/useConfirmPayment.js.map +1 -1
- package/lib/module/hooks/useConfirmSetupIntent.js +1 -1
- package/lib/module/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js +2 -0
- package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -0
- package/lib/module/hooks/useGooglePay.js +1 -1
- package/lib/module/hooks/useGooglePay.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- 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/types/FinancialConnections.js +2 -0
- package/lib/module/types/FinancialConnections.js.map +1 -0
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/SetupIntent.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/NativeStripeSdk.d.ts +3 -1
- package/lib/typescript/src/components/CardForm.d.ts +1 -1
- package/lib/typescript/src/components/GooglePayButton.d.ts +2 -2
- package/lib/typescript/src/functions.d.ts +15 -1
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +11 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +3 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/types/ApplePay.d.ts +31 -5
- package/lib/typescript/src/types/FinancialConnections.d.ts +100 -0
- package/lib/typescript/src/types/PaymentIntent.d.ts +1 -0
- package/lib/typescript/src/types/PaymentMethod.d.ts +9 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +17 -15
- package/lib/typescript/src/types/SetupIntent.d.ts +1 -0
- package/lib/typescript/src/types/Token.d.ts +18 -7
- package/lib/typescript/src/types/index.d.ts +2 -1
- package/package.json +11 -23
- package/src/NativeStripeSdk.tsx +7 -0
- package/src/components/CardForm.tsx +2 -2
- package/src/components/GooglePayButton.tsx +8 -2
- package/src/functions.ts +58 -0
- package/src/hooks/useFinancialConnectionsSheet.tsx +34 -0
- package/src/hooks/useStripe.tsx +21 -0
- package/src/index.tsx +1 -0
- package/src/types/ApplePay.ts +39 -6
- package/src/types/FinancialConnections.ts +126 -0
- package/src/types/PaymentIntent.ts +1 -0
- package/src/types/PaymentMethod.ts +11 -1
- package/src/types/PaymentSheet.ts +34 -36
- package/src/types/SetupIntent.ts +1 -0
- package/src/types/Token.ts +24 -7
- package/src/types/index.ts +2 -0
- package/android/.DS_Store +0 -0
- package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/.gitignore +0 -3
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/android.iml +0 -18
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/vcs.xml +0 -6
- package/android/.idea/workspace.xml +0 -52
- package/android/local.properties +0 -8
- package/android/src/.DS_Store +0 -0
- package/android/src/androidTest/.DS_Store +0 -0
- package/android/src/androidTest/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +0 -35
- package/android/src/main/res/drawable-night/googlepay_button_no_shadow_background.xml +0 -6
- package/android/src/main/res/drawable-night-hdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-night-mdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-night-v21/googlepay_button_no_shadow_background.xml +0 -7
- package/android/src/main/res/drawable-night-xhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-night-xxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-night-xxxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/values-night/googlepay_strings.xml +0 -12
- package/ios/.DS_Store +0 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -22
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -27
- package/lib/typescript/e2e/buyNowPayLater.test.d.ts +0 -1
- package/lib/typescript/e2e/helpers.d.ts +0 -5
- package/lib/typescript/e2e/payments.test.d.ts +0 -1
- package/lib/typescript/e2e/paymentsWithRedirects.test.d.ts +0 -1
- package/lib/typescript/e2e/screenObject/BasicPaymentScreen.d.ts +0 -16
- package/lib/typescript/e2e/screenObject/HomeScreen.d.ts +0 -6
- package/lib/typescript/e2e/screenObject/components/BECSForm.d.ts +0 -8
- package/lib/typescript/e2e/screenObject/components/CardField.d.ts +0 -10
- package/lib/typescript/example/server/index.d.ts +0 -1
- package/lib/typescript/example/server/utils.d.ts +0 -11
- package/lib/typescript/example/src/App.d.ts +0 -45
- package/lib/typescript/example/src/Config.d.ts +0 -2
- package/lib/typescript/example/src/colors.d.ts +0 -8
- package/lib/typescript/example/src/components/Button.d.ts +0 -11
- package/lib/typescript/example/src/components/Collapse.d.ts +0 -6
- package/lib/typescript/example/src/components/PaymentScreen.d.ts +0 -7
- package/lib/typescript/example/src/helpers.d.ts +0 -1
- package/lib/typescript/example/src/screens/ACHPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/ACHSetupScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/AfterpayClearpayPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/AlipayPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/ApplePayScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/AuBECSDebitPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/AuBECSDebitSetupPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/BancontactPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/BancontactSetupFuturePaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/CVCReCollectionScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/CreateTokenScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/EPSPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/FPXPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/GiropayPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/GooglePayScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/GrabPayPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/HomeScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/IdealPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/IdealSetupFuturePaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/KlarnaPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/MultilineWebhookPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/NoWebhookPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/OxxoPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/P24PaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/PayPalScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/PaymentResultScreen.d.ts +0 -8
- package/lib/typescript/example/src/screens/PaymentSheetAppearance.d.ts +0 -3
- package/lib/typescript/example/src/screens/PaymentsUICompleteScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/PaymentsUICustomScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/SepaPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/SepaSetupFuturePaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/SetupFuturePaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/SofortPaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/SofortSetupFuturePaymentScreen.d.ts +0 -1
- package/lib/typescript/example/src/screens/WebhookPaymentScreen.d.ts +0 -1
- package/lib/typescript/src/plugin/__tests__/withStripe-test.d.ts +0 -1
- package/src/plugin/__tests__/fixtures/sample-AndroidManifest.xml +0 -24
- package/src/plugin/__tests__/withStripe-test.ts +0 -111
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/android/src/main/res/{layout-night/googlepay_button.xml → layout/googlepay_button_dark.xml}
RENAMED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
android:focusable="true"
|
|
5
5
|
android:layout_width="match_parent"
|
|
6
6
|
android:layout_height="48sp"
|
|
7
|
-
android:background="@drawable/
|
|
8
|
-
android:
|
|
7
|
+
android:background="@drawable/googlepay_button_background_dark"
|
|
8
|
+
android:padding="2sp"
|
|
9
9
|
android:contentDescription="@string/googlepay_button_content_description">
|
|
10
10
|
<LinearLayout
|
|
11
11
|
android:duplicateParentState="true"
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
android:layout_height="0dp"
|
|
21
21
|
android:scaleType="fitCenter"
|
|
22
22
|
android:duplicateParentState="true"
|
|
23
|
-
android:src="@drawable/
|
|
23
|
+
android:src="@drawable/googlepay_button_content_dark"/>
|
|
24
24
|
</LinearLayout>
|
|
25
25
|
<ImageView
|
|
26
26
|
android:layout_width="match_parent"
|
|
27
27
|
android:layout_height="match_parent"
|
|
28
28
|
android:scaleType="fitXY"
|
|
29
29
|
android:duplicateParentState="true"
|
|
30
|
-
android:src="@drawable/
|
|
30
|
+
android:src="@drawable/googlepay_button_overlay_dark"/>
|
|
31
31
|
</RelativeLayout>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
android:focusable="true"
|
|
5
5
|
android:layout_width="match_parent"
|
|
6
6
|
android:layout_height="48sp"
|
|
7
|
-
android:background="@drawable/
|
|
7
|
+
android:background="@drawable/googlepay_button_background_dark"
|
|
8
8
|
android:padding="2sp"
|
|
9
9
|
android:contentDescription="@string/pay_with_googlepay_button_content_description">
|
|
10
10
|
<LinearLayout
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
android:layout_height="0dp"
|
|
21
21
|
android:scaleType="fitCenter"
|
|
22
22
|
android:duplicateParentState="true"
|
|
23
|
-
android:src="@drawable/
|
|
23
|
+
android:src="@drawable/pay_with_googlepay_button_content_dark"/>
|
|
24
24
|
</LinearLayout>
|
|
25
25
|
<ImageView
|
|
26
26
|
android:layout_width="match_parent"
|
|
27
27
|
android:layout_height="match_parent"
|
|
28
28
|
android:scaleType="fitXY"
|
|
29
29
|
android:duplicateParentState="true"
|
|
30
|
-
android:src="@drawable/
|
|
31
|
-
</RelativeLayout>
|
|
30
|
+
android:src="@drawable/googlepay_button_overlay_dark"/>
|
|
31
|
+
</RelativeLayout>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ApplePayUtils.swift
|
|
3
|
+
// stripe-react-native
|
|
4
|
+
//
|
|
5
|
+
// Created by Charles Cruzan on 6/27/22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import Stripe
|
|
10
|
+
|
|
11
|
+
class ApplePayUtils {
|
|
12
|
+
|
|
13
|
+
@available(iOS 15.0, *)
|
|
14
|
+
internal class func createDeferredPaymentSummaryItem(item: [String : Any]) throws -> PKPaymentSummaryItem {
|
|
15
|
+
let label = item["label"] as? String ?? ""
|
|
16
|
+
let amount = NSDecimalNumber(string: item["amount"] as? String ?? "")
|
|
17
|
+
|
|
18
|
+
let deferredItem = PKDeferredPaymentSummaryItem(
|
|
19
|
+
label: label,
|
|
20
|
+
amount: amount
|
|
21
|
+
)
|
|
22
|
+
guard let date = item["deferredDate"] as? Double else {
|
|
23
|
+
throw ApplePayUtilsError.missingParameter(label, "deferredDate")
|
|
24
|
+
}
|
|
25
|
+
deferredItem.deferredDate = Date(timeIntervalSince1970: date)
|
|
26
|
+
return deferredItem
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@available(iOS 15.0, *)
|
|
30
|
+
internal class func createRecurringPaymentSummaryItem(item: [String : Any]) throws -> PKPaymentSummaryItem {
|
|
31
|
+
let label = item["label"] as? String ?? ""
|
|
32
|
+
let amount = NSDecimalNumber(string: item["amount"] as? String ?? "")
|
|
33
|
+
|
|
34
|
+
let recurringItem = PKRecurringPaymentSummaryItem(
|
|
35
|
+
label: label,
|
|
36
|
+
amount: amount
|
|
37
|
+
)
|
|
38
|
+
guard let intervalCount = item["intervalCount"] as? Int else {
|
|
39
|
+
throw ApplePayUtilsError.missingParameter(label, "intervalCount")
|
|
40
|
+
}
|
|
41
|
+
recurringItem.intervalCount = intervalCount
|
|
42
|
+
recurringItem.intervalUnit = try mapToIntervalUnit(intervalString: item["intervalUnit"] as? String)
|
|
43
|
+
if let startDate = item["startDate"] as? Double {
|
|
44
|
+
recurringItem.startDate = Date(timeIntervalSince1970: startDate)
|
|
45
|
+
}
|
|
46
|
+
if let endDate = item["endDate"] as? Double {
|
|
47
|
+
recurringItem.endDate = Date(timeIntervalSince1970: endDate)
|
|
48
|
+
}
|
|
49
|
+
return recurringItem
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
internal class func mapToIntervalUnit(intervalString: String?) throws -> NSCalendar.Unit {
|
|
53
|
+
switch intervalString {
|
|
54
|
+
case "minute":
|
|
55
|
+
return NSCalendar.Unit.minute
|
|
56
|
+
case "hour":
|
|
57
|
+
return NSCalendar.Unit.hour
|
|
58
|
+
case "day":
|
|
59
|
+
return NSCalendar.Unit.day
|
|
60
|
+
case "month":
|
|
61
|
+
return NSCalendar.Unit.month
|
|
62
|
+
case "year":
|
|
63
|
+
return NSCalendar.Unit.year
|
|
64
|
+
default:
|
|
65
|
+
throw ApplePayUtilsError.invalidTimeInterval(intervalString ?? "null")
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
internal class func createImmediatePaymentSummaryItem(item: [String : Any]) -> PKPaymentSummaryItem {
|
|
70
|
+
let label = item["label"] as? String ?? ""
|
|
71
|
+
let amount = NSDecimalNumber(string: item["amount"] as? String ?? "")
|
|
72
|
+
|
|
73
|
+
return PKPaymentSummaryItem(
|
|
74
|
+
label: label,
|
|
75
|
+
amount: amount,
|
|
76
|
+
type: item["isPending"] as? Bool ?? false ?
|
|
77
|
+
PKPaymentSummaryItemType.pending : PKPaymentSummaryItemType.final
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public class func buildPaymentSummaryItems(items: [[String : Any]]?) throws -> [PKPaymentSummaryItem] {
|
|
82
|
+
var paymentSummaryItems: [PKPaymentSummaryItem] = []
|
|
83
|
+
if let items = items {
|
|
84
|
+
for item in items {
|
|
85
|
+
let paymentSummaryItem = try buildPaymentSummaryItem(item: item)
|
|
86
|
+
paymentSummaryItems.append(paymentSummaryItem)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return paymentSummaryItems
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
internal class func buildPaymentSummaryItem(item: [String : Any]) throws -> PKPaymentSummaryItem {
|
|
94
|
+
switch item["paymentType"] as? String {
|
|
95
|
+
case "Deferred":
|
|
96
|
+
if #available(iOS 15.0, *) {
|
|
97
|
+
return try createDeferredPaymentSummaryItem(item: item)
|
|
98
|
+
} else {
|
|
99
|
+
return createImmediatePaymentSummaryItem(item: item)
|
|
100
|
+
}
|
|
101
|
+
case "Recurring":
|
|
102
|
+
if #available(iOS 15.0, *) {
|
|
103
|
+
return try createRecurringPaymentSummaryItem(item: item)
|
|
104
|
+
} else {
|
|
105
|
+
return createImmediatePaymentSummaryItem(item: item)
|
|
106
|
+
}
|
|
107
|
+
case "Immediate":
|
|
108
|
+
return createImmediatePaymentSummaryItem(item: item)
|
|
109
|
+
default:
|
|
110
|
+
throw ApplePayUtilsError.invalidCartSummaryItemType(item["paymentType"] as? String ?? "null")
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public class func buildPaymentSheetApplePayConfig(
|
|
115
|
+
merchantIdentifier: String?,
|
|
116
|
+
merchantCountryCode: String?,
|
|
117
|
+
paymentSummaryItems: [[String : Any]]?
|
|
118
|
+
) throws -> PaymentSheet.ApplePayConfiguration {
|
|
119
|
+
guard let merchantId = merchantIdentifier else {
|
|
120
|
+
throw ApplePayUtilsError.missingMerchantId
|
|
121
|
+
}
|
|
122
|
+
guard let countryCode = merchantCountryCode else {
|
|
123
|
+
throw ApplePayUtilsError.missingCountryCode
|
|
124
|
+
}
|
|
125
|
+
let paymentSummaryItems = try ApplePayUtils.buildPaymentSummaryItems(
|
|
126
|
+
items: paymentSummaryItems
|
|
127
|
+
)
|
|
128
|
+
return PaymentSheet.ApplePayConfiguration.init(
|
|
129
|
+
merchantId: merchantId,
|
|
130
|
+
merchantCountryCode: countryCode,
|
|
131
|
+
paymentSummaryItems:paymentSummaryItems.count > 0 ? paymentSummaryItems : nil
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
enum ApplePayUtilsError : Error, Equatable {
|
|
137
|
+
case invalidCartSummaryItemType(String)
|
|
138
|
+
case missingParameter(String, String)
|
|
139
|
+
case invalidTimeInterval(String)
|
|
140
|
+
case missingMerchantId
|
|
141
|
+
case missingCountryCode
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
extension ApplePayUtilsError: LocalizedError {
|
|
145
|
+
public var errorDescription: String? {
|
|
146
|
+
switch self {
|
|
147
|
+
case .invalidCartSummaryItemType(let type):
|
|
148
|
+
return "Failed to ceate Apple Pay summary item. Expected `type` to be one of 'Immediate', 'Recurring', or 'Deferred', but received: \(type)"
|
|
149
|
+
case .missingParameter(let label, let parameter):
|
|
150
|
+
return "Failed to create Apple Pay summary item with label: \(label). The \(parameter) item parameter is required, but none was provided."
|
|
151
|
+
case .invalidTimeInterval(let providedInterval):
|
|
152
|
+
return "Failed to create Apple Pay summary item. \(providedInterval) is not a valid timeInterval, must be one of: minute, hour, day, month, or year."
|
|
153
|
+
case .missingMerchantId:
|
|
154
|
+
return "`merchantIdentifier` is required, but none was found. Ensure you are passing this to initStripe your StripeProvider."
|
|
155
|
+
case .missingCountryCode:
|
|
156
|
+
return "`merchantCountryCode` is a required param, but was not provided."
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
package/ios/CardFormView.swift
CHANGED
|
@@ -75,6 +75,26 @@ class CardFormView: UIView, STPCardFormViewDelegate {
|
|
|
75
75
|
if let backgroundColor = cardStyle["backgroundColor"] as? String {
|
|
76
76
|
cardForm?.backgroundColor = UIColor(hexString: backgroundColor)
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
The following reveals a bug in STPCardFormView where there's a extra space in the layer,
|
|
80
|
+
and thus must remain commented out for now.
|
|
81
|
+
|
|
82
|
+
if let borderWidth = cardStyle["borderWidth"] as? Int {
|
|
83
|
+
cardForm?.layer.borderWidth = CGFloat(borderWidth)
|
|
84
|
+
} else {
|
|
85
|
+
cardForm?.layer.borderWidth = CGFloat(0)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
*/
|
|
89
|
+
if let borderColor = cardStyle["borderColor"] as? String {
|
|
90
|
+
cardForm?.layer.borderColor = UIColor(hexString: borderColor).cgColor
|
|
91
|
+
}
|
|
92
|
+
if let borderRadius = cardStyle["borderRadius"] as? Int {
|
|
93
|
+
cardForm?.layer.cornerRadius = CGFloat(borderRadius)
|
|
94
|
+
}
|
|
95
|
+
if let cursorColor = cardStyle["cursorColor"] as? String {
|
|
96
|
+
cardForm?.tintColor = UIColor(hexString: cursorColor)
|
|
97
|
+
}
|
|
78
98
|
// if let disabledBackgroundColor = cardStyle["disabledBackgroundColor"] as? String {
|
|
79
99
|
// cardForm?.disabledBackgroundColor = UIColor(hexString: disabledBackgroundColor)
|
|
80
100
|
// }
|
package/ios/Errors.swift
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Stripe
|
|
2
|
+
@_spi(STP) import StripeCore
|
|
2
3
|
|
|
3
4
|
enum ErrorType {
|
|
4
5
|
static let Failed = "Failed"
|
|
@@ -84,5 +85,15 @@ class Errors {
|
|
|
84
85
|
|
|
85
86
|
return ["error": value]
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
class func createError(_ code: String, _ error: Error) -> NSDictionary {
|
|
90
|
+
if let stripeError = error as? StripeError {
|
|
91
|
+
return createError(code, NSError.stp_error(from: stripeError))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return createError(code, error as NSError)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
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.")
|
|
87
98
|
}
|
|
88
99
|
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FinancialConnections.swift
|
|
3
|
+
// stripe-react-native
|
|
4
|
+
//
|
|
5
|
+
// Created by Charles Cruzan on 7/12/22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import StripeFinancialConnections
|
|
10
|
+
import Stripe
|
|
11
|
+
|
|
12
|
+
class FinancialConnections {
|
|
13
|
+
|
|
14
|
+
internal static func present(
|
|
15
|
+
withClientSecret: String,
|
|
16
|
+
resolve: @escaping RCTPromiseResolveBlock
|
|
17
|
+
) -> Void {
|
|
18
|
+
DispatchQueue.main.async {
|
|
19
|
+
FinancialConnectionsSheet(financialConnectionsSessionClientSecret: withClientSecret).present(
|
|
20
|
+
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
21
|
+
completion: { result in
|
|
22
|
+
switch result {
|
|
23
|
+
case .completed(session: let session):
|
|
24
|
+
resolve([ "session": mapFromSessionResult(session) ])
|
|
25
|
+
case .canceled:
|
|
26
|
+
resolve(Errors.createError(ErrorType.Canceled, "The flow has been canceled."))
|
|
27
|
+
case .failed(let error):
|
|
28
|
+
resolve(Errors.createError(ErrorType.Failed, error))
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
internal static func presentForToken(
|
|
35
|
+
withClientSecret: String,
|
|
36
|
+
resolve: @escaping RCTPromiseResolveBlock
|
|
37
|
+
) -> Void {
|
|
38
|
+
DispatchQueue.main.async {
|
|
39
|
+
FinancialConnectionsSheet(financialConnectionsSessionClientSecret: withClientSecret).presentForToken(
|
|
40
|
+
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
|
|
41
|
+
completion: { result in
|
|
42
|
+
switch result {
|
|
43
|
+
case .completed(result: let result):
|
|
44
|
+
resolve(
|
|
45
|
+
[
|
|
46
|
+
"session": mapFromSessionResult(result.session),
|
|
47
|
+
"token" : mapFromTokenResult(result.token)
|
|
48
|
+
]
|
|
49
|
+
)
|
|
50
|
+
case .canceled:
|
|
51
|
+
resolve(Errors.createError(ErrorType.Canceled, "The flow has been canceled."))
|
|
52
|
+
case .failed(let error):
|
|
53
|
+
resolve(Errors.createError(ErrorType.Failed, error))
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
internal static func mapFromSessionResult(
|
|
60
|
+
_ session: StripeAPI.FinancialConnectionsSession
|
|
61
|
+
) -> NSDictionary {
|
|
62
|
+
return [
|
|
63
|
+
"id": session.id,
|
|
64
|
+
"clientSecret": session.clientSecret,
|
|
65
|
+
"livemode": session.livemode,
|
|
66
|
+
"accounts": mapFromAccountsList(accounts: session.accounts)
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
internal static func mapFromTokenResult(
|
|
71
|
+
_ token: StripeAPI.BankAccountToken?
|
|
72
|
+
) -> NSDictionary {
|
|
73
|
+
return [
|
|
74
|
+
"bankAccount": mapFromBankAccount(bankAccount: token?.bankAccount) ?? NSNull(),
|
|
75
|
+
"livemode": token?.livemode ?? false,
|
|
76
|
+
"id": token?.id ?? NSNull(),
|
|
77
|
+
"used": token?.used ?? false,
|
|
78
|
+
"type": Mappers.mapFromTokenType(STPTokenType.bankAccount) ?? NSNull(),
|
|
79
|
+
"created": NSNull(), // Doesn't exist on StripeAPI.BankAccountToken
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
internal static func mapFromBankAccount(
|
|
84
|
+
bankAccount: StripeAPI.BankAccountToken.BankAccount?
|
|
85
|
+
) -> NSDictionary? {
|
|
86
|
+
guard let bankAccount = bankAccount else {
|
|
87
|
+
return nil
|
|
88
|
+
}
|
|
89
|
+
// return Mappers.mapFromBankAccount(bankAccount) Cannot use this since it expects an STPBankAccount
|
|
90
|
+
return [
|
|
91
|
+
"id": bankAccount.id,
|
|
92
|
+
"bankName": bankAccount.bankName ?? NSNull(),
|
|
93
|
+
"accountHolderName": bankAccount.accountHolderName ?? NSNull(),
|
|
94
|
+
"accountHolderType": NSNull(), // Doesn't exist on StripeAPI.BankAccountToken
|
|
95
|
+
"currency": bankAccount.currency,
|
|
96
|
+
"country": bankAccount.country,
|
|
97
|
+
"routingNumber": bankAccount.routingNumber ?? NSNull(),
|
|
98
|
+
"fingerprint": bankAccount.fingerprint ?? NSNull(),
|
|
99
|
+
"last4": bankAccount.last4,
|
|
100
|
+
"status": bankAccount.status.prefix(1).uppercased() + bankAccount.status.lowercased().dropFirst(), // stripe-ios returns a string, not STPBankAccountStatus
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
internal static func mapFromAccountsList(
|
|
105
|
+
accounts: StripeAPI.FinancialConnectionsSession.AccountList
|
|
106
|
+
) -> [[String: Any]] {
|
|
107
|
+
var result = [[String: Any]]()
|
|
108
|
+
|
|
109
|
+
for account in accounts.data {
|
|
110
|
+
result.append([
|
|
111
|
+
"id": account.id,
|
|
112
|
+
"livemode": account.livemode,
|
|
113
|
+
"displayName": account.displayName ?? NSNull(),
|
|
114
|
+
"status": mapFromStatus(account.status),
|
|
115
|
+
"institutionName": account.institutionName,
|
|
116
|
+
"last4": account.last4 ?? NSNull(),
|
|
117
|
+
"created": account.created * 1000,
|
|
118
|
+
"balance": mapFromAccountBalance(balance: account.balance) ?? NSNull(),
|
|
119
|
+
"balanceRefresh": mapFromAccountBalanceRefresh(balanceRefresh: account.balanceRefresh) ?? NSNull(),
|
|
120
|
+
"category": mapFromCategory(account.category),
|
|
121
|
+
"subcategory": mapFromSubcategory(account.subcategory),
|
|
122
|
+
"permissions": account.permissions?.map { mapFromPermission($0) } ?? NSNull(),
|
|
123
|
+
"supportedPaymentMethodTypes": account.supportedPaymentMethodTypes.map { mapFromSupportedPaymentMethodTypes($0) },
|
|
124
|
+
])
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return result
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
internal static func mapFromAccountBalance(
|
|
131
|
+
balance: StripeAPI.FinancialConnectionsAccount.Balance?
|
|
132
|
+
) -> NSDictionary? {
|
|
133
|
+
guard let balance = balance else {
|
|
134
|
+
return nil
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return [
|
|
138
|
+
"asOf": balance.asOf * 1000,
|
|
139
|
+
"type": mapFromBalanceType(balance.type),
|
|
140
|
+
// TODO: Protected by internal on iOS only. PR is out to fix
|
|
141
|
+
"cash": ["available": NSNull()], // balance.cash?.available
|
|
142
|
+
"credit": ["used": NSNull()], // balance.credit?.used
|
|
143
|
+
"current": balance.current,
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
internal static func mapFromAccountBalanceRefresh(
|
|
148
|
+
balanceRefresh: StripeAPI.FinancialConnectionsAccount.BalanceRefresh?
|
|
149
|
+
) -> NSDictionary? {
|
|
150
|
+
guard let balanceRefresh = balanceRefresh else {
|
|
151
|
+
return nil
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return [
|
|
155
|
+
"status": mapFromBalanceRefreshStatus(balanceRefresh.status),
|
|
156
|
+
"lastAttemptedAt": balanceRefresh.lastAttemptedAt * 1000,
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
internal static func mapFromStatus( _ status: StripeAPI.FinancialConnectionsAccount.Status) -> String {
|
|
161
|
+
switch status {
|
|
162
|
+
case .active:
|
|
163
|
+
return "active"
|
|
164
|
+
case .inactive:
|
|
165
|
+
return "inactive"
|
|
166
|
+
case .disconnected:
|
|
167
|
+
return "disconnected"
|
|
168
|
+
case .unparsable:
|
|
169
|
+
return "unparsable"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
internal static func mapFromCategory( _ category: StripeAPI.FinancialConnectionsAccount.Category) -> String {
|
|
174
|
+
switch category {
|
|
175
|
+
case .cash:
|
|
176
|
+
return "cash"
|
|
177
|
+
case .credit:
|
|
178
|
+
return "credit"
|
|
179
|
+
case .investment:
|
|
180
|
+
return "investment"
|
|
181
|
+
case .other:
|
|
182
|
+
return "other"
|
|
183
|
+
case .unparsable:
|
|
184
|
+
return "unparsable"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
internal static func mapFromSubcategory( _ subcategory: StripeAPI.FinancialConnectionsAccount.Subcategory) -> String {
|
|
189
|
+
switch subcategory {
|
|
190
|
+
case .savings:
|
|
191
|
+
return "savings"
|
|
192
|
+
case .mortgage:
|
|
193
|
+
return "mortgage"
|
|
194
|
+
case .checking:
|
|
195
|
+
return "checking"
|
|
196
|
+
case .creditCard:
|
|
197
|
+
return "creditCard"
|
|
198
|
+
case .lineOfCredit:
|
|
199
|
+
return "lineOfCredit"
|
|
200
|
+
case .other:
|
|
201
|
+
return "other"
|
|
202
|
+
case .unparsable:
|
|
203
|
+
return "unparsable"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
internal static func mapFromPermission( _ permission: StripeAPI.FinancialConnectionsAccount.Permissions) -> String {
|
|
208
|
+
switch permission {
|
|
209
|
+
case .transactions:
|
|
210
|
+
return "transactions"
|
|
211
|
+
case .ownership:
|
|
212
|
+
return "ownership"
|
|
213
|
+
case .paymentMethod:
|
|
214
|
+
return "paymentMethod"
|
|
215
|
+
case .accountNumbers:
|
|
216
|
+
return "accountNumbers"
|
|
217
|
+
case .balances:
|
|
218
|
+
return "balances"
|
|
219
|
+
case .unparsable:
|
|
220
|
+
return "unparsable"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
internal static func mapFromSupportedPaymentMethodTypes( _ type: StripeAPI.FinancialConnectionsAccount.SupportedPaymentMethodTypes) -> String {
|
|
225
|
+
switch type {
|
|
226
|
+
case .usBankAccount:
|
|
227
|
+
return "usBankAccount"
|
|
228
|
+
case .link:
|
|
229
|
+
return "link"
|
|
230
|
+
case .unparsable:
|
|
231
|
+
return "unparsable"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
internal static func mapFromBalanceType( _ type: StripeAPI.FinancialConnectionsAccount.Balance.ModelType) -> String {
|
|
236
|
+
switch type {
|
|
237
|
+
case .cash:
|
|
238
|
+
return "cash"
|
|
239
|
+
case .credit:
|
|
240
|
+
return "credit"
|
|
241
|
+
case .unparsable:
|
|
242
|
+
return "unparsable"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
internal static func mapFromBalanceRefreshStatus( _ status: StripeAPI.FinancialConnectionsAccount.BalanceRefresh.Status) -> String {
|
|
247
|
+
switch status {
|
|
248
|
+
case .succeeded:
|
|
249
|
+
return "succeeded"
|
|
250
|
+
case .pending:
|
|
251
|
+
return "pending"
|
|
252
|
+
case .failed:
|
|
253
|
+
return "failed"
|
|
254
|
+
case .unparsable:
|
|
255
|
+
return "unparsable"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
package/ios/Mappers.swift
CHANGED
|
@@ -16,17 +16,6 @@ class Mappers {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
class func mapToPaymentSummaryItemType(type: String?) -> PKPaymentSummaryItemType {
|
|
20
|
-
if let type = type {
|
|
21
|
-
switch type {
|
|
22
|
-
case "pending": return PKPaymentSummaryItemType.pending
|
|
23
|
-
case "final": return PKPaymentSummaryItemType.final
|
|
24
|
-
default: return PKPaymentSummaryItemType.final
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return PKPaymentSummaryItemType.final
|
|
28
|
-
}
|
|
29
|
-
|
|
30
19
|
class func mapFromBankAccountHolderType(_ type: STPBankAccountHolderType?) -> String? {
|
|
31
20
|
if let type = type {
|
|
32
21
|
switch type {
|
|
@@ -61,18 +50,21 @@ class Mappers {
|
|
|
61
50
|
}
|
|
62
51
|
|
|
63
52
|
class func mapFromBankAccount(_ bankAccount: STPBankAccount?) -> NSDictionary? {
|
|
64
|
-
|
|
53
|
+
guard let bankAccount = bankAccount else {
|
|
65
54
|
return nil
|
|
66
55
|
}
|
|
56
|
+
|
|
67
57
|
let result: NSDictionary = [
|
|
68
|
-
"id": bankAccount
|
|
69
|
-
"bankName": bankAccount
|
|
70
|
-
"accountHolderName": bankAccount
|
|
71
|
-
"accountHolderType": mapFromBankAccountHolderType(bankAccount
|
|
72
|
-
"country": bankAccount
|
|
73
|
-
"currency": bankAccount
|
|
74
|
-
"routingNumber": bankAccount
|
|
75
|
-
"status": mapFromBankAccountStatus(bankAccount
|
|
58
|
+
"id": bankAccount.stripeID,
|
|
59
|
+
"bankName": bankAccount.bankName ?? NSNull(),
|
|
60
|
+
"accountHolderName": bankAccount.accountHolderName ?? NSNull(),
|
|
61
|
+
"accountHolderType": mapFromBankAccountHolderType(bankAccount.accountHolderType) ?? NSNull(),
|
|
62
|
+
"country": bankAccount.country ?? NSNull(),
|
|
63
|
+
"currency": bankAccount.currency ?? NSNull(),
|
|
64
|
+
"routingNumber": bankAccount.routingNumber ?? NSNull(),
|
|
65
|
+
"status": mapFromBankAccountStatus(bankAccount.status) ?? NSNull(),
|
|
66
|
+
"fingerprint": bankAccount.fingerprint ?? NSNull(),
|
|
67
|
+
"last4": bankAccount.last4 ?? NSNull()
|
|
76
68
|
]
|
|
77
69
|
return result
|
|
78
70
|
}
|
|
@@ -171,8 +163,12 @@ class Mappers {
|
|
|
171
163
|
let amount = NSDecimalNumber(string: method["amount"] as? String ?? "")
|
|
172
164
|
let identifier = method["identifier"] as! String
|
|
173
165
|
let detail = method["detail"] as? String ?? ""
|
|
174
|
-
let
|
|
175
|
-
|
|
166
|
+
let pm = PKShippingMethod.init(
|
|
167
|
+
label: label,
|
|
168
|
+
amount: amount,
|
|
169
|
+
type: method["isPending"] as? Bool ?? false
|
|
170
|
+
? PKPaymentSummaryItemType.pending : PKPaymentSummaryItemType.final
|
|
171
|
+
)
|
|
176
172
|
pm.identifier = identifier
|
|
177
173
|
pm.detail = detail
|
|
178
174
|
shippingMethodsList.append(pm)
|
|
@@ -283,6 +279,7 @@ class Mappers {
|
|
|
283
279
|
case STPPaymentMethodType.klarna: return "Klarna"
|
|
284
280
|
case STPPaymentMethodType.USBankAccount: return "USBankAccount"
|
|
285
281
|
case STPPaymentMethodType.payPal: return "PayPal"
|
|
282
|
+
case STPPaymentMethodType.affirm: return "Affirm"
|
|
286
283
|
case STPPaymentMethodType.unknown: return "Unknown"
|
|
287
284
|
default: return "Unknown"
|
|
288
285
|
}
|
|
@@ -312,6 +309,7 @@ class Mappers {
|
|
|
312
309
|
case "WeChatPay": return STPPaymentMethodType.weChatPay
|
|
313
310
|
case "USBankAccount": return STPPaymentMethodType.USBankAccount
|
|
314
311
|
case "PayPal": return STPPaymentMethodType.payPal
|
|
312
|
+
case "Affirm": return STPPaymentMethodType.affirm
|
|
315
313
|
default: return STPPaymentMethodType.unknown
|
|
316
314
|
}
|
|
317
315
|
}
|
|
@@ -53,6 +53,8 @@ class PaymentMethodFactory {
|
|
|
53
53
|
return try createUSBankAccountPaymentMethodParams()
|
|
54
54
|
case STPPaymentMethodType.payPal:
|
|
55
55
|
return try createPayPalPaymentMethodParams()
|
|
56
|
+
case STPPaymentMethodType.affirm:
|
|
57
|
+
return try createAffirmPaymentMethodParams()
|
|
56
58
|
// case STPPaymentMethodType.weChatPay:
|
|
57
59
|
// return try createWeChatPayPaymentMethodParams()
|
|
58
60
|
default:
|
|
@@ -102,6 +104,8 @@ class PaymentMethodFactory {
|
|
|
102
104
|
return try createUSBankAccountPaymentMethodOptions()
|
|
103
105
|
case STPPaymentMethodType.payPal:
|
|
104
106
|
return nil
|
|
107
|
+
case STPPaymentMethodType.affirm:
|
|
108
|
+
return nil
|
|
105
109
|
default:
|
|
106
110
|
throw PaymentMethodError.paymentNotSupported
|
|
107
111
|
}
|
|
@@ -361,6 +365,11 @@ class PaymentMethodFactory {
|
|
|
361
365
|
private func createPayPalPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
362
366
|
return STPPaymentMethodParams(payPal: STPPaymentMethodPayPalParams(), billingDetails: billingDetailsParams, metadata: nil)
|
|
363
367
|
}
|
|
368
|
+
|
|
369
|
+
private func createAffirmPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
370
|
+
let params = STPPaymentMethodAffirmParams()
|
|
371
|
+
return STPPaymentMethodParams(affirm: params, metadata: nil)
|
|
372
|
+
}
|
|
364
373
|
}
|
|
365
374
|
|
|
366
375
|
enum PaymentMethodError: Error {
|
package/ios/StripeSdk.m
CHANGED
|
@@ -131,5 +131,14 @@ RCT_EXTERN_METHOD(
|
|
|
131
131
|
resolver: (RCTPromiseResolveBlock)resolve
|
|
132
132
|
rejecter: (RCTPromiseRejectBlock)reject
|
|
133
133
|
)
|
|
134
|
-
|
|
134
|
+
RCT_EXTERN_METHOD(
|
|
135
|
+
collectBankAccountToken:(NSString *)clientSecret
|
|
136
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
137
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
138
|
+
)
|
|
139
|
+
RCT_EXTERN_METHOD(
|
|
140
|
+
collectFinancialConnectionsAccounts:(NSString *)clientSecret
|
|
141
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
142
|
+
rejecter: (RCTPromiseRejectBlock)reject
|
|
143
|
+
)
|
|
135
144
|
@end
|