@fat-zebra/sdk 2.0.3-beta.1 → 2.0.3-beta.3
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/dist/main.js +27 -53
- package/dist/sca/cardinal.d.ts +1 -0
- package/dist/sca/cardinal.js +4 -0
- package/dist/sca/index.js +3 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -51,6 +51,10 @@ class FatZebra {
|
|
|
51
51
|
this.headless.addEventListener('load', () => resolve());
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
this.sca = new Sca({
|
|
55
|
+
gatewayClient: this.gatewayClient,
|
|
56
|
+
});
|
|
57
|
+
this.sca.loadScript();
|
|
54
58
|
this.authReady = this.setAuthImpl();
|
|
55
59
|
const message = {
|
|
56
60
|
channel: 'sca',
|
|
@@ -71,12 +75,6 @@ class FatZebra {
|
|
|
71
75
|
});
|
|
72
76
|
this.setThreeDSecureListeners();
|
|
73
77
|
}
|
|
74
|
-
else {
|
|
75
|
-
this.sca = new Sca({
|
|
76
|
-
gatewayClient: this.gatewayClient,
|
|
77
|
-
});
|
|
78
|
-
this.sca.loadScript();
|
|
79
|
-
}
|
|
80
78
|
});
|
|
81
79
|
}
|
|
82
80
|
tokenizeCard(card) {
|
|
@@ -149,7 +147,7 @@ class FatZebra {
|
|
|
149
147
|
}
|
|
150
148
|
verifyCard(params) {
|
|
151
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
-
var _a
|
|
150
|
+
var _a;
|
|
153
151
|
console.log('verifyCard');
|
|
154
152
|
const valid = validateVerifyCardParams(params);
|
|
155
153
|
if (!valid) {
|
|
@@ -159,34 +157,22 @@ class FatZebra {
|
|
|
159
157
|
});
|
|
160
158
|
return;
|
|
161
159
|
}
|
|
162
|
-
yield this.
|
|
160
|
+
yield this.bridgeReady;
|
|
163
161
|
switch (params.paymentMethod.type) {
|
|
164
162
|
case PaymentMethodType.CARD: {
|
|
165
163
|
console.log('Verify card (new card)');
|
|
166
164
|
const card = params.paymentMethod.data;
|
|
167
165
|
this.cardDidTokenize((data) => __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
var _a
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
const bin = card.number.substr(0, 6);
|
|
181
|
-
this.sca.run({
|
|
182
|
-
source: 'verifyCard',
|
|
183
|
-
cardToken: data.token,
|
|
184
|
-
customer: params.customer,
|
|
185
|
-
paymentIntent: params.paymentIntent,
|
|
186
|
-
bin,
|
|
187
|
-
challengeWindowSize: (_b = params.options) === null || _b === void 0 ? void 0 : _b.challengeWindowSize,
|
|
188
|
-
});
|
|
189
|
-
}
|
|
166
|
+
var _a;
|
|
167
|
+
const bin = card.number.substr(0, 6);
|
|
168
|
+
this.sca.run({
|
|
169
|
+
source: 'verifyCard',
|
|
170
|
+
cardToken: data.token,
|
|
171
|
+
customer: params.customer,
|
|
172
|
+
paymentIntent: params.paymentIntent,
|
|
173
|
+
bin,
|
|
174
|
+
challengeWindowSize: (_a = params.options) === null || _a === void 0 ? void 0 : _a.challengeWindowSize,
|
|
175
|
+
});
|
|
190
176
|
}));
|
|
191
177
|
this.tokenizeCard(card);
|
|
192
178
|
break;
|
|
@@ -194,29 +180,17 @@ class FatZebra {
|
|
|
194
180
|
case PaymentMethodType.CARD_ON_FILE: {
|
|
195
181
|
console.log('Verify card (card on file)');
|
|
196
182
|
const cardToken = params.paymentMethod.data.token;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const bin = (yield this.gatewayClient.getCard({
|
|
209
|
-
card_token: cardToken,
|
|
210
|
-
})).data.bin;
|
|
211
|
-
this.sca.run({
|
|
212
|
-
source: 'verifyCard',
|
|
213
|
-
cardToken,
|
|
214
|
-
customer: params.customer,
|
|
215
|
-
paymentIntent: params.paymentIntent,
|
|
216
|
-
bin,
|
|
217
|
-
challengeWindowSize: (_b = params.options) === null || _b === void 0 ? void 0 : _b.challengeWindowSize,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
183
|
+
const bin = (yield this.gatewayClient.getCard({
|
|
184
|
+
card_token: cardToken,
|
|
185
|
+
})).data.bin;
|
|
186
|
+
this.sca.run({
|
|
187
|
+
source: 'verifyCard',
|
|
188
|
+
cardToken,
|
|
189
|
+
customer: params.customer,
|
|
190
|
+
paymentIntent: params.paymentIntent,
|
|
191
|
+
bin,
|
|
192
|
+
challengeWindowSize: (_a = params.options) === null || _a === void 0 ? void 0 : _a.challengeWindowSize,
|
|
193
|
+
});
|
|
220
194
|
break;
|
|
221
195
|
}
|
|
222
196
|
}
|
package/dist/sca/cardinal.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export default class CardinalManager {
|
|
|
13
13
|
setup(jwt: any): void;
|
|
14
14
|
onPaymentValidated(handler: (data: PaymentValidatedDTO, error: string) => void): void;
|
|
15
15
|
onPaymentSetupComplete(callback: (data: CardinalSetupCompleteResponseData) => void): void;
|
|
16
|
+
off(event: string): void;
|
|
16
17
|
processBin(bin: string): Promise<any>;
|
|
17
18
|
continue(acsUrl: string, pareq: string, transactionId: string): void;
|
|
18
19
|
}
|
package/dist/sca/cardinal.js
CHANGED
|
@@ -63,6 +63,10 @@ export default class CardinalManager {
|
|
|
63
63
|
callback(data);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
+
off(event) {
|
|
67
|
+
var _a;
|
|
68
|
+
(_a = window.Cardinal) === null || _a === void 0 ? void 0 : _a.off(event);
|
|
69
|
+
}
|
|
66
70
|
processBin(bin) {
|
|
67
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
72
|
yield window.Cardinal.trigger('bin.process', bin);
|
package/dist/sca/index.js
CHANGED
|
@@ -102,7 +102,9 @@ class Sca {
|
|
|
102
102
|
perform3DS(_a) {
|
|
103
103
|
return __awaiter(this, arguments, void 0, function* ({ sessionID }) {
|
|
104
104
|
this.sessionId = sessionID;
|
|
105
|
-
//
|
|
105
|
+
// Clear any orphaned listeners.
|
|
106
|
+
this._cardinal.off('payments.validated');
|
|
107
|
+
// Called after OTP is entered on challenge prompt.
|
|
106
108
|
this._cardinal.onPaymentValidated((data, error) => __awaiter(this, void 0, void 0, function* () {
|
|
107
109
|
var _a;
|
|
108
110
|
if (typeof error == 'string') {
|