@expensify/react-native-wallet 0.1.38 → 0.1.40
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.
|
@@ -79,15 +79,13 @@ class WalletModule internal constructor(context: ReactApplicationContext) :
|
|
|
79
79
|
val localPromise = pendingPushTokenizePromise
|
|
80
80
|
pendingPushTokenizePromise = null
|
|
81
81
|
if (resultCode == RESULT_OK) {
|
|
82
|
-
data?.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
localPromise?.resolve(TokenizationStatus.SUCCESS.code)
|
|
90
|
-
}
|
|
82
|
+
val tokenId = data?.getStringExtra(TapAndPay.EXTRA_ISSUER_TOKEN_ID)
|
|
83
|
+
sendEvent(
|
|
84
|
+
context,
|
|
85
|
+
OnCardActivatedEvent.NAME,
|
|
86
|
+
OnCardActivatedEvent("activated", tokenId).toMap()
|
|
87
|
+
)
|
|
88
|
+
localPromise?.resolve(TokenizationStatus.SUCCESS.code)
|
|
91
89
|
} else if (resultCode == RESULT_CANCELED) {
|
|
92
90
|
sendEvent(
|
|
93
91
|
context,
|
|
@@ -95,6 +93,8 @@ class WalletModule internal constructor(context: ReactApplicationContext) :
|
|
|
95
93
|
OnCardActivatedEvent("canceled", null).toMap()
|
|
96
94
|
)
|
|
97
95
|
localPromise?.resolve(TokenizationStatus.CANCELED.code)
|
|
96
|
+
} else {
|
|
97
|
+
localPromise?.resolve(TokenizationStatus.ERROR.code)
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}
|
package/ios/RNWallet.mm
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
#import <react_native_wallet-Swift.h>
|
|
8
8
|
#endif
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
@interface RNWallet () <WalletDelegate>
|
|
12
11
|
@end
|
|
13
12
|
|
|
@@ -34,17 +33,33 @@ RCT_REMAP_METHOD(checkWalletAvailability,
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
RCT_REMAP_METHOD(IOSPresentAddPaymentPassView,
|
|
36
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
37
37
|
IOSPresentAddPaymentPassView:(JS::NativeWallet::IOSCardData &)cardData
|
|
38
|
+
#else
|
|
39
|
+
IOSPresentAddPaymentPassView:(NSDictionary *)cardData
|
|
40
|
+
#endif
|
|
38
41
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
39
42
|
reject:(RCTPromiseRejectBlock)reject)
|
|
40
43
|
{
|
|
41
44
|
@try {
|
|
42
|
-
NSDictionary *cardDataDict =
|
|
45
|
+
NSDictionary *cardDataDict = nil;
|
|
46
|
+
|
|
47
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
48
|
+
cardDataDict = @{
|
|
43
49
|
@"network": [self safeString:cardData.network()],
|
|
44
50
|
@"cardHolderName": [self safeString:cardData.cardHolderName()],
|
|
45
51
|
@"lastDigits": [self safeString:cardData.lastDigits()],
|
|
46
52
|
@"cardDescription": [self safeString:cardData.cardDescription()],
|
|
47
53
|
};
|
|
54
|
+
#else
|
|
55
|
+
cardDataDict = @{
|
|
56
|
+
@"network": [self safeString:cardData[@"network"]],
|
|
57
|
+
@"cardHolderName": [self safeString:cardData[@"cardHolderName"]],
|
|
58
|
+
@"lastDigits": [self safeString:cardData[@"lastDigits"]],
|
|
59
|
+
@"cardDescription": [self safeString:cardData[@"cardDescription"]],
|
|
60
|
+
};
|
|
61
|
+
#endif
|
|
62
|
+
|
|
48
63
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
49
64
|
[self->walletManager IOSPresentAddPaymentPassViewWithCardData:cardDataDict completion:^(OperationResult result, NSDictionary* data) {
|
|
50
65
|
[self handleWalletResponse:result data:data completedBlock:resolve errorPrefix:@"present_payment_pass_view_failed" defaultErrorMessage:@"Failed to present the payment pass view" rejecter:reject];
|
|
@@ -56,16 +71,31 @@ RCT_REMAP_METHOD(IOSPresentAddPaymentPassView,
|
|
|
56
71
|
}
|
|
57
72
|
|
|
58
73
|
RCT_REMAP_METHOD(IOSHandleAddPaymentPassResponse,
|
|
74
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
59
75
|
IOSHandleAddPaymentPassResponse:(JS::NativeWallet::IOSEncryptPayload &)payload
|
|
76
|
+
#else
|
|
77
|
+
IOSHandleAddPaymentPassResponse:(NSDictionary *)payload
|
|
78
|
+
#endif
|
|
60
79
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
61
80
|
reject:(RCTPromiseRejectBlock)reject)
|
|
62
81
|
{
|
|
63
82
|
@try {
|
|
64
|
-
NSDictionary *payloadDict =
|
|
83
|
+
NSDictionary *payloadDict = nil;
|
|
84
|
+
|
|
85
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
86
|
+
payloadDict = @{
|
|
65
87
|
@"encryptedPassData": [self safeString:payload.encryptedPassData()],
|
|
66
88
|
@"activationData": [self safeString:payload.activationData()],
|
|
67
89
|
@"ephemeralPublicKey": [self safeString:payload.ephemeralPublicKey()],
|
|
68
90
|
};
|
|
91
|
+
#else
|
|
92
|
+
payloadDict = @{
|
|
93
|
+
@"encryptedPassData": [self safeString:payload[@"encryptedPassData"]],
|
|
94
|
+
@"activationData": [self safeString:payload[@"activationData"]],
|
|
95
|
+
@"ephemeralPublicKey": [self safeString:payload[@"ephemeralPublicKey"]],
|
|
96
|
+
};
|
|
97
|
+
#endif
|
|
98
|
+
|
|
69
99
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
70
100
|
[self->walletManager IOSHandleAddPaymentPassResponseWithPayload:payloadDict completion:^(OperationResult result, NSDictionary* data) {
|
|
71
101
|
[self handleWalletResponse:result data:data completedBlock:resolve errorPrefix:@"add_card_failed" defaultErrorMessage:@"Failed to add the card to the wallet" rejecter:reject];
|
|
@@ -93,7 +123,15 @@ RCT_REMAP_METHOD(getCardStatusByIdentifier,
|
|
|
93
123
|
resolve([walletManager getCardStatusByIdentifierWithIdentifier:identifier]);
|
|
94
124
|
}
|
|
95
125
|
|
|
96
|
-
- (void)addCardToGoogleWallet:
|
|
126
|
+
- (void)addCardToGoogleWallet:
|
|
127
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
128
|
+
(JS::NativeWallet::AndroidCardData &)cardData
|
|
129
|
+
#else
|
|
130
|
+
(NSDictionary *)cardData
|
|
131
|
+
#endif
|
|
132
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
133
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
134
|
+
{
|
|
97
135
|
// no-op
|
|
98
136
|
}
|
|
99
137
|
|
|
@@ -149,5 +187,4 @@ RCT_REMAP_METHOD(getCardStatusByIdentifier,
|
|
|
149
187
|
}
|
|
150
188
|
#endif
|
|
151
189
|
|
|
152
|
-
|
|
153
190
|
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expensify/react-native-wallet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "A React Native module designed for seamless integration of Card Push Provisioning into Apple Wallet and Google Wallet, enabling easy and secure addition of payment cards directly from your application.",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "lib/commonjs/index",
|