@paydock/client-sdk 1.137.1-beta → 1.138.1

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/bundles/index.cjs CHANGED
@@ -1189,7 +1189,7 @@ SDK.headerKeys = Object.freeze({
1189
1189
  version: 'x-sdk-version',
1190
1190
  type: 'x-sdk-type'
1191
1191
  });
1192
- SDK._version = 'v1.137.1-beta';
1192
+ SDK._version = 'v1.138.1';
1193
1193
 
1194
1194
  function isFunction(value) {
1195
1195
  return typeof value === 'function';
@@ -10169,7 +10169,7 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10169
10169
  });
10170
10170
  };
10171
10171
  _this.onPaymentAuthorized = function (event) {
10172
- var _a;
10172
+ var _a, _b, _c, _d, _e;
10173
10173
  var _event$payment = event.payment,
10174
10174
  token = _event$payment.token,
10175
10175
  billingContact = _event$payment.billingContact,
@@ -10187,8 +10187,8 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10187
10187
  }), {
10188
10188
  type: token.paymentMethod.type,
10189
10189
  card_scheme: token.paymentMethod.network,
10190
- address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
10191
- address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
10190
+ address_line1: (_b = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0],
10191
+ address_line2: (_c = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _c === void 0 ? void 0 : _c[1],
10192
10192
  address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
10193
10193
  address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
10194
10194
  address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
@@ -10202,8 +10202,8 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10202
10202
  }), _this.hasShippingOptions() && {
10203
10203
  options: _this.meta.shipping_options
10204
10204
  }), {
10205
- address_line1: shippingContact.addressLines[0],
10206
- address_line2: shippingContact.addressLines[1],
10205
+ address_line1: (_d = shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[0],
10206
+ address_line2: (_e = shippingContact.addressLines) === null || _e === void 0 ? void 0 : _e[1],
10207
10207
  address_country: shippingContact.countryCode,
10208
10208
  address_city: shippingContact.locality,
10209
10209
  address_postcode: shippingContact.postalCode,
@@ -22659,62 +22659,75 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
22659
22659
  });
22660
22660
  };
22661
22661
  _this.onPaymentAuthorized = function (event) {
22662
- var _a, _b, _c, _d;
22663
- var _event$payment = event.payment,
22664
- token = _event$payment.token,
22665
- billingContact = _event$payment.billingContact,
22666
- shippingContact = _event$payment.shippingContact;
22667
- var hasShippingFields = !!(((_a = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _a === void 0 ? void 0 : _a.length) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea));
22668
- var hasContactFields = !!((shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName));
22669
- _this.executeWalletCapture(_extends(_extends({}, (hasShippingFields || hasContactFields) && {
22670
- shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, ((_b = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0]) && {
22671
- address_line1: shippingContact.addressLines[0]
22672
- }), ((_c = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _c === void 0 ? void 0 : _c[1]) && {
22673
- address_line2: shippingContact.addressLines[1]
22674
- }), ((_d = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[2]) && {
22675
- address_line3: shippingContact.addressLines[2]
22676
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) && {
22677
- address_country: shippingContact.countryCode
22678
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) && {
22679
- address_city: shippingContact.locality
22680
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) && {
22681
- address_postcode: shippingContact.postalCode
22682
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea) && {
22683
- address_state: shippingContact.administrativeArea
22684
- }), hasContactFields && {
22685
- contact: _extends(_extends(_extends(_extends({}, (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) && {
22686
- phone: shippingContact.phoneNumber
22687
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) && {
22688
- email: shippingContact.emailAddress
22689
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) && {
22690
- first_name: shippingContact.givenName
22691
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName) && {
22692
- last_name: shippingContact.familyName
22662
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22663
+ try {
22664
+ var _event$payment = event.payment,
22665
+ token = _event$payment.token,
22666
+ billingContact = _event$payment.billingContact,
22667
+ shippingContact = _event$payment.shippingContact;
22668
+ var hasShippingFields = !!(((_a = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _a === void 0 ? void 0 : _a.length) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea));
22669
+ var hasContactFields = !!((shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName));
22670
+ _this.executeWalletCapture(_extends(_extends({}, (hasShippingFields || hasContactFields) && {
22671
+ shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, ((_b = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0]) && {
22672
+ address_line1: (_c = shippingContact.addressLines) === null || _c === void 0 ? void 0 : _c[0]
22673
+ }), ((_d = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[1]) && {
22674
+ address_line2: (_e = shippingContact.addressLines) === null || _e === void 0 ? void 0 : _e[1]
22675
+ }), ((_f = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _f === void 0 ? void 0 : _f[2]) && {
22676
+ address_line3: (_g = shippingContact.addressLines) === null || _g === void 0 ? void 0 : _g[2]
22677
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) && {
22678
+ address_country: shippingContact.countryCode
22679
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) && {
22680
+ address_city: shippingContact.locality
22681
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) && {
22682
+ address_postcode: shippingContact.postalCode
22683
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea) && {
22684
+ address_state: shippingContact.administrativeArea
22685
+ }), hasContactFields && {
22686
+ contact: _extends(_extends(_extends(_extends({}, (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) && {
22687
+ phone: shippingContact.phoneNumber
22688
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) && {
22689
+ email: shippingContact.emailAddress
22690
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) && {
22691
+ first_name: shippingContact.givenName
22692
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName) && {
22693
+ last_name: shippingContact.familyName
22694
+ })
22693
22695
  })
22694
- })
22695
- }), {
22696
- customer: {
22697
- first_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.givenName,
22698
- last_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.familyName,
22699
- email: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress),
22700
- phone: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber),
22701
- payment_source: {
22702
- wallet_type: WALLET_TYPE.APPLE,
22703
- address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
22704
- address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
22705
- address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
22706
- address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
22707
- address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
22708
- address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
22709
- ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '',
22710
- wallet_express: true
22696
+ }), {
22697
+ customer: {
22698
+ first_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.givenName,
22699
+ last_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.familyName,
22700
+ email: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress),
22701
+ phone: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber),
22702
+ payment_source: {
22703
+ wallet_type: WALLET_TYPE.APPLE,
22704
+ address_line1: (_h = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _h === void 0 ? void 0 : _h[0],
22705
+ address_line2: (_j = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _j === void 0 ? void 0 : _j[1],
22706
+ address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
22707
+ address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
22708
+ address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
22709
+ address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
22710
+ ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '',
22711
+ wallet_express: true
22712
+ }
22711
22713
  }
22712
- }
22713
- })).then(function () {
22714
- _this.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS);
22715
- })["catch"](function () {
22714
+ })).then(function () {
22715
+ _this.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS);
22716
+ })["catch"](function () {
22717
+ _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
22718
+ });
22719
+ } catch (error) {
22720
+ // this ensures thatwe always call completePayment and emit error callback even if there's an uncaught exception
22716
22721
  _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
22717
- });
22722
+ _this.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
22723
+ event: EVENT.PAYMENT_ERROR,
22724
+ chargeId: (_k = _this.chargeWalletTokenMeta) === null || _k === void 0 ? void 0 : _k.charge.id,
22725
+ data: {
22726
+ message: error instanceof Error ? error.message : 'Payment processing failed',
22727
+ code: 'PAYMENT_AUTHORIZATION_ERROR'
22728
+ }
22729
+ });
22730
+ }
22718
22731
  };
22719
22732
  _this.onCancelPayment = function () {
22720
22733
  return _this.handleCheckoutClose();
@@ -22992,7 +23005,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
22992
23005
  }, {
22993
23006
  key: "parseShippingContactUpdateEvent",
22994
23007
  value: function parseShippingContactUpdateEvent(data) {
22995
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
23008
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
22996
23009
  return _extends(_extends(_extends({
22997
23010
  contact: {
22998
23011
  phone: (_e = (_d = (_c = (_b = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping) === null || _c === void 0 ? void 0 : _c.contact) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : data.shippingContact.phoneNumber,
@@ -23001,9 +23014,9 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
23001
23014
  last_name: (_v = (_u = (_t = (_s = (_r = this.chargeWalletTokenMeta) === null || _r === void 0 ? void 0 : _r.charge) === null || _s === void 0 ? void 0 : _s.shipping) === null || _t === void 0 ? void 0 : _t.contact) === null || _u === void 0 ? void 0 : _u.last_name) !== null && _v !== void 0 ? _v : data.shippingContact.familyName
23002
23015
  }
23003
23016
  }, ((_w = data.shippingContact.addressLines) === null || _w === void 0 ? void 0 : _w[0]) && {
23004
- address_line1: data.shippingContact.addressLines[0]
23005
- }), ((_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[1]) && {
23006
- address_line2: data.shippingContact.addressLines[1]
23017
+ address_line1: (_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[0]
23018
+ }), ((_y = data.shippingContact.addressLines) === null || _y === void 0 ? void 0 : _y[1]) && {
23019
+ address_line2: (_z = data.shippingContact.addressLines) === null || _z === void 0 ? void 0 : _z[1]
23007
23020
  }), {
23008
23021
  address_city: data.shippingContact.locality,
23009
23022
  address_postcode: data.shippingContact.postalCode,
package/bundles/index.mjs CHANGED
@@ -1187,7 +1187,7 @@ SDK.headerKeys = Object.freeze({
1187
1187
  version: 'x-sdk-version',
1188
1188
  type: 'x-sdk-type'
1189
1189
  });
1190
- SDK._version = 'v1.137.1-beta';
1190
+ SDK._version = 'v1.138.1';
1191
1191
 
1192
1192
  function isFunction(value) {
1193
1193
  return typeof value === 'function';
@@ -10167,7 +10167,7 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10167
10167
  });
10168
10168
  };
10169
10169
  _this.onPaymentAuthorized = function (event) {
10170
- var _a;
10170
+ var _a, _b, _c, _d, _e;
10171
10171
  var _event$payment = event.payment,
10172
10172
  token = _event$payment.token,
10173
10173
  billingContact = _event$payment.billingContact,
@@ -10185,8 +10185,8 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10185
10185
  }), {
10186
10186
  type: token.paymentMethod.type,
10187
10187
  card_scheme: token.paymentMethod.network,
10188
- address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
10189
- address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
10188
+ address_line1: (_b = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0],
10189
+ address_line2: (_c = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _c === void 0 ? void 0 : _c[1],
10190
10190
  address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
10191
10191
  address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
10192
10192
  address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
@@ -10200,8 +10200,8 @@ var AppleWalletService = /*#__PURE__*/function (_WalletService) {
10200
10200
  }), _this.hasShippingOptions() && {
10201
10201
  options: _this.meta.shipping_options
10202
10202
  }), {
10203
- address_line1: shippingContact.addressLines[0],
10204
- address_line2: shippingContact.addressLines[1],
10203
+ address_line1: (_d = shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[0],
10204
+ address_line2: (_e = shippingContact.addressLines) === null || _e === void 0 ? void 0 : _e[1],
10205
10205
  address_country: shippingContact.countryCode,
10206
10206
  address_city: shippingContact.locality,
10207
10207
  address_postcode: shippingContact.postalCode,
@@ -22657,62 +22657,75 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
22657
22657
  });
22658
22658
  };
22659
22659
  _this.onPaymentAuthorized = function (event) {
22660
- var _a, _b, _c, _d;
22661
- var _event$payment = event.payment,
22662
- token = _event$payment.token,
22663
- billingContact = _event$payment.billingContact,
22664
- shippingContact = _event$payment.shippingContact;
22665
- var hasShippingFields = !!(((_a = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _a === void 0 ? void 0 : _a.length) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea));
22666
- var hasContactFields = !!((shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName));
22667
- _this.executeWalletCapture(_extends(_extends({}, (hasShippingFields || hasContactFields) && {
22668
- shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, ((_b = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0]) && {
22669
- address_line1: shippingContact.addressLines[0]
22670
- }), ((_c = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _c === void 0 ? void 0 : _c[1]) && {
22671
- address_line2: shippingContact.addressLines[1]
22672
- }), ((_d = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[2]) && {
22673
- address_line3: shippingContact.addressLines[2]
22674
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) && {
22675
- address_country: shippingContact.countryCode
22676
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) && {
22677
- address_city: shippingContact.locality
22678
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) && {
22679
- address_postcode: shippingContact.postalCode
22680
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea) && {
22681
- address_state: shippingContact.administrativeArea
22682
- }), hasContactFields && {
22683
- contact: _extends(_extends(_extends(_extends({}, (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) && {
22684
- phone: shippingContact.phoneNumber
22685
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) && {
22686
- email: shippingContact.emailAddress
22687
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) && {
22688
- first_name: shippingContact.givenName
22689
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName) && {
22690
- last_name: shippingContact.familyName
22660
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22661
+ try {
22662
+ var _event$payment = event.payment,
22663
+ token = _event$payment.token,
22664
+ billingContact = _event$payment.billingContact,
22665
+ shippingContact = _event$payment.shippingContact;
22666
+ var hasShippingFields = !!(((_a = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _a === void 0 ? void 0 : _a.length) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea));
22667
+ var hasContactFields = !!((shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName));
22668
+ _this.executeWalletCapture(_extends(_extends({}, (hasShippingFields || hasContactFields) && {
22669
+ shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, ((_b = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0]) && {
22670
+ address_line1: (_c = shippingContact.addressLines) === null || _c === void 0 ? void 0 : _c[0]
22671
+ }), ((_d = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[1]) && {
22672
+ address_line2: (_e = shippingContact.addressLines) === null || _e === void 0 ? void 0 : _e[1]
22673
+ }), ((_f = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _f === void 0 ? void 0 : _f[2]) && {
22674
+ address_line3: (_g = shippingContact.addressLines) === null || _g === void 0 ? void 0 : _g[2]
22675
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) && {
22676
+ address_country: shippingContact.countryCode
22677
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) && {
22678
+ address_city: shippingContact.locality
22679
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) && {
22680
+ address_postcode: shippingContact.postalCode
22681
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea) && {
22682
+ address_state: shippingContact.administrativeArea
22683
+ }), hasContactFields && {
22684
+ contact: _extends(_extends(_extends(_extends({}, (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) && {
22685
+ phone: shippingContact.phoneNumber
22686
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) && {
22687
+ email: shippingContact.emailAddress
22688
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) && {
22689
+ first_name: shippingContact.givenName
22690
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName) && {
22691
+ last_name: shippingContact.familyName
22692
+ })
22691
22693
  })
22692
- })
22693
- }), {
22694
- customer: {
22695
- first_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.givenName,
22696
- last_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.familyName,
22697
- email: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress),
22698
- phone: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber),
22699
- payment_source: {
22700
- wallet_type: WALLET_TYPE.APPLE,
22701
- address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
22702
- address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
22703
- address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
22704
- address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
22705
- address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
22706
- address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
22707
- ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '',
22708
- wallet_express: true
22694
+ }), {
22695
+ customer: {
22696
+ first_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.givenName,
22697
+ last_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.familyName,
22698
+ email: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress),
22699
+ phone: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber),
22700
+ payment_source: {
22701
+ wallet_type: WALLET_TYPE.APPLE,
22702
+ address_line1: (_h = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _h === void 0 ? void 0 : _h[0],
22703
+ address_line2: (_j = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _j === void 0 ? void 0 : _j[1],
22704
+ address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
22705
+ address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
22706
+ address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
22707
+ address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
22708
+ ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '',
22709
+ wallet_express: true
22710
+ }
22709
22711
  }
22710
- }
22711
- })).then(function () {
22712
- _this.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS);
22713
- })["catch"](function () {
22712
+ })).then(function () {
22713
+ _this.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS);
22714
+ })["catch"](function () {
22715
+ _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
22716
+ });
22717
+ } catch (error) {
22718
+ // this ensures thatwe always call completePayment and emit error callback even if there's an uncaught exception
22714
22719
  _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
22715
- });
22720
+ _this.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
22721
+ event: EVENT.PAYMENT_ERROR,
22722
+ chargeId: (_k = _this.chargeWalletTokenMeta) === null || _k === void 0 ? void 0 : _k.charge.id,
22723
+ data: {
22724
+ message: error instanceof Error ? error.message : 'Payment processing failed',
22725
+ code: 'PAYMENT_AUTHORIZATION_ERROR'
22726
+ }
22727
+ });
22728
+ }
22716
22729
  };
22717
22730
  _this.onCancelPayment = function () {
22718
22731
  return _this.handleCheckoutClose();
@@ -22990,7 +23003,7 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
22990
23003
  }, {
22991
23004
  key: "parseShippingContactUpdateEvent",
22992
23005
  value: function parseShippingContactUpdateEvent(data) {
22993
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
23006
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
22994
23007
  return _extends(_extends(_extends({
22995
23008
  contact: {
22996
23009
  phone: (_e = (_d = (_c = (_b = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping) === null || _c === void 0 ? void 0 : _c.contact) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : data.shippingContact.phoneNumber,
@@ -22999,9 +23012,9 @@ var ApplePayWalletButtonExpress = /*#__PURE__*/function (_BaseWalletButton) {
22999
23012
  last_name: (_v = (_u = (_t = (_s = (_r = this.chargeWalletTokenMeta) === null || _r === void 0 ? void 0 : _r.charge) === null || _s === void 0 ? void 0 : _s.shipping) === null || _t === void 0 ? void 0 : _t.contact) === null || _u === void 0 ? void 0 : _u.last_name) !== null && _v !== void 0 ? _v : data.shippingContact.familyName
23000
23013
  }
23001
23014
  }, ((_w = data.shippingContact.addressLines) === null || _w === void 0 ? void 0 : _w[0]) && {
23002
- address_line1: data.shippingContact.addressLines[0]
23003
- }), ((_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[1]) && {
23004
- address_line2: data.shippingContact.addressLines[1]
23015
+ address_line1: (_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[0]
23016
+ }), ((_y = data.shippingContact.addressLines) === null || _y === void 0 ? void 0 : _y[1]) && {
23017
+ address_line2: (_z = data.shippingContact.addressLines) === null || _z === void 0 ? void 0 : _z[1]
23005
23018
  }), {
23006
23019
  address_city: data.shippingContact.locality,
23007
23020
  address_postcode: data.shippingContact.postalCode,
@@ -1 +1 @@
1
- {"version":3,"file":"apple-pay.wallet-button-express.d.ts","sourceRoot":"","sources":["../../../../src/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAMvF;;;;;;;;;;;;;;GAcG;AACH,cAAM,2BAA4B,SAAQ,gBAAgB,CAAC,kBAAkB,CAAC;IAC5E,OAAO,CAAC,cAAc,CAAkB;IAExC,kBAAkB,aAEhB,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,MAAM,EAC9B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,kBAAkB;IAQ1B;;;;;;;OAOG;IACI,IAAI;IAyBX,OAAO,CAAC,cAAc;IA+BtB;;;;;;;;OAQG;IACI,OAAO,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAI9C,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,KAAK;IAsBb,OAAO,CAAC,uBAAuB,CAW7B;IAEF,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,kBAAkB,CAgBxB;IAEF,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,mBAAmB,CAmFzB;IAEF,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,+BAA+B,CA8BrC;IAEF,OAAO,CAAC,8BAA8B,CAgBpC;IAEF,OAAO,CAAC,8BAA8B;IAWtC,OAAO,CAAC,+BAA+B;IA+BvC,OAAO,CAAC,iBAAiB;CA0B1B;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"apple-pay.wallet-button-express.d.ts","sourceRoot":"","sources":["../../../../src/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAMvF;;;;;;;;;;;;;;GAcG;AACH,cAAM,2BAA4B,SAAQ,gBAAgB,CAAC,kBAAkB,CAAC;IAC5E,OAAO,CAAC,cAAc,CAAkB;IAExC,kBAAkB,aAEhB,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,MAAM,EAC9B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,kBAAkB;IAQ1B;;;;;;;OAOG;IACI,IAAI;IAyBX,OAAO,CAAC,cAAc;IA+BtB;;;;;;;;OAQG;IACI,OAAO,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAI9C,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,KAAK;IAsBb,OAAO,CAAC,uBAAuB,CAW7B;IAEF,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,kBAAkB,CAgBxB;IAEF,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,mBAAmB,CAgGzB;IAEF,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,+BAA+B,CA8BrC;IAEF,OAAO,CAAC,8BAA8B,CAgBpC;IAEF,OAAO,CAAC,8BAA8B;IAWtC,OAAO,CAAC,+BAA+B;IA+BvC,OAAO,CAAC,iBAAiB;CA0B1B;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -1193,7 +1193,7 @@
1193
1193
  version: 'x-sdk-version',
1194
1194
  type: 'x-sdk-type'
1195
1195
  });
1196
- SDK._version = 'v1.137.1-beta';
1196
+ SDK._version = 'v1.138.1';
1197
1197
 
1198
1198
  function isFunction(value) {
1199
1199
  return typeof value === 'function';
@@ -10173,7 +10173,7 @@
10173
10173
  });
10174
10174
  };
10175
10175
  _this.onPaymentAuthorized = function (event) {
10176
- var _a;
10176
+ var _a, _b, _c, _d, _e;
10177
10177
  var _event$payment = event.payment,
10178
10178
  token = _event$payment.token,
10179
10179
  billingContact = _event$payment.billingContact,
@@ -10191,8 +10191,8 @@
10191
10191
  }), {
10192
10192
  type: token.paymentMethod.type,
10193
10193
  card_scheme: token.paymentMethod.network,
10194
- address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
10195
- address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
10194
+ address_line1: (_b = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0],
10195
+ address_line2: (_c = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _c === void 0 ? void 0 : _c[1],
10196
10196
  address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
10197
10197
  address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
10198
10198
  address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
@@ -10206,8 +10206,8 @@
10206
10206
  }), _this.hasShippingOptions() && {
10207
10207
  options: _this.meta.shipping_options
10208
10208
  }), {
10209
- address_line1: shippingContact.addressLines[0],
10210
- address_line2: shippingContact.addressLines[1],
10209
+ address_line1: (_d = shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[0],
10210
+ address_line2: (_e = shippingContact.addressLines) === null || _e === void 0 ? void 0 : _e[1],
10211
10211
  address_country: shippingContact.countryCode,
10212
10212
  address_city: shippingContact.locality,
10213
10213
  address_postcode: shippingContact.postalCode,
@@ -22663,62 +22663,75 @@
22663
22663
  });
22664
22664
  };
22665
22665
  _this.onPaymentAuthorized = function (event) {
22666
- var _a, _b, _c, _d;
22667
- var _event$payment = event.payment,
22668
- token = _event$payment.token,
22669
- billingContact = _event$payment.billingContact,
22670
- shippingContact = _event$payment.shippingContact;
22671
- var hasShippingFields = !!(((_a = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _a === void 0 ? void 0 : _a.length) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea));
22672
- var hasContactFields = !!((shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName));
22673
- _this.executeWalletCapture(_extends(_extends({}, (hasShippingFields || hasContactFields) && {
22674
- shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, ((_b = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0]) && {
22675
- address_line1: shippingContact.addressLines[0]
22676
- }), ((_c = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _c === void 0 ? void 0 : _c[1]) && {
22677
- address_line2: shippingContact.addressLines[1]
22678
- }), ((_d = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[2]) && {
22679
- address_line3: shippingContact.addressLines[2]
22680
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) && {
22681
- address_country: shippingContact.countryCode
22682
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) && {
22683
- address_city: shippingContact.locality
22684
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) && {
22685
- address_postcode: shippingContact.postalCode
22686
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea) && {
22687
- address_state: shippingContact.administrativeArea
22688
- }), hasContactFields && {
22689
- contact: _extends(_extends(_extends(_extends({}, (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) && {
22690
- phone: shippingContact.phoneNumber
22691
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) && {
22692
- email: shippingContact.emailAddress
22693
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) && {
22694
- first_name: shippingContact.givenName
22695
- }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName) && {
22696
- last_name: shippingContact.familyName
22666
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22667
+ try {
22668
+ var _event$payment = event.payment,
22669
+ token = _event$payment.token,
22670
+ billingContact = _event$payment.billingContact,
22671
+ shippingContact = _event$payment.shippingContact;
22672
+ var hasShippingFields = !!(((_a = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _a === void 0 ? void 0 : _a.length) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea));
22673
+ var hasContactFields = !!((shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName));
22674
+ _this.executeWalletCapture(_extends(_extends({}, (hasShippingFields || hasContactFields) && {
22675
+ shipping: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, ((_b = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _b === void 0 ? void 0 : _b[0]) && {
22676
+ address_line1: (_c = shippingContact.addressLines) === null || _c === void 0 ? void 0 : _c[0]
22677
+ }), ((_d = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _d === void 0 ? void 0 : _d[1]) && {
22678
+ address_line2: (_e = shippingContact.addressLines) === null || _e === void 0 ? void 0 : _e[1]
22679
+ }), ((_f = shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.addressLines) === null || _f === void 0 ? void 0 : _f[2]) && {
22680
+ address_line3: (_g = shippingContact.addressLines) === null || _g === void 0 ? void 0 : _g[2]
22681
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.countryCode) && {
22682
+ address_country: shippingContact.countryCode
22683
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.locality) && {
22684
+ address_city: shippingContact.locality
22685
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.postalCode) && {
22686
+ address_postcode: shippingContact.postalCode
22687
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.administrativeArea) && {
22688
+ address_state: shippingContact.administrativeArea
22689
+ }), hasContactFields && {
22690
+ contact: _extends(_extends(_extends(_extends({}, (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber) && {
22691
+ phone: shippingContact.phoneNumber
22692
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress) && {
22693
+ email: shippingContact.emailAddress
22694
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName) && {
22695
+ first_name: shippingContact.givenName
22696
+ }), (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName) && {
22697
+ last_name: shippingContact.familyName
22698
+ })
22697
22699
  })
22698
- })
22699
- }), {
22700
- customer: {
22701
- first_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.givenName,
22702
- last_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.familyName,
22703
- email: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress),
22704
- phone: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber),
22705
- payment_source: {
22706
- wallet_type: WALLET_TYPE.APPLE,
22707
- address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
22708
- address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
22709
- address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
22710
- address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
22711
- address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
22712
- address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
22713
- ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '',
22714
- wallet_express: true
22700
+ }), {
22701
+ customer: {
22702
+ first_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.givenName,
22703
+ last_name: billingContact === null || billingContact === void 0 ? void 0 : billingContact.familyName,
22704
+ email: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.emailAddress) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.emailAddress),
22705
+ phone: (billingContact === null || billingContact === void 0 ? void 0 : billingContact.phoneNumber) || (shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.phoneNumber),
22706
+ payment_source: {
22707
+ wallet_type: WALLET_TYPE.APPLE,
22708
+ address_line1: (_h = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _h === void 0 ? void 0 : _h[0],
22709
+ address_line2: (_j = billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines) === null || _j === void 0 ? void 0 : _j[1],
22710
+ address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
22711
+ address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
22712
+ address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
22713
+ address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
22714
+ ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '',
22715
+ wallet_express: true
22716
+ }
22715
22717
  }
22716
- }
22717
- })).then(function () {
22718
- _this.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS);
22719
- })["catch"](function () {
22718
+ })).then(function () {
22719
+ _this.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS);
22720
+ })["catch"](function () {
22721
+ _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
22722
+ });
22723
+ } catch (error) {
22724
+ // this ensures thatwe always call completePayment and emit error callback even if there's an uncaught exception
22720
22725
  _this.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE);
22721
- });
22726
+ _this.eventEmitter.emit(EVENT.PAYMENT_ERROR, {
22727
+ event: EVENT.PAYMENT_ERROR,
22728
+ chargeId: (_k = _this.chargeWalletTokenMeta) === null || _k === void 0 ? void 0 : _k.charge.id,
22729
+ data: {
22730
+ message: error instanceof Error ? error.message : 'Payment processing failed',
22731
+ code: 'PAYMENT_AUTHORIZATION_ERROR'
22732
+ }
22733
+ });
22734
+ }
22722
22735
  };
22723
22736
  _this.onCancelPayment = function () {
22724
22737
  return _this.handleCheckoutClose();
@@ -22996,7 +23009,7 @@
22996
23009
  }, {
22997
23010
  key: "parseShippingContactUpdateEvent",
22998
23011
  value: function parseShippingContactUpdateEvent(data) {
22999
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
23012
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
23000
23013
  return _extends(_extends(_extends({
23001
23014
  contact: {
23002
23015
  phone: (_e = (_d = (_c = (_b = (_a = this.chargeWalletTokenMeta) === null || _a === void 0 ? void 0 : _a.charge) === null || _b === void 0 ? void 0 : _b.shipping) === null || _c === void 0 ? void 0 : _c.contact) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : data.shippingContact.phoneNumber,
@@ -23005,9 +23018,9 @@
23005
23018
  last_name: (_v = (_u = (_t = (_s = (_r = this.chargeWalletTokenMeta) === null || _r === void 0 ? void 0 : _r.charge) === null || _s === void 0 ? void 0 : _s.shipping) === null || _t === void 0 ? void 0 : _t.contact) === null || _u === void 0 ? void 0 : _u.last_name) !== null && _v !== void 0 ? _v : data.shippingContact.familyName
23006
23019
  }
23007
23020
  }, ((_w = data.shippingContact.addressLines) === null || _w === void 0 ? void 0 : _w[0]) && {
23008
- address_line1: data.shippingContact.addressLines[0]
23009
- }), ((_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[1]) && {
23010
- address_line2: data.shippingContact.addressLines[1]
23021
+ address_line1: (_x = data.shippingContact.addressLines) === null || _x === void 0 ? void 0 : _x[0]
23022
+ }), ((_y = data.shippingContact.addressLines) === null || _y === void 0 ? void 0 : _y[1]) && {
23023
+ address_line2: (_z = data.shippingContact.addressLines) === null || _z === void 0 ? void 0 : _z[1]
23011
23024
  }), {
23012
23025
  address_city: data.shippingContact.locality,
23013
23026
  address_postcode: data.shippingContact.postalCode,