@tap-payments/apple-pay-button 1.1.2 → 1.1.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/build/hooks/useApplePay.js +16 -14
- package/package.json +1 -1
|
@@ -218,18 +218,18 @@ export var useApplePay = function (_a) {
|
|
|
218
218
|
});
|
|
219
219
|
}); };
|
|
220
220
|
session_1.onpaymentauthorized = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
221
|
-
var _a, token, rest, newEvent, _b, data, error_2;
|
|
222
|
-
var
|
|
223
|
-
return __generator(this, function (
|
|
224
|
-
switch (
|
|
221
|
+
var _a, token, rest, newEvent, _b, _c, paymentData, paymentMethod_1, transactionIdentifier, data, error_2;
|
|
222
|
+
var _d, _e;
|
|
223
|
+
return __generator(this, function (_f) {
|
|
224
|
+
switch (_f.label) {
|
|
225
225
|
case 0:
|
|
226
226
|
setLoading(true);
|
|
227
227
|
if (debug)
|
|
228
228
|
console.info('onpaymentauthorized event', event);
|
|
229
|
-
|
|
229
|
+
_f.label = 1;
|
|
230
230
|
case 1:
|
|
231
|
-
|
|
232
|
-
_a = (
|
|
231
|
+
_f.trys.push([1, 9, 10, 11]);
|
|
232
|
+
_a = (_d = event.payment) !== null && _d !== void 0 ? _d : {}, token = _a.token, rest = __rest(_a, ["token"]);
|
|
233
233
|
newEvent = { payment: rest };
|
|
234
234
|
_b = scope;
|
|
235
235
|
switch (_b) {
|
|
@@ -237,27 +237,29 @@ export var useApplePay = function (_a) {
|
|
|
237
237
|
case 'TapToken': return [3, 4];
|
|
238
238
|
}
|
|
239
239
|
return [3, 7];
|
|
240
|
-
case 2: return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event.payment.token
|
|
240
|
+
case 2: return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event.payment.token, newEvent))];
|
|
241
241
|
case 3:
|
|
242
|
-
|
|
242
|
+
_f.sent();
|
|
243
243
|
session_1.completePayment({ status: ApplePaySession.STATUS_SUCCESS });
|
|
244
244
|
return [3, 8];
|
|
245
|
-
case 4:
|
|
245
|
+
case 4:
|
|
246
|
+
_c = (_e = event.payment.token) !== null && _e !== void 0 ? _e : {}, paymentData = _c.paymentData, paymentMethod_1 = _c.paymentMethod, transactionIdentifier = _c.transactionIdentifier;
|
|
247
|
+
return [4, appService.tapTokenization(__assign(__assign({}, paymentData), { paymentMethod: paymentMethod_1, transactionIdentifier: transactionIdentifier }))];
|
|
246
248
|
case 5:
|
|
247
|
-
data =
|
|
249
|
+
data = _f.sent();
|
|
248
250
|
return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, newEvent))];
|
|
249
251
|
case 6:
|
|
250
|
-
|
|
252
|
+
_f.sent();
|
|
251
253
|
session_1.completePayment({ status: ApplePaySession.STATUS_SUCCESS });
|
|
252
254
|
return [3, 8];
|
|
253
255
|
case 7:
|
|
254
256
|
console.error('We only support AppleToken and TapToken for now');
|
|
255
257
|
console.info('Completing payment with status: STATUS_FAILURE');
|
|
256
258
|
session_1.completePayment({ status: ApplePaySession.STATUS_FAILURE });
|
|
257
|
-
|
|
259
|
+
_f.label = 8;
|
|
258
260
|
case 8: return [3, 11];
|
|
259
261
|
case 9:
|
|
260
|
-
error_2 =
|
|
262
|
+
error_2 = _f.sent();
|
|
261
263
|
if (debug)
|
|
262
264
|
console.error('error in onpaymentauthorized', error_2);
|
|
263
265
|
session_1.completePayment({ status: ApplePaySession.STATUS_FAILURE });
|