@stripe/stripe-react-native 0.56.0 → 0.57.1
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/android/build.gradle +76 -118
- package/android/gradle.properties +1 -1
- package/android/settings.gradle +2 -0
- package/android/spotless.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +24 -20
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +20 -17
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +28 -32
- package/android/src/main/java/com/reactnativestripesdk/{CollectBankAccountLauncherFragment.kt → CollectBankAccountLauncherManager.kt} +23 -44
- package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +4 -11
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +52 -132
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +0 -8
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
- package/android/src/main/java/com/reactnativestripesdk/{FinancialConnectionsSheetFragment.kt → FinancialConnectionsSheetManager.kt} +43 -92
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +107 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherManager.kt +37 -0
- 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/{PaymentLauncherFragment.kt → PaymentLauncherManager.kt} +40 -77
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +11 -20
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +409 -483
- package/android/src/main/java/com/reactnativestripesdk/{PaymentSheetFragment.kt → PaymentSheetManager.kt} +65 -300
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +227 -232
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +78 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +52 -39
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/{CustomerSheetFragment.kt → CustomerSheetManager.kt} +64 -99
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -3
- 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 +87 -11
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +178 -185
- package/android/src/main/java/com/reactnativestripesdk/utils/StripeUIManager.kt +62 -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 +26 -26
- 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 +212 -75
- 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 -41
- 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 +16 -18
- 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/StripeSdkEmitter.swift +4 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +31 -26
- package/ios/StripeSdkImpl+Embedded.swift +11 -9
- package/ios/StripeSdkImpl+PaymentSheet.swift +51 -42
- package/ios/StripeSdkImpl.swift +919 -191
- 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/PaymentIntent.js.map +1 -1
- 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/PaymentIntent.js.map +1 -1
- 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 +3 -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/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/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/PaymentIntent.d.ts +1 -9
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts +2 -8
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- 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 +24 -12
- 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 +22 -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/NativeNavigationBar.ts +16 -0
- package/src/specs/NativeOnrampSdkModule.ts +47 -0
- package/src/specs/NativeStripeSdkModule.ts +5 -0
- package/src/types/Errors.ts +6 -0
- package/src/types/Onramp.ts +317 -0
- package/src/types/PaymentIntent.ts +0 -10
- package/src/types/PaymentMethod.ts +0 -9
- package/src/types/PaymentSheet.ts +7 -0
- package/src/types/index.ts +8 -0
- package/stripe-react-native.podspec +21 -8
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -703
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +0 -146
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +0 -68
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +0 -102
- package/android/src/main/java/com/reactnativestripesdk/utils/StripeFragment.kt +0 -52
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=
|
|
6
|
+
StripeSdk_stripeVersion=22.2.+
|
package/android/spotless.gradle
CHANGED
|
@@ -2,14 +2,15 @@ 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
|
|
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.getIntOr
|
|
13
14
|
import com.reactnativestripesdk.utils.getIntOrNull
|
|
14
15
|
import com.reactnativestripesdk.utils.getValOr
|
|
15
16
|
import com.stripe.android.databinding.StripeBecsDebitWidgetBinding
|
|
@@ -41,31 +42,34 @@ class AuBECSDebitFormView(
|
|
|
41
42
|
val textColor = getValOr(value, "textColor", null)
|
|
42
43
|
val textErrorColor = getValOr(value, "textErrorColor", null)
|
|
43
44
|
val placeholderColor = getValOr(value, "placeholderColor", null)
|
|
44
|
-
val fontSize = getIntOrNull(
|
|
45
|
-
val borderWidth = getIntOrNull(
|
|
45
|
+
val fontSize = value.getIntOrNull("fontSize")
|
|
46
|
+
val borderWidth = value.getIntOrNull("borderWidth")
|
|
46
47
|
val backgroundColor = getValOr(value, "backgroundColor", null)
|
|
47
48
|
val borderColor = getValOr(value, "borderColor", null)
|
|
48
|
-
val borderRadius =
|
|
49
|
+
val borderRadius = value.getIntOr("borderRadius", 0)
|
|
49
50
|
|
|
50
51
|
textColor?.let {
|
|
51
|
-
|
|
52
|
-
(binding.
|
|
53
|
-
(binding.
|
|
54
|
-
(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)
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
textErrorColor?.let {
|
|
58
|
-
|
|
59
|
-
(binding.
|
|
60
|
-
(binding.
|
|
61
|
-
(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)
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
placeholderColor?.let {
|
|
65
|
-
|
|
66
|
-
(binding.
|
|
67
|
-
(binding.
|
|
68
|
-
(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)
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
fontSize?.let {
|
|
@@ -83,12 +87,12 @@ class AuBECSDebitFormView(
|
|
|
83
87
|
.build(),
|
|
84
88
|
).also { shape ->
|
|
85
89
|
shape.strokeWidth = 0.0f
|
|
86
|
-
shape.strokeColor = ColorStateList.valueOf(
|
|
87
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
90
|
+
shape.strokeColor = ColorStateList.valueOf("#000000".toColorInt())
|
|
91
|
+
shape.fillColor = ColorStateList.valueOf("#FFFFFF".toColorInt())
|
|
88
92
|
borderWidth?.let { shape.strokeWidth = (it * 2).toFloat() }
|
|
89
|
-
borderColor?.let { shape.strokeColor = ColorStateList.valueOf(
|
|
93
|
+
borderColor?.let { shape.strokeColor = ColorStateList.valueOf(it.toColorInt()) }
|
|
90
94
|
backgroundColor?.let {
|
|
91
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
95
|
+
shape.fillColor = ColorStateList.valueOf(it.toColorInt())
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
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
|
|
@@ -19,6 +19,7 @@ import com.google.android.material.shape.CornerFamily
|
|
|
19
19
|
import com.google.android.material.shape.MaterialShapeDrawable
|
|
20
20
|
import com.google.android.material.shape.ShapeAppearanceModel
|
|
21
21
|
import com.reactnativestripesdk.utils.PostalCodeUtilities
|
|
22
|
+
import com.reactnativestripesdk.utils.getIntOr
|
|
22
23
|
import com.reactnativestripesdk.utils.getIntOrNull
|
|
23
24
|
import com.reactnativestripesdk.utils.getValOr
|
|
24
25
|
import com.reactnativestripesdk.utils.hideSoftKeyboard
|
|
@@ -103,12 +104,12 @@ class CardFieldView(
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
fun setCardStyle(value: ReadableMap?) {
|
|
106
|
-
val borderWidth = getIntOrNull(
|
|
107
|
+
val borderWidth = value.getIntOrNull("borderWidth")
|
|
107
108
|
val backgroundColor = getValOr(value, "backgroundColor", null)
|
|
108
109
|
val borderColor = getValOr(value, "borderColor", null)
|
|
109
|
-
val borderRadius =
|
|
110
|
+
val borderRadius = value.getIntOr("borderRadius", 0)
|
|
110
111
|
val textColor = getValOr(value, "textColor", null)
|
|
111
|
-
val fontSize = getIntOrNull(
|
|
112
|
+
val fontSize = value.getIntOrNull("fontSize")
|
|
112
113
|
val fontFamily = getValOr(value, "fontFamily")
|
|
113
114
|
val placeholderColor = getValOr(value, "placeholderColor", null)
|
|
114
115
|
val textErrorColor = getValOr(value, "textErrorColor", null)
|
|
@@ -123,19 +124,19 @@ class CardFieldView(
|
|
|
123
124
|
|
|
124
125
|
textColor?.let {
|
|
125
126
|
for (editTextBinding in bindings) {
|
|
126
|
-
editTextBinding.setTextColor(
|
|
127
|
+
editTextBinding.setTextColor(it.toColorInt())
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
textErrorColor?.let {
|
|
130
131
|
for (editTextBinding in bindings) {
|
|
131
|
-
editTextBinding.setErrorColor(
|
|
132
|
+
editTextBinding.setErrorColor(it.toColorInt())
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
placeholderColor?.let {
|
|
135
136
|
for (editTextBinding in bindings) {
|
|
136
|
-
editTextBinding.setHintTextColor(
|
|
137
|
+
editTextBinding.setHintTextColor(it.toColorInt())
|
|
137
138
|
}
|
|
138
|
-
setCardBrandTint(
|
|
139
|
+
setCardBrandTint(it.toColorInt())
|
|
139
140
|
}
|
|
140
141
|
fontSize?.let {
|
|
141
142
|
for (editTextBinding in bindings) {
|
|
@@ -157,7 +158,7 @@ class CardFieldView(
|
|
|
157
158
|
}
|
|
158
159
|
cursorColor?.let {
|
|
159
160
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
160
|
-
val color =
|
|
161
|
+
val color = it.toColorInt()
|
|
161
162
|
for (editTextBinding in bindings) {
|
|
162
163
|
editTextBinding.textCursorDrawable?.setTint(color)
|
|
163
164
|
editTextBinding.textSelectHandle?.setTint(color)
|
|
@@ -177,16 +178,16 @@ class CardFieldView(
|
|
|
177
178
|
.build(),
|
|
178
179
|
).also { shape ->
|
|
179
180
|
shape.strokeWidth = 0.0f
|
|
180
|
-
shape.strokeColor = ColorStateList.valueOf(
|
|
181
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
181
|
+
shape.strokeColor = ColorStateList.valueOf("#000000".toColorInt())
|
|
182
|
+
shape.fillColor = ColorStateList.valueOf("#FFFFFF".toColorInt())
|
|
182
183
|
borderWidth?.let {
|
|
183
184
|
shape.strokeWidth = PixelUtil.toPixelFromDIP(it.toDouble())
|
|
184
185
|
}
|
|
185
186
|
borderColor?.let {
|
|
186
|
-
shape.strokeColor = ColorStateList.valueOf(
|
|
187
|
+
shape.strokeColor = ColorStateList.valueOf(it.toColorInt())
|
|
187
188
|
}
|
|
188
189
|
backgroundColor?.let {
|
|
189
|
-
shape.fillColor = ColorStateList.valueOf(
|
|
190
|
+
shape.fillColor = ColorStateList.valueOf(it.toColorInt())
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
}
|
|
@@ -233,7 +234,7 @@ class CardFieldView(
|
|
|
233
234
|
fun setPostalCodeEnabled(isEnabled: Boolean) {
|
|
234
235
|
mCardWidget.postalCodeEnabled = isEnabled
|
|
235
236
|
|
|
236
|
-
if (isEnabled
|
|
237
|
+
if (!isEnabled) {
|
|
237
238
|
mCardWidget.postalCodeRequired = false
|
|
238
239
|
}
|
|
239
240
|
}
|
|
@@ -281,9 +282,10 @@ class CardFieldView(
|
|
|
281
282
|
cardAddress = null
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
mCardWidget.
|
|
285
|
-
cardDetails["brand"] = mapCardBrand(
|
|
286
|
-
|
|
285
|
+
mCardWidget.paymentMethodCreateParams?.let {
|
|
286
|
+
cardDetails["brand"] = mapCardBrand(mCardWidget.brand)
|
|
287
|
+
@SuppressLint("RestrictedApi")
|
|
288
|
+
cardDetails["last4"] = it.cardLast4()
|
|
287
289
|
} ?: run {
|
|
288
290
|
cardDetails["brand"] = null
|
|
289
291
|
cardDetails["last4"] = null
|
|
@@ -353,6 +355,7 @@ class CardFieldView(
|
|
|
353
355
|
CardValidCallback.Fields.Expiry,
|
|
354
356
|
cardInputWidgetBinding.expiryDateEditText,
|
|
355
357
|
)
|
|
358
|
+
@SuppressLint("VisibleForTests")
|
|
356
359
|
cardDetails["brand"] = mapCardBrand(cardInputWidgetBinding.cardNumberEditText.cardBrand)
|
|
357
360
|
|
|
358
361
|
if (isValid) {
|