@stripe/stripe-react-native 0.24.0 → 0.25.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/CHANGELOG.md +13 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +1 -1
- package/ios/ApplePayViewController.swift +8 -8
- package/ios/PaymentPassFinder.swift +9 -5
- package/ios/PushProvisioning/AddToWalletButtonView.swift +1 -1
- package/ios/PushProvisioning/PushProvisioningUtils.swift +8 -19
- package/ios/StripeSdk.swift +0 -5
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/typescript/src/types/PushProvisioning.d.ts +3 -1
- package/package.json +1 -1
- package/src/types/PushProvisioning.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.25.0 - 2023-02-27
|
|
6
|
+
|
|
7
|
+
### New Features
|
|
8
|
+
|
|
9
|
+
- Added the `supportsTapToPay` option to `canAddCardToWallet`. [#1308](https://github.com/stripe/stripe-react-native/pull/1308)
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
|
|
13
|
+
- Fixed an issue on iOS where `canAddCardToWallet` would always return a `details.status` of `UNSUPPORTED_DEVICE` on iPads. [#1305](https://github.com/stripe/stripe-react-native/pull/1305)
|
|
14
|
+
- Fixed an issue on iOS where `canAddCardToWallet` would always return a `{canAddCard: false}` if the card in question had been provsioned on the current device, but **had not yet been provisioned** on a paired Watch. [#1305](https://github.com/stripe/stripe-react-native/pull/1305)
|
|
15
|
+
- Fixed an issue on iOS where the **deprecated** `onDidSetShippingMethod` & `onDidSetShippingContact` events wouldn't be triggered if you were using the `useApplePay` hook _without_ using the `ApplePayButton` component. [#1298](https://github.com/stripe/stripe-react-native/pull/1298)
|
|
16
|
+
- Fixed an issue on Android where `canAddCardToWallet` could result in a null pointer exception on devices without NFC compatibility. [#1308](https://github.com/stripe/stripe-react-native/pull/1308)
|
|
17
|
+
|
|
5
18
|
## 0.24.0 - 2023-02-17
|
|
6
19
|
|
|
7
20
|
### Breaking changes
|
|
@@ -696,7 +696,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
696
696
|
return
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
-
if (!PushProvisioningProxy.isNFCEnabled(reactApplicationContext)) {
|
|
699
|
+
if (params.getBooleanOr("supportsTapToPay", true) && !PushProvisioningProxy.isNFCEnabled(reactApplicationContext)) {
|
|
700
700
|
promise.resolve(createCanAddCardResult(false, "UNSUPPORTED_DEVICE"))
|
|
701
701
|
return
|
|
702
702
|
}
|
package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt
CHANGED
|
@@ -33,7 +33,7 @@ object PushProvisioningProxy {
|
|
|
33
33
|
fun isNFCEnabled(context: ReactApplicationContext): Boolean {
|
|
34
34
|
return if (context.packageManager.hasSystemFeature(PackageManager.FEATURE_NFC)) {
|
|
35
35
|
val adapter = NfcAdapter.getDefaultAdapter(context)
|
|
36
|
-
adapter
|
|
36
|
+
adapter?.isEnabled ?: false
|
|
37
37
|
} else {
|
|
38
38
|
false
|
|
39
39
|
}
|
|
@@ -122,13 +122,13 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
|
|
|
122
122
|
didSelect shippingMethod: PKShippingMethod,
|
|
123
123
|
handler: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void
|
|
124
124
|
) {
|
|
125
|
+
if (self.hasLegacyApplePayListeners) {
|
|
126
|
+
// Legacy, remove when useApplePay hook is removed
|
|
127
|
+
sendEvent(withName: "onDidSetShippingMethod", body: ["shippingMethod": Mappers.mapFromShippingMethod(shippingMethod: shippingMethod)])
|
|
128
|
+
}
|
|
125
129
|
if let callback = self.shippingMethodUpdateJSCallback {
|
|
126
130
|
self.shippingMethodUpdateCompletion = handler
|
|
127
131
|
callback(["shippingMethod": Mappers.mapFromShippingMethod(shippingMethod: shippingMethod)])
|
|
128
|
-
if (self.hasLegacyApplePayListeners) {
|
|
129
|
-
// Legacy, remove when useApplePay hook is removed
|
|
130
|
-
sendEvent(withName: "onDidSetShippingMethod", body: ["shippingMethod": Mappers.mapFromShippingMethod(shippingMethod: shippingMethod)])
|
|
131
|
-
}
|
|
132
132
|
} else {
|
|
133
133
|
handler(
|
|
134
134
|
PKPaymentRequestShippingMethodUpdate.init(paymentSummaryItems: applePaySummaryItems)
|
|
@@ -141,13 +141,13 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
|
|
|
141
141
|
didSelectShippingContact contact: PKContact,
|
|
142
142
|
handler: @escaping (PKPaymentRequestShippingContactUpdate) -> Void
|
|
143
143
|
) {
|
|
144
|
+
if (self.hasLegacyApplePayListeners) {
|
|
145
|
+
// Legacy, remove when useApplePay hook is removed
|
|
146
|
+
sendEvent(withName: "onDidSetShippingContact", body: ["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact)])
|
|
147
|
+
}
|
|
144
148
|
if let callback = self.shippingContactUpdateJSCallback {
|
|
145
149
|
self.shippingContactUpdateCompletion = handler
|
|
146
150
|
callback(["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact)])
|
|
147
|
-
if (self.hasLegacyApplePayListeners) {
|
|
148
|
-
// Legacy, remove when useApplePay hook is removed
|
|
149
|
-
sendEvent(withName: "onDidSetShippingContact", body: ["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact)])
|
|
150
|
-
}
|
|
151
151
|
} else {
|
|
152
152
|
handler(
|
|
153
153
|
PKPaymentRequestShippingContactUpdate.init(
|
|
@@ -13,14 +13,18 @@ internal class PaymentPassFinder: NSObject {
|
|
|
13
13
|
case PAIRED_DEVICE
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
class func
|
|
16
|
+
class func findPassWith(
|
|
17
|
+
primaryAccountIdentifier: String,
|
|
18
|
+
hasPairedAppleWatch: Bool,
|
|
19
|
+
completion: @escaping ((Bool, [PassLocation]) -> Void)
|
|
20
|
+
) {
|
|
17
21
|
let existingPassOnDevice: PKPass? = {
|
|
18
22
|
if #available(iOS 13.4, *) {
|
|
19
23
|
return PKPassLibrary().passes(of: PKPassType.secureElement)
|
|
20
|
-
.first(where: { $0.secureElementPass?.
|
|
24
|
+
.first(where: { $0.secureElementPass?.primaryAccountIdentifier == primaryAccountIdentifier && $0.secureElementPass?.passActivationState != .deactivated && !$0.isRemotePass })
|
|
21
25
|
} else {
|
|
22
26
|
return PKPassLibrary().passes(of: PKPassType.payment)
|
|
23
|
-
.first(where: { $0.paymentPass?.
|
|
27
|
+
.first(where: { $0.paymentPass?.primaryAccountIdentifier == primaryAccountIdentifier && $0.paymentPass?.passActivationState != .deactivated && !$0.isRemotePass })
|
|
24
28
|
}
|
|
25
29
|
}()
|
|
26
30
|
|
|
@@ -41,10 +45,10 @@ internal class PaymentPassFinder: NSObject {
|
|
|
41
45
|
let existingPassOnPairedDevices: PKPass? = {
|
|
42
46
|
if #available(iOS 13.4, *) {
|
|
43
47
|
return PKPassLibrary().remoteSecureElementPasses
|
|
44
|
-
.first(where: { $0.secureElementPass?.
|
|
48
|
+
.first(where: { $0.secureElementPass?.primaryAccountIdentifier == primaryAccountIdentifier && $0.secureElementPass?.passActivationState != .deactivated })
|
|
45
49
|
} else {
|
|
46
50
|
return PKPassLibrary().remotePaymentPasses()
|
|
47
|
-
.first(where: { $0.paymentPass?.
|
|
51
|
+
.first(where: { $0.paymentPass?.primaryAccountIdentifier == primaryAccountIdentifier && $0.paymentPass?.passActivationState != .deactivated })
|
|
48
52
|
}
|
|
49
53
|
}()
|
|
50
54
|
|
|
@@ -39,7 +39,7 @@ class AddToWalletButtonView: UIView {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@objc func beginPushProvisioning() {
|
|
42
|
-
if (!PushProvisioningUtils.canAddPaymentPass(
|
|
42
|
+
if (!PushProvisioningUtils.canAddPaymentPass(isTestMode: self.testEnv)) {
|
|
43
43
|
onCompleteAction!(
|
|
44
44
|
Errors.createError(
|
|
45
45
|
ErrorType.Failed,
|
|
@@ -10,24 +10,18 @@ import Stripe
|
|
|
10
10
|
|
|
11
11
|
internal class PushProvisioningUtils {
|
|
12
12
|
class func canAddCardToWallet(
|
|
13
|
-
last4: String,
|
|
14
13
|
primaryAccountIdentifier: String,
|
|
15
14
|
testEnv: Bool,
|
|
16
15
|
hasPairedAppleWatch: Bool,
|
|
17
16
|
completion: @escaping (_ canAddCard: Bool, _ status: AddCardToWalletStatus?) -> Void
|
|
18
17
|
) {
|
|
19
|
-
if (!
|
|
18
|
+
if (!canAddPaymentPass(isTestMode: testEnv)) {
|
|
20
19
|
completion(false, AddCardToWalletStatus.UNSUPPORTED_DEVICE)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let canAddCard = canAddPaymentPass(
|
|
24
|
-
primaryAccountIdentifier: primaryAccountIdentifier,
|
|
25
|
-
isTestMode: testEnv)
|
|
26
|
-
|
|
27
|
-
if (!canAddCard) {
|
|
28
|
-
completion(canAddCard, AddCardToWalletStatus.MISSING_CONFIGURATION)
|
|
29
20
|
} else {
|
|
30
|
-
PaymentPassFinder.
|
|
21
|
+
PaymentPassFinder.findPassWith(
|
|
22
|
+
primaryAccountIdentifier: primaryAccountIdentifier,
|
|
23
|
+
hasPairedAppleWatch: hasPairedAppleWatch)
|
|
24
|
+
{ canAddCardToADevice, passLocations in
|
|
31
25
|
var status: AddCardToWalletStatus? = nil
|
|
32
26
|
if (!canAddCardToADevice) {
|
|
33
27
|
status = AddCardToWalletStatus.CARD_ALREADY_EXISTS
|
|
@@ -41,16 +35,12 @@ internal class PushProvisioningUtils {
|
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
37
|
|
|
44
|
-
class func canAddPaymentPass(
|
|
38
|
+
class func canAddPaymentPass(isTestMode: Bool) -> Bool {
|
|
45
39
|
if (isTestMode) {
|
|
46
40
|
return STPFakeAddPaymentPassViewController.canAddPaymentPass()
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return PKPassLibrary().canAddSecureElementPass(primaryAccountIdentifier: primaryAccountIdentifier)
|
|
51
|
-
} else {
|
|
52
|
-
return PKAddPaymentPassViewController.canAddPaymentPass()
|
|
53
|
-
}
|
|
42
|
+
|
|
43
|
+
return PKAddPaymentPassViewController.canAddPaymentPass()
|
|
54
44
|
}
|
|
55
45
|
|
|
56
46
|
class func getPassLocation(last4: String) -> PaymentPassFinder.PassLocation? {
|
|
@@ -79,7 +69,6 @@ internal class PushProvisioningUtils {
|
|
|
79
69
|
|
|
80
70
|
enum AddCardToWalletStatus: String {
|
|
81
71
|
case UNSUPPORTED_DEVICE
|
|
82
|
-
case MISSING_CONFIGURATION
|
|
83
72
|
case CARD_ALREADY_EXISTS
|
|
84
73
|
case CARD_EXISTS_ON_CURRENT_DEVICE
|
|
85
74
|
case CARD_EXISTS_ON_PAIRED_DEVICE
|
package/ios/StripeSdk.swift
CHANGED
|
@@ -1022,12 +1022,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
1022
1022
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
1023
1023
|
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
1024
1024
|
) -> Void {
|
|
1025
|
-
guard let last4 = params["cardLastFour"] as? String else {
|
|
1026
|
-
resolve(Errors.createError(ErrorType.Failed, "You must provide `cardLastFour`"))
|
|
1027
|
-
return
|
|
1028
|
-
}
|
|
1029
1025
|
PushProvisioningUtils.canAddCardToWallet(
|
|
1030
|
-
last4: last4,
|
|
1031
1026
|
primaryAccountIdentifier: params["primaryAccountIdentifier"] as? String ?? "",
|
|
1032
1027
|
testEnv: params["testEnv"] as? Bool ?? false,
|
|
1033
1028
|
hasPairedAppleWatch: params["hasPairedAppleWatch"] as? Bool ?? false)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GooglePayCardTokenStatus","CanAddCardToWalletStatus"],"sources":["PushProvisioning.ts"],"sourcesContent":["import type { StripeError, GooglePayError } from './Errors';\n\nexport type GooglePayCardToken = {\n id: string;\n cardLastFour: string;\n network: number;\n serviceProvider: number;\n issuer: string;\n status: GooglePayCardTokenStatus;\n};\n\nexport enum GooglePayCardTokenStatus {\n /** */\n TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION = 'TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION',\n /** */\n TOKEN_STATE_PENDING = 'TOKEN_STATE_PENDING',\n /** */\n TOKEN_STATE_SUSPENDED = 'TOKEN_STATE_SUSPENDED',\n /** */\n TOKEN_STATE_ACTIVE = 'TOKEN_STATE_ACTIVE',\n /** */\n TOKEN_STATE_FELICA_PENDING_PROVISIONING = 'TOKEN_STATE_FELICA_PENDING_PROVISIONING',\n /** */\n TOKEN_STATE_UNTOKENIZED = 'TOKEN_STATE_UNTOKENIZED',\n}\n\nexport type IsCardInWalletResult =\n | {\n isInWallet: boolean;\n token?: GooglePayCardToken;\n error?: undefined;\n }\n | {\n isInWallet?: undefined;\n token?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport type CanAddCardToWalletParams = {\n /** The `primary_account_identifier` value from the issued card. Can be an empty string. */\n primaryAccountIdentifier: string | null;\n /** Last 4 digits of the card number. */\n cardLastFour: 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 /** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */\n hasPairedAppleWatch?: boolean;\n};\n\nexport type CanAddCardToWalletResult =\n | {\n canAddCard: boolean;\n details?: {\n token?: GooglePayCardToken;\n status?: CanAddCardToWalletStatus;\n };\n error?: undefined;\n }\n | {\n canAddCard?: undefined;\n details?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport enum CanAddCardToWalletStatus {\n /** You are missing configuration required for Push Provisioning. Make sure you've completed all steps at https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native. */\n MISSING_CONFIGURATION = 'MISSING_CONFIGURATION',\n /** This device doesn't support adding a card to the native wallet. */\n UNSUPPORTED_DEVICE = 'UNSUPPORTED_DEVICE',\n /** This card already exists on this device and any paired devices. */\n CARD_ALREADY_EXISTS = 'CARD_ALREADY_EXISTS',\n /** This card already exists on this device, but not on the paired device. */\n CARD_EXISTS_ON_CURRENT_DEVICE = 'CARD_EXISTS_ON_CURRENT_DEVICE',\n /** This card already exists on the paired device, but not on this device. */\n CARD_EXISTS_ON_PAIRED_DEVICE = 'CARD_EXISTS_ON_PAIRED_DEVICE',\n}\n"],"mappings":"qIAWYA,yBAAwB,qEAAxBA,wBAAwB,EAAxBA,wBAAwB,sFAAxBA,wBAAwB,8CAAxBA,wBAAwB,kDAAxBA,wBAAwB,4CAAxBA,wBAAwB,sFAAxBA,wBAAwB,yDAAxBA,wBAAwB,oCAAxBA,wBAAwB,
|
|
1
|
+
{"version":3,"names":["GooglePayCardTokenStatus","CanAddCardToWalletStatus"],"sources":["PushProvisioning.ts"],"sourcesContent":["import type { StripeError, GooglePayError } from './Errors';\n\nexport type GooglePayCardToken = {\n id: string;\n cardLastFour: string;\n network: number;\n serviceProvider: number;\n issuer: string;\n status: GooglePayCardTokenStatus;\n};\n\nexport enum GooglePayCardTokenStatus {\n /** */\n TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION = 'TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION',\n /** */\n TOKEN_STATE_PENDING = 'TOKEN_STATE_PENDING',\n /** */\n TOKEN_STATE_SUSPENDED = 'TOKEN_STATE_SUSPENDED',\n /** */\n TOKEN_STATE_ACTIVE = 'TOKEN_STATE_ACTIVE',\n /** */\n TOKEN_STATE_FELICA_PENDING_PROVISIONING = 'TOKEN_STATE_FELICA_PENDING_PROVISIONING',\n /** */\n TOKEN_STATE_UNTOKENIZED = 'TOKEN_STATE_UNTOKENIZED',\n}\n\nexport type IsCardInWalletResult =\n | {\n isInWallet: boolean;\n token?: GooglePayCardToken;\n error?: undefined;\n }\n | {\n isInWallet?: undefined;\n token?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport type CanAddCardToWalletParams = {\n /** The `primary_account_identifier` value from the issued card. Can be an empty string. */\n primaryAccountIdentifier: string | null;\n /** Last 4 digits of the card number. Required for Android. */\n cardLastFour: 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 /** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */\n hasPairedAppleWatch?: boolean;\n /** Android only, defaults to `true`. Set this to `false` if you'd like to allow users without NFC-enabled devices to add cards to the wallet. NFC is required for paying in stores. */\n supportsTapToPay?: boolean;\n};\n\nexport type CanAddCardToWalletResult =\n | {\n canAddCard: boolean;\n details?: {\n token?: GooglePayCardToken;\n status?: CanAddCardToWalletStatus;\n };\n error?: undefined;\n }\n | {\n canAddCard?: undefined;\n details?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport enum CanAddCardToWalletStatus {\n /** You are missing configuration required for Push Provisioning. Make sure you've completed all steps at https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native. */\n MISSING_CONFIGURATION = 'MISSING_CONFIGURATION',\n /** This device doesn't support adding a card to the native wallet. */\n UNSUPPORTED_DEVICE = 'UNSUPPORTED_DEVICE',\n /** This card already exists on this device and any paired devices. */\n CARD_ALREADY_EXISTS = 'CARD_ALREADY_EXISTS',\n /** This card already exists on this device, but not on the paired device. */\n CARD_EXISTS_ON_CURRENT_DEVICE = 'CARD_EXISTS_ON_CURRENT_DEVICE',\n /** This card already exists on the paired device, but not on this device. */\n CARD_EXISTS_ON_PAIRED_DEVICE = 'CARD_EXISTS_ON_PAIRED_DEVICE',\n}\n"],"mappings":"qIAWYA,yBAAwB,qEAAxBA,wBAAwB,EAAxBA,wBAAwB,sFAAxBA,wBAAwB,8CAAxBA,wBAAwB,kDAAxBA,wBAAwB,4CAAxBA,wBAAwB,sFAAxBA,wBAAwB,yDAAxBA,wBAAwB,oCAAxBA,wBAAwB,SAuDxBC,yBAAwB,qEAAxBA,wBAAwB,EAAxBA,wBAAwB,kDAAxBA,wBAAwB,4CAAxBA,wBAAwB,8CAAxBA,wBAAwB,kEAAxBA,wBAAwB,mEAAxBA,wBAAwB,oCAAxBA,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GooglePayCardTokenStatus","CanAddCardToWalletStatus"],"sources":["PushProvisioning.ts"],"sourcesContent":["import type { StripeError, GooglePayError } from './Errors';\n\nexport type GooglePayCardToken = {\n id: string;\n cardLastFour: string;\n network: number;\n serviceProvider: number;\n issuer: string;\n status: GooglePayCardTokenStatus;\n};\n\nexport enum GooglePayCardTokenStatus {\n /** */\n TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION = 'TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION',\n /** */\n TOKEN_STATE_PENDING = 'TOKEN_STATE_PENDING',\n /** */\n TOKEN_STATE_SUSPENDED = 'TOKEN_STATE_SUSPENDED',\n /** */\n TOKEN_STATE_ACTIVE = 'TOKEN_STATE_ACTIVE',\n /** */\n TOKEN_STATE_FELICA_PENDING_PROVISIONING = 'TOKEN_STATE_FELICA_PENDING_PROVISIONING',\n /** */\n TOKEN_STATE_UNTOKENIZED = 'TOKEN_STATE_UNTOKENIZED',\n}\n\nexport type IsCardInWalletResult =\n | {\n isInWallet: boolean;\n token?: GooglePayCardToken;\n error?: undefined;\n }\n | {\n isInWallet?: undefined;\n token?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport type CanAddCardToWalletParams = {\n /** The `primary_account_identifier` value from the issued card. Can be an empty string. */\n primaryAccountIdentifier: string | null;\n /** Last 4 digits of the card number. */\n cardLastFour: 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 /** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */\n hasPairedAppleWatch?: boolean;\n};\n\nexport type CanAddCardToWalletResult =\n | {\n canAddCard: boolean;\n details?: {\n token?: GooglePayCardToken;\n status?: CanAddCardToWalletStatus;\n };\n error?: undefined;\n }\n | {\n canAddCard?: undefined;\n details?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport enum CanAddCardToWalletStatus {\n /** You are missing configuration required for Push Provisioning. Make sure you've completed all steps at https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native. */\n MISSING_CONFIGURATION = 'MISSING_CONFIGURATION',\n /** This device doesn't support adding a card to the native wallet. */\n UNSUPPORTED_DEVICE = 'UNSUPPORTED_DEVICE',\n /** This card already exists on this device and any paired devices. */\n CARD_ALREADY_EXISTS = 'CARD_ALREADY_EXISTS',\n /** This card already exists on this device, but not on the paired device. */\n CARD_EXISTS_ON_CURRENT_DEVICE = 'CARD_EXISTS_ON_CURRENT_DEVICE',\n /** This card already exists on the paired device, but not on this device. */\n CARD_EXISTS_ON_PAIRED_DEVICE = 'CARD_EXISTS_ON_PAIRED_DEVICE',\n}\n"],"mappings":"qIAWYA,yBAAwB,qEAAxBA,wBAAwB,EAAxBA,wBAAwB,sFAAxBA,wBAAwB,8CAAxBA,wBAAwB,kDAAxBA,wBAAwB,4CAAxBA,wBAAwB,sFAAxBA,wBAAwB,yDAAxBA,wBAAwB,oCAAxBA,wBAAwB,
|
|
1
|
+
{"version":3,"names":["GooglePayCardTokenStatus","CanAddCardToWalletStatus"],"sources":["PushProvisioning.ts"],"sourcesContent":["import type { StripeError, GooglePayError } from './Errors';\n\nexport type GooglePayCardToken = {\n id: string;\n cardLastFour: string;\n network: number;\n serviceProvider: number;\n issuer: string;\n status: GooglePayCardTokenStatus;\n};\n\nexport enum GooglePayCardTokenStatus {\n /** */\n TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION = 'TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION',\n /** */\n TOKEN_STATE_PENDING = 'TOKEN_STATE_PENDING',\n /** */\n TOKEN_STATE_SUSPENDED = 'TOKEN_STATE_SUSPENDED',\n /** */\n TOKEN_STATE_ACTIVE = 'TOKEN_STATE_ACTIVE',\n /** */\n TOKEN_STATE_FELICA_PENDING_PROVISIONING = 'TOKEN_STATE_FELICA_PENDING_PROVISIONING',\n /** */\n TOKEN_STATE_UNTOKENIZED = 'TOKEN_STATE_UNTOKENIZED',\n}\n\nexport type IsCardInWalletResult =\n | {\n isInWallet: boolean;\n token?: GooglePayCardToken;\n error?: undefined;\n }\n | {\n isInWallet?: undefined;\n token?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport type CanAddCardToWalletParams = {\n /** The `primary_account_identifier` value from the issued card. Can be an empty string. */\n primaryAccountIdentifier: string | null;\n /** Last 4 digits of the card number. Required for Android. */\n cardLastFour: 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 /** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */\n hasPairedAppleWatch?: boolean;\n /** Android only, defaults to `true`. Set this to `false` if you'd like to allow users without NFC-enabled devices to add cards to the wallet. NFC is required for paying in stores. */\n supportsTapToPay?: boolean;\n};\n\nexport type CanAddCardToWalletResult =\n | {\n canAddCard: boolean;\n details?: {\n token?: GooglePayCardToken;\n status?: CanAddCardToWalletStatus;\n };\n error?: undefined;\n }\n | {\n canAddCard?: undefined;\n details?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport enum CanAddCardToWalletStatus {\n /** You are missing configuration required for Push Provisioning. Make sure you've completed all steps at https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native. */\n MISSING_CONFIGURATION = 'MISSING_CONFIGURATION',\n /** This device doesn't support adding a card to the native wallet. */\n UNSUPPORTED_DEVICE = 'UNSUPPORTED_DEVICE',\n /** This card already exists on this device and any paired devices. */\n CARD_ALREADY_EXISTS = 'CARD_ALREADY_EXISTS',\n /** This card already exists on this device, but not on the paired device. */\n CARD_EXISTS_ON_CURRENT_DEVICE = 'CARD_EXISTS_ON_CURRENT_DEVICE',\n /** This card already exists on the paired device, but not on this device. */\n CARD_EXISTS_ON_PAIRED_DEVICE = 'CARD_EXISTS_ON_PAIRED_DEVICE',\n}\n"],"mappings":"qIAWYA,yBAAwB,qEAAxBA,wBAAwB,EAAxBA,wBAAwB,sFAAxBA,wBAAwB,8CAAxBA,wBAAwB,kDAAxBA,wBAAwB,4CAAxBA,wBAAwB,sFAAxBA,wBAAwB,yDAAxBA,wBAAwB,oCAAxBA,wBAAwB,SAuDxBC,yBAAwB,qEAAxBA,wBAAwB,EAAxBA,wBAAwB,kDAAxBA,wBAAwB,4CAAxBA,wBAAwB,8CAAxBA,wBAAwB,kEAAxBA,wBAAwB,mEAAxBA,wBAAwB,oCAAxBA,wBAAwB"}
|
|
@@ -33,12 +33,14 @@ export declare type IsCardInWalletResult = {
|
|
|
33
33
|
export declare type CanAddCardToWalletParams = {
|
|
34
34
|
/** The `primary_account_identifier` value from the issued card. Can be an empty string. */
|
|
35
35
|
primaryAccountIdentifier: string | null;
|
|
36
|
-
/** Last 4 digits of the card number. */
|
|
36
|
+
/** Last 4 digits of the card number. Required for Android. */
|
|
37
37
|
cardLastFour: string;
|
|
38
38
|
/** 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 */
|
|
39
39
|
testEnv?: boolean;
|
|
40
40
|
/** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */
|
|
41
41
|
hasPairedAppleWatch?: boolean;
|
|
42
|
+
/** Android only, defaults to `true`. Set this to `false` if you'd like to allow users without NFC-enabled devices to add cards to the wallet. NFC is required for paying in stores. */
|
|
43
|
+
supportsTapToPay?: boolean;
|
|
42
44
|
};
|
|
43
45
|
export declare type CanAddCardToWalletResult = {
|
|
44
46
|
canAddCard: boolean;
|
package/package.json
CHANGED
|
@@ -39,12 +39,14 @@ export type IsCardInWalletResult =
|
|
|
39
39
|
export type CanAddCardToWalletParams = {
|
|
40
40
|
/** The `primary_account_identifier` value from the issued card. Can be an empty string. */
|
|
41
41
|
primaryAccountIdentifier: string | null;
|
|
42
|
-
/** Last 4 digits of the card number. */
|
|
42
|
+
/** Last 4 digits of the card number. Required for Android. */
|
|
43
43
|
cardLastFour: string;
|
|
44
44
|
/** 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 */
|
|
45
45
|
testEnv?: boolean;
|
|
46
46
|
/** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */
|
|
47
47
|
hasPairedAppleWatch?: boolean;
|
|
48
|
+
/** Android only, defaults to `true`. Set this to `false` if you'd like to allow users without NFC-enabled devices to add cards to the wallet. NFC is required for paying in stores. */
|
|
49
|
+
supportsTapToPay?: boolean;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export type CanAddCardToWalletResult =
|