@fat-zebra/sdk 2.0.3-beta.3 → 2.0.3-beta.4
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/hpp/hpp.js +3 -0
- package/dist/main.js +53 -27
- package/package.json +1 -1
package/dist/hpp/hpp.js
CHANGED
|
@@ -259,6 +259,9 @@ __decorate([
|
|
|
259
259
|
__decorate([
|
|
260
260
|
logMethod()
|
|
261
261
|
], Hpp.prototype, "setPublicEventListeners", null);
|
|
262
|
+
__decorate([
|
|
263
|
+
logMethod()
|
|
264
|
+
], Hpp.prototype, "destroy", null);
|
|
262
265
|
__decorate([
|
|
263
266
|
logMethod()
|
|
264
267
|
], Hpp.prototype, "createPurchase", null);
|
package/dist/main.js
CHANGED
|
@@ -51,10 +51,6 @@ 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();
|
|
58
54
|
this.authReady = this.setAuthImpl();
|
|
59
55
|
const message = {
|
|
60
56
|
channel: 'sca',
|
|
@@ -75,6 +71,12 @@ class FatZebra {
|
|
|
75
71
|
});
|
|
76
72
|
this.setThreeDSecureListeners();
|
|
77
73
|
}
|
|
74
|
+
else {
|
|
75
|
+
this.sca = new Sca({
|
|
76
|
+
gatewayClient: this.gatewayClient,
|
|
77
|
+
});
|
|
78
|
+
this.sca.loadScript();
|
|
79
|
+
}
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
tokenizeCard(card) {
|
|
@@ -147,7 +149,7 @@ class FatZebra {
|
|
|
147
149
|
}
|
|
148
150
|
verifyCard(params) {
|
|
149
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
var _a;
|
|
152
|
+
var _a, _b;
|
|
151
153
|
console.log('verifyCard');
|
|
152
154
|
const valid = validateVerifyCardParams(params);
|
|
153
155
|
if (!valid) {
|
|
@@ -157,22 +159,34 @@ class FatZebra {
|
|
|
157
159
|
});
|
|
158
160
|
return;
|
|
159
161
|
}
|
|
160
|
-
yield this.
|
|
162
|
+
yield this.authReady;
|
|
161
163
|
switch (params.paymentMethod.type) {
|
|
162
164
|
case PaymentMethodType.CARD: {
|
|
163
165
|
console.log('Verify card (new card)');
|
|
164
166
|
const card = params.paymentMethod.data;
|
|
165
167
|
this.cardDidTokenize((data) => __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
var _a;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
var _a, _b;
|
|
169
|
+
if (this.threeDSecure && this.isThreeDSecureEnabled) {
|
|
170
|
+
this.threeDSecure.run({
|
|
171
|
+
paymentIntent: params.paymentIntent,
|
|
172
|
+
cardToken: data.token,
|
|
173
|
+
merchantUsername: this.fzConfig.username,
|
|
174
|
+
challengeWindowSize: (_a = params.options) === null || _a === void 0 ? void 0 : _a.challengeWindowSize,
|
|
175
|
+
test: this.fzConfig.test,
|
|
176
|
+
tokenizeOnly: true,
|
|
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
|
+
}
|
|
176
190
|
}));
|
|
177
191
|
this.tokenizeCard(card);
|
|
178
192
|
break;
|
|
@@ -180,17 +194,29 @@ class FatZebra {
|
|
|
180
194
|
case PaymentMethodType.CARD_ON_FILE: {
|
|
181
195
|
console.log('Verify card (card on file)');
|
|
182
196
|
const cardToken = params.paymentMethod.data.token;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
if (this.threeDSecure && this.isThreeDSecureEnabled) {
|
|
198
|
+
this.threeDSecure.run({
|
|
199
|
+
paymentIntent: params.paymentIntent,
|
|
200
|
+
cardToken,
|
|
201
|
+
merchantUsername: this.fzConfig.username,
|
|
202
|
+
challengeWindowSize: (_a = params.options) === null || _a === void 0 ? void 0 : _a.challengeWindowSize,
|
|
203
|
+
test: this.fzConfig.test,
|
|
204
|
+
tokenizeOnly: true,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
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
|
+
}
|
|
194
220
|
break;
|
|
195
221
|
}
|
|
196
222
|
}
|