@stripe/stripe-react-native 0.57.0 → 0.57.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +1029 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +19 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +76 -118
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/settings.gradle +2 -0
- package/android/spotless.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +20 -17
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +13 -11
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +17 -21
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherManager.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +53 -11
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +105 -117
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -8
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +13 -15
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +7 -5
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt +31 -0
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +120 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +228 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +73 -30
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +19 -245
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +52 -14
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +4 -4
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +15 -35
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +5 -10
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +90 -77
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +6 -4
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +13 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +41 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +92 -44
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +3 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +118 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +922 -0
- package/android/src/test/java/com/facebook/testutils/shadows/ShadowArguments.kt +29 -0
- package/android/src/test/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManagerTest.kt +163 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +976 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetAppearanceTest.kt +801 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +523 -0
- package/android/src/test/java/com/reactnativestripesdk/addresssheet/AddressSheetViewTest.kt +551 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +567 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +456 -0
- package/android/src/test/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +43 -0
- package/android/src/test/resources/robolectric.properties +2 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +3 -3
- package/ios/AddressSheet/AddressSheetView.swift +25 -25
- package/ios/AddressSheet/AddressSheetViewManager.swift +2 -2
- package/ios/ApplePayButtonManager.swift +1 -1
- package/ios/ApplePayButtonView.swift +9 -10
- package/ios/ApplePayUtils.swift +51 -51
- package/ios/ApplePayViewController.swift +25 -29
- package/ios/AuBECSDebitFormManager.swift +1 -1
- package/ios/AuBECSDebitFormView.swift +13 -15
- package/ios/CardFieldManager.swift +4 -4
- package/ios/CardFieldView.swift +9 -9
- package/ios/CardFormManager.swift +3 -3
- package/ios/CardFormView.swift +28 -28
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingView.swift +97 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +133 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.m +16 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.swift +17 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +15 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +19 -19
- package/ios/EmbeddedPaymentElementView.swift +2 -2
- package/ios/Errors.swift +22 -23
- package/ios/FinancialConnections.swift +37 -37
- package/ios/Mappers.swift +210 -71
- package/ios/NavigationBarManager.m +13 -0
- package/ios/NavigationBarManager.swift +17 -0
- package/ios/NavigationBarView.swift +65 -0
- package/ios/NewArch/NavigationBarComponentView.h +10 -0
- package/ios/NewArch/NavigationBarComponentView.mm +86 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
- package/ios/PaymentMethodFactory.swift +24 -24
- package/ios/PaymentOptionDisplayData+ReactNative.swift +4 -4
- package/ios/PaymentPassFinder.swift +9 -10
- package/ios/PaymentSheetAppearance.swift +137 -138
- package/ios/PushProvisioning/AddToWalletButtonManager.swift +2 -2
- package/ios/PushProvisioning/AddToWalletButtonView.swift +15 -17
- package/ios/PushProvisioning/PushProvisioningUtils.swift +11 -11
- package/ios/StripeContainerManager.swift +1 -1
- package/ios/StripeContainerView.swift +3 -3
- package/ios/StripeOnrampSdk.h +17 -0
- package/ios/StripeOnrampSdk.mm +158 -0
- package/ios/StripeSdk.mm +8 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/tianzhao.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/tianzhao.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
- package/ios/StripeSdkEmitter.swift +4 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +30 -25
- package/ios/StripeSdkImpl+Embedded.swift +11 -9
- package/ios/StripeSdkImpl+PaymentSheet.swift +36 -34
- package/ios/StripeSdkImpl.swift +913 -185
- package/ios/UIColorExtension.swift +72 -0
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/connect/Components.js +2 -0
- package/lib/commonjs/connect/Components.js.map +1 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js +2 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/commonjs/connect/EmbeddedComponent.js +19 -0
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -0
- package/lib/commonjs/connect/ModalCloseButton.js +2 -0
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -0
- package/lib/commonjs/connect/NavigationBar.js +2 -0
- package/lib/commonjs/connect/NavigationBar.js.map +1 -0
- package/lib/commonjs/connect/connectTypes.js +2 -0
- package/lib/commonjs/connect/connectTypes.js.map +1 -0
- package/lib/commonjs/events.js +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/hooks/useOnramp.js +2 -0
- package/lib/commonjs/hooks/useOnramp.js.map +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withStripe.js +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +2 -0
- package/lib/commonjs/specs/NativeNavigationBar.js.map +1 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/Onramp.js +2 -0
- package/lib/commonjs/types/Onramp.js.map +1 -0
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/connect/Components.js +2 -0
- package/lib/module/connect/Components.js.map +1 -0
- package/lib/module/connect/ConnectComponentsProvider.js +2 -0
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/module/connect/EmbeddedComponent.js +19 -0
- package/lib/module/connect/EmbeddedComponent.js.map +1 -0
- package/lib/module/connect/ModalCloseButton.js +2 -0
- package/lib/module/connect/ModalCloseButton.js.map +1 -0
- package/lib/module/connect/NavigationBar.js +2 -0
- package/lib/module/connect/NavigationBar.js.map +1 -0
- package/lib/module/connect/connectTypes.js +2 -0
- package/lib/module/connect/connectTypes.js.map +1 -0
- package/lib/module/events.js +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/hooks/useOnramp.js +2 -0
- package/lib/module/hooks/useOnramp.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withStripe.js +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js.map +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js.map +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/module/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/module/specs/NativeNavigationBar.js +2 -0
- package/lib/module/specs/NativeNavigationBar.js.map +1 -0
- package/lib/module/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/Onramp.js +2 -0
- package/lib/module/types/Onramp.js.map +1 -0
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
- package/lib/typescript/src/connect/Components.d.ts +23 -0
- package/lib/typescript/src/connect/Components.d.ts.map +1 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +22 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts +18 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts +7 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts.map +1 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts +8 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/connect/connectTypes.d.ts +464 -0
- package/lib/typescript/src/connect/connectTypes.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +4 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/helpers.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +158 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/plugin/withStripe.d.ts +15 -0
- package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts +14 -0
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts +11 -0
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +28 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/Errors.d.ts +5 -0
- package/lib/typescript/src/types/Errors.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +275 -0
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +7 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +25 -14
- package/src/components/StripeProvider.tsx +5 -0
- package/src/connect/Components.tsx +279 -0
- package/src/connect/ConnectComponentsProvider.tsx +93 -0
- package/src/connect/EmbeddedComponent.tsx +407 -0
- package/src/connect/ModalCloseButton.tsx +44 -0
- package/src/connect/NavigationBar.tsx +29 -0
- package/src/connect/connectTypes.ts +626 -0
- package/src/events.ts +23 -0
- package/src/hooks/useOnramp.tsx +334 -0
- package/src/index.tsx +13 -0
- package/src/plugin/withStripe.ts +104 -7
- package/src/specs/NativeConnectAccountOnboardingView.ts +19 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +5 -1
- package/src/specs/NativeNavigationBar.ts +16 -0
- package/src/specs/NativeOnrampSdkModule.ts +47 -0
- package/src/specs/NativeStripeSdkModule.ts +5 -0
- package/src/types/EmbeddedPaymentElement.tsx +24 -3
- package/src/types/Errors.ts +6 -0
- package/src/types/Onramp.ts +317 -0
- package/src/types/PaymentSheet.ts +7 -0
- package/src/types/index.ts +8 -0
- package/stripe-react-native.podspec +20 -7
|
@@ -0,0 +1,19 @@
|
|
|
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="CHOOSE_PER_TEST" />
|
|
8
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
9
|
+
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
|
10
|
+
<option name="modules">
|
|
11
|
+
<set>
|
|
12
|
+
<option value="$PROJECT_DIR$" />
|
|
13
|
+
</set>
|
|
14
|
+
</option>
|
|
15
|
+
<option name="resolveExternalAnnotations" value="false" />
|
|
16
|
+
</GradleProjectSettings>
|
|
17
|
+
</option>
|
|
18
|
+
</component>
|
|
19
|
+
</project>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
4
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
|
5
|
+
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
6
|
+
</component>
|
|
7
|
+
<component name="ProjectType">
|
|
8
|
+
<option name="id" value="Android" />
|
|
9
|
+
</component>
|
|
10
|
+
</project>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="RunConfigurationProducerService">
|
|
4
|
+
<option name="ignoredProducers">
|
|
5
|
+
<set>
|
|
6
|
+
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
|
7
|
+
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
|
8
|
+
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
|
9
|
+
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
|
10
|
+
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
|
11
|
+
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
|
12
|
+
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
|
13
|
+
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
|
14
|
+
</set>
|
|
15
|
+
</option>
|
|
16
|
+
</component>
|
|
17
|
+
</project>
|
package/android/build.gradle
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
buildscript {
|
|
2
2
|
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
-
def
|
|
4
|
-
? rootProject.ext.get(
|
|
5
|
-
: project.properties[
|
|
3
|
+
def kotlinVersion = rootProject.ext.has("kotlinVersion")
|
|
4
|
+
? rootProject.ext.get("kotlinVersion")
|
|
5
|
+
: project.properties["StripeSdk_kotlinVersion"]
|
|
6
6
|
|
|
7
|
-
def kotlinMajor =
|
|
7
|
+
def kotlinMajor = kotlinVersion.tokenize("\\.")[0].toInteger()
|
|
8
8
|
|
|
9
9
|
repositories {
|
|
10
10
|
google()
|
|
@@ -12,28 +12,28 @@ buildscript {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
dependencies {
|
|
15
|
-
classpath
|
|
15
|
+
classpath "com.android.tools.build:gradle:7.2.2"
|
|
16
16
|
// noinspection DifferentKotlinGradleVersion
|
|
17
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
18
|
-
classpath
|
|
17
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
18
|
+
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
|
|
19
19
|
// only use this old compose-compiler plugin when Kotlin >= 2.0
|
|
20
20
|
if (kotlinMajor >= 2) {
|
|
21
|
-
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$
|
|
21
|
+
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (project == rootProject) {
|
|
27
|
-
apply from:
|
|
27
|
+
apply from: "spotless.gradle"
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
def getExtOrDefault(name) {
|
|
32
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties[
|
|
32
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["StripeSdk_" + name]
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
def getExtOrIntegerDefault(name) {
|
|
36
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties[
|
|
36
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["StripeSdk_" + name]).toInteger()
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
def isNewArchitectureEnabled() {
|
|
@@ -44,6 +44,11 @@ def isNewArchitectureEnabled() {
|
|
|
44
44
|
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
def isOnrampIncluded() {
|
|
48
|
+
return rootProject.ext.has("StripeSdk_includeOnramp") &&
|
|
49
|
+
rootProject.ext.StripeSdk_includeOnramp.toString().toLowerCase() == "true"
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
def reactNativeArchitectures() {
|
|
48
53
|
def value = project.getProperties().get("reactNativeArchitectures")
|
|
49
54
|
return value ? value.split(",") : [
|
|
@@ -54,22 +59,19 @@ def reactNativeArchitectures() {
|
|
|
54
59
|
]
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
def
|
|
58
|
-
|
|
59
|
-
: project.properties['StripeSdk_kotlinVersion']
|
|
60
|
-
def kotlinMajor = kotlin_version.tokenize('\\.')[0].toInteger()
|
|
62
|
+
def kotlinVersion = getExtOrDefault("kotlinVersion")
|
|
63
|
+
def kotlinMajor = kotlinVersion.tokenize("\\.")[0].toInteger()
|
|
61
64
|
|
|
62
|
-
apply plugin:
|
|
63
|
-
apply plugin:
|
|
64
|
-
apply plugin:
|
|
65
|
+
apply plugin: "com.android.library"
|
|
66
|
+
apply plugin: "kotlin-android"
|
|
67
|
+
apply plugin: "kotlin-parcelize"
|
|
65
68
|
// Only apply the compose plugin if we have the old compose-compiler on the classpath
|
|
66
69
|
if (kotlinMajor >= 2) {
|
|
67
|
-
apply plugin:
|
|
70
|
+
apply plugin: "org.jetbrains.kotlin.plugin.compose"
|
|
68
71
|
}
|
|
69
|
-
//apply plugin: 'kotlin-android-extensions'
|
|
70
72
|
|
|
71
73
|
if (isNewArchitectureEnabled()) {
|
|
72
|
-
apply plugin:
|
|
74
|
+
apply plugin: "com.facebook.react"
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
android {
|
|
@@ -78,7 +80,7 @@ android {
|
|
|
78
80
|
buildConfig true
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
compileSdkVersion getExtOrIntegerDefault(
|
|
83
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
82
84
|
|
|
83
85
|
// Used to override the NDK path/version on internal CI or by allowing
|
|
84
86
|
// users to customize the NDK path/version from their root project (e.g. for M1 support)
|
|
@@ -90,28 +92,24 @@ android {
|
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
defaultConfig {
|
|
93
|
-
minSdkVersion getExtOrIntegerDefault(
|
|
94
|
-
targetSdkVersion getExtOrIntegerDefault(
|
|
95
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
96
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
95
97
|
versionCode 1
|
|
96
98
|
versionName "1.0"
|
|
97
99
|
vectorDrawables.useSupportLibrary = true
|
|
98
|
-
|
|
99
|
-
consumerProguardFiles 'proguard-rules.txt'
|
|
100
|
+
consumerProguardFiles "proguard-rules.txt"
|
|
100
101
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
102
|
+
buildConfigField "boolean", "IS_ONRAMP_INCLUDED", isOnrampIncluded().toString()
|
|
101
103
|
|
|
102
104
|
ndk {
|
|
103
105
|
abiFilters(*reactNativeArchitectures())
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
buildTypes {
|
|
108
|
-
release {
|
|
109
|
-
minifyEnabled false
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
109
|
lintOptions {
|
|
114
|
-
disable
|
|
110
|
+
disable "GradleCompatible"
|
|
111
|
+
textReport true
|
|
112
|
+
textOutput "stdout"
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
compileOptions {
|
|
@@ -119,6 +117,10 @@ android {
|
|
|
119
117
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
120
118
|
}
|
|
121
119
|
|
|
120
|
+
kotlinOptions {
|
|
121
|
+
allWarningsAsErrors = System.getenv("RN_STRIPE_WARNINGS_AS_ERRORS") == "true"
|
|
122
|
+
}
|
|
123
|
+
|
|
122
124
|
buildFeatures {
|
|
123
125
|
viewBinding true
|
|
124
126
|
compose true
|
|
@@ -129,6 +131,19 @@ android {
|
|
|
129
131
|
if (!isNewArchitectureEnabled()) {
|
|
130
132
|
srcDirs += ["src/oldarch/java"]
|
|
131
133
|
}
|
|
134
|
+
if (isOnrampIncluded()) {
|
|
135
|
+
srcDirs += ["src/onramp/java"]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// When running tests on bitrise we need to make sure that the test artifacts are inside
|
|
141
|
+
// the root project directory (in that case example/android), or it won't be picked up.
|
|
142
|
+
testOptions {
|
|
143
|
+
unitTests.all { Test test ->
|
|
144
|
+
def outputRoot = rootProject.layout.buildDirectory.get().asFile
|
|
145
|
+
test.reports.junitXml.outputLocation.set(new File(outputRoot, "test-results/${test.name}"))
|
|
146
|
+
test.reports.html.outputLocation.set(new File(outputRoot, "reports/tests/${test.name}"))
|
|
132
147
|
}
|
|
133
148
|
}
|
|
134
149
|
}
|
|
@@ -136,104 +151,47 @@ android {
|
|
|
136
151
|
repositories {
|
|
137
152
|
mavenCentral()
|
|
138
153
|
google()
|
|
139
|
-
|
|
140
|
-
def found = false
|
|
141
|
-
def defaultDir = null
|
|
142
|
-
def androidSourcesName = 'React Native sources'
|
|
143
|
-
|
|
144
|
-
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
145
|
-
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
146
|
-
} else {
|
|
147
|
-
defaultDir = new File(
|
|
148
|
-
projectDir,
|
|
149
|
-
'/../../../node_modules/react-native/android'
|
|
150
|
-
)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (defaultDir.exists()) {
|
|
154
|
-
maven {
|
|
155
|
-
url defaultDir.toString()
|
|
156
|
-
name androidSourcesName
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
160
|
-
found = true
|
|
161
|
-
} else {
|
|
162
|
-
def parentDir = rootProject.projectDir
|
|
163
|
-
|
|
164
|
-
1.upto(5, {
|
|
165
|
-
if (found) return true
|
|
166
|
-
parentDir = parentDir.parentFile
|
|
167
|
-
|
|
168
|
-
def androidSourcesDir = new File(
|
|
169
|
-
parentDir,
|
|
170
|
-
'node_modules/react-native'
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
def androidPrebuiltBinaryDir = new File(
|
|
174
|
-
parentDir,
|
|
175
|
-
'node_modules/react-native/android'
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
if (androidPrebuiltBinaryDir.exists()) {
|
|
179
|
-
maven {
|
|
180
|
-
url androidPrebuiltBinaryDir.toString()
|
|
181
|
-
name androidSourcesName
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
185
|
-
found = true
|
|
186
|
-
} else if (androidSourcesDir.exists()) {
|
|
187
|
-
maven {
|
|
188
|
-
url androidSourcesDir.toString()
|
|
189
|
-
name androidSourcesName
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
193
|
-
found = true
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (!found) {
|
|
199
|
-
throw new GradleException(
|
|
200
|
-
"${project.name}: unable to locate React Native android sources. " +
|
|
201
|
-
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
154
|
}
|
|
205
155
|
|
|
206
|
-
def
|
|
156
|
+
def stripeVersion = getExtOrDefault("stripeVersion")
|
|
207
157
|
|
|
208
158
|
dependencies {
|
|
209
159
|
// noinspection GradleDynamicVersion
|
|
210
|
-
api
|
|
211
|
-
implementation
|
|
212
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
160
|
+
api "com.facebook.react:react-native:+"
|
|
161
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
213
162
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
|
|
214
|
-
implementation("com.stripe:stripe-android:$
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
implementation
|
|
222
|
-
implementation
|
|
223
|
-
implementation
|
|
224
|
-
implementation
|
|
163
|
+
implementation("com.stripe:stripe-android:$stripeVersion")
|
|
164
|
+
implementation("com.stripe:financial-connections:$stripeVersion")
|
|
165
|
+
|
|
166
|
+
if (isOnrampIncluded()) {
|
|
167
|
+
implementation("com.stripe:crypto-onramp:$stripeVersion")
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
implementation "com.google.android.material:material:1.3.0"
|
|
171
|
+
implementation "androidx.appcompat:appcompat:1.4.1"
|
|
172
|
+
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
|
173
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
|
|
174
|
+
implementation "androidx.browser:browser:1.8.0"
|
|
225
175
|
|
|
226
176
|
// play-services-wallet is already included in stripe-android
|
|
227
177
|
compileOnly "com.google.android.gms:play-services-wallet:19.3.0"
|
|
228
178
|
|
|
229
179
|
// Users need to declare this dependency on their own, otherwise all methods are a no-op
|
|
230
|
-
compileOnly
|
|
180
|
+
compileOnly "com.stripe:stripe-android-issuing-push-provisioning:1.1.0"
|
|
231
181
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
182
|
+
testImplementation "junit:junit:4.13"
|
|
183
|
+
testImplementation "org.mockito:mockito-core:3.+"
|
|
184
|
+
testImplementation "org.robolectric:robolectric:4.10"
|
|
185
|
+
testImplementation "androidx.test:core:1.4.0"
|
|
236
186
|
|
|
237
187
|
implementation "androidx.compose.ui:ui:1.7.8"
|
|
238
188
|
implementation "androidx.compose.foundation:foundation-layout:1.7.8"
|
|
239
189
|
}
|
|
190
|
+
|
|
191
|
+
def lintRulesJar = file("$projectDir/lint-rules/build/libs/lint-rules-1.0.0.jar")
|
|
192
|
+
if (lintRulesJar.exists()) {
|
|
193
|
+
dependencies {
|
|
194
|
+
lintChecks files(lintRulesJar)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
@@ -3,4 +3,4 @@ StripeSdk_compileSdkVersion=30
|
|
|
3
3
|
StripeSdk_targetSdkVersion=28
|
|
4
4
|
StripeSdk_minSdkVersion=21
|
|
5
5
|
# Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
|
|
6
|
-
StripeSdk_stripeVersion=22.
|
|
6
|
+
StripeSdk_stripeVersion=22.2.+
|
|
@@ -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
|
+
#Thu Jun 26 11:00:51 PDT 2025
|
|
8
|
+
sdk.dir=/Users/tianzhao/Library/Android/sdk
|
package/android/spotless.gradle
CHANGED
|
@@ -2,8 +2,8 @@ package com.reactnativestripesdk
|
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.content.res.ColorStateList
|
|
5
|
-
import android.graphics.Color
|
|
6
5
|
import android.widget.FrameLayout
|
|
6
|
+
import androidx.core.graphics.toColorInt
|
|
7
7
|
import com.facebook.react.bridge.ReadableMap
|
|
8
8
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
9
9
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
@@ -49,24 +49,27 @@ class AuBECSDebitFormView(
|
|
|
49
49
|
val borderRadius = value.getIntOr("borderRadius", 0)
|
|
50
50
|
|
|
51
51
|
textColor?.let {
|
|
52
|
-
|
|
53
|
-
(binding.
|
|
54
|
-
(binding.
|
|
55
|
-
(binding.
|
|
52
|
+
val color = it.toColorInt()
|
|
53
|
+
(binding.accountNumberEditText as StripeEditText).setTextColor(color)
|
|
54
|
+
(binding.bsbEditText as StripeEditText).setTextColor(color)
|
|
55
|
+
(binding.emailEditText as StripeEditText).setTextColor(color)
|
|
56
|
+
(binding.nameEditText).setTextColor(color)
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
textErrorColor?.let {
|
|
59
|
-
|
|
60
|
-
(binding.
|
|
61
|
-
(binding.
|
|
62
|
-
(binding.
|
|
60
|
+
val color = it.toColorInt()
|
|
61
|
+
(binding.accountNumberEditText as StripeEditText).setErrorColor(color)
|
|
62
|
+
(binding.bsbEditText as StripeEditText).setErrorColor(color)
|
|
63
|
+
(binding.emailEditText as StripeEditText).setErrorColor(color)
|
|
64
|
+
(binding.nameEditText).setErrorColor(color)
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
placeholderColor?.let {
|
|
66
|
-
|
|
67
|
-
(binding.
|
|
68
|
-
(binding.
|
|
69
|
-
(binding.
|
|
68
|
+
val color = it.toColorInt()
|
|
69
|
+
(binding.accountNumberEditText as StripeEditText).setHintTextColor(color)
|
|
70
|
+
(binding.bsbEditText as StripeEditText).setHintTextColor(color)
|
|
71
|
+
(binding.emailEditText as StripeEditText).setHintTextColor(color)
|
|
72
|
+
(binding.nameEditText).setHintTextColor(color)
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
fontSize?.let {
|
|
@@ -84,12 +87,12 @@ class AuBECSDebitFormView(
|
|
|
84
87
|
.build(),
|
|
85
88
|
).also { shape ->
|
|
86
89
|
shape.strokeWidth = 0.0f
|
|
87
|
-
shape.strokeColor = ColorStateList.valueOf(
|
|
88
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
90
|
+
shape.strokeColor = ColorStateList.valueOf("#000000".toColorInt())
|
|
91
|
+
shape.fillColor = ColorStateList.valueOf("#FFFFFF".toColorInt())
|
|
89
92
|
borderWidth?.let { shape.strokeWidth = (it * 2).toFloat() }
|
|
90
|
-
borderColor?.let { shape.strokeColor = ColorStateList.valueOf(
|
|
93
|
+
borderColor?.let { shape.strokeColor = ColorStateList.valueOf(it.toColorInt()) }
|
|
91
94
|
backgroundColor?.let {
|
|
92
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
95
|
+
shape.fillColor = ColorStateList.valueOf(it.toColorInt())
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
}
|
|
@@ -2,13 +2,13 @@ package com.reactnativestripesdk
|
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.content.res.ColorStateList
|
|
5
|
-
import android.graphics.Color
|
|
6
5
|
import android.os.Build
|
|
7
6
|
import android.text.Editable
|
|
8
7
|
import android.text.InputFilter
|
|
9
8
|
import android.text.TextWatcher
|
|
10
9
|
import android.util.Log
|
|
11
10
|
import android.widget.FrameLayout
|
|
11
|
+
import androidx.core.graphics.toColorInt
|
|
12
12
|
import androidx.core.os.LocaleListCompat
|
|
13
13
|
import com.facebook.react.bridge.ReadableMap
|
|
14
14
|
import com.facebook.react.uimanager.PixelUtil
|
|
@@ -124,19 +124,19 @@ class CardFieldView(
|
|
|
124
124
|
|
|
125
125
|
textColor?.let {
|
|
126
126
|
for (editTextBinding in bindings) {
|
|
127
|
-
editTextBinding.setTextColor(
|
|
127
|
+
editTextBinding.setTextColor(it.toColorInt())
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
textErrorColor?.let {
|
|
131
131
|
for (editTextBinding in bindings) {
|
|
132
|
-
editTextBinding.setErrorColor(
|
|
132
|
+
editTextBinding.setErrorColor(it.toColorInt())
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
placeholderColor?.let {
|
|
136
136
|
for (editTextBinding in bindings) {
|
|
137
|
-
editTextBinding.setHintTextColor(
|
|
137
|
+
editTextBinding.setHintTextColor(it.toColorInt())
|
|
138
138
|
}
|
|
139
|
-
setCardBrandTint(
|
|
139
|
+
setCardBrandTint(it.toColorInt())
|
|
140
140
|
}
|
|
141
141
|
fontSize?.let {
|
|
142
142
|
for (editTextBinding in bindings) {
|
|
@@ -158,7 +158,7 @@ class CardFieldView(
|
|
|
158
158
|
}
|
|
159
159
|
cursorColor?.let {
|
|
160
160
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
161
|
-
val color =
|
|
161
|
+
val color = it.toColorInt()
|
|
162
162
|
for (editTextBinding in bindings) {
|
|
163
163
|
editTextBinding.textCursorDrawable?.setTint(color)
|
|
164
164
|
editTextBinding.textSelectHandle?.setTint(color)
|
|
@@ -178,16 +178,16 @@ class CardFieldView(
|
|
|
178
178
|
.build(),
|
|
179
179
|
).also { shape ->
|
|
180
180
|
shape.strokeWidth = 0.0f
|
|
181
|
-
shape.strokeColor = ColorStateList.valueOf(
|
|
182
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
181
|
+
shape.strokeColor = ColorStateList.valueOf("#000000".toColorInt())
|
|
182
|
+
shape.fillColor = ColorStateList.valueOf("#FFFFFF".toColorInt())
|
|
183
183
|
borderWidth?.let {
|
|
184
184
|
shape.strokeWidth = PixelUtil.toPixelFromDIP(it.toDouble())
|
|
185
185
|
}
|
|
186
186
|
borderColor?.let {
|
|
187
|
-
shape.strokeColor = ColorStateList.valueOf(
|
|
187
|
+
shape.strokeColor = ColorStateList.valueOf(it.toColorInt())
|
|
188
188
|
}
|
|
189
189
|
backgroundColor?.let {
|
|
190
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
190
|
+
shape.fillColor = ColorStateList.valueOf(it.toColorInt())
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -234,7 +234,7 @@ class CardFieldView(
|
|
|
234
234
|
fun setPostalCodeEnabled(isEnabled: Boolean) {
|
|
235
235
|
mCardWidget.postalCodeEnabled = isEnabled
|
|
236
236
|
|
|
237
|
-
if (isEnabled
|
|
237
|
+
if (!isEnabled) {
|
|
238
238
|
mCardWidget.postalCodeRequired = false
|
|
239
239
|
}
|
|
240
240
|
}
|
|
@@ -284,6 +284,7 @@ class CardFieldView(
|
|
|
284
284
|
|
|
285
285
|
mCardWidget.paymentMethodCreateParams?.let {
|
|
286
286
|
cardDetails["brand"] = mapCardBrand(mCardWidget.brand)
|
|
287
|
+
@SuppressLint("RestrictedApi")
|
|
287
288
|
cardDetails["last4"] = it.cardLast4()
|
|
288
289
|
} ?: run {
|
|
289
290
|
cardDetails["brand"] = null
|
|
@@ -354,6 +355,7 @@ class CardFieldView(
|
|
|
354
355
|
CardValidCallback.Fields.Expiry,
|
|
355
356
|
cardInputWidgetBinding.expiryDateEditText,
|
|
356
357
|
)
|
|
358
|
+
@SuppressLint("VisibleForTests")
|
|
357
359
|
cardDetails["brand"] = mapCardBrand(cardInputWidgetBinding.cardNumberEditText.cardBrand)
|
|
358
360
|
|
|
359
361
|
if (isValid) {
|