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