@stripe/stripe-react-native 0.13.1 → 0.16.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/CHANGELOG.md +68 -11
- 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 +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/modules/android.iml +18 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +6 -0
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +28 -6
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +34 -3
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +17 -7
- package/android/src/main/java/com/reactnativestripesdk/GooglePayFragment.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +3 -0
- 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 +48 -28
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +69 -23
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +1 -2
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +19 -7
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +46 -39
- package/android/src/main/java/com/reactnativestripesdk/{Errors.kt → utils/Errors.kt} +1 -1
- package/android/src/main/java/com/reactnativestripesdk/{Extensions.kt → utils/Extensions.kt} +1 -1
- package/android/src/main/java/com/reactnativestripesdk/{Mappers.kt → utils/Mappers.kt} +19 -1
- 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/CardFieldView.swift +11 -8
- package/ios/CardFormView.swift +20 -0
- package/ios/Mappers.swift +8 -13
- package/ios/PaymentMethodFactory.swift +9 -0
- package/ios/StripeSdk.m +5 -0
- package/ios/StripeSdk.swift +60 -53
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme +52 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +22 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +27 -0
- package/ios/Tests/ApplePayUtilsTests.swift +214 -0
- package/ios/Tests/PushProvisioningTests.swift +49 -0
- package/ios/pushprovisioning/AddToWalletButtonView.swift +1 -5
- package/ios/pushprovisioning/PushProvisioningUtils.swift +64 -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/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +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/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +2 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts +1 -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 +2 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -1
- package/lib/typescript/src/types/ApplePay.d.ts +31 -5
- package/lib/typescript/src/types/PaymentMethod.d.ts +9 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +19 -16
- package/lib/typescript/src/types/index.d.ts +20 -0
- package/package.json +7 -15
- package/src/NativeStripeSdk.tsx +5 -0
- package/src/components/AddToWalletButton.tsx +1 -1
- package/src/components/CardForm.tsx +2 -2
- package/src/components/GooglePayButton.tsx +8 -2
- package/src/functions.ts +25 -0
- package/src/hooks/useStripe.tsx +13 -0
- package/src/types/ApplePay.ts +39 -6
- package/src/types/PaymentMethod.ts +11 -1
- package/src/types/PaymentSheet.ts +34 -35
- package/src/types/index.ts +27 -0
- package/stripe-react-native.podspec +6 -1
- 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/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 -17
- 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
package/.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
|
2
|
+
# coding styles between different editors and IDEs
|
|
3
|
+
# editorconfig.org
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
|
|
9
|
+
indent_style = space
|
|
10
|
+
indent_size = 2
|
|
11
|
+
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
charset = utf-8
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
insert_final_newline = true
|
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 0.
|
|
5
|
+
## 0.16.0 - 2022-07-22
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
- The `<GooglePayButton />` component no longer overrides the `type` to use the dark mode version when the device is in Dark Mode. If you set the `type` value, it will always be respected. If you don't set the `type` value, it will match the system's theme (`standard_shadow` when in Light Mode, and `standard_dark` when in Dark Mode). [#1051](https://github.com/stripe/stripe-react-native/pull/1051)
|
|
10
|
+
|
|
11
|
+
### New features
|
|
12
|
+
|
|
13
|
+
- Added support for `pay_dark` and `standard_dark` to the `<GooglePayButton />` component's `type` prop. This allows you to display the [dark Google Pay button](https://developers.google.com/pay/api/android/guides/brand-guidelines). [#1051](https://github.com/stripe/stripe-react-native/pull/1051)
|
|
14
|
+
- Added support for `borderColor`, `borderRadius`, and `cursorColor` to `CardForm`'s `cardStyle` prop on iOS (already exists on Android). [#1048](https://github.com/stripe/stripe-react-native/pull/1048)
|
|
15
|
+
|
|
16
|
+
### Fixes
|
|
17
|
+
|
|
18
|
+
- Reduced the size of the `@stripe/stripe-react-native` by preventing unnecessary files from being published. [#1043](https://github.com/stripe/stripe-react-native/pull/1043)
|
|
19
|
+
|
|
20
|
+
## 0.15.0 - 2022-07-14
|
|
21
|
+
|
|
22
|
+
### Breaking changes
|
|
23
|
+
|
|
24
|
+
- [#1020](https://github.com/stripe/stripe-react-native/pull/1020) Changed some of fields for the `params` object that is supplied to `initPaymentSheet(params)`:
|
|
25
|
+
- **Changed the `applePay` field**. Previously this field accepted a boolean, now it accepts an object of type `ApplePayParams`, which includes the `merchantCountryCode` field, and a new `paymentSummaryItems` field (see "New features" below).
|
|
26
|
+
- **Changed the `googlePay` field**. Previously this field accepted a boolean, now it accepts an object of type `GooglePayParams`, which includes the `merchantCountryCode`, `currencyCode`, and `testEnv` fields.
|
|
27
|
+
- Since the `merchantCountryCode` field now lives under the `applePay` and `googlePay` objects, it has been removed from the base `params` object.
|
|
28
|
+
- Similarly, since the `currencyCode` and `testEnv` fields now live under the `googlePay` object, they have been removed from the base `params` object .
|
|
29
|
+
- [#1020](https://github.com/stripe/stripe-react-native/pull/1020) In `ApplePay.CartSummaryItem`:
|
|
30
|
+
- Renamed `type` to `isPending`- (if you had `type: 'pending'`, replace it with `isPending: true`. if `type: 'final'`, either remove it or set `isPending: false`).
|
|
31
|
+
- The same change was made to `ApplePay.ShippingMethod`: renamed `type` to `isPending`.
|
|
32
|
+
- Added a **new** `paymentType` field. This field is **required**, and in all pre-existing cases where you created a `CartSummaryItem`, should be set to `paymentType: 'Immediate'` (support for types `Deferred` and `Recurring` wasn't available until this release).
|
|
33
|
+
|
|
34
|
+
### New features
|
|
35
|
+
|
|
36
|
+
- Added support for iOS 15 `paymentSummaryItems`: `PKDeferredPaymentSummaryItem` and `PKRecurringPaymentSummaryItem`.
|
|
37
|
+
- You can now specify Apple Pay line items to be displayed when paying with Apple Pay in PaymentSheet by providing `applePay.paymentSummaryItems` to the `initPaymentSheet` method. [#1020](https://github.com/stripe/stripe-react-native/pull/1020)
|
|
38
|
+
- Added support for Affirm (previously, Affirm was only available in the Payment Sheet). [1036](https://github.com/stripe/stripe-react-native/pull/1036)
|
|
39
|
+
|
|
40
|
+
### Fixes
|
|
41
|
+
|
|
42
|
+
- Fixed behavior of `CardField` and `CardForm` on Android to match that on iOS; postal code input no longer accepts characters that are never present in postal codes (anything besides 0-9, a-z, A-Z, hyphens, and whitespace). [#1027](https://github.com/stripe/stripe-react-native/pull/1027).
|
|
43
|
+
- Fixed an issue on older version of React Native where calling `collectBankAccountForSetup` or `collectBankAccountForPayment` and getting a `Canceled` result could cause a crash. [#1037](https://github.com/stripe/stripe-react-native/pull/1037)
|
|
44
|
+
- Fixed an issue where some Android builds would fail on the `lintVitalRelease` step. [#1038](https://github.com/stripe/stripe-react-native/pull/1038)
|
|
45
|
+
|
|
46
|
+
## 0.14.0 - 2022-06-30
|
|
47
|
+
|
|
48
|
+
### Breaking changes
|
|
49
|
+
|
|
50
|
+
### New features
|
|
51
|
+
|
|
52
|
+
- Added the `canAddCardToWallet` method. [#986](https://github.com/stripe/stripe-react-native/pull/986).
|
|
53
|
+
|
|
54
|
+
### Fixes
|
|
55
|
+
|
|
56
|
+
- Fix build errors on Xcode 14 beta 1 by upgrading `stripe-ios` to `~>22.5.1`. [#1011](https://github.com/stripe/stripe-react-native/pull/1011)
|
|
57
|
+
- Fixed an issue on Android where the `brand` field in `CardField`'s `onCardChange` callback wouldn't be set unless the card details were fully complete. [#1012](https://github.com/stripe/stripe-react-native/pull/1012)
|
|
58
|
+
- Fixed an issue where Payment Sheet would cause crashes on Android if `merchantDisplayName` wasn't provided. [#1015](https://github.com/stripe/stripe-react-native/pull/1015)
|
|
59
|
+
- Fixed a bug on Android where a crash could occur if the PaymentSheet was canceled and opened again. [#1014](https://github.com/stripe/stripe-react-native/pull/1014)
|
|
60
|
+
- Fixed an instance on iOS where `CardField`'s expiry date would remain marked as valid, even when it's invalid. [#1018](https://github.com/stripe/stripe-react-native/issues/1018)
|
|
61
|
+
|
|
62
|
+
## 0.13.1 - 2022-06-16
|
|
6
63
|
|
|
7
64
|
### Breaking changes
|
|
8
65
|
|
|
@@ -12,7 +69,7 @@
|
|
|
12
69
|
|
|
13
70
|
- Never show postal code input in `CardField` if `postalCodeEnabled=false` (regardless of `countryCode`). [#996](https://github.com/stripe/stripe-react-native/pull/996)
|
|
14
71
|
|
|
15
|
-
## 0.13.0
|
|
72
|
+
## 0.13.0 - 2022-06-15
|
|
16
73
|
|
|
17
74
|
### Breaking changes
|
|
18
75
|
|
|
@@ -28,7 +85,7 @@
|
|
|
28
85
|
- Fixed an issue on Android where the `complete` field in the `onCardChange` callback would incorrectly be set to `true` even if the postal code wasn't filled out. [#989](https://github.com/stripe/stripe-react-native/pull/989)
|
|
29
86
|
- Make `SetupIntent.lastSetupError` and `PaymentIntent.lastPaymentError` object shape consistent on iOS and Android.[#990](https://github.com/stripe/stripe-react-native/pull/990)
|
|
30
87
|
|
|
31
|
-
## 0.12.0
|
|
88
|
+
## 0.12.0 - 2022-06-02
|
|
32
89
|
|
|
33
90
|
### Breaking changes
|
|
34
91
|
|
|
@@ -44,7 +101,7 @@
|
|
|
44
101
|
- Fixed a bug where the wrong CVC icon was show in the `CardForm` component on Android. [#966](https://github.com/stripe/stripe-react-native/pull/966)
|
|
45
102
|
- The card brand tint color is now correctly set in the `CardField` component on Android via the `cardStyle.textColor` prop. [#851](https://github.com/stripe/stripe-react-native/pull/851)
|
|
46
103
|
|
|
47
|
-
## 0.11.0
|
|
104
|
+
## 0.11.0 - 2022-05-24
|
|
48
105
|
|
|
49
106
|
### Breaking changes
|
|
50
107
|
|
|
@@ -60,7 +117,7 @@
|
|
|
60
117
|
- Improved error messages on Android for failed `confirmPayment` and `confirmSetupIntent` calls, and any Google Pay related methods. [#957](https://github.com/stripe/stripe-react-native/pull/957)
|
|
61
118
|
- Made Android card validation state consistent with iOS in the `CardField` `onCardChange` callback. [#958](https://github.com/stripe/stripe-react-native/pull/958)
|
|
62
119
|
|
|
63
|
-
## 0.10.0
|
|
120
|
+
## 0.10.0 - 2022-05-19
|
|
64
121
|
|
|
65
122
|
### Breaking changes
|
|
66
123
|
|
|
@@ -72,7 +129,7 @@
|
|
|
72
129
|
|
|
73
130
|
### Fixes
|
|
74
131
|
|
|
75
|
-
## 0.9.0
|
|
132
|
+
## 0.9.0 - 2022-05-10
|
|
76
133
|
|
|
77
134
|
- [#913](https://github.com/stripe/stripe-react-native/pull/913) BREAKING CHANGE: Changed props for the `<AddToWalletButton />` component. Instead of passing `cardHolderName`, `cardLastFour`, `cardDescription`, and `cardBrand` directly as props, you will instead pass a `cardDetails` prop, which is an object containing the following fields:
|
|
78
135
|
- `primaryAccountIdentifier`: The `wallet.primary_account_identifier` value from the issued card.
|
|
@@ -89,7 +146,7 @@
|
|
|
89
146
|
- [#914](https://github.com/stripe/stripe-react-native/pull/914) fix: add `fingerprint` to Card result object on Android (already present on iOS)
|
|
90
147
|
- [#912](https://github.com/stripe/stripe-react-native/pull/912) fix: allow for providing zip code straight from `CardField` component on Android
|
|
91
148
|
|
|
92
|
-
## 0.8.0
|
|
149
|
+
## 0.8.0 - 2022-04-27
|
|
93
150
|
|
|
94
151
|
- **Breaking: This version requires you use `react-native@0.64.0` or above**
|
|
95
152
|
- [#902](https://github.com/stripe/stripe-react-native/pull/902) fix: create custom babel plugin for package.json imports in src/
|
|
@@ -99,7 +156,7 @@
|
|
|
99
156
|
- [#849](https://github.com/stripe/stripe-react-native/pull/849) BREAKING CHANGE: Renamed `placeholder` prop on `<CardField />` and `<CardForm />` to `placeholders`.
|
|
100
157
|
- [#849](https://github.com/stripe/stripe-react-native/pull/849) Feat: Added customized styling options to `<CardForm />` on Android.
|
|
101
158
|
|
|
102
|
-
## 0.7.0
|
|
159
|
+
## 0.7.0 - 2022-04-19
|
|
103
160
|
|
|
104
161
|
- [#894](https://github.com/stripe/stripe-react-native/pull/894) Fix: `<CardField />` `onBlur` callback will now be called appropriately on Android
|
|
105
162
|
- [#846](https://github.com/stripe/stripe-react-native/pull/846) Fix: Avoid crashes when `currentActivity` is null
|
|
@@ -143,21 +200,21 @@
|
|
|
143
200
|
- (Typescript) `GooglePay.IsGooglePaySupportedParams` is now `GooglePay.IsSupportedParams`
|
|
144
201
|
- (Typescript) Removed `GooglePay.SetupIntentParams`
|
|
145
202
|
|
|
146
|
-
## 0.6.0
|
|
203
|
+
## 0.6.0 - 2022-04-01
|
|
147
204
|
|
|
148
205
|
- [#861](https://github.com/stripe/stripe-react-native/pull/861) BREAKING: This library now supports iOS 12 and up, due to `stripe-ios` increasing the deployment target. If you would like to build for iOS 11, please continue to use `@stripe/stripe-react-native@0.5.0`.
|
|
149
206
|
- To upgrade your iOS deployment target to 12.0, you can either do so in Xcode under your `Build Settings`, or by modifying `IPHONEOS_DEPLOYMENT_TARGET` in your `project.pbxproj` directly. You will also need to update your Podfile to target `:ios, '12.0'`.
|
|
150
207
|
- [#861](https://github.com/stripe/stripe-react-native/pull/861) Feat: Add support for ACHv2 payments **on iOS only**.
|
|
151
208
|
- [#861](https://github.com/stripe/stripe-react-native/pull/861) Chore: Upgrade `stripe-ios` to 22.0.0.
|
|
152
209
|
|
|
153
|
-
## 0.5.0
|
|
210
|
+
## 0.5.0 - 2022-03-29
|
|
154
211
|
|
|
155
212
|
- [#863](https://github.com/stripe/stripe-react-native/pull/863) Feat: add card ID and bankAccount ID to token response
|
|
156
213
|
- [#862](https://github.com/stripe/stripe-react-native/pull/862) Feat: Add support for setting a card's `currency` when creating a Token
|
|
157
214
|
- [#854](https://github.com/stripe/stripe-react-native/pull/854) Chore: Upgrade `stripe-ios` to 21.13.0. Upgrade `stripe-android` to 19.3.0.
|
|
158
215
|
- [#845](https://github.com/stripe/stripe-react-native/pull/845) Feat: Added support for `placeholderColor`, `textErrorColor `, `borderColor`, `borderRadius`, and `borderWidth` for `AuBECSDebitForm` on iOS
|
|
159
216
|
|
|
160
|
-
## 0.4.0
|
|
217
|
+
## 0.4.0 - 2022-03-10
|
|
161
218
|
|
|
162
219
|
- [#821](https://github.com/stripe/stripe-react-native/pull/821) Feat: Add support for Klarna
|
|
163
220
|
- [#630](https://github.com/stripe/stripe-react-native/pull/630) Fix: card field focus jumps back to the card number field on Android
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
+
<component name="GradleSettings">
|
|
5
|
+
<option name="linkedExternalProjectsSettings">
|
|
6
|
+
<GradleProjectSettings>
|
|
7
|
+
<option name="testRunner" value="GRADLE" />
|
|
8
|
+
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
+
</GradleProjectSettings>
|
|
11
|
+
</option>
|
|
12
|
+
</component>
|
|
13
|
+
</project>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
|
4
|
+
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectType">
|
|
7
|
+
<option name="id" value="Android" />
|
|
8
|
+
</component>
|
|
9
|
+
</project>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="android-gradle" name="Android-Gradle">
|
|
5
|
+
<configuration>
|
|
6
|
+
<option name="GRADLE_PROJECT_PATH" value=":" />
|
|
7
|
+
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
|
|
8
|
+
<option name="LAST_KNOWN_AGP_VERSION" />
|
|
9
|
+
</configuration>
|
|
10
|
+
</facet>
|
|
11
|
+
</component>
|
|
12
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
13
|
+
<exclude-output />
|
|
14
|
+
<content url="file://$MODULE_DIR$/../.." />
|
|
15
|
+
<orderEntry type="inheritedJdk" />
|
|
16
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
17
|
+
</component>
|
|
18
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/android/build.gradle
CHANGED
|
@@ -34,6 +34,7 @@ android {
|
|
|
34
34
|
versionCode 1
|
|
35
35
|
versionName "1.0"
|
|
36
36
|
vectorDrawables.useSupportLibrary = true
|
|
37
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
buildTypes {
|
|
@@ -146,4 +147,9 @@ dependencies {
|
|
|
146
147
|
|
|
147
148
|
// Users need to declare this dependency on their own, otherwise all methods are a no-op
|
|
148
149
|
compileOnly 'com.stripe:stripe-android-issuing-push-provisioning:1.1.0'
|
|
150
|
+
|
|
151
|
+
androidTestImplementation "junit:junit:4.13"
|
|
152
|
+
androidTestImplementation "androidx.test:core:1.4.0"
|
|
153
|
+
androidTestImplementation 'androidx.test:runner:1.1.0'
|
|
154
|
+
androidTestImplementation "org.mockito:mockito-core:3.+"
|
|
149
155
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Tue Jun 21 15:53:06 EDT 2022
|
|
8
|
+
sdk.dir=/Users/charliecruzan/Library/Android/sdk
|
|
@@ -10,6 +10,8 @@ import com.facebook.react.uimanager.events.EventDispatcher
|
|
|
10
10
|
import com.google.android.material.shape.CornerFamily
|
|
11
11
|
import com.google.android.material.shape.MaterialShapeDrawable
|
|
12
12
|
import com.google.android.material.shape.ShapeAppearanceModel
|
|
13
|
+
import com.reactnativestripesdk.utils.getIntOrNull
|
|
14
|
+
import com.reactnativestripesdk.utils.getValOr
|
|
13
15
|
import com.stripe.android.databinding.BecsDebitWidgetBinding
|
|
14
16
|
import com.stripe.android.model.PaymentMethodCreateParams
|
|
15
17
|
import com.stripe.android.view.BecsDebitWidget
|
|
@@ -5,6 +5,7 @@ import android.graphics.Color
|
|
|
5
5
|
import android.graphics.Typeface
|
|
6
6
|
import android.os.Build
|
|
7
7
|
import android.text.Editable
|
|
8
|
+
import android.text.InputFilter
|
|
8
9
|
import android.text.TextWatcher
|
|
9
10
|
import android.util.Log
|
|
10
11
|
import android.widget.FrameLayout
|
|
@@ -16,6 +17,8 @@ import com.facebook.react.uimanager.events.EventDispatcher
|
|
|
16
17
|
import com.google.android.material.shape.CornerFamily
|
|
17
18
|
import com.google.android.material.shape.MaterialShapeDrawable
|
|
18
19
|
import com.google.android.material.shape.ShapeAppearanceModel
|
|
20
|
+
import com.reactnativestripesdk.utils.*
|
|
21
|
+
import com.reactnativestripesdk.utils.mapCardBrand
|
|
19
22
|
import com.stripe.android.core.model.CountryCode
|
|
20
23
|
import com.stripe.android.core.model.CountryUtils
|
|
21
24
|
import com.stripe.android.databinding.CardInputWidgetBinding
|
|
@@ -25,7 +28,6 @@ import com.stripe.android.view.CardInputListener
|
|
|
25
28
|
import com.stripe.android.view.CardInputWidget
|
|
26
29
|
import com.stripe.android.view.CardValidCallback
|
|
27
30
|
import com.stripe.android.view.StripeEditText
|
|
28
|
-
import java.lang.Exception
|
|
29
31
|
|
|
30
32
|
class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
31
33
|
private var mCardWidget: CardInputWidget = CardInputWidget(context)
|
|
@@ -205,12 +207,11 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
205
207
|
* We can reliable assume that setPostalCodeEnabled is called before
|
|
206
208
|
* setCountryCode because of the order of the props in CardField.tsx
|
|
207
209
|
*/
|
|
208
|
-
fun setCountryCode(
|
|
210
|
+
fun setCountryCode(countryString: String?) {
|
|
209
211
|
if (mCardWidget.postalCodeEnabled) {
|
|
210
|
-
val
|
|
211
|
-
|
|
212
|
-
)
|
|
213
|
-
mCardWidget.postalCodeRequired = doesCountryUsePostalCode
|
|
212
|
+
val countryCode = CountryCode.create(value = countryString ?: LocaleListCompat.getAdjustedDefault()[0].country)
|
|
213
|
+
mCardWidget.postalCodeRequired = CountryUtils.doesCountryUsePostalCode(countryCode)
|
|
214
|
+
setPostalCodeFilter(countryCode)
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
|
|
@@ -275,6 +276,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
275
276
|
cardDetails["validNumber"] = getCardValidationState(CardValidCallback.Fields.Number, cardInputWidgetBinding.cardNumberEditText)
|
|
276
277
|
cardDetails["validCVC"] = getCardValidationState(CardValidCallback.Fields.Cvc, cardInputWidgetBinding.cvcEditText)
|
|
277
278
|
cardDetails["validExpiryDate"] = getCardValidationState(CardValidCallback.Fields.Expiry, cardInputWidgetBinding.expiryDateEditText)
|
|
279
|
+
cardDetails["brand"] = mapCardBrand(cardInputWidgetBinding.cardNumberEditText.cardBrand)
|
|
278
280
|
|
|
279
281
|
if (isValid) {
|
|
280
282
|
onValidCardChange()
|
|
@@ -335,6 +337,26 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
335
337
|
})
|
|
336
338
|
}
|
|
337
339
|
|
|
340
|
+
private fun setPostalCodeFilter(countryCode: CountryCode) {
|
|
341
|
+
cardInputWidgetBinding.postalCodeEditText.filters = arrayOf(
|
|
342
|
+
*cardInputWidgetBinding.postalCodeEditText.filters,
|
|
343
|
+
createPostalCodeInputFilter(countryCode)
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
private fun createPostalCodeInputFilter(countryCode: CountryCode): InputFilter {
|
|
348
|
+
return InputFilter { charSequence, start, end, _, _, _ ->
|
|
349
|
+
for (i in start until end) {
|
|
350
|
+
val isValidCharacter = (countryCode == CountryCode.US && PostalCodeUtilities.isValidUsPostalCodeCharacter(charSequence[i])) ||
|
|
351
|
+
(countryCode != CountryCode.US && PostalCodeUtilities.isValidGlobalPostalCodeCharacter(charSequence[i]))
|
|
352
|
+
if (!isValidCharacter) {
|
|
353
|
+
return@InputFilter ""
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return@InputFilter null
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
338
360
|
override fun requestLayout() {
|
|
339
361
|
super.requestLayout()
|
|
340
362
|
post(mLayoutRunnable)
|
|
@@ -4,6 +4,7 @@ import android.content.res.ColorStateList
|
|
|
4
4
|
import android.graphics.Color
|
|
5
5
|
import android.graphics.Typeface
|
|
6
6
|
import android.os.Build
|
|
7
|
+
import android.text.InputFilter
|
|
7
8
|
import android.view.View
|
|
8
9
|
import android.view.View.OnFocusChangeListener
|
|
9
10
|
import android.widget.FrameLayout
|
|
@@ -14,6 +15,8 @@ import com.facebook.react.uimanager.events.EventDispatcher
|
|
|
14
15
|
import com.google.android.material.shape.CornerFamily
|
|
15
16
|
import com.google.android.material.shape.MaterialShapeDrawable
|
|
16
17
|
import com.google.android.material.shape.ShapeAppearanceModel
|
|
18
|
+
import com.reactnativestripesdk.utils.*
|
|
19
|
+
import com.reactnativestripesdk.utils.mapCardBrand
|
|
17
20
|
import com.stripe.android.core.model.CountryCode
|
|
18
21
|
import com.stripe.android.databinding.CardMultilineWidgetBinding
|
|
19
22
|
import com.stripe.android.databinding.StripeCardFormViewBinding
|
|
@@ -50,10 +53,15 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
fun setDefaultValues(defaults: ReadableMap) {
|
|
53
|
-
defaults.getString("countryCode")
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
setCountry(defaults.getString("countryCode"))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private fun setCountry(countryString: String?) {
|
|
60
|
+
if (countryString != null) {
|
|
61
|
+
cardFormViewBinding.countryLayout.setSelectedCountryCode(CountryCode(countryString))
|
|
62
|
+
cardFormViewBinding.countryLayout.updateUiForCountryEntered(CountryCode(countryString))
|
|
56
63
|
}
|
|
64
|
+
setPostalCodeFilter()
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
fun setPlaceHolders(value: ReadableMap) {
|
|
@@ -254,6 +262,29 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
254
262
|
}
|
|
255
263
|
}
|
|
256
264
|
|
|
265
|
+
private fun setPostalCodeFilter() {
|
|
266
|
+
cardFormViewBinding.postalCode.filters = arrayOf(
|
|
267
|
+
*cardFormViewBinding.postalCode.filters,
|
|
268
|
+
createPostalCodeInputFilter()
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
private fun createPostalCodeInputFilter(): InputFilter {
|
|
273
|
+
return InputFilter { charSequence, start, end, _, _, _ ->
|
|
274
|
+
if (cardFormViewBinding.countryLayout.getSelectedCountryCode() == CountryCode.US) {
|
|
275
|
+
// Rely on CardFormView's built-in US postal code filter
|
|
276
|
+
return@InputFilter null
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
for (i in start until end) {
|
|
280
|
+
if (!PostalCodeUtilities.isValidGlobalPostalCodeCharacter(charSequence[i])) {
|
|
281
|
+
return@InputFilter ""
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return@InputFilter null
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
257
288
|
override fun requestLayout() {
|
|
258
289
|
super.requestLayout()
|
|
259
290
|
post(mLayoutRunnable)
|
package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt
CHANGED
|
@@ -9,6 +9,11 @@ import androidx.appcompat.app.AppCompatActivity
|
|
|
9
9
|
import androidx.fragment.app.Fragment
|
|
10
10
|
import com.facebook.react.bridge.Promise
|
|
11
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
+
import com.reactnativestripesdk.utils.*
|
|
13
|
+
import com.reactnativestripesdk.utils.createError
|
|
14
|
+
import com.reactnativestripesdk.utils.createResult
|
|
15
|
+
import com.reactnativestripesdk.utils.mapFromPaymentIntentResult
|
|
16
|
+
import com.reactnativestripesdk.utils.mapFromSetupIntentResult
|
|
12
17
|
import com.stripe.android.model.PaymentIntent
|
|
13
18
|
import com.stripe.android.model.SetupIntent
|
|
14
19
|
import com.stripe.android.model.StripeIntent
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
+
import android.content.res.Configuration
|
|
3
4
|
import android.view.LayoutInflater
|
|
4
5
|
import android.widget.FrameLayout
|
|
5
6
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
@@ -8,13 +9,17 @@ class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout
|
|
|
8
9
|
private var buttonType: String? = null
|
|
9
10
|
|
|
10
11
|
fun initialize() {
|
|
11
|
-
val type =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
val type =
|
|
13
|
+
when (buttonType) {
|
|
14
|
+
"pay" -> R.layout.pay_with_googlepay_button_no_shadow
|
|
15
|
+
"pay_dark" -> R.layout.pay_with_googlepay_button_dark
|
|
16
|
+
"pay_shadow" -> R.layout.pay_with_googlepay_button
|
|
17
|
+
"standard" -> R.layout.googlepay_button_no_shadow
|
|
18
|
+
"standard_dark" -> R.layout.googlepay_button_dark
|
|
19
|
+
"standard_shadow" -> R.layout.googlepay_button
|
|
20
|
+
else -> if (isNightMode()) R.layout.googlepay_button_dark else R.layout.googlepay_button
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
val button = LayoutInflater.from(context).inflate(
|
|
19
24
|
type, null
|
|
20
25
|
)
|
|
@@ -25,4 +30,9 @@ class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout
|
|
|
25
30
|
fun setType(type: String) {
|
|
26
31
|
buttonType = type
|
|
27
32
|
}
|
|
33
|
+
|
|
34
|
+
private fun isNightMode(): Boolean {
|
|
35
|
+
val nightModeFlags: Int = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
|
36
|
+
return nightModeFlags == Configuration.UI_MODE_NIGHT_YES
|
|
37
|
+
}
|
|
28
38
|
}
|
|
@@ -8,6 +8,10 @@ import android.widget.FrameLayout
|
|
|
8
8
|
import androidx.fragment.app.Fragment
|
|
9
9
|
import com.facebook.react.bridge.Promise
|
|
10
10
|
import com.facebook.react.bridge.WritableNativeMap
|
|
11
|
+
import com.reactnativestripesdk.utils.GooglePayErrorType
|
|
12
|
+
import com.reactnativestripesdk.utils.createError
|
|
13
|
+
import com.reactnativestripesdk.utils.createResult
|
|
14
|
+
import com.reactnativestripesdk.utils.mapFromPaymentMethod
|
|
11
15
|
import com.stripe.android.googlepaylauncher.GooglePayEnvironment
|
|
12
16
|
import com.stripe.android.googlepaylauncher.GooglePayLauncher
|
|
13
17
|
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher
|
|
@@ -9,6 +9,9 @@ import androidx.appcompat.app.AppCompatActivity
|
|
|
9
9
|
import androidx.fragment.app.Fragment
|
|
10
10
|
import com.facebook.react.bridge.Promise
|
|
11
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
+
import com.reactnativestripesdk.utils.*
|
|
13
|
+
import com.reactnativestripesdk.utils.createError
|
|
14
|
+
import com.reactnativestripesdk.utils.createMissingActivityError
|
|
12
15
|
import com.stripe.android.ApiResultCallback
|
|
13
16
|
import com.stripe.android.Stripe
|
|
14
17
|
import com.stripe.android.model.*
|