@paydock/client-sdk 1.11.8 → 1.11.13-beta

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.
Files changed (42) hide show
  1. package/README.md +39 -28
  2. package/bundles/widget.umd.js +96 -24
  3. package/bundles/widget.umd.min.js +1 -1
  4. package/lib/checkout-button/afterpay-checkout-button.d.ts +15 -0
  5. package/lib/checkout-button/afterpay-checkout-button.js +26 -1
  6. package/lib/checkout-button/afterpay-checkout-button.js.map +1 -1
  7. package/lib/checkout-button/afterpay.runner.d.ts +4 -4
  8. package/lib/checkout-button/afterpay.runner.js +4 -5
  9. package/lib/checkout-button/afterpay.runner.js.map +1 -1
  10. package/lib/checkout-button/checkout-button.d.ts +2 -1
  11. package/lib/checkout-button/checkout-button.js +4 -1
  12. package/lib/checkout-button/checkout-button.js.map +1 -1
  13. package/lib/checkout-button/index.d.ts +1 -3
  14. package/lib/checkout-button/index.js +1 -3
  15. package/lib/checkout-button/index.js.map +1 -1
  16. package/lib/checkout-button/runner.d.ts +4 -3
  17. package/lib/checkout-button/runner.js +1 -1
  18. package/lib/checkout-button/runner.js.map +1 -1
  19. package/lib/components/param.d.ts +1 -3
  20. package/lib/components/param.js +0 -4
  21. package/lib/components/param.js.map +1 -1
  22. package/lib/helper/browser.d.ts +4 -0
  23. package/lib/helper/browser.js +24 -0
  24. package/lib/helper/browser.js.map +1 -1
  25. package/lib/helper/url.d.ts +1 -0
  26. package/lib/helper/url.js +3 -0
  27. package/lib/helper/url.js.map +1 -1
  28. package/lib/wallet-buttons/apple.wallet-service.js +13 -2
  29. package/lib/wallet-buttons/apple.wallet-service.js.map +1 -1
  30. package/lib/wallet-buttons/google.wallet-service.js +5 -7
  31. package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
  32. package/lib/widget/configuration.d.ts +1 -3
  33. package/lib/widget/configuration.js +1 -3
  34. package/lib/widget/configuration.js.map +1 -1
  35. package/lib/widget/html-multi-widget.d.ts +1 -2
  36. package/lib/widget/html-multi-widget.js +1 -2
  37. package/lib/widget/html-multi-widget.js.map +1 -1
  38. package/lib/widget/html-widget.d.ts +1 -3
  39. package/lib/widget/html-widget.js +1 -3
  40. package/lib/widget/html-widget.js.map +1 -1
  41. package/package.json +4 -1
  42. package/slate.md +17 -17
package/README.md CHANGED
@@ -656,7 +656,7 @@ Class Widget include method for working on html and include extended by HtmlMult
656
656
  | --- | --- | --- | --- |
657
657
  | selector | <code>string</code> | | Selector of html element. Container for widget |
658
658
  | publicKey | <code>string</code> | | PayDock users public key |
659
- | [gatewayID] | <code>string</code> | <code>&quot;default&quot;</code> | ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token. |
659
+ | [gatewayID] | <code>string</code> | <code>&quot;default&quot;</code> | ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway |
660
660
  | [paymentType] | <code>string</code> | <code>&quot;card&quot;</code> | Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”. |
661
661
  | [purpose] | <code>string</code> | <code>&quot;payment_source&quot;</code> | Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’ |
662
662
 
@@ -666,8 +666,6 @@ Class Widget include method for working on html and include extended by HtmlMult
666
666
  var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID'); // short
667
667
 
668
668
  var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID', 'bank_account', 'payment_source'); // extend
669
-
670
- var widget = new HtmlWidget('#widget', 'publicKey', 'not_configured'); // without gateway
671
669
  ```
672
670
  <a name="w_HtmlWidget+setWebHookDestination" id="w_HtmlWidget+setWebHookDestination"></a>
673
671
 
@@ -1351,8 +1349,7 @@ var widget = new MultiWidget('#widget', 'publicKey',['configurationToken', 'conf
1351
1349
  var widget = new MultiWidget('#widget', 'publicKey', new Configuration('gatewayId')); With Configuration
1352
1350
 
1353
1351
  var widget = new MultiWidget('#widget', 'publicKey',[ With Configurations
1354
- Configuration(), // default gateway_id,
1355
- Configuration('not_configured'), // without gateway,
1352
+ Configuration() // default gateway_id,
1356
1353
  Configuration('gatewayId'),
1357
1354
  Configuration('gatewayId', 'bank_account')
1358
1355
  ]);
@@ -1912,7 +1909,7 @@ Class Configuration include methods for creating configuration token
1912
1909
 
1913
1910
  | Param | Type | Default | Description |
1914
1911
  | --- | --- | --- | --- |
1915
- | [gatewayID] | <code>string</code> | <code>&quot;default&quot;</code> | gateway ID. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token. |
1912
+ | [gatewayID] | <code>string</code> | <code>&quot;default&quot;</code> | gateway ID. By default or if put 'default', it will use the selected default gateway |
1916
1913
  | paymentType | <code>string</code> | | Type of payment source which shows in widget form. Available parameters [PAYMENT_TYPE](#w_PAYMENT_TYPE) |
1917
1914
  | purpose | <code>string</code> | | Param which describes payment purpose. By default uses Available parameters [PURPOSE](#w_PURPOSE) |
1918
1915
 
@@ -1922,8 +1919,6 @@ Class Configuration include methods for creating configuration token
1922
1919
  var config = new Configuration('gatewayId'); // short
1923
1920
 
1924
1921
  var config = new Configuration('gatewayId', 'bank_account', 'paymentSource'); // extend
1925
-
1926
- var config = new Configuration('not_configured'); // without gateway
1927
1922
  ```
1928
1923
  <a name="w_Configuration+setWebHookDestination" id="w_Configuration+setWebHookDestination"></a>
1929
1924
 
@@ -3351,7 +3346,7 @@ As a result, you will be able to receive a one-time token for charges, subscript
3351
3346
 
3352
3347
 
3353
3348
  ## Checkout button simple example
3354
-
3349
+
3355
3350
  ### Container
3356
3351
 
3357
3352
  ```html
@@ -3371,14 +3366,14 @@ var button = new paydock.PaypalCheckoutButton('#button', 'publicKey', 'gatewayId
3371
3366
  ```javascript--es2015
3372
3367
  // ES2015 | TypeScript
3373
3368
 
3374
-
3369
+
3375
3370
  var button = new PaypalCheckoutButton('#button', 'publicKey');
3376
3371
  ```
3377
3372
 
3378
3373
  Then write only need 1 line of code in js to initialize widget
3379
3374
 
3380
3375
 
3381
- ### Full example
3376
+ ### Full example
3382
3377
 
3383
3378
  ```html
3384
3379
  <!DOCTYPE html>
@@ -3419,7 +3414,7 @@ button.on('finish', function (data) { // Add handler of event
3419
3414
 
3420
3415
  This example shows how you can use a lot of other methods to settings your button
3421
3416
 
3422
- ### Full Paypal example
3417
+ ### Full Paypal example
3423
3418
 
3424
3419
  ```html
3425
3420
  <!DOCTYPE html>
@@ -3446,16 +3441,16 @@ This example shows how you can use a lot of other methods to settings your butto
3446
3441
  reference: '15',
3447
3442
  first_name: 'Joshua',
3448
3443
  last_name: 'Wood',
3449
- phone: '0231049872'});
3450
-
3451
- button.on('finish', function (data) {
3444
+ phone: '0231049872'});
3445
+
3446
+ button.on('finish', function (data) {
3452
3447
  console.log('on:finish', data);
3453
3448
  });
3454
3449
  </script>
3455
3450
  </body>
3456
3451
  </html>
3457
3452
  ```
3458
- ### Full ZipMoney example
3453
+ ### Full ZipMoney example
3459
3454
 
3460
3455
  ```html
3461
3456
  <!DOCTYPE html>
@@ -3485,7 +3480,6 @@ This example shows how you can use a lot of other methods to settings your butto
3485
3480
  "charge": {
3486
3481
  "amount": "4",
3487
3482
  "currency":"AUD",
3488
- "shipping_type": "delivery",
3489
3483
  "shipping_address": {
3490
3484
  "first_name": "Joshua",
3491
3485
  "last_name": "Wood",
@@ -3521,7 +3515,7 @@ This example shows how you can use a lot of other methods to settings your butto
3521
3515
  }
3522
3516
  ]
3523
3517
  },
3524
-
3518
+
3525
3519
  "statistics": {
3526
3520
  "account_created": "2017-05-05",
3527
3521
  "sales_total_number": "5",
@@ -3532,9 +3526,9 @@ This example shows how you can use a lot of other methods to settings your butto
3532
3526
  "previous_chargeback": "true",
3533
3527
  "currency": "AUD",
3534
3528
  "last_login": "2017-06-01"
3535
- });
3536
-
3537
- button.on('finish', function (data) {
3529
+ });
3530
+
3531
+ button.on('finish', function (data) {
3538
3532
  console.log('on:finish', data);
3539
3533
  });
3540
3534
  </script>
@@ -3542,7 +3536,7 @@ This example shows how you can use a lot of other methods to settings your butto
3542
3536
  </html>
3543
3537
  ```
3544
3538
 
3545
- ### Full Aftepay example
3539
+ ### Full Aftepay example
3546
3540
 
3547
3541
  ```html
3548
3542
  <!DOCTYPE html>
@@ -3561,8 +3555,9 @@ This example shows how you can use a lot of other methods to settings your butto
3561
3555
  <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
3562
3556
  <script>
3563
3557
  var button = new paydock.AfterpayCheckoutButton('#button', 'publicKey', 'gatewayId');
3564
-
3558
+
3565
3559
  button.onFinishInsert('input[name="pst"]', 'payment_source_token');
3560
+ button.showEnhancedTrackingProtectionPopup(true);
3566
3561
  button.setMeta({
3567
3562
  amount: "100",
3568
3563
  currency: "AUD",
@@ -3578,8 +3573,8 @@ This example shows how you can use a lot of other methods to settings your butto
3578
3573
  address_country: 'Australia',
3579
3574
  phone: '0412345678',
3580
3575
  });
3581
-
3582
- button.on('finish', function (data) {
3576
+
3577
+ button.on('finish', function (data) {
3583
3578
  console.log('on:finish', data);
3584
3579
  });
3585
3580
  </script>
@@ -3689,7 +3684,6 @@ Interface for ZipMoney checkout meta information
3689
3684
  | [date_of_birth] | <code>string</code> | Date of birth name for the customer |
3690
3685
  | charge.amount | <code>number</code> | Amount to be paid |
3691
3686
  | [charge.currency] | <code>string</code> | Currency code |
3692
- | [charge.reference] | <code>string</code> | Reference |
3693
3687
  | charge.items | <code>array</code> | Collections of orders |
3694
3688
  | charge.items[].name | <code>string</code> | Name of the item |
3695
3689
  | charge.items[].amount | <code>number</code> | Amount of the item |
@@ -3698,8 +3692,7 @@ Interface for ZipMoney checkout meta information
3698
3692
  | [charge.items[].reference] | <code>string</code> | reference of the item |
3699
3693
  | [charge.items[].item_uri] | <code>string</code> | url of the item in your store |
3700
3694
  | [charge.items[].image_url] | <code>string</code> | url of the image in your store |
3701
- | [charge.shipping_type] | <code>string</code> | Shipping type, values can be: ‘pickup’, ‘delivery’, defaults to ‘delivery’ |
3702
- | [charge.shipping_address] | <code>string</code> | Object with shipping address details |
3695
+ | charge.shipping_address | <code>string</code> | Object with shipping address details |
3703
3696
  | [charge.shipping_address.first_name] | <code>string</code> | Shipping first name |
3704
3697
  | [charge.shipping_address.last_name] | <code>string</code> | Shipping last name |
3705
3698
  | charge.shipping_address.line1 | <code>string</code> | Shipping address line 1 |
@@ -4190,6 +4183,7 @@ Class AfterpayCheckoutButton is wrapper of CheckoutButton transform usual button
4190
4183
 
4191
4184
  * [AfterpayCheckoutButton](#cb_AfterpayCheckoutButton) ⇐ [<code>CheckoutButton</code>](#cb_CheckoutButton)
4192
4185
  * [new exports.AfterpayCheckoutButton(selector, accessToken, [gatewayId])](#cb_new_AfterpayCheckoutButton_new)
4186
+ * [.showEnhancedTrackingProtectionPopup(boolean)](#cb_AfterpayCheckoutButton+showEnhancedTrackingProtectionPopup)
4193
4187
  * [.on(eventName, cb)](#cb_CheckoutButton+on)
4194
4188
  * [.close()](#cb_CheckoutButton+close)
4195
4189
  * [.onFinishInsert(selector, dataType)](#cb_CheckoutButton+onFinishInsert)
@@ -4214,6 +4208,23 @@ Class AfterpayCheckoutButton is wrapper of CheckoutButton transform usual button
4214
4208
  ```javascript
4215
4209
  var widget = new AfterpayCheckoutButton('#button', 'access-token','gatewayId');
4216
4210
  ```
4211
+ <a name="cb_AfterpayCheckoutButton+showEnhancedTrackingProtectionPopup" id="cb_AfterpayCheckoutButton+showEnhancedTrackingProtectionPopup"></a>
4212
+
4213
+ ### afterpayCheckoutButton.showEnhancedTrackingProtectionPopup(boolean)
4214
+ Method which toggles the "Enhanced Tracking Protection" warning popup to 'on' mode.
4215
+
4216
+ This popup with a warning about "Enhanced Tracking Protection" limitations
4217
+ would be shown in the Mozilla Firefox browser version 100+
4218
+
4219
+ By default, the popup would not be shown, until
4220
+ the flag would be set to `true`
4221
+
4222
+ **Kind**: instance method of [<code>AfterpayCheckoutButton</code>](#cb_AfterpayCheckoutButton)
4223
+
4224
+ | Param | Type | Description |
4225
+ | --- | --- | --- |
4226
+ | boolean | <code>doShow</code> | flag which toggle the popup visibility |
4227
+
4217
4228
  <a name="cb_CheckoutButton+on" id="cb_CheckoutButton+on"></a>
4218
4229
 
4219
4230
  ### afterpayCheckoutButton.on(eventName, cb)
@@ -310,6 +310,13 @@
310
310
  value: function extendSearchParams(uri, key, val) {
311
311
  return uri.replace(new RegExp("([?&]" + key + "(?=[=&#]|$)[^#&]*|(?=#|$))"), "&" + key + "=" + encodeURIComponent(val)).replace(/^([^?&]+)&/, "$1?");
312
312
  }
313
+ }, {
314
+ key: "serialize",
315
+ value: function serialize(params) {
316
+ return Object.keys(params).map(function (key) {
317
+ return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
318
+ }).join('&');
319
+ }
313
320
  }]);
314
321
  return Url;
315
322
  }();
@@ -566,9 +573,7 @@
566
573
  *
567
574
  * var config = new Configuration('gatewayId', 'bank_account', 'paymentSource'); // extend
568
575
  *
569
- * var config = new Configuration('not_configured'); // without gateway
570
- *
571
- * @param {string} [gatewayID=default] - gateway ID. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
576
+ * @param {string} [gatewayID=default] - gateway ID. By default or if put 'default', it will use the selected default gateway
572
577
  * @param {string} paymentType - Type of payment source which shows in widget form. Available parameters [PAYMENT_TYPE]{@link PAYMENT_TYPE}
573
578
  * @param {string} purpose - Param which describes payment purpose. By default uses Available parameters [PURPOSE]{@link PURPOSE}
574
579
  **/
@@ -1876,8 +1881,7 @@
1876
1881
  * var widget = new MultiWidget('#widget', 'publicKey', new Configuration('gatewayId')); With Configuration
1877
1882
  *
1878
1883
  * var widget = new MultiWidget('#widget', 'publicKey',[ With Configurations
1879
- * Configuration(), // default gateway_id,
1880
- * Configuration('not_configured'), // without gateway,
1884
+ * Configuration() // default gateway_id,
1881
1885
  * Configuration('gatewayId'),
1882
1886
  * Configuration('gatewayId', 'bank_account')
1883
1887
  * ]);
@@ -2237,11 +2241,9 @@
2237
2241
  *
2238
2242
  * var widget = new HtmlWidget('#widget', 'publicKey', 'gatewayID', 'bank_account', 'payment_source'); // extend
2239
2243
  *
2240
- * var widget = new HtmlWidget('#widget', 'publicKey', 'not_configured'); // without gateway
2241
- *
2242
2244
  * @param {string} selector - Selector of html element. Container for widget
2243
2245
  * @param {string} publicKey - PayDock users public key
2244
- * @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway. If put 'not_configured', it won’t use gateway to create downstream token.
2246
+ * @param {string} [gatewayID=default] - ID of a gateway connected to PayDock. By default or if put 'default', it will use the selected default gateway
2245
2247
  * @param {string} [paymentType=card] - Type of payment source which shows in widget form. Available parameters : “card”, “bank_account”.
2246
2248
  * @param {string} [purpose=payment_source] - Purpose of widget form. Available parameters: ‘payment_source’, ‘card_payment_source_with_cvv’, ‘card_payment_source_without_cvv’
2247
2249
  **/
@@ -2641,6 +2643,32 @@
2641
2643
  value: function getScreenWidth() {
2642
2644
  return screen.width;
2643
2645
  }
2646
+ }, {
2647
+ key: 'getBrowserInfo',
2648
+ value: function getBrowserInfo() {
2649
+ var ua = navigator.userAgent;
2650
+ var M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
2651
+ var tem = void 0;
2652
+ if (/trident/i.test(M[1])) {
2653
+ tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
2654
+ return { name: 'IE', version: tem[1] || '' };
2655
+ }
2656
+ if (M[1] === 'Chrome') {
2657
+ tem = ua.match(/\bOPR|Edge\/(\d+)/);
2658
+ if (tem != null) {
2659
+ return { name: 'Opera', version: tem[1] };
2660
+ }
2661
+ }
2662
+ M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
2663
+ // tslint:disable-next-line:no-conditional-assignment
2664
+ if ((tem = ua.match(/version\/(\d+)/i)) != null) {
2665
+ M.splice(1, 1, tem[1]);
2666
+ }
2667
+ return {
2668
+ name: M[0],
2669
+ version: M[1]
2670
+ };
2671
+ }
2644
2672
  }]);
2645
2673
  return Browser;
2646
2674
  }();
@@ -2893,7 +2921,7 @@
2893
2921
  value: function _continue() {}
2894
2922
  }, {
2895
2923
  key: 'next',
2896
- value: function next(checkoutData) {}
2924
+ value: function next(checkoutData, params) {}
2897
2925
  }, {
2898
2926
  key: 'stop',
2899
2927
  value: function stop() {}
@@ -4443,10 +4471,10 @@
4443
4471
  }
4444
4472
  }, {
4445
4473
  key: "next",
4446
- value: function next(checkoutData) {
4474
+ value: function next(checkoutData, params) {
4447
4475
  this.checkout = checkoutData;
4448
4476
  if (!Browser.isSupportPopUp()) window.localStorage.setItem('paydock_checkout_token', JSON.stringify(this.checkout));
4449
- this.popup.redirect(this.getRedirectUrl());
4477
+ this.popup.redirect(this.getRedirectUrl(params));
4450
4478
  }
4451
4479
  }, {
4452
4480
  key: "error",
@@ -4468,9 +4496,8 @@
4468
4496
  }
4469
4497
  }, {
4470
4498
  key: "getRedirectUrl",
4471
- value: function getRedirectUrl() {
4472
- var env = this.checkout.mode === 'live' ? 'live' : 'test';
4473
- return this.widgetEnv.getConf().url + Url.extendSearchParams(CHECKOUT_URL, 'token', encodeURIComponent(this.checkout.reference_id)) + '&env=' + encodeURIComponent(env);
4499
+ value: function getRedirectUrl(params) {
4500
+ return this.widgetEnv.getConf().url + CHECKOUT_URL + '?' + Url.serialize(_extends(_extends({}, params), { token: this.checkout.reference_id, env: this.checkout.mode === 'live' ? 'live' : 'test' }));
4474
4501
  }
4475
4502
  }]);
4476
4503
  return AfterpayRunner;
@@ -4545,6 +4572,11 @@
4545
4572
  }
4546
4573
 
4547
4574
  createClass(CheckoutButton, [{
4575
+ key: "buildAdditionalParams",
4576
+ value: function buildAdditionalParams() {
4577
+ return {};
4578
+ }
4579
+ }, {
4548
4580
  key: "initCheckout",
4549
4581
  value: function initCheckout() {
4550
4582
  var _this2 = this;
@@ -4558,7 +4590,7 @@
4558
4590
  externalCheckout.setEnv(_this2.env);
4559
4591
  externalCheckout.send(_this2.aceessToken, function (checkout) {
4560
4592
  _this2.eventEmitter.emit(CHECKOUT_BUTTON_EVENT.POPUP_REDIRECT, {});
4561
- _this2.runner.next(checkout);
4593
+ _this2.runner.next(checkout, _this2.buildAdditionalParams());
4562
4594
  }, function (error, code) {
4563
4595
  _this2.eventEmitter.emit(CHECKOUT_BUTTON_EVENT.ERROR, {});
4564
4596
  _this2.runner.error(error, code, function (close) {
@@ -4846,9 +4878,40 @@
4846
4878
 
4847
4879
  _this.accessToken = accessToken;
4848
4880
  _this.gatewayId = gatewayId;
4881
+ _this.showETP = false;
4849
4882
  return _this;
4850
4883
  }
4884
+ /**
4885
+ * Method which toggles the "Enhanced Tracking Protection" warning popup to 'on' mode.
4886
+ *
4887
+ * This popup with a warning about "Enhanced Tracking Protection" limitations
4888
+ * would be shown in the Mozilla Firefox browser version 100+
4889
+ *
4890
+ * By default, the popup would not be shown, until
4891
+ * the flag would be set to `true`
4892
+ * @param {doShow} boolean - flag which toggle the popup visibility
4893
+ */
4894
+
4895
+
4896
+ createClass(AfterpayCheckoutButton, [{
4897
+ key: "showEnhancedTrackingProtectionPopup",
4898
+ value: function showEnhancedTrackingProtectionPopup(doShow) {
4899
+ var _Browser$getBrowserIn = Browser.getBrowserInfo(),
4900
+ name = _Browser$getBrowserIn.name,
4901
+ version = _Browser$getBrowserIn.version;
4851
4902
 
4903
+ if (doShow && name === 'Firefox' && +version >= 100) this.showETP = true;
4904
+ }
4905
+ }, {
4906
+ key: "buildAdditionalParams",
4907
+ value: function buildAdditionalParams() {
4908
+ var params = get(AfterpayCheckoutButton.prototype.__proto__ || Object.getPrototypeOf(AfterpayCheckoutButton.prototype), "buildAdditionalParams", this).call(this);
4909
+ if (this.showETP) {
4910
+ params.show_etp = true;
4911
+ }
4912
+ return params;
4913
+ }
4914
+ }]);
4852
4915
  return AfterpayCheckoutButton;
4853
4916
  }(CheckoutButton);
4854
4917
 
@@ -5666,10 +5729,21 @@
5666
5729
 
5667
5730
  _this.latestShippingData.shippingContact = shippingContact;
5668
5731
  var shippingOptionMethod = (_a = _this.selectedShippingOption) === null || _a === void 0 ? void 0 : _a.type;
5669
- var cardNameFromShippingContact = [shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.givenName, shippingContact === null || shippingContact === void 0 ? void 0 : shippingContact.familyName].join(' ').trim();
5670
5732
  _this.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
5671
5733
  data: _extends({ customer: {
5672
- payment_source: _extends(_extends({ wallet_type: WALLET_TYPE.APPLE }, cardNameFromShippingContact && { card_name: cardNameFromShippingContact }), { type: token.paymentMethod.type, card_scheme: token.paymentMethod.network, address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0], address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1], address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode, address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality, address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode, address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea, ref_token: token.paymentData ? JSON.stringify(token.paymentData) : '' })
5734
+ payment_source: {
5735
+ wallet_type: WALLET_TYPE.APPLE,
5736
+ card_name: token.paymentMethod.displayName,
5737
+ type: token.paymentMethod.type,
5738
+ card_scheme: token.paymentMethod.network,
5739
+ address_line1: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[0],
5740
+ address_line2: billingContact === null || billingContact === void 0 ? void 0 : billingContact.addressLines[1],
5741
+ address_country: billingContact === null || billingContact === void 0 ? void 0 : billingContact.countryCode,
5742
+ address_city: billingContact === null || billingContact === void 0 ? void 0 : billingContact.locality,
5743
+ address_postcode: billingContact === null || billingContact === void 0 ? void 0 : billingContact.postalCode,
5744
+ address_state: billingContact === null || billingContact === void 0 ? void 0 : billingContact.administrativeArea,
5745
+ ref_token: token.paymentData ? JSON.stringify(token.paymentData) : ''
5746
+ }
5673
5747
  } }, _this.meta.request_shipping && shippingContact && {
5674
5748
  shipping: _extends(_extends(_extends({}, shippingOptionMethod && { method: shippingOptionMethod }), _this.hasShippingOptions() && { options: _this.meta.shipping_options }), { address_line1: shippingContact.addressLines[0], address_line2: shippingContact.addressLines[1], address_country: shippingContact.countryCode, address_city: shippingContact.locality, address_postcode: shippingContact.postalCode, address_state: shippingContact.administrativeArea, contact: {
5675
5749
  first_name: shippingContact.givenName,
@@ -6119,17 +6193,15 @@
6119
6193
  var shippingAddressLine2 = (_h = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _h === void 0 ? void 0 : _h.address2;
6120
6194
  var shippingOptionMethod = (_j = this.selectedShippingOption) === null || _j === void 0 ? void 0 : _j.type;
6121
6195
  return new Promise(function (resolve) {
6122
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
6196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
6123
6197
  return _this4.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
6124
6198
  data: _extends({ customer: {
6125
- payment_source: _extends(_extends(_extends(_extends({ wallet_type: WALLET_TYPE.GOOGLE,
6126
- // card_name: paymentData.shippingAddress?.name, // TODO: Do we want to use this value? Point 2 at https://paydock.atlassian.net/browse/P2-7209?focusedCommentId=60202
6127
- type: paymentData.paymentMethodData.type, card_scheme: (_b = (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.cardNetwork }, billingAddressLine1 && { address_line1: billingAddressLine1 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), { address_country: (_e = (_d = (_c = paymentData.paymentMethodData) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.billingAddress) === null || _e === void 0 ? void 0 : _e.countryCode, address_city: (_h = (_g = (_f = paymentData.paymentMethodData) === null || _f === void 0 ? void 0 : _f.info) === null || _g === void 0 ? void 0 : _g.billingAddress) === null || _h === void 0 ? void 0 : _h.locality, address_postcode: (_l = (_k = (_j = paymentData.paymentMethodData) === null || _j === void 0 ? void 0 : _j.info) === null || _k === void 0 ? void 0 : _k.billingAddress) === null || _l === void 0 ? void 0 : _l.postalCode, address_state: (_p = (_o = (_m = paymentData.paymentMethodData) === null || _m === void 0 ? void 0 : _m.info) === null || _o === void 0 ? void 0 : _o.billingAddress) === null || _p === void 0 ? void 0 : _p.administrativeArea, ref_token: paymentData.paymentMethodData.tokenizationData.token })
6199
+ payment_source: _extends(_extends(_extends(_extends({ wallet_type: WALLET_TYPE.GOOGLE, card_name: (_a = paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.description, type: paymentData.paymentMethodData.type, card_scheme: (_c = (_b = paymentData.paymentMethodData) === null || _b === void 0 ? void 0 : _b.info) === null || _c === void 0 ? void 0 : _c.cardNetwork }, billingAddressLine1 && { address_line1: billingAddressLine1 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), billingAddressLine2 && { address_line2: billingAddressLine2 }), { address_country: (_f = (_e = (_d = paymentData.paymentMethodData) === null || _d === void 0 ? void 0 : _d.info) === null || _e === void 0 ? void 0 : _e.billingAddress) === null || _f === void 0 ? void 0 : _f.countryCode, address_city: (_j = (_h = (_g = paymentData.paymentMethodData) === null || _g === void 0 ? void 0 : _g.info) === null || _h === void 0 ? void 0 : _h.billingAddress) === null || _j === void 0 ? void 0 : _j.locality, address_postcode: (_m = (_l = (_k = paymentData.paymentMethodData) === null || _k === void 0 ? void 0 : _k.info) === null || _l === void 0 ? void 0 : _l.billingAddress) === null || _m === void 0 ? void 0 : _m.postalCode, address_state: (_q = (_p = (_o = paymentData.paymentMethodData) === null || _o === void 0 ? void 0 : _o.info) === null || _p === void 0 ? void 0 : _p.billingAddress) === null || _q === void 0 ? void 0 : _q.administrativeArea, ref_token: paymentData.paymentMethodData.tokenizationData.token })
6128
6200
  } }, _this4.isShippingRequired() && {
6129
- shipping: _extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && { method: shippingOptionMethod }), _this4.hasShippingOptions() && { options: _this4.meta.shipping_options }), shippingAddressLine1 && { address_line1: shippingAddressLine1 }), shippingAddressLine2 && { address_line2: shippingAddressLine2 }), { address_country: (_q = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _q === void 0 ? void 0 : _q.countryCode, address_city: (_r = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _r === void 0 ? void 0 : _r.locality, address_postcode: (_s = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _s === void 0 ? void 0 : _s.postalCode, address_state: (_t = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _t === void 0 ? void 0 : _t.administrativeArea, contact: {
6130
- first_name: (_u = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _u === void 0 ? void 0 : _u.name,
6201
+ shipping: _extends(_extends(_extends(_extends(_extends({}, shippingOptionMethod && { method: shippingOptionMethod }), _this4.hasShippingOptions() && { options: _this4.meta.shipping_options }), shippingAddressLine1 && { address_line1: shippingAddressLine1 }), shippingAddressLine2 && { address_line2: shippingAddressLine2 }), { address_country: (_r = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _r === void 0 ? void 0 : _r.countryCode, address_city: (_s = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _s === void 0 ? void 0 : _s.locality, address_postcode: (_t = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _t === void 0 ? void 0 : _t.postalCode, address_state: (_u = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _u === void 0 ? void 0 : _u.administrativeArea, contact: {
6202
+ first_name: (_v = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _v === void 0 ? void 0 : _v.name,
6131
6203
  email: paymentData === null || paymentData === void 0 ? void 0 : paymentData.email,
6132
- phone: (_v = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _v === void 0 ? void 0 : _v.phoneNumber
6204
+ phone: (_w = paymentData === null || paymentData === void 0 ? void 0 : paymentData.shippingAddress) === null || _w === void 0 ? void 0 : _w.phoneNumber
6133
6205
  } })
6134
6206
  }),
6135
6207
  onSuccess: function onSuccess() {