@stripe/stripe-react-native 0.22.1 → 0.23.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/CHANGELOG.md +22 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +21 -9
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +6 -4
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +67 -65
- package/android/src/main/res/layout/googlepay_mark_button.xml +0 -2
- package/ios/ApplePayViewController.swift +25 -15
- package/ios/Mappers.swift +11 -9
- package/ios/PaymentMethodFactory.swift +1 -1
- package/ios/StripeSdk.m +1 -0
- package/ios/StripeSdk.swift +8 -5
- package/ios/Tests/ApplePayUtilsTests.swift +0 -1
- package/jest/mock.js +6 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useApplePay.js +1 -1
- package/lib/commonjs/hooks/useApplePay.js.map +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentMethod.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useApplePay.js +1 -1
- package/lib/module/hooks/useApplePay.js.map +1 -1
- package/lib/module/hooks/usePlatformPay.js +1 -1
- package/lib/module/hooks/usePlatformPay.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentMethod.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +1 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts +1 -1
- package/lib/typescript/src/functions.d.ts +8 -2
- package/lib/typescript/src/hooks/usePlatformPay.d.ts +6 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +22 -11
- package/lib/typescript/src/types/PaymentIntent.d.ts +2 -0
- package/lib/typescript/src/types/PaymentMethod.d.ts +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +1 -1
- package/lib/typescript/src/types/PlatformPay.d.ts +6 -1
- package/lib/typescript/src/types/PushProvisioning.d.ts +1 -1
- package/lib/typescript/src/types/SetupIntent.d.ts +2 -0
- package/lib/typescript/src/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/NativeStripeSdk.tsx +3 -2
- package/src/components/AddToWalletButton.tsx +1 -1
- package/src/functions.ts +35 -4
- package/src/hooks/useApplePay.tsx +1 -2
- package/src/hooks/usePlatformPay.tsx +19 -0
- package/src/hooks/useStripe.tsx +11 -0
- package/src/index.tsx +22 -36
- package/src/types/PaymentIntent.ts +2 -0
- package/src/types/PaymentMethod.ts +1 -0
- package/src/types/PaymentSheet.ts +1 -1
- package/src/types/PlatformPay.ts +9 -1
- package/src/types/PushProvisioning.ts +1 -1
- package/src/types/SetupIntent.ts +2 -0
- package/src/types/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.23.1 - 2023-01-25
|
|
6
|
+
|
|
7
|
+
## Fixes
|
|
8
|
+
|
|
9
|
+
- Fixed an issue with `confirmPlatformPaySetupIntent` on iOS. [#1266](https://github.com/stripe/stripe-react-native/pull/1266)
|
|
10
|
+
- Fixed types so that Klarna accepts the `shippingDetails` property. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
|
|
11
|
+
- Both [`PaymentIntent.Result`](https://stripe.dev/stripe-react-native/api-reference/interfaces/PaymentIntent.Result.html) and [`SetupIntent.Result`](https://stripe.dev/stripe-react-native/api-reference/interfaces/SetupIntent.Result.html) types now include a `paymentMethod` field. This replaces the `paymentMethodId` field, which will be removed in a later release. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
|
|
12
|
+
|
|
13
|
+
## 0.23.0 - 2023-01-09
|
|
14
|
+
|
|
15
|
+
### Breaking changes
|
|
16
|
+
|
|
17
|
+
- `createPlatformPayPaymentMethod` no longer returns a `token` object. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
|
|
18
|
+
- If your integration depends on Stripe's Tokens API, please use `createPlatformPayToken`, which accepts identical arguments.
|
|
19
|
+
|
|
20
|
+
## Fixes
|
|
21
|
+
|
|
22
|
+
- Fixed an issue with `createPlatformPayPaymentMethod` on iOS where a "Canceled" error could be returned in production. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
|
|
23
|
+
- Fixed an issue where the `PlatformPayButton` with `type={PlatformPay.ButtonType.GooglePayMark}` would be unclickable. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
|
|
24
|
+
- Fixed an issue on Android where `CardField` would render without the necessary padding. [48debb2](https://github.com/stripe/stripe-react-native/commit/48debb27de4b02d8309b4e42737be066cdf33835)
|
|
25
|
+
- Fixed an issue on iOS where providing a `null` value to certain method parameters would result in a crash. [#1252](https://github.com/stripe/stripe-react-native/pull/1252)
|
|
26
|
+
|
|
5
27
|
## 0.22.1 - 2022-12-07
|
|
6
28
|
|
|
7
29
|
## Fixes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
StripeSdk_kotlinVersion=1.6.21
|
|
2
|
-
StripeSdk_stripeVersion=20.
|
|
2
|
+
StripeSdk_stripeVersion=20.19.+
|
|
@@ -51,11 +51,11 @@ class GooglePayRequestHelper {
|
|
|
51
51
|
val isPhoneNumberRequired = params?.getBooleanOr("isPhoneNumberRequired", false)
|
|
52
52
|
val isRequired = params?.getBooleanOr("isRequired", false)
|
|
53
53
|
val allowedCountryCodes = if (params?.hasKey("allowedCountryCodes") == true)
|
|
54
|
-
params.getArray("allowedCountryCodes") as
|
|
54
|
+
params.getArray("allowedCountryCodes")?.toArrayList()?.toSet() as? Set<String> else null
|
|
55
55
|
|
|
56
56
|
return GooglePayJsonFactory.ShippingAddressParameters(
|
|
57
57
|
isRequired = isRequired ?: false,
|
|
58
|
-
allowedCountryCodes = allowedCountryCodes.toSet(),
|
|
58
|
+
allowedCountryCodes = allowedCountryCodes ?: Locale.getISOCountries().toSet(),
|
|
59
59
|
phoneNumberRequired = isPhoneNumberRequired ?: false
|
|
60
60
|
)
|
|
61
61
|
}
|
|
@@ -98,12 +98,16 @@ class GooglePayRequestHelper {
|
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
internal fun handleGooglePaymentMethodResult(resultCode: Int, data: Intent?, stripe: Stripe, promise: Promise) {
|
|
101
|
+
internal fun handleGooglePaymentMethodResult(resultCode: Int, data: Intent?, stripe: Stripe, forToken: Boolean, promise: Promise) {
|
|
102
102
|
when (resultCode) {
|
|
103
103
|
Activity.RESULT_OK -> {
|
|
104
104
|
data?.let { intent ->
|
|
105
105
|
PaymentData.getFromIntent(intent)?.let {
|
|
106
|
-
|
|
106
|
+
if (forToken) {
|
|
107
|
+
resolveWithToken(it, promise)
|
|
108
|
+
} else {
|
|
109
|
+
resolveWithPaymentMethod(it, stripe, promise)
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
}
|
|
@@ -118,13 +122,9 @@ class GooglePayRequestHelper {
|
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
private fun
|
|
125
|
+
private fun resolveWithPaymentMethod(paymentData: PaymentData, stripe: Stripe, promise: Promise) {
|
|
122
126
|
val paymentInformation = JSONObject(paymentData.toJson())
|
|
123
|
-
val googlePayResult = GooglePayResult.fromJson(paymentInformation)
|
|
124
127
|
val promiseResult = WritableNativeMap()
|
|
125
|
-
googlePayResult.token?.let {
|
|
126
|
-
promiseResult.putMap("token", mapFromToken(it))
|
|
127
|
-
}
|
|
128
128
|
stripe.createPaymentMethod(
|
|
129
129
|
PaymentMethodCreateParams.createFromGooglePay(paymentInformation),
|
|
130
130
|
callback = object : ApiResultCallback<PaymentMethod> {
|
|
@@ -139,6 +139,18 @@ class GooglePayRequestHelper {
|
|
|
139
139
|
}
|
|
140
140
|
)
|
|
141
141
|
}
|
|
142
|
+
|
|
143
|
+
private fun resolveWithToken(paymentData: PaymentData, promise: Promise) {
|
|
144
|
+
val paymentInformation = JSONObject(paymentData.toJson())
|
|
145
|
+
val googlePayResult = GooglePayResult.fromJson(paymentInformation)
|
|
146
|
+
val promiseResult = WritableNativeMap()
|
|
147
|
+
googlePayResult.token?.let {
|
|
148
|
+
promiseResult.putMap("token", mapFromToken(it))
|
|
149
|
+
promise.resolve(promiseResult)
|
|
150
|
+
} ?: run {
|
|
151
|
+
promise.resolve(createError("Failed", "Unexpected response from Google Pay. No token was found."))
|
|
152
|
+
}
|
|
153
|
+
}
|
|
142
154
|
}
|
|
143
155
|
}
|
|
144
156
|
|
|
@@ -167,7 +167,7 @@ class PaymentLauncherFragment(
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
private fun retrieveSetupIntent(clientSecret: String, stripeAccountId: String?) {
|
|
170
|
-
stripe.retrieveSetupIntent(clientSecret, stripeAccountId, object : ApiResultCallback<SetupIntent> {
|
|
170
|
+
stripe.retrieveSetupIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<SetupIntent> {
|
|
171
171
|
override fun onError(e: Exception) {
|
|
172
172
|
promise.resolve(createError(ConfirmSetupIntentErrorType.Failed.toString(), e))
|
|
173
173
|
removeFragment(context)
|
|
@@ -208,7 +208,7 @@ class PaymentLauncherFragment(
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
private fun retrievePaymentIntent(clientSecret: String, stripeAccountId: String?) {
|
|
211
|
-
stripe.retrievePaymentIntent(clientSecret, stripeAccountId, object : ApiResultCallback<PaymentIntent> {
|
|
211
|
+
stripe.retrievePaymentIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<PaymentIntent> {
|
|
212
212
|
override fun onError(e: Exception) {
|
|
213
213
|
promise.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), e))
|
|
214
214
|
removeFragment(context)
|
|
@@ -40,6 +40,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
40
40
|
private var confirmPromise: Promise? = null
|
|
41
41
|
private var confirmPaymentClientSecret: String? = null
|
|
42
42
|
private var createPlatformPayPaymentMethodPromise: Promise? = null
|
|
43
|
+
private var platformPayUsesDeprecatedTokenFlow = false
|
|
43
44
|
|
|
44
45
|
private var paymentSheetFragment: PaymentSheetFragment? = null
|
|
45
46
|
private var googlePayFragment: GooglePayFragment? = null
|
|
@@ -65,7 +66,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
65
66
|
when (requestCode) {
|
|
66
67
|
GooglePayRequestHelper.LOAD_PAYMENT_DATA_REQUEST_CODE -> {
|
|
67
68
|
createPlatformPayPaymentMethodPromise?.let {
|
|
68
|
-
GooglePayRequestHelper.handleGooglePaymentMethodResult(resultCode, data, stripe, it)
|
|
69
|
+
GooglePayRequestHelper.handleGooglePaymentMethodResult(resultCode, data, stripe, platformPayUsesDeprecatedTokenFlow, it)
|
|
69
70
|
createPlatformPayPaymentMethodPromise = null
|
|
70
71
|
} ?: run { Log.d("StripeReactNative", "No promise was found, Google Pay result went unhandled,") }
|
|
71
72
|
}
|
|
@@ -609,7 +610,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
609
610
|
when (launcherResult) {
|
|
610
611
|
GooglePayLauncher.Result.Completed -> {
|
|
611
612
|
if (isPaymentIntent) {
|
|
612
|
-
stripe.retrievePaymentIntent(clientSecret, stripeAccountId,
|
|
613
|
+
stripe.retrievePaymentIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<PaymentIntent> {
|
|
613
614
|
override fun onError(e: Exception) {
|
|
614
615
|
promise.resolve(createResult("paymentIntent", WritableNativeMap()))
|
|
615
616
|
}
|
|
@@ -618,7 +619,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
618
619
|
}
|
|
619
620
|
})
|
|
620
621
|
} else {
|
|
621
|
-
stripe.retrieveSetupIntent(clientSecret, stripeAccountId, object : ApiResultCallback<SetupIntent> {
|
|
622
|
+
stripe.retrieveSetupIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<SetupIntent> {
|
|
622
623
|
override fun onError(e: Exception) {
|
|
623
624
|
promise.resolve(createResult("setupIntent", WritableNativeMap()))
|
|
624
625
|
}
|
|
@@ -654,11 +655,12 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
654
655
|
}
|
|
655
656
|
|
|
656
657
|
@ReactMethod
|
|
657
|
-
fun createPlatformPayPaymentMethod(params: ReadableMap, promise: Promise) {
|
|
658
|
+
fun createPlatformPayPaymentMethod(params: ReadableMap, usesDeprecatedTokenFlow: Boolean, promise: Promise) {
|
|
658
659
|
val googlePayParams: ReadableMap = params.getMap("googlePay") ?: run {
|
|
659
660
|
promise.resolve(createError(GooglePayErrorType.Failed.toString(), "You must provide the `googlePay` parameter."))
|
|
660
661
|
return
|
|
661
662
|
}
|
|
663
|
+
platformPayUsesDeprecatedTokenFlow = usesDeprecatedTokenFlow
|
|
662
664
|
createPlatformPayPaymentMethodPromise = promise
|
|
663
665
|
getCurrentActivityOrResolveWithError(promise)?.let {
|
|
664
666
|
val request = GooglePayRequestHelper.createPaymentRequest(
|
|
@@ -326,77 +326,69 @@ internal fun mapFromToken(token: Token): WritableMap {
|
|
|
326
326
|
|
|
327
327
|
internal fun mapFromPaymentMethod(paymentMethod: PaymentMethod): WritableMap {
|
|
328
328
|
val pm: WritableMap = WritableNativeMap()
|
|
329
|
-
val card: WritableMap = WritableNativeMap()
|
|
330
|
-
val sepaDebit: WritableMap = WritableNativeMap()
|
|
331
|
-
val bacsDebit: WritableMap = WritableNativeMap()
|
|
332
|
-
val auBECSDebit: WritableMap = WritableNativeMap()
|
|
333
|
-
val sofort: WritableMap = WritableNativeMap()
|
|
334
|
-
val ideal: WritableMap = WritableNativeMap()
|
|
335
|
-
val fpx: WritableMap = WritableNativeMap()
|
|
336
|
-
val upi: WritableMap = WritableNativeMap()
|
|
337
|
-
val usBankAccount: WritableMap = WritableNativeMap()
|
|
338
|
-
|
|
339
|
-
card.putString("brand", mapCardBrand(paymentMethod.card?.brand))
|
|
340
|
-
card.putString("country", paymentMethod.card?.country)
|
|
341
|
-
paymentMethod.card?.expiryYear?.let {
|
|
342
|
-
card.putInt("expYear", it)
|
|
343
|
-
}
|
|
344
|
-
paymentMethod.card?.expiryMonth?.let {
|
|
345
|
-
card.putInt("expMonth", it)
|
|
346
|
-
}
|
|
347
|
-
card.putString("funding", paymentMethod.card?.funding)
|
|
348
|
-
card.putString("last4", paymentMethod.card?.last4)
|
|
349
|
-
card.putString("fingerprint", paymentMethod.card?.fingerprint)
|
|
350
|
-
card.putString("preferredNetwork", paymentMethod.card?.networks?.preferred)
|
|
351
|
-
card.putArray("availableNetworks", paymentMethod.card?.networks?.available?.toList() as? ReadableArray)
|
|
352
|
-
|
|
353
|
-
sepaDebit.putString("bankCode", paymentMethod.sepaDebit?.bankCode)
|
|
354
|
-
sepaDebit.putString("country", paymentMethod.sepaDebit?.country)
|
|
355
|
-
sepaDebit.putString("fingerprint", paymentMethod.sepaDebit?.fingerprint)
|
|
356
|
-
sepaDebit.putString("last4", paymentMethod.sepaDebit?.branchCode)
|
|
357
|
-
|
|
358
|
-
bacsDebit.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
|
|
359
|
-
bacsDebit.putString("last4", paymentMethod.bacsDebit?.last4)
|
|
360
|
-
bacsDebit.putString("sortCode", paymentMethod.bacsDebit?.sortCode)
|
|
361
|
-
|
|
362
|
-
auBECSDebit.putString("bsbNumber", paymentMethod.bacsDebit?.sortCode)
|
|
363
|
-
auBECSDebit.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
|
|
364
|
-
auBECSDebit.putString("last4", paymentMethod.bacsDebit?.last4)
|
|
365
|
-
|
|
366
|
-
sofort.putString("country", paymentMethod.sofort?.country)
|
|
367
|
-
|
|
368
|
-
ideal.putString("bankName", paymentMethod.ideal?.bank)
|
|
369
|
-
ideal.putString("bankIdentifierCode", paymentMethod.ideal?.bankIdentifierCode)
|
|
370
|
-
|
|
371
|
-
fpx.putString("accountHolderType", paymentMethod.fpx?.accountHolderType)
|
|
372
|
-
fpx.putString("bank", paymentMethod.fpx?.bank)
|
|
373
|
-
|
|
374
|
-
upi.putString("vpa", paymentMethod.upi?.vpa)
|
|
375
|
-
|
|
376
|
-
usBankAccount.putString("routingNumber", paymentMethod.usBankAccount?.routingNumber)
|
|
377
|
-
usBankAccount.putString("accountType", mapFromUSBankAccountType(paymentMethod.usBankAccount?.accountType))
|
|
378
|
-
usBankAccount.putString("accountHolderType", mapFromUSBankAccountHolderType(paymentMethod.usBankAccount?.accountHolderType))
|
|
379
|
-
usBankAccount.putString("last4", paymentMethod.usBankAccount?.last4)
|
|
380
|
-
usBankAccount.putString("bankName", paymentMethod.usBankAccount?.bankName)
|
|
381
|
-
usBankAccount.putString("linkedAccount", paymentMethod.usBankAccount?.linkedAccount)
|
|
382
|
-
usBankAccount.putString("fingerprint", paymentMethod.usBankAccount?.fingerprint)
|
|
383
|
-
usBankAccount.putString("preferredNetworks", paymentMethod.usBankAccount?.networks?.preferred)
|
|
384
|
-
usBankAccount.putArray("supportedNetworks", paymentMethod.usBankAccount?.networks?.supported as? ReadableArray)
|
|
385
329
|
|
|
386
330
|
pm.putString("id", paymentMethod.id)
|
|
387
331
|
pm.putString("paymentMethodType", mapPaymentMethodType(paymentMethod.type))
|
|
388
332
|
pm.putBoolean("livemode", paymentMethod.liveMode)
|
|
389
333
|
pm.putString("customerId", paymentMethod.customerId)
|
|
390
334
|
pm.putMap("billingDetails", mapFromBillingDetails(paymentMethod.billingDetails))
|
|
391
|
-
pm.putMap("Card",
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
335
|
+
pm.putMap("Card", WritableNativeMap().also {
|
|
336
|
+
it.putString("brand", mapCardBrand(paymentMethod.card?.brand))
|
|
337
|
+
it.putString("country", paymentMethod.card?.country)
|
|
338
|
+
paymentMethod.card?.expiryYear?.let { year ->
|
|
339
|
+
it.putInt("expYear", year)
|
|
340
|
+
}
|
|
341
|
+
paymentMethod.card?.expiryMonth?.let { month ->
|
|
342
|
+
it.putInt("expMonth", month)
|
|
343
|
+
}
|
|
344
|
+
it.putString("funding", paymentMethod.card?.funding)
|
|
345
|
+
it.putString("last4", paymentMethod.card?.last4)
|
|
346
|
+
it.putString("fingerprint", paymentMethod.card?.fingerprint)
|
|
347
|
+
it.putString("preferredNetwork", paymentMethod.card?.networks?.preferred)
|
|
348
|
+
it.putArray("availableNetworks", paymentMethod.card?.networks?.available?.toList() as? ReadableArray)
|
|
349
|
+
})
|
|
350
|
+
pm.putMap("SepaDebit", WritableNativeMap().also {
|
|
351
|
+
it.putString("bankCode", paymentMethod.sepaDebit?.bankCode)
|
|
352
|
+
it.putString("country", paymentMethod.sepaDebit?.country)
|
|
353
|
+
it.putString("fingerprint", paymentMethod.sepaDebit?.fingerprint)
|
|
354
|
+
it.putString("last4", paymentMethod.sepaDebit?.branchCode)
|
|
355
|
+
})
|
|
356
|
+
pm.putMap("BacsDebit", WritableNativeMap().also {
|
|
357
|
+
it.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
|
|
358
|
+
it.putString("last4", paymentMethod.bacsDebit?.last4)
|
|
359
|
+
it.putString("sortCode", paymentMethod.bacsDebit?.sortCode)
|
|
360
|
+
})
|
|
361
|
+
pm.putMap("AuBecsDebit",
|
|
362
|
+
WritableNativeMap().also {
|
|
363
|
+
it.putString("bsbNumber", paymentMethod.bacsDebit?.sortCode)
|
|
364
|
+
it.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
|
|
365
|
+
it.putString("last4", paymentMethod.bacsDebit?.last4)
|
|
366
|
+
})
|
|
367
|
+
pm.putMap("Sofort", WritableNativeMap().also {
|
|
368
|
+
it.putString("country", paymentMethod.sofort?.country)
|
|
369
|
+
})
|
|
370
|
+
pm.putMap("Ideal", WritableNativeMap().also {
|
|
371
|
+
it.putString("bankName", paymentMethod.ideal?.bank)
|
|
372
|
+
it.putString("bankIdentifierCode", paymentMethod.ideal?.bankIdentifierCode)
|
|
373
|
+
})
|
|
374
|
+
pm.putMap("Fpx", WritableNativeMap().also {
|
|
375
|
+
it.putString("accountHolderType", paymentMethod.fpx?.accountHolderType)
|
|
376
|
+
it.putString("bank", paymentMethod.fpx?.bank)
|
|
377
|
+
})
|
|
378
|
+
pm.putMap("Upi", WritableNativeMap().also {
|
|
379
|
+
it.putString("vpa", paymentMethod.upi?.vpa)
|
|
380
|
+
})
|
|
381
|
+
pm.putMap("USBankAccount", WritableNativeMap().also {
|
|
382
|
+
it.putString("routingNumber", paymentMethod.usBankAccount?.routingNumber)
|
|
383
|
+
it.putString("accountType", mapFromUSBankAccountType(paymentMethod.usBankAccount?.accountType))
|
|
384
|
+
it.putString("accountHolderType", mapFromUSBankAccountHolderType(paymentMethod.usBankAccount?.accountHolderType))
|
|
385
|
+
it.putString("last4", paymentMethod.usBankAccount?.last4)
|
|
386
|
+
it.putString("bankName", paymentMethod.usBankAccount?.bankName)
|
|
387
|
+
it.putString("linkedAccount", paymentMethod.usBankAccount?.linkedAccount)
|
|
388
|
+
it.putString("fingerprint", paymentMethod.usBankAccount?.fingerprint)
|
|
389
|
+
it.putString("preferredNetworks", paymentMethod.usBankAccount?.networks?.preferred)
|
|
390
|
+
it.putArray("supportedNetworks", paymentMethod.usBankAccount?.networks?.supported as? ReadableArray)
|
|
391
|
+
})
|
|
400
392
|
|
|
401
393
|
return pm
|
|
402
394
|
}
|
|
@@ -407,6 +399,11 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
|
|
|
407
399
|
map.putString("clientSecret", paymentIntent.clientSecret)
|
|
408
400
|
map.putBoolean("livemode", paymentIntent.isLiveMode)
|
|
409
401
|
map.putString("paymentMethodId", paymentIntent.paymentMethodId)
|
|
402
|
+
map.putMap("paymentMethod", paymentIntent.paymentMethod?.let {
|
|
403
|
+
mapFromPaymentMethod(it)
|
|
404
|
+
} ?: run {
|
|
405
|
+
null
|
|
406
|
+
})
|
|
410
407
|
map.putString("receiptEmail", paymentIntent.receiptEmail)
|
|
411
408
|
map.putString("currency", paymentIntent.currency)
|
|
412
409
|
map.putString("status", mapIntentStatus(paymentIntent.status))
|
|
@@ -786,6 +783,11 @@ internal fun mapFromSetupIntentResult(setupIntent: SetupIntent): WritableMap {
|
|
|
786
783
|
map.putBoolean("livemode", setupIntent.isLiveMode)
|
|
787
784
|
map.putString("clientSecret", setupIntent.clientSecret)
|
|
788
785
|
map.putString("paymentMethodId", setupIntent.paymentMethodId)
|
|
786
|
+
map.putMap("paymentMethod", setupIntent.paymentMethod?.let {
|
|
787
|
+
mapFromPaymentMethod(it)
|
|
788
|
+
} ?: run {
|
|
789
|
+
null
|
|
790
|
+
})
|
|
789
791
|
map.putString("usage", mapSetupIntentUsage(setupIntent.usage))
|
|
790
792
|
map.putString("created", convertToUnixTimestamp(setupIntent.created))
|
|
791
793
|
map.putMap("nextAction", mapNextAction(setupIntent.nextActionType, setupIntent.nextActionData))
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
android:focusable="true"
|
|
8
8
|
android:minWidth="1dp"
|
|
9
9
|
android:background="@drawable/googlepay_mark_background">
|
|
10
|
-
|
|
11
10
|
<ImageView
|
|
12
|
-
android:id="@+id/imageView2"
|
|
13
11
|
android:layout_width="wrap_content"
|
|
14
12
|
android:layout_height="wrap_content"
|
|
15
13
|
android:cropToPadding="true"
|
|
@@ -15,23 +15,31 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
|
|
|
15
15
|
handler completion: @escaping (PKPaymentAuthorizationResult) -> Void
|
|
16
16
|
) {
|
|
17
17
|
applePaymentMethodFlowCanBeCanceled = false
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
promiseResult["token"] = Mappers.mapFromToken(token: token.splitApplePayAddressByNewline())
|
|
29
|
-
}
|
|
30
|
-
self.createPlatformPayPaymentMethodResolver?(promiseResult)
|
|
31
|
-
}
|
|
18
|
+
|
|
19
|
+
if (platformPayUsesDeprecatedTokenFlow) {
|
|
20
|
+
STPAPIClient.shared.createToken(with: payment) { token, error in
|
|
21
|
+
if let error = error {
|
|
22
|
+
self.createPlatformPayPaymentMethodResolver?(Errors.createError(ErrorType.Failed, error))
|
|
23
|
+
} else {
|
|
24
|
+
let promiseResult = [
|
|
25
|
+
"token": token != nil ? Mappers.mapFromToken(token: token!.splitApplePayAddressByNewline()) : [:]
|
|
26
|
+
]
|
|
27
|
+
self.createPlatformPayPaymentMethodResolver?(promiseResult)
|
|
32
28
|
}
|
|
29
|
+
completion(PKPaymentAuthorizationResult.init(status: .success, errors: nil))
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
STPAPIClient.shared.createPaymentMethod(with: payment) { paymentMethod, error in
|
|
33
|
+
if let error = error {
|
|
34
|
+
self.createPlatformPayPaymentMethodResolver?(Errors.createError(ErrorType.Failed, error))
|
|
35
|
+
} else {
|
|
36
|
+
let promiseResult = [
|
|
37
|
+
"paymentMethod": Mappers.mapFromPaymentMethod(paymentMethod?.splitApplePayAddressByNewline()) ?? [:]
|
|
38
|
+
]
|
|
39
|
+
self.createPlatformPayPaymentMethodResolver?(promiseResult)
|
|
40
|
+
}
|
|
41
|
+
completion(PKPaymentAuthorizationResult.init(status: .success, errors: nil))
|
|
33
42
|
}
|
|
34
|
-
completion(PKPaymentAuthorizationResult.init(status: .success, errors: nil))
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
|
|
@@ -159,6 +167,8 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
|
|
|
159
167
|
) {
|
|
160
168
|
if let clientSecret = self.confirmApplePayPaymentClientSecret {
|
|
161
169
|
completion(clientSecret, nil)
|
|
170
|
+
} else if let clientSecret = self.confirmApplePaySetupClientSecret {
|
|
171
|
+
completion(clientSecret, nil)
|
|
162
172
|
} else {
|
|
163
173
|
self.applePayCompletionCallback = completion
|
|
164
174
|
let method = Mappers.mapFromPaymentMethod(paymentMethod.splitApplePayAddressByNewline())
|
package/ios/Mappers.swift
CHANGED
|
@@ -381,6 +381,7 @@ class Mappers {
|
|
|
381
381
|
"receiptEmail": paymentIntent.receiptEmail ?? NSNull(),
|
|
382
382
|
"livemode": paymentIntent.livemode,
|
|
383
383
|
"paymentMethodId": paymentIntent.paymentMethodId ?? NSNull(),
|
|
384
|
+
"paymentMethod": mapFromPaymentMethod(paymentIntent.paymentMethod) ?? NSNull(),
|
|
384
385
|
"captureMethod": mapCaptureMethod(paymentIntent.captureMethod),
|
|
385
386
|
"confirmationMethod": mapConfirmationMethod(paymentIntent.confirmationMethod),
|
|
386
387
|
"created": convertDateToUnixTimestampMilliseconds(date: paymentIntent.created) ?? NSNull(),
|
|
@@ -502,19 +503,19 @@ class Mappers {
|
|
|
502
503
|
return nil
|
|
503
504
|
}
|
|
504
505
|
let billing = STPPaymentMethodBillingDetails()
|
|
505
|
-
billing.email =
|
|
506
|
-
billing.phone =
|
|
507
|
-
billing.name =
|
|
506
|
+
billing.email = billingDetails["email"] as? String
|
|
507
|
+
billing.phone = billingDetails["phone"] as? String
|
|
508
|
+
billing.name = billingDetails["name"] as? String
|
|
508
509
|
|
|
509
510
|
let address = STPPaymentMethodAddress()
|
|
510
511
|
|
|
511
512
|
if let addressMap = billingDetails["address"] as? NSDictionary {
|
|
512
|
-
address.city =
|
|
513
|
-
address.postalCode =
|
|
514
|
-
address.country =
|
|
515
|
-
address.line1 =
|
|
516
|
-
address.line2 =
|
|
517
|
-
address.state =
|
|
513
|
+
address.city = addressMap["city"] as? String
|
|
514
|
+
address.postalCode = addressMap["postalCode"] as? String
|
|
515
|
+
address.country = addressMap["country"] as? String
|
|
516
|
+
address.line1 = addressMap["line1"] as? String
|
|
517
|
+
address.line2 = addressMap["line2"] as? String
|
|
518
|
+
address.state = addressMap["state"] as? String
|
|
518
519
|
}
|
|
519
520
|
|
|
520
521
|
billing.address = address
|
|
@@ -718,6 +719,7 @@ class Mappers {
|
|
|
718
719
|
"paymentMethodTypes": NSArray(),
|
|
719
720
|
"usage": mapFromSetupIntentUsage(usage: setupIntent.usage),
|
|
720
721
|
"paymentMethodId": setupIntent.paymentMethodID ?? NSNull(),
|
|
722
|
+
"paymentMethod": mapFromPaymentMethod(setupIntent.paymentMethod) ?? NSNull(),
|
|
721
723
|
"created": NSNull(),
|
|
722
724
|
"lastSetupError": NSNull(),
|
|
723
725
|
"nextAction": mapNextAction(nextAction: setupIntent.nextAction) ?? NSNull(),
|
|
@@ -158,7 +158,7 @@ class PaymentMethodFactory {
|
|
|
158
158
|
private func createCardPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
159
159
|
if let token = paymentMethodData?["token"] as? String {
|
|
160
160
|
let methodParams = STPPaymentMethodCardParams()
|
|
161
|
-
methodParams.token =
|
|
161
|
+
methodParams.token = token
|
|
162
162
|
return STPPaymentMethodParams(card: methodParams, billingDetails: billingDetailsParams, metadata: nil)
|
|
163
163
|
}
|
|
164
164
|
|
package/ios/StripeSdk.m
CHANGED
package/ios/StripeSdk.swift
CHANGED
|
@@ -29,6 +29,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
29
29
|
|
|
30
30
|
var applePaymentAuthorizationController: PKPaymentAuthorizationViewController? = nil
|
|
31
31
|
var createPlatformPayPaymentMethodResolver: RCTPromiseResolveBlock? = nil
|
|
32
|
+
var platformPayUsesDeprecatedTokenFlow = false
|
|
32
33
|
var applePaymentMethodFlowCanBeCanceled = false
|
|
33
34
|
|
|
34
35
|
var confirmPaymentClientSecret: String? = nil
|
|
@@ -93,10 +94,10 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
93
94
|
StripeAPI.defaultPublishableKey = publishableKey
|
|
94
95
|
STPAPIClient.shared.stripeAccount = stripeAccountId
|
|
95
96
|
|
|
96
|
-
let name =
|
|
97
|
-
let partnerId =
|
|
98
|
-
let version =
|
|
99
|
-
let url =
|
|
97
|
+
let name = appInfo["name"] as? String ?? ""
|
|
98
|
+
let partnerId = appInfo["partnerId"] as? String ?? ""
|
|
99
|
+
let version = appInfo["version"] as? String ?? ""
|
|
100
|
+
let url = appInfo["url"] as? String ?? ""
|
|
100
101
|
|
|
101
102
|
STPAPIClient.shared.appInfo = STPAppInfo(name: name, partnerId: partnerId, version: version, url: url)
|
|
102
103
|
self.merchantIdentifier = merchantIdentifier
|
|
@@ -536,8 +537,9 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
536
537
|
resolve(StripeAPI.deviceSupportsApplePay())
|
|
537
538
|
}
|
|
538
539
|
|
|
539
|
-
@objc(createPlatformPayPaymentMethod:resolver:rejecter:)
|
|
540
|
+
@objc(createPlatformPayPaymentMethod:usesDeprecatedTokenFlow:resolver:rejecter:)
|
|
540
541
|
func createPlatformPayPaymentMethod(params: NSDictionary,
|
|
542
|
+
usesDeprecatedTokenFlow: Bool,
|
|
541
543
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
542
544
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
543
545
|
guard let applePayPatams = params["applePay"] as? NSDictionary else {
|
|
@@ -554,6 +556,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
554
556
|
self.applePayShippingMethods = paymentRequest.shippingMethods ?? []
|
|
555
557
|
self.applePayShippingAddressErrors = nil
|
|
556
558
|
self.applePayCouponCodeErrors = nil
|
|
559
|
+
platformPayUsesDeprecatedTokenFlow = usesDeprecatedTokenFlow
|
|
557
560
|
applePaymentMethodFlowCanBeCanceled = true
|
|
558
561
|
createPlatformPayPaymentMethodResolver = resolve
|
|
559
562
|
self.applePaymentAuthorizationController = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest)
|
package/jest/mock.js
CHANGED
|
@@ -34,6 +34,9 @@ const mockFunctions = {
|
|
|
34
34
|
dismissPlatformPay: jest.fn(async () => true),
|
|
35
35
|
createPlatformPayPaymentMethod: jest.fn(async () => ({
|
|
36
36
|
paymentMethod: {},
|
|
37
|
+
error: null,
|
|
38
|
+
})),
|
|
39
|
+
createPlatformPayToken: jest.fn(async () => ({
|
|
37
40
|
token: {},
|
|
38
41
|
error: null,
|
|
39
42
|
})),
|
|
@@ -177,6 +180,9 @@ const mockHooks = {
|
|
|
177
180
|
createPlatformPayPaymentMethod: jest.fn(async () => ({
|
|
178
181
|
...mockFunctions.createPlatformPayPaymentMethod(),
|
|
179
182
|
})),
|
|
183
|
+
createPlatformPayToken: jest.fn(async () => ({
|
|
184
|
+
...mockFunctions.createPlatformPayToken(),
|
|
185
|
+
})),
|
|
180
186
|
updatePlatformPaySheet: jest.fn(async () => ({
|
|
181
187
|
...mockFunctions.updatePlatformPaySheet(),
|
|
182
188
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StripeSdk","NativeModules"],"sources":["NativeStripeSdk.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethod,\n PaymentIntent,\n ApplePay,\n PlatformPay,\n PaymentSheet,\n SetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n ApplePayResult,\n CreateTokenResult,\n GooglePayInitResult,\n PayWithGooglePayResult,\n CreateGooglePayPaymentMethodResult,\n GooglePay,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions\n ): Promise<CreatePaymentMethodResult>;\n handleNextAction(\n paymentIntentClientSecret: string,\n returnURL?: string | null\n ): Promise<HandleNextActionResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options?: PaymentIntent.ConfirmOptions\n ): Promise<ConfirmPaymentResult>;\n isApplePaySupported(): Promise<boolean>;\n presentApplePay(params: ApplePay.PresentParams): Promise<ApplePayResult>;\n confirmApplePayPayment(clientSecret: string): Promise<void>;\n updateApplePaySummaryItems(\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ): Promise<void>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n presentPaymentSheet(): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: Token.CreateParams): Promise<CreateTokenResult>;\n isGooglePaySupported(params: GooglePay.IsSupportedParams): Promise<boolean>;\n initGooglePay(params: GooglePay.InitParams): Promise<GooglePayInitResult>;\n presentGooglePay(\n params: GooglePay.PresentParams\n ): Promise<PayWithGooglePayResult>;\n createGooglePayPaymentMethod(\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n verifyMicrodeposits(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n collectBankAccount(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };\n canAddCardToWallet(\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult>;\n isCardInWallet(params: {\n cardLastFour: string;\n }): Promise<IsCardInWalletResult>;\n collectBankAccountToken(\n clientSecret: string\n ): Promise<FinancialConnections.TokenResult>;\n collectFinancialConnectionsAccounts(\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult>;\n resetPaymentSheetCustomer(): Promise<null>;\n isPlatformPaySupported(params: {\n googlePay?: GooglePay.IsSupportedParams;\n }): Promise<boolean>;\n createPlatformPayPaymentMethod(\n params: PlatformPay.PaymentMethodParams\n ): Promise<PlatformPay.PaymentMethodResult>;\n dismissPlatformPay(): Promise<boolean>;\n updatePlatformPaySheet(\n summaryItems: Array<ApplePay.CartSummaryItem>,\n shippingMethods: Array<ApplePay.ShippingMethod>,\n errors: Array<PlatformPay.ApplePaySheetError>\n ): Promise<void>;\n confirmPlatformPay(\n clientSecret: string,\n params: PlatformPay.ConfirmParams,\n isPaymentIntent: boolean\n ): Promise<\n PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult\n >;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"],"mappings":"gFAAA,
|
|
1
|
+
{"version":3,"names":["StripeSdk","NativeModules"],"sources":["NativeStripeSdk.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethod,\n PaymentIntent,\n ApplePay,\n PlatformPay,\n PaymentSheet,\n SetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n ApplePayResult,\n CreateTokenResult,\n GooglePayInitResult,\n PayWithGooglePayResult,\n CreateGooglePayPaymentMethodResult,\n GooglePay,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions\n ): Promise<CreatePaymentMethodResult>;\n handleNextAction(\n paymentIntentClientSecret: string,\n returnURL?: string | null\n ): Promise<HandleNextActionResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options?: PaymentIntent.ConfirmOptions\n ): Promise<ConfirmPaymentResult>;\n isApplePaySupported(): Promise<boolean>;\n presentApplePay(params: ApplePay.PresentParams): Promise<ApplePayResult>;\n confirmApplePayPayment(clientSecret: string): Promise<void>;\n updateApplePaySummaryItems(\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ): Promise<void>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n presentPaymentSheet(): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: Token.CreateParams): Promise<CreateTokenResult>;\n isGooglePaySupported(params: GooglePay.IsSupportedParams): Promise<boolean>;\n initGooglePay(params: GooglePay.InitParams): Promise<GooglePayInitResult>;\n presentGooglePay(\n params: GooglePay.PresentParams\n ): Promise<PayWithGooglePayResult>;\n createGooglePayPaymentMethod(\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n verifyMicrodeposits(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n collectBankAccount(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };\n canAddCardToWallet(\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult>;\n isCardInWallet(params: {\n cardLastFour: string;\n }): Promise<IsCardInWalletResult>;\n collectBankAccountToken(\n clientSecret: string\n ): Promise<FinancialConnections.TokenResult>;\n collectFinancialConnectionsAccounts(\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult>;\n resetPaymentSheetCustomer(): Promise<null>;\n isPlatformPaySupported(params: {\n googlePay?: GooglePay.IsSupportedParams;\n }): Promise<boolean>;\n createPlatformPayPaymentMethod(\n params: PlatformPay.PaymentMethodParams,\n usesDeprecatedTokenFlow: boolean\n ): Promise<PlatformPay.PaymentMethodResult | PlatformPay.TokenResult>;\n dismissPlatformPay(): Promise<boolean>;\n updatePlatformPaySheet(\n summaryItems: Array<ApplePay.CartSummaryItem>,\n shippingMethods: Array<ApplePay.ShippingMethod>,\n errors: Array<PlatformPay.ApplePaySheetError>\n ): Promise<void>;\n confirmPlatformPay(\n clientSecret: string,\n params: PlatformPay.ConfirmParams,\n isPaymentIntent: boolean\n ): Promise<\n PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult\n >;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"],"mappings":"gFAAA,yCAmIA,GAAQA,UAAS,CAAKC,0BAAa,CAA3BD,SAAS,CAAmB,aAErBA,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AddToWalletButtonNative","requireNativeComponent","AddToWalletButton","onComplete","props","value","nativeEvent"],"sources":["AddToWalletButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If
|
|
1
|
+
{"version":3,"names":["AddToWalletButtonNative","requireNativeComponent","AddToWalletButton","onComplete","props","value","nativeEvent"],"sources":["AddToWalletButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If false, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */\n testEnv?: boolean;\n /** Details of the Issued Card you'd like added to the device's wallet */\n cardDetails: {\n /** The `primary_account_identifier` value from the issued card. */\n primaryAccountIdentifier: string | null;\n /** The card holder name (used only on iOS) */\n name: string;\n /** A user-facing description of the card. Required on Android.*/\n description: string;\n /** Last 4 digits of the card, only used on iOS */\n lastFour?: string;\n /** Optional, only used on iOS */\n brand?: Token.CardBrand;\n };\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardDetails={{\n * primaryAccountIdentifier: \"V-123\",\n * name: \"David Wallace\",\n * lastFour: \"4242\",\n * }}\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"],"mappings":"wXAAA,oDACA,yCAOsB,qIAQtB,GAAMA,wBAAuB,CAC3B,GAAAC,mCAAsB,EAAM,mBAAmB,CAAC,CAgE3C,QAASC,kBAAiB,MAAkC,IAA/BC,WAAU,MAAVA,UAAU,CAAKC,KAAK,uDACtD,MACE,8BAAC,uBAAuB,0BAClBA,KAAK,EACT,gBAAgB,CAAE,0BAChBC,KAEE,QACCF,WAAU,CAACE,KAAK,CAACC,WAAW,CAAC,EAAC,6EACnC,CAEN"}
|