@stripe/stripe-react-native 0.44.0 → 0.45.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/.clang-format +90 -0
- package/.editorconfig +3 -0
- package/CHANGELOG.md +7 -1
- package/android/build.gradle +89 -18
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +15 -6
- package/android/src/main/java/com/reactnativestripesdk/CardChangeEvent.kt +56 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -4
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +55 -45
- package/android/src/main/java/com/reactnativestripesdk/{CardFocusEvent.kt → CardFocusChangeEvent.kt} +2 -2
- package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +17 -16
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +5 -5
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +39 -33
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +4 -2
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +182 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +231 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +8 -5
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +14 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +17 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +266 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +8 -13
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +106 -59
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +34 -4
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +33 -27
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +49 -24
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +16 -3
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +11 -29
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +36 -12
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +5 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +21 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerDelegate.java +49 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerInterface.java +25 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerDelegate.java +64 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerInterface.java +30 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +41 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +20 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerDelegate.java +36 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerInterface.java +20 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerDelegate.java +73 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerInterface.java +31 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerDelegate.java +67 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerInterface.java +29 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +49 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +21 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +38 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +19 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerDelegate.java +32 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerInterface.java +17 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +311 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +21 -19
- package/ios/AddressSheet/AddressSheetView.swift +23 -17
- package/ios/ApplePayButtonManager.m +0 -1
- package/ios/ApplePayButtonManager.swift +1 -3
- package/ios/ApplePayButtonView.swift +25 -20
- package/ios/ApplePayViewController.swift +22 -22
- package/ios/AuBECSDebitFormView.swift +14 -8
- package/ios/CardFieldManager.swift +1 -4
- package/ios/CardFieldView.swift +28 -25
- package/ios/CardFormManager.swift +1 -4
- package/ios/CardFormView.swift +25 -16
- package/ios/CustomerSheet/CustomerSheetUtils.swift +12 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +8 -8
- package/ios/EmbeddedPaymentElementManager.m +6 -0
- package/ios/EmbeddedPaymentElementView.swift +48 -0
- package/ios/NewArch/AddToWalletButtonComponentView.h +10 -0
- package/ios/NewArch/AddToWalletButtonComponentView.mm +93 -0
- package/ios/NewArch/AddressSheetViewComponentView.h +10 -0
- package/ios/NewArch/AddressSheetViewComponentView.mm +109 -0
- package/ios/NewArch/ApplePayButtonComponentView.h +10 -0
- package/ios/NewArch/ApplePayButtonComponentView.mm +124 -0
- package/ios/NewArch/AuBECSDebitFormComponentView.h +10 -0
- package/ios/NewArch/AuBECSDebitFormComponentView.mm +95 -0
- package/ios/NewArch/CardFieldComponentView.h +10 -0
- package/ios/NewArch/CardFieldComponentView.mm +125 -0
- package/ios/NewArch/CardFormComponentView.h +10 -0
- package/ios/NewArch/CardFormComponentView.mm +108 -0
- package/ios/NewArch/StripeContainerComponentView.h +10 -0
- package/ios/NewArch/StripeContainerComponentView.mm +74 -0
- package/ios/NewArch/StripeNewArchConversions.h +20 -0
- package/ios/NewArch/StripeNewArchConversions.mm +47 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +27 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +105 -0
- package/ios/PaymentOptionDisplayData+ReactNative.swift +55 -0
- package/ios/PaymentSheetAppearance.swift +194 -1
- package/ios/PushProvisioning/AddToWalletButtonView.swift +19 -13
- package/ios/StripeContainerView.swift +5 -3
- package/ios/StripeSdk.h +21 -0
- package/ios/StripeSdk.mm +415 -0
- package/ios/StripeSdkEmitter.swift +19 -0
- package/ios/{StripeSdk+CustomerSheet.swift → StripeSdkImpl+CustomerSheet.swift} +24 -25
- package/ios/StripeSdkImpl+Embedded.swift +327 -0
- package/ios/{StripeSdk+PaymentSheet.swift → StripeSdkImpl+PaymentSheet.swift} +18 -29
- package/ios/{StripeSdk.swift → StripeSdkImpl.swift} +50 -72
- package/ios/StripeSwiftInterop.h +25 -0
- package/ios/stripe_react_native.h +2 -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/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.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/events.js +2 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +2 -0
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -0
- package/lib/commonjs/specs/NativeAddressSheet.js +2 -0
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -0
- package/lib/commonjs/specs/NativeApplePayButton.js +2 -0
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -0
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +2 -0
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -0
- package/lib/commonjs/specs/NativeCardField.js +2 -0
- package/lib/commonjs/specs/NativeCardField.js.map +1 -0
- package/lib/commonjs/specs/NativeCardForm.js +2 -0
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +2 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -0
- package/lib/commonjs/specs/NativeGooglePayButton.js +2 -0
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +2 -0
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -0
- package/lib/commonjs/specs/utils.js +2 -0
- package/lib/commonjs/specs/utils.js.map +1 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js +2 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -0
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.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/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.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/events.js +2 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +2 -0
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -0
- package/lib/module/specs/NativeAddressSheet.js +2 -0
- package/lib/module/specs/NativeAddressSheet.js.map +1 -0
- package/lib/module/specs/NativeApplePayButton.js +2 -0
- package/lib/module/specs/NativeApplePayButton.js.map +1 -0
- package/lib/module/specs/NativeAuBECSDebitForm.js +2 -0
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -0
- package/lib/module/specs/NativeCardField.js +2 -0
- package/lib/module/specs/NativeCardField.js.map +1 -0
- package/lib/module/specs/NativeCardForm.js +2 -0
- package/lib/module/specs/NativeCardForm.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +2 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -0
- package/lib/module/specs/NativeGooglePayButton.js +2 -0
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +2 -0
- package/lib/module/specs/NativeStripeContainer.js.map +1 -0
- package/lib/module/specs/NativeStripeSdkModule.js +2 -0
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -0
- package/lib/module/specs/utils.js +2 -0
- package/lib/module/specs/utils.js.map +1 -0
- package/lib/module/types/EmbeddedPaymentElement.js +2 -0
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -0
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -1
- package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -1
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -1
- package/lib/typescript/src/components/CardField.d.ts +1 -1
- package/lib/typescript/src/components/CardField.d.ts.map +1 -1
- package/lib/typescript/src/components/CardForm.d.ts +1 -1
- package/lib/typescript/src/components/CardForm.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +13 -0
- package/lib/typescript/src/events.d.ts.map +1 -0
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -4
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
- package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts +27 -0
- package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAddressSheet.d.ts +34 -0
- package/lib/typescript/src/specs/NativeAddressSheet.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts +28 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts +19 -0
- package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCardField.d.ts +33 -0
- package/lib/typescript/src/specs/NativeCardField.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCardForm.d.ts +31 -0
- package/lib/typescript/src/specs/NativeCardForm.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +22 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeGooglePayButton.d.ts +11 -0
- package/lib/typescript/src/specs/NativeGooglePayButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeContainer.d.ts +8 -0
- package/lib/typescript/src/specs/NativeStripeContainer.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +93 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/utils.d.ts +20 -0
- package/lib/typescript/src/specs/utils.d.ts.map +1 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +1 -5
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +161 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +97 -4
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +3 -2
- package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -1
- package/lib/typescript/src/types/components/CardFormView.d.ts +3 -1
- package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -1
- package/package.json +20 -1
- package/src/components/AddToWalletButton.tsx +2 -5
- package/src/components/AddressSheet.tsx +5 -16
- package/src/components/AuBECSDebitForm.tsx +3 -12
- package/src/components/CardField.tsx +20 -30
- package/src/components/CardForm.tsx +14 -29
- package/src/components/CustomerSheet.tsx +23 -25
- package/src/components/PlatformPayButton.tsx +6 -6
- package/src/components/StripeContainer.tsx +5 -12
- package/src/components/StripeProvider.tsx +1 -1
- package/src/events.ts +49 -0
- package/src/functions.ts +13 -24
- package/src/hooks/useFinancialConnectionsSheet.tsx +2 -2
- package/src/hooks/useStripe.tsx +2 -2
- package/src/index.tsx +3 -0
- package/src/specs/NativeAddToWalletButton.ts +40 -0
- package/src/specs/NativeAddressSheet.ts +50 -0
- package/src/specs/NativeApplePayButton.ts +40 -0
- package/src/specs/NativeAuBECSDebitForm.ts +24 -0
- package/src/specs/NativeCardField.ts +51 -0
- package/src/specs/NativeCardForm.ts +43 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +37 -0
- package/src/specs/NativeGooglePayButton.ts +20 -0
- package/src/specs/NativeStripeContainer.ts +12 -0
- package/src/specs/NativeStripeSdkModule.ts +219 -0
- package/src/specs/utils.ts +22 -0
- package/src/types/CustomerSheet.ts +1 -5
- package/src/types/EmbeddedPaymentElement.tsx +467 -0
- package/src/types/PaymentSheet.ts +114 -4
- package/src/types/components/CardFieldInput.ts +1 -2
- package/src/types/components/CardFormView.ts +1 -1
- package/stripe-react-native.podspec +27 -2
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +0 -54
- package/ios/StripeSdk.m +0 -244
- package/lib/commonjs/NativeStripeSdk.js +0 -2
- package/lib/commonjs/NativeStripeSdk.js.map +0 -1
- package/lib/commonjs/components/ApplePayButtonNative.js +0 -2
- package/lib/commonjs/components/ApplePayButtonNative.js.map +0 -1
- package/lib/commonjs/components/GooglePayButtonNative.js +0 -2
- package/lib/commonjs/components/GooglePayButtonNative.js.map +0 -1
- package/lib/module/NativeStripeSdk.js +0 -2
- package/lib/module/NativeStripeSdk.js.map +0 -1
- package/lib/module/components/ApplePayButtonNative.js +0 -2
- package/lib/module/components/ApplePayButtonNative.js.map +0 -1
- package/lib/module/components/GooglePayButtonNative.js +0 -2
- package/lib/module/components/GooglePayButtonNative.js.map +0 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +0 -58
- package/lib/typescript/src/NativeStripeSdk.d.ts.map +0 -1
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +0 -4
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +0 -1
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +0 -4
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +0 -1
- package/src/NativeStripeSdk.tsx +0 -159
- package/src/components/ApplePayButtonNative.tsx +0 -5
- package/src/components/GooglePayButtonNative.tsx +0 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.app.Activity
|
|
4
5
|
import android.content.Intent
|
|
5
6
|
import android.util.Log
|
|
@@ -7,16 +8,14 @@ import androidx.fragment.app.FragmentActivity
|
|
|
7
8
|
import com.facebook.react.bridge.BaseActivityEventListener
|
|
8
9
|
import com.facebook.react.bridge.Promise
|
|
9
10
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
10
|
-
import com.facebook.react.bridge.ReactContext
|
|
11
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
12
11
|
import com.facebook.react.bridge.ReactMethod
|
|
13
12
|
import com.facebook.react.bridge.ReadableArray
|
|
14
13
|
import com.facebook.react.bridge.ReadableMap
|
|
15
14
|
import com.facebook.react.bridge.WritableMap
|
|
16
15
|
import com.facebook.react.bridge.WritableNativeMap
|
|
17
16
|
import com.facebook.react.module.annotations.ReactModule
|
|
18
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
19
17
|
import com.reactnativestripesdk.addresssheet.AddressLauncherFragment
|
|
18
|
+
import com.reactnativestripesdk.customersheet.CustomerSheetFragment
|
|
20
19
|
import com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy
|
|
21
20
|
import com.reactnativestripesdk.utils.ConfirmPaymentErrorType
|
|
22
21
|
import com.reactnativestripesdk.utils.CreateTokenErrorType
|
|
@@ -61,6 +60,7 @@ import com.stripe.android.model.SetupIntent
|
|
|
61
60
|
import com.stripe.android.model.Token
|
|
62
61
|
import com.stripe.android.payments.bankaccount.CollectBankAccountConfiguration
|
|
63
62
|
import com.stripe.android.paymentsheet.PaymentSheet
|
|
63
|
+
import kotlinx.coroutines.CompletableDeferred
|
|
64
64
|
import kotlinx.coroutines.CoroutineScope
|
|
65
65
|
import kotlinx.coroutines.Dispatchers
|
|
66
66
|
import kotlinx.coroutines.launch
|
|
@@ -69,9 +69,7 @@ import org.json.JSONObject
|
|
|
69
69
|
@ReactModule(name = StripeSdkModule.NAME)
|
|
70
70
|
class StripeSdkModule(
|
|
71
71
|
reactContext: ReactApplicationContext,
|
|
72
|
-
) :
|
|
73
|
-
override fun getName(): String = NAME
|
|
74
|
-
|
|
72
|
+
) : NativeStripeSdkModuleSpec(reactContext) {
|
|
75
73
|
var cardFieldView: CardFieldView? = null
|
|
76
74
|
var cardFormView: CardFormView? = null
|
|
77
75
|
|
|
@@ -89,7 +87,7 @@ class StripeSdkModule(
|
|
|
89
87
|
|
|
90
88
|
private var customerSheetFragment: CustomerSheetFragment? = null
|
|
91
89
|
|
|
92
|
-
internal var
|
|
90
|
+
internal var embeddedIntentCreationCallback = CompletableDeferred<ReadableMap>()
|
|
93
91
|
|
|
94
92
|
// If you create a new Fragment, you must put the tag here, otherwise result callbacks for that
|
|
95
93
|
// Fragment will not work on RN < 0.65
|
|
@@ -176,17 +174,18 @@ class StripeSdkModule(
|
|
|
176
174
|
)
|
|
177
175
|
}
|
|
178
176
|
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
@SuppressLint("RestrictedApi")
|
|
178
|
+
override fun getTypedExportedConstants() =
|
|
179
|
+
mapOf(
|
|
181
180
|
"API_VERSIONS" to
|
|
182
|
-
|
|
181
|
+
mapOf(
|
|
183
182
|
"CORE" to ApiVersion.API_VERSION_CODE,
|
|
184
183
|
"ISSUING" to PushProvisioningProxy.getApiVersion(),
|
|
185
184
|
),
|
|
186
185
|
)
|
|
187
186
|
|
|
188
187
|
@ReactMethod
|
|
189
|
-
fun initialise(
|
|
188
|
+
override fun initialise(
|
|
190
189
|
params: ReadableMap,
|
|
191
190
|
promise: Promise,
|
|
192
191
|
) {
|
|
@@ -217,7 +216,7 @@ class StripeSdkModule(
|
|
|
217
216
|
}
|
|
218
217
|
|
|
219
218
|
@ReactMethod
|
|
220
|
-
fun initPaymentSheet(
|
|
219
|
+
override fun initPaymentSheet(
|
|
221
220
|
params: ReadableMap,
|
|
222
221
|
promise: Promise,
|
|
223
222
|
) {
|
|
@@ -240,7 +239,7 @@ class StripeSdkModule(
|
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
@ReactMethod
|
|
243
|
-
fun presentPaymentSheet(
|
|
242
|
+
override fun presentPaymentSheet(
|
|
244
243
|
options: ReadableMap,
|
|
245
244
|
promise: Promise,
|
|
246
245
|
) {
|
|
@@ -261,7 +260,7 @@ class StripeSdkModule(
|
|
|
261
260
|
}
|
|
262
261
|
|
|
263
262
|
@ReactMethod
|
|
264
|
-
fun confirmPaymentSheetPayment(promise: Promise) {
|
|
263
|
+
override fun confirmPaymentSheetPayment(promise: Promise) {
|
|
265
264
|
if (paymentSheetFragment == null) {
|
|
266
265
|
promise.resolve(PaymentSheetFragment.createMissingInitError())
|
|
267
266
|
return
|
|
@@ -271,16 +270,18 @@ class StripeSdkModule(
|
|
|
271
270
|
}
|
|
272
271
|
|
|
273
272
|
@ReactMethod
|
|
274
|
-
fun resetPaymentSheetCustomer(promise: Promise) {
|
|
273
|
+
override fun resetPaymentSheetCustomer(promise: Promise) {
|
|
275
274
|
PaymentSheet.resetCustomer(context = reactApplicationContext)
|
|
276
275
|
promise.resolve(null)
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
@ReactMethod
|
|
280
|
-
fun intentCreationCallback(
|
|
279
|
+
override fun intentCreationCallback(
|
|
281
280
|
params: ReadableMap,
|
|
282
281
|
promise: Promise,
|
|
283
282
|
) {
|
|
283
|
+
embeddedIntentCreationCallback.complete(params)
|
|
284
|
+
|
|
284
285
|
if (paymentSheetFragment == null) {
|
|
285
286
|
promise.resolve(PaymentSheetFragment.createMissingInitError())
|
|
286
287
|
return
|
|
@@ -290,7 +291,7 @@ class StripeSdkModule(
|
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
@ReactMethod
|
|
293
|
-
fun createPaymentMethod(
|
|
294
|
+
override fun createPaymentMethod(
|
|
294
295
|
data: ReadableMap,
|
|
295
296
|
options: ReadableMap,
|
|
296
297
|
promise: Promise,
|
|
@@ -330,7 +331,7 @@ class StripeSdkModule(
|
|
|
330
331
|
}
|
|
331
332
|
|
|
332
333
|
@ReactMethod
|
|
333
|
-
fun createToken(
|
|
334
|
+
override fun createToken(
|
|
334
335
|
params: ReadableMap,
|
|
335
336
|
promise: Promise,
|
|
336
337
|
) {
|
|
@@ -467,7 +468,7 @@ class StripeSdkModule(
|
|
|
467
468
|
}
|
|
468
469
|
|
|
469
470
|
@ReactMethod
|
|
470
|
-
fun createTokenForCVCUpdate(
|
|
471
|
+
override fun createTokenForCVCUpdate(
|
|
471
472
|
cvc: String,
|
|
472
473
|
promise: Promise,
|
|
473
474
|
) {
|
|
@@ -490,8 +491,9 @@ class StripeSdkModule(
|
|
|
490
491
|
}
|
|
491
492
|
|
|
492
493
|
@ReactMethod
|
|
493
|
-
fun handleNextAction(
|
|
494
|
+
override fun handleNextAction(
|
|
494
495
|
paymentIntentClientSecret: String,
|
|
496
|
+
returnUrl: String?,
|
|
495
497
|
promise: Promise,
|
|
496
498
|
) {
|
|
497
499
|
paymentLauncherFragment =
|
|
@@ -506,8 +508,9 @@ class StripeSdkModule(
|
|
|
506
508
|
}
|
|
507
509
|
|
|
508
510
|
@ReactMethod
|
|
509
|
-
fun handleNextActionForSetup(
|
|
511
|
+
override fun handleNextActionForSetup(
|
|
510
512
|
setupIntentClientSecret: String,
|
|
513
|
+
returnUrl: String?,
|
|
511
514
|
promise: Promise,
|
|
512
515
|
) {
|
|
513
516
|
paymentLauncherFragment =
|
|
@@ -541,10 +544,10 @@ class StripeSdkModule(
|
|
|
541
544
|
// }
|
|
542
545
|
|
|
543
546
|
@ReactMethod
|
|
544
|
-
fun confirmPayment(
|
|
547
|
+
override fun confirmPayment(
|
|
545
548
|
paymentIntentClientSecret: String,
|
|
546
549
|
params: ReadableMap?,
|
|
547
|
-
options: ReadableMap
|
|
550
|
+
options: ReadableMap?,
|
|
548
551
|
promise: Promise,
|
|
549
552
|
) {
|
|
550
553
|
val paymentMethodData = getMapOrNull(params, "paymentMethodData")
|
|
@@ -604,7 +607,7 @@ class StripeSdkModule(
|
|
|
604
607
|
}
|
|
605
608
|
|
|
606
609
|
@ReactMethod
|
|
607
|
-
fun retrievePaymentIntent(
|
|
610
|
+
override fun retrievePaymentIntent(
|
|
608
611
|
clientSecret: String,
|
|
609
612
|
promise: Promise,
|
|
610
613
|
) {
|
|
@@ -615,7 +618,7 @@ class StripeSdkModule(
|
|
|
615
618
|
}
|
|
616
619
|
|
|
617
620
|
@ReactMethod
|
|
618
|
-
fun retrieveSetupIntent(
|
|
621
|
+
override fun retrieveSetupIntent(
|
|
619
622
|
clientSecret: String,
|
|
620
623
|
promise: Promise,
|
|
621
624
|
) {
|
|
@@ -626,7 +629,7 @@ class StripeSdkModule(
|
|
|
626
629
|
}
|
|
627
630
|
|
|
628
631
|
@ReactMethod
|
|
629
|
-
fun confirmSetupIntent(
|
|
632
|
+
override fun confirmSetupIntent(
|
|
630
633
|
setupIntentClientSecret: String,
|
|
631
634
|
params: ReadableMap,
|
|
632
635
|
options: ReadableMap,
|
|
@@ -677,7 +680,7 @@ class StripeSdkModule(
|
|
|
677
680
|
}
|
|
678
681
|
|
|
679
682
|
@ReactMethod
|
|
680
|
-
fun isPlatformPaySupported(
|
|
683
|
+
override fun isPlatformPaySupported(
|
|
681
684
|
params: ReadableMap?,
|
|
682
685
|
promise: Promise,
|
|
683
686
|
) {
|
|
@@ -703,7 +706,7 @@ class StripeSdkModule(
|
|
|
703
706
|
}
|
|
704
707
|
|
|
705
708
|
@ReactMethod
|
|
706
|
-
fun confirmPlatformPay(
|
|
709
|
+
override fun confirmPlatformPay(
|
|
707
710
|
clientSecret: String,
|
|
708
711
|
params: ReadableMap,
|
|
709
712
|
isPaymentIntent: Boolean,
|
|
@@ -799,7 +802,7 @@ class StripeSdkModule(
|
|
|
799
802
|
}
|
|
800
803
|
|
|
801
804
|
@ReactMethod
|
|
802
|
-
fun createPlatformPayPaymentMethod(
|
|
805
|
+
override fun createPlatformPayPaymentMethod(
|
|
803
806
|
params: ReadableMap,
|
|
804
807
|
usesDeprecatedTokenFlow: Boolean,
|
|
805
808
|
promise: Promise,
|
|
@@ -828,7 +831,7 @@ class StripeSdkModule(
|
|
|
828
831
|
}
|
|
829
832
|
|
|
830
833
|
@ReactMethod
|
|
831
|
-
fun canAddCardToWallet(
|
|
834
|
+
override fun canAddCardToWallet(
|
|
832
835
|
params: ReadableMap,
|
|
833
836
|
promise: Promise,
|
|
834
837
|
) {
|
|
@@ -862,7 +865,7 @@ class StripeSdkModule(
|
|
|
862
865
|
}
|
|
863
866
|
|
|
864
867
|
@ReactMethod
|
|
865
|
-
fun isCardInWallet(
|
|
868
|
+
override fun isCardInWallet(
|
|
866
869
|
params: ReadableMap,
|
|
867
870
|
promise: Promise,
|
|
868
871
|
) {
|
|
@@ -886,7 +889,7 @@ class StripeSdkModule(
|
|
|
886
889
|
}
|
|
887
890
|
|
|
888
891
|
@ReactMethod
|
|
889
|
-
fun collectBankAccount(
|
|
892
|
+
override fun collectBankAccount(
|
|
890
893
|
isPaymentIntent: Boolean,
|
|
891
894
|
clientSecret: String,
|
|
892
895
|
params: ReadableMap,
|
|
@@ -946,7 +949,7 @@ class StripeSdkModule(
|
|
|
946
949
|
}
|
|
947
950
|
|
|
948
951
|
@ReactMethod
|
|
949
|
-
fun verifyMicrodeposits(
|
|
952
|
+
override fun verifyMicrodeposits(
|
|
950
953
|
isPaymentIntent: Boolean,
|
|
951
954
|
clientSecret: String,
|
|
952
955
|
params: ReadableMap,
|
|
@@ -1031,7 +1034,7 @@ class StripeSdkModule(
|
|
|
1031
1034
|
}
|
|
1032
1035
|
|
|
1033
1036
|
@ReactMethod
|
|
1034
|
-
fun collectBankAccountToken(
|
|
1037
|
+
override fun collectBankAccountToken(
|
|
1035
1038
|
clientSecret: String,
|
|
1036
1039
|
params: ReadableMap,
|
|
1037
1040
|
promise: Promise,
|
|
@@ -1053,7 +1056,7 @@ class StripeSdkModule(
|
|
|
1053
1056
|
}
|
|
1054
1057
|
|
|
1055
1058
|
@ReactMethod
|
|
1056
|
-
fun collectFinancialConnectionsAccounts(
|
|
1059
|
+
override fun collectFinancialConnectionsAccounts(
|
|
1057
1060
|
clientSecret: String,
|
|
1058
1061
|
params: ReadableMap,
|
|
1059
1062
|
promise: Promise,
|
|
@@ -1075,7 +1078,7 @@ class StripeSdkModule(
|
|
|
1075
1078
|
}
|
|
1076
1079
|
|
|
1077
1080
|
@ReactMethod
|
|
1078
|
-
fun initCustomerSheet(
|
|
1081
|
+
override fun initCustomerSheet(
|
|
1079
1082
|
params: ReadableMap,
|
|
1080
1083
|
customerAdapterOverrides: ReadableMap,
|
|
1081
1084
|
promise: Promise,
|
|
@@ -1107,7 +1110,7 @@ class StripeSdkModule(
|
|
|
1107
1110
|
}
|
|
1108
1111
|
|
|
1109
1112
|
@ReactMethod
|
|
1110
|
-
fun presentCustomerSheet(
|
|
1113
|
+
override fun presentCustomerSheet(
|
|
1111
1114
|
params: ReadableMap,
|
|
1112
1115
|
promise: Promise,
|
|
1113
1116
|
) {
|
|
@@ -1121,14 +1124,14 @@ class StripeSdkModule(
|
|
|
1121
1124
|
}
|
|
1122
1125
|
|
|
1123
1126
|
@ReactMethod
|
|
1124
|
-
fun retrieveCustomerSheetPaymentOptionSelection(promise: Promise) {
|
|
1127
|
+
override fun retrieveCustomerSheetPaymentOptionSelection(promise: Promise) {
|
|
1125
1128
|
customerSheetFragment?.retrievePaymentOptionSelection(promise) ?: run {
|
|
1126
1129
|
promise.resolve(CustomerSheetFragment.createMissingInitError())
|
|
1127
1130
|
}
|
|
1128
1131
|
}
|
|
1129
1132
|
|
|
1130
1133
|
@ReactMethod
|
|
1131
|
-
fun customerAdapterFetchPaymentMethodsCallback(
|
|
1134
|
+
override fun customerAdapterFetchPaymentMethodsCallback(
|
|
1132
1135
|
paymentMethodJsonObjects: ReadableArray,
|
|
1133
1136
|
promise: Promise,
|
|
1134
1137
|
) {
|
|
@@ -1152,7 +1155,7 @@ class StripeSdkModule(
|
|
|
1152
1155
|
}
|
|
1153
1156
|
|
|
1154
1157
|
@ReactMethod
|
|
1155
|
-
fun customerAdapterAttachPaymentMethodCallback(
|
|
1158
|
+
override fun customerAdapterAttachPaymentMethodCallback(
|
|
1156
1159
|
paymentMethodJson: ReadableMap,
|
|
1157
1160
|
promise: Promise,
|
|
1158
1161
|
) {
|
|
@@ -1174,7 +1177,7 @@ class StripeSdkModule(
|
|
|
1174
1177
|
}
|
|
1175
1178
|
|
|
1176
1179
|
@ReactMethod
|
|
1177
|
-
fun customerAdapterDetachPaymentMethodCallback(
|
|
1180
|
+
override fun customerAdapterDetachPaymentMethodCallback(
|
|
1178
1181
|
paymentMethodJson: ReadableMap,
|
|
1179
1182
|
promise: Promise,
|
|
1180
1183
|
) {
|
|
@@ -1196,7 +1199,7 @@ class StripeSdkModule(
|
|
|
1196
1199
|
}
|
|
1197
1200
|
|
|
1198
1201
|
@ReactMethod
|
|
1199
|
-
fun customerAdapterSetSelectedPaymentOptionCallback(promise: Promise) {
|
|
1202
|
+
override fun customerAdapterSetSelectedPaymentOptionCallback(promise: Promise) {
|
|
1200
1203
|
customerSheetFragment?.let {
|
|
1201
1204
|
it.customerAdapter?.setSelectedPaymentOptionCallback?.complete(Unit)
|
|
1202
1205
|
} ?: run {
|
|
@@ -1206,7 +1209,7 @@ class StripeSdkModule(
|
|
|
1206
1209
|
}
|
|
1207
1210
|
|
|
1208
1211
|
@ReactMethod
|
|
1209
|
-
fun customerAdapterFetchSelectedPaymentOptionCallback(
|
|
1212
|
+
override fun customerAdapterFetchSelectedPaymentOptionCallback(
|
|
1210
1213
|
paymentOption: String?,
|
|
1211
1214
|
promise: Promise,
|
|
1212
1215
|
) {
|
|
@@ -1219,7 +1222,7 @@ class StripeSdkModule(
|
|
|
1219
1222
|
}
|
|
1220
1223
|
|
|
1221
1224
|
@ReactMethod
|
|
1222
|
-
fun customerAdapterSetupIntentClientSecretForCustomerAttachCallback(
|
|
1225
|
+
override fun customerAdapterSetupIntentClientSecretForCustomerAttachCallback(
|
|
1223
1226
|
clientSecret: String,
|
|
1224
1227
|
promise: Promise,
|
|
1225
1228
|
) {
|
|
@@ -1232,26 +1235,70 @@ class StripeSdkModule(
|
|
|
1232
1235
|
}
|
|
1233
1236
|
|
|
1234
1237
|
@ReactMethod
|
|
1235
|
-
fun
|
|
1236
|
-
|
|
1238
|
+
override fun createEmbeddedPaymentElement(
|
|
1239
|
+
intentConfig: ReadableMap,
|
|
1240
|
+
configuration: ReadableMap,
|
|
1241
|
+
promise: Promise,
|
|
1242
|
+
) {
|
|
1243
|
+
// TODO:
|
|
1237
1244
|
}
|
|
1238
1245
|
|
|
1239
1246
|
@ReactMethod
|
|
1240
|
-
fun
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1247
|
+
override fun confirmEmbeddedPaymentElement(
|
|
1248
|
+
viewTag: Double,
|
|
1249
|
+
promise: Promise,
|
|
1250
|
+
) {
|
|
1251
|
+
// noop, iOS only
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
@ReactMethod
|
|
1255
|
+
override fun updateEmbeddedPaymentElement(
|
|
1256
|
+
intentConfig: ReadableMap,
|
|
1257
|
+
promise: Promise,
|
|
1258
|
+
) {
|
|
1259
|
+
// TODO:
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
@ReactMethod
|
|
1263
|
+
override fun clearEmbeddedPaymentOption(
|
|
1264
|
+
viewTag: Double,
|
|
1265
|
+
promise: Promise,
|
|
1266
|
+
) {
|
|
1267
|
+
// noop, iOS only
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
override fun handleURLCallback(
|
|
1271
|
+
url: String,
|
|
1272
|
+
promise: Promise,
|
|
1273
|
+
) {
|
|
1274
|
+
// noop, iOS only.
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
override fun openApplePaySetup(promise: Promise) {
|
|
1278
|
+
// noop, iOS only.
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
override fun configureOrderTracking(
|
|
1282
|
+
orderTypeIdentifier: String,
|
|
1283
|
+
orderIdentifier: String,
|
|
1284
|
+
webServiceUrl: String,
|
|
1285
|
+
authenticationToken: String,
|
|
1286
|
+
promise: Promise,
|
|
1287
|
+
) {
|
|
1288
|
+
// noop, iOS only.
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
override fun dismissPlatformPay(promise: Promise?) {
|
|
1292
|
+
// noop, iOS only.
|
|
1245
1293
|
}
|
|
1246
1294
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1295
|
+
override fun updatePlatformPaySheet(
|
|
1296
|
+
summaryItems: ReadableArray?,
|
|
1297
|
+
shippingMethods: ReadableArray?,
|
|
1298
|
+
errors: ReadableArray?,
|
|
1299
|
+
promise: Promise?,
|
|
1251
1300
|
) {
|
|
1252
|
-
|
|
1253
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
1254
|
-
.emit(eventName, params)
|
|
1301
|
+
// noop, iOS only.
|
|
1255
1302
|
}
|
|
1256
1303
|
|
|
1257
1304
|
/**
|
|
@@ -1267,6 +1314,6 @@ class StripeSdkModule(
|
|
|
1267
1314
|
}
|
|
1268
1315
|
|
|
1269
1316
|
companion object {
|
|
1270
|
-
const val NAME =
|
|
1317
|
+
const val NAME = NativeStripeSdkModuleSpec.NAME
|
|
1271
1318
|
}
|
|
1272
1319
|
}
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
8
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
6
9
|
import com.facebook.react.uimanager.ViewManager
|
|
7
10
|
import com.reactnativestripesdk.addresssheet.AddressSheetViewManager
|
|
8
11
|
import com.reactnativestripesdk.pushprovisioning.AddToWalletButtonManager
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
// Fool autolinking for older versions that do not support BaseReactPackage.
|
|
14
|
+
// public class StripeSdkPackage implements ReactPackage {
|
|
15
|
+
class StripeSdkPackage : BaseReactPackage() {
|
|
16
|
+
override fun getModule(
|
|
17
|
+
name: String,
|
|
18
|
+
reactContext: ReactApplicationContext,
|
|
19
|
+
): NativeModule? =
|
|
20
|
+
when (name) {
|
|
21
|
+
StripeSdkModule.NAME -> StripeSdkModule(reactContext)
|
|
22
|
+
else -> null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
26
|
+
val moduleList: Array<Class<out NativeModule?>> = arrayOf(StripeSdkModule::class.java)
|
|
27
|
+
val reactModuleInfoMap: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
28
|
+
for (moduleClass in moduleList) {
|
|
29
|
+
val reactModule = moduleClass.getAnnotation(ReactModule::class.java) ?: continue
|
|
30
|
+
reactModuleInfoMap[reactModule.name] =
|
|
31
|
+
ReactModuleInfo(
|
|
32
|
+
reactModule.name,
|
|
33
|
+
moduleClass.name,
|
|
34
|
+
true,
|
|
35
|
+
reactModule.needsEagerInit,
|
|
36
|
+
reactModule.isCxxModule,
|
|
37
|
+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
return ReactModuleInfoProvider { reactModuleInfoMap }
|
|
41
|
+
}
|
|
13
42
|
|
|
14
43
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
|
|
15
44
|
listOf<ViewManager<*, *>>(
|
|
@@ -20,5 +49,6 @@ class StripeSdkPackage : ReactPackage {
|
|
|
20
49
|
GooglePayButtonManager(),
|
|
21
50
|
AddToWalletButtonManager(reactContext),
|
|
22
51
|
AddressSheetViewManager(),
|
|
52
|
+
EmbeddedPaymentElementViewManager(),
|
|
23
53
|
)
|
|
24
54
|
}
|
|
@@ -84,35 +84,35 @@ class AddressSheetView(
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
fun setAppearance(appearanceParams: ReadableMap) {
|
|
87
|
+
fun setAppearance(appearanceParams: ReadableMap?) {
|
|
88
88
|
this.appearanceParams = appearanceParams
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
fun setDefaultValues(defaults: ReadableMap) {
|
|
92
|
-
defaultAddress = buildAddressDetails(
|
|
91
|
+
fun setDefaultValues(defaults: ReadableMap?) {
|
|
92
|
+
defaultAddress = defaults?.let { buildAddressDetails(it) }
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
fun setAdditionalFields(fields: ReadableMap) {
|
|
96
|
-
additionalFields = buildAdditionalFieldsConfiguration(
|
|
95
|
+
fun setAdditionalFields(fields: ReadableMap?) {
|
|
96
|
+
additionalFields = fields?.let { buildAdditionalFieldsConfiguration(it) }
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
fun setAllowedCountries(countries: List<String
|
|
100
|
-
allowedCountries = countries
|
|
99
|
+
fun setAllowedCountries(countries: List<String>?) {
|
|
100
|
+
allowedCountries = countries?.toSet() ?: emptySet()
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
fun setAutocompleteCountries(countries: List<String
|
|
104
|
-
autocompleteCountries = countries
|
|
103
|
+
fun setAutocompleteCountries(countries: List<String>?) {
|
|
104
|
+
autocompleteCountries = countries?.toSet() ?: emptySet()
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
fun setPrimaryButtonTitle(title: String) {
|
|
107
|
+
fun setPrimaryButtonTitle(title: String?) {
|
|
108
108
|
buttonTitle = title
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
fun setSheetTitle(title: String) {
|
|
111
|
+
fun setSheetTitle(title: String?) {
|
|
112
112
|
sheetTitle = title
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
fun setGooglePlacesApiKey(key: String) {
|
|
115
|
+
fun setGooglePlacesApiKey(key: String?) {
|
|
116
116
|
googlePlacesApiKey = key
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -158,21 +158,27 @@ class AddressSheetView(
|
|
|
158
158
|
)
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
internal fun buildResult(addressDetails: AddressDetails): WritableMap
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
161
|
+
internal fun buildResult(addressDetails: AddressDetails): WritableMap =
|
|
162
|
+
WritableNativeMap().apply {
|
|
163
|
+
putMap(
|
|
164
|
+
"result",
|
|
165
|
+
WritableNativeMap().apply {
|
|
166
|
+
putString("name", addressDetails.name)
|
|
167
|
+
putMap(
|
|
168
|
+
"address",
|
|
169
|
+
WritableNativeMap().apply {
|
|
170
|
+
putString("city", addressDetails.address?.city)
|
|
171
|
+
putString("country", addressDetails.address?.country)
|
|
172
|
+
putString("line1", addressDetails.address?.line1)
|
|
173
|
+
putString("line2", addressDetails.address?.line2)
|
|
174
|
+
putString("postalCode", addressDetails.address?.postalCode)
|
|
175
|
+
putString("state", addressDetails.address?.state)
|
|
176
|
+
},
|
|
177
|
+
)
|
|
178
|
+
putString("phone", addressDetails.phoneNumber)
|
|
179
|
+
putBoolean("isCheckboxSelected", addressDetails.isCheckboxSelected ?: false)
|
|
180
|
+
},
|
|
181
|
+
)
|
|
172
182
|
}
|
|
173
|
-
result.putString("phone", addressDetails.phoneNumber)
|
|
174
|
-
result.putBoolean("isCheckboxSelected", addressDetails.isCheckboxSelected ?: false)
|
|
175
|
-
return result
|
|
176
|
-
}
|
|
177
183
|
}
|
|
178
184
|
}
|