@paydock/client-sdk 1.10.60-beta → 1.10.74-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 (53) hide show
  1. package/README.md +146 -23
  2. package/bundles/widget.umd.js +760 -124
  3. package/bundles/widget.umd.min.js +1 -1
  4. package/lib/api/api-charge-internal.d.ts +52 -0
  5. package/lib/api/api-charge-internal.js +12 -1
  6. package/lib/api/api-charge-internal.js.map +1 -1
  7. package/lib/canvas-3ds/canvas-3ds.d.ts +17 -1
  8. package/lib/canvas-3ds/canvas-3ds.js +30 -4
  9. package/lib/canvas-3ds/canvas-3ds.js.map +1 -1
  10. package/lib/canvas-3ds/services/gpayments-service.d.ts +42 -0
  11. package/lib/canvas-3ds/services/gpayments-service.js +162 -0
  12. package/lib/canvas-3ds/services/gpayments-service.js.map +1 -0
  13. package/lib/canvas-3ds/services/index.d.ts +1 -0
  14. package/lib/canvas-3ds/services/index.js +2 -0
  15. package/lib/canvas-3ds/services/index.js.map +1 -0
  16. package/lib/canvas-3ds/services/standalone3ds-service.d.ts +21 -0
  17. package/lib/canvas-3ds/services/standalone3ds-service.js +32 -0
  18. package/lib/canvas-3ds/services/standalone3ds-service.js.map +1 -0
  19. package/lib/components/param.d.ts +20 -3
  20. package/lib/components/param.js +2 -0
  21. package/lib/components/param.js.map +1 -1
  22. package/lib/helper/access-token.d.ts +6 -0
  23. package/lib/helper/access-token.js +17 -0
  24. package/lib/helper/access-token.js.map +1 -1
  25. package/lib/wallet-buttons/apple.wallet-service.d.ts +13 -1
  26. package/lib/wallet-buttons/apple.wallet-service.js +67 -41
  27. package/lib/wallet-buttons/apple.wallet-service.js.map +1 -1
  28. package/lib/wallet-buttons/flypay.wallet-service.js +1 -4
  29. package/lib/wallet-buttons/flypay.wallet-service.js.map +1 -1
  30. package/lib/wallet-buttons/google.wallet-service.d.ts +29 -0
  31. package/lib/wallet-buttons/google.wallet-service.js +240 -0
  32. package/lib/wallet-buttons/google.wallet-service.js.map +1 -0
  33. package/lib/wallet-buttons/interfaces.d.ts +4 -1
  34. package/lib/wallet-buttons/mastercard.wallet-service.js +7 -1
  35. package/lib/wallet-buttons/mastercard.wallet-service.js.map +1 -1
  36. package/lib/wallet-buttons/paypal.wallet-service.js +3 -3
  37. package/lib/wallet-buttons/paypal.wallet-service.js.map +1 -1
  38. package/lib/wallet-buttons/stripe.wallet-service.d.ts +1 -0
  39. package/lib/wallet-buttons/stripe.wallet-service.js +9 -3
  40. package/lib/wallet-buttons/stripe.wallet-service.js.map +1 -1
  41. package/lib/wallet-buttons/wallet-buttons.d.ts +44 -13
  42. package/lib/wallet-buttons/wallet-buttons.js +37 -12
  43. package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
  44. package/lib/wallet-buttons/wallet-service.d.ts +2 -1
  45. package/lib/wallet-buttons/wallet-service.js.map +1 -1
  46. package/lib/widget/configuration.d.ts +3 -3
  47. package/lib/widget/configuration.js +8 -7
  48. package/lib/widget/configuration.js.map +1 -1
  49. package/lib/widget/multi-widget.d.ts +10 -10
  50. package/lib/widget/multi-widget.js +15 -9
  51. package/lib/widget/multi-widget.js.map +1 -1
  52. package/package.json +2 -1
  53. package/slate.md +83 -0
package/README.md CHANGED
@@ -1901,7 +1901,7 @@ Class Configuration include methods for creating configuration token
1901
1901
  * [.setMeta(object)](#w_Configuration+setMeta)
1902
1902
  * [.setEnv(env, [alias])](#w_Configuration+setEnv)
1903
1903
  * [.setLabel(label)](#w_Configuration+setLabel)
1904
- * [.createToken(publicKey, cb, errorCb)](#w_Configuration+createToken)
1904
+ * [.createToken(accessToken, cb, errorCb)](#w_Configuration+createToken)
1905
1905
 
1906
1906
  <a name="w_new_Configuration_new" id="w_new_Configuration_new"></a>
1907
1907
 
@@ -2041,14 +2041,14 @@ config.setLabel('custom label');
2041
2041
  ```
2042
2042
  <a name="w_Configuration+createToken" id="w_Configuration+createToken"></a>
2043
2043
 
2044
- ### configuration.createToken(publicKey, cb, errorCb)
2044
+ ### configuration.createToken(accessToken, cb, errorCb)
2045
2045
  createToken - method which exactly create payment one time token
2046
2046
 
2047
2047
  **Kind**: instance method of [<code>Configuration</code>](#w_Configuration)
2048
2048
 
2049
2049
  | Param | Type | Description |
2050
2050
  | --- | --- | --- |
2051
- | publicKey | <code>string</code> | Customer public key which provided for each client |
2051
+ | accessToken | <code>string</code> | Customer access token or public key which provided for each client |
2052
2052
  | cb | <code>createToken~requestCallback</code> | The callback that handles the success response. |
2053
2053
  | errorCb | <code>createToken~requestCallback</code> | The callback that handles the failed response. |
2054
2054
 
@@ -2070,7 +2070,7 @@ Class MultiWidget include method for for creating iframe url
2070
2070
  **Kind**: global class
2071
2071
 
2072
2072
  * [MultiWidget](#w_MultiWidget)
2073
- * [new exports.MultiWidget(publicKey, conf)](#w_new_MultiWidget_new)
2073
+ * [new exports.MultiWidget(accessToken, conf)](#w_new_MultiWidget_new)
2074
2074
  * [.setStyles(fields)](#w_MultiWidget+setStyles)
2075
2075
  * [.usePhoneCountryMask([options])](#w_MultiWidget+usePhoneCountryMask)
2076
2076
  * [.setTexts(fields)](#w_MultiWidget+setTexts)
@@ -2090,23 +2090,23 @@ Class MultiWidget include method for for creating iframe url
2090
2090
 
2091
2091
  <a name="w_new_MultiWidget_new" id="w_new_MultiWidget_new"></a>
2092
2092
 
2093
- ### new exports.MultiWidget(publicKey, conf)
2093
+ ### new exports.MultiWidget(accessToken, conf)
2094
2094
 
2095
2095
  | Param | Type | Description |
2096
2096
  | --- | --- | --- |
2097
- | publicKey | <code>string</code> | PayDock users public key |
2097
+ | accessToken | <code>string</code> | PayDock users access token or public key |
2098
2098
  | conf | [<code>Configuration</code>](#w_Configuration) \| <code>string</code> \| [<code>Array.&lt;Configuration&gt;</code>](#w_Configuration) \| <code>Array.&lt;string&gt;</code> | exemplar[s] Configuration class OR configuration token |
2099
2099
 
2100
2100
  **Example**
2101
2101
 
2102
2102
  ```javascript
2103
- var widget = new MultiWidget('publicKey','configurationToken'); // With a pre-created configuration token
2103
+ var widget = new MultiWidget('accessToken','configurationToken'); // With a pre-created configuration token
2104
2104
 
2105
- var widget = new MultiWidget('publicKey',['configurationToken', 'configurationToken2']); // With pre-created configuration tokens
2105
+ var widget = new MultiWidget('accessToken',['configurationToken', 'configurationToken2']); // With pre-created configuration tokens
2106
2106
 
2107
- var widget = new MultiWidget('publicKey', new Configuration('gatewayId')); With Configuration
2107
+ var widget = new MultiWidget('accessToken', new Configuration('gatewayId')); With Configuration
2108
2108
 
2109
- var widget = new MultiWidget('publicKey',[ With Configurations
2109
+ var widget = new MultiWidget('accessToken',[ With Configurations
2110
2110
  Configuration('gatewayId'),
2111
2111
  Configuration('gatewayId', 'bank_account')
2112
2112
  ]);
@@ -4557,6 +4557,89 @@ This example shows how you can use a lot of other methods to settings your form
4557
4557
  </html>
4558
4558
  ```
4559
4559
 
4560
+ ## Canvas 3ds for Standalone 3ds charges
4561
+
4562
+ After you initialized the 3ds charge via `v1/charges/standalone-3ds` API endpoint, you get a token used to initialized the Canvas3ds. All above information regarding setup, loading and initialization still apply.
4563
+
4564
+ ### Full example
4565
+
4566
+ ```html
4567
+ <!DOCTYPE html>
4568
+ <html lang="en">
4569
+ <head>
4570
+ <meta charset="UTF-8" />
4571
+ <title>Title</title>
4572
+ <style>
4573
+ iframe {
4574
+ border: 0;
4575
+ width: 40%;
4576
+ height: 450px;
4577
+ }
4578
+ </style>
4579
+ </head>
4580
+ <body>
4581
+ <div id="widget3ds"></div>
4582
+ <script src="https://app-sandbox.paydock.com/v1/widget.umd.js"></script>
4583
+ <script>
4584
+ var canvas3ds = new paydock.Canvas3ds("#widget3ds", "token");
4585
+ canvas3ds.on("chargeAuthSuccess", function (data) {
4586
+ console.log(data);
4587
+ });
4588
+ canvas3ds.on("chargeAuthReject", function (data) {
4589
+ console.log(data);
4590
+ });
4591
+ canvas3ds.on("chargeAuthChallenge", function (data) {
4592
+ console.log(data);
4593
+ });
4594
+ canvas3ds.on("chargeAuthDecoupled", function (data) {
4595
+ console.log(data.result.description);
4596
+ });
4597
+ canvas3ds.on("error", function ({ charge_3ds_id, error }) {
4598
+ console.log(error);
4599
+ });
4600
+ canvas3ds.load();
4601
+ </script>
4602
+ </body>
4603
+ </html>
4604
+ ```
4605
+
4606
+ The chargeAuthSuccess event is executed both for frictionless flow, or for challenge flow after the customer has correctly authenticated with the bank using whatever challenge imposed.
4607
+ The chargeAuthChallenge event is sent before starting a challenge flow (i.e. opening an IFrame for the customer to complete a challenge with ther bank)
4608
+ The chargeAuthDecoupled event is sent when the flow is a decoupled challenge, alongside a `data.result.description` field that you must show to the customer, indicating the method the user must use to authenticate. For example this may happen by having the cardholder authenticating directly with their banking app through biometrics. Once the end customer does this, the Canvas3ds will be able to recognize the challenge result is ready and will either produce a chargeAuthSuccess or chargeAuthReject event
4609
+ The error event is sent if an unexpected issue with the client library occurs. In such scenarios, you should consider the autentication process as interrupted
4610
+
4611
+ ### Event and Values
4612
+
4613
+ | Event Value | Type | Description |
4614
+ | ------------------- | ------------------- | -------------------------------------------------------------- |
4615
+ | chargeAuthSuccess | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
4616
+ | chargeAuthReject | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
4617
+ | chargeAuthChallenge | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
4618
+ | chargeAuthDecoupled | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
4619
+ | error | <code>object</code> | Instance of [chargeError](#cb_chargeError) |
4620
+
4621
+ ## Response Values
4622
+
4623
+ <a name="cb_chargeEventResponse" id="cb_chargeEventResponse"></a>
4624
+
4625
+ ### ChargeEventResponse
4626
+
4627
+ | Param | Type | Description |
4628
+ | ------------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------- |
4629
+ | status | <code>string</code> | status for the event transaction |
4630
+ | charge_3ds_id | <code>string</code> | Universal unique transaction identifier to identify the transaction |
4631
+ | <code>result.description</code> | <code>string</code> [Optional] | field that you must show to the customer, indicating the method the user must use to authenticate. |
4632
+
4633
+ ### ChargeError
4634
+
4635
+ <a name="cb_chargeError" id="cb_chargeError"></a>
4636
+
4637
+ | Param | Type | Description |
4638
+ | ------------- | ------------------- | ------------------------------------------------------------------- |
4639
+ | error | <code>object</code> | error response |
4640
+ | charge_3ds_id | <code>string</code> | Universal unique transaction identifier to identify the transaction |
4641
+
4642
+
4560
4643
  ## Vault Display Widget
4561
4644
  You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#vault-display-widget)
4562
4645
 
@@ -4807,8 +4890,14 @@ The final method to beginning, the load process of widget to html
4807
4890
  <dt><a href="#IWalletMeta">IWalletMeta</a> : <code>object</code></dt>
4808
4891
  <dd><p>Interface of data used by the wallet checkout and payment proccess.</p>
4809
4892
  </dd>
4810
- <dt><a href="#IShippingOption">IShippingOption</a> : <code>object</code></dt>
4811
- <dd><p>Interface of Shipping Options.</p>
4893
+ <dt><a href="#IApplePayShippingOption">IApplePayShippingOption</a> : <code>object</code></dt>
4894
+ <dd><p>Interface of Shipping Options for ApplePay</p>
4895
+ </dd>
4896
+ <dt><a href="#IGooglePayShippingOption">IGooglePayShippingOption</a> : <code>object</code></dt>
4897
+ <dd><p>Interface of Shipping Options for GooglePay</p>
4898
+ </dd>
4899
+ <dt><a href="#IPayPalShippingOption">IPayPalShippingOption</a> : <code>object</code></dt>
4900
+ <dd><p>Interface of Shipping Options for PayPal</p>
4812
4901
  </dd>
4813
4902
  </dl>
4814
4903
 
@@ -4821,23 +4910,24 @@ Interface of data used by the wallet checkout and payment proccess.
4821
4910
 
4822
4911
  | Param | Type | Description |
4823
4912
  | --- | --- | --- |
4824
- | [amount_label] | <code>string</code> | Label shown next to the total amount to be paid. Required for [Stripe, ApplePay]. N/A for [FlyPay, PayPal]. |
4825
- | [country] | <code>string</code> | Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay]. N/A for [FlyPay, PayPal]. |
4913
+ | [amount_label] | <code>string</code> | Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, PayPal]. |
4914
+ | [country] | <code>string</code> | Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, PayPal]. |
4826
4915
  | [pay_later] | <code>string</code> | Used to enable Pay Later feature in PayPal Smart Checkout WalletButton integration when available. Optional for [PayPal]. N/A for other wallets. |
4827
4916
  | [request_payer_name] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
4828
4917
  | [request_payer_email] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
4829
4918
  | [request_payer_phone] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
4830
- | [request_shipping] | <code>boolean</code> | Used to request or not shipping address in the Wallet checkout, being able to handle amount changes via the `update` event. Optional for [FlyPay, PayPal, ApplePay]. N/A for [Stripe]. |
4831
- | [shipping_options] | [<code>[ &#x27;Array&#x27; ].&lt;IShippingOption&gt;</code>](#IShippingOption) | Used to provide available shipping options. Optional for [ApplePay]. N/A for the other wallets. |
4919
+ | [request_shipping] | <code>boolean</code> | Used to request or not shipping address in the Wallet checkout, being able to handle amount changes via the `update` event. Optional for [FlyPay, PayPal, ApplePay, GooglePay]. N/A for [Stripe]. |
4920
+ | [shipping_options] | [<code>Array.&lt;IApplePayShippingOption&gt;</code>](#IApplePayShippingOption) \| [<code>Array.&lt;IPayPalShippingOption&gt;</code>](#IPayPalShippingOption) | Used to provide available shipping options.(To use shipping_options the request_shipping flag should be true). Optional for [ApplePay]. N/A for the other wallets. |
4921
+ | [merchant_name] | <code>string</code> | Merchant Name used for GooglePay integration via MPGS. Required for [GooglePay]. N/A for other wallets. |
4832
4922
  | [raw_data_initialization] | <code>object</code> | Used to provide values to initialize wallet with raw data. Optional for [ApplePay]. N/A for the other wallets. |
4833
4923
  | [style] | <code>object</code> | Used to style PayPal buttons, check possible values at https://developer.paypal.com/docs/business/checkout/reference/style-guide. Also used at ApplePay to select button type. Optional for [PayPal, ApplePay]. N/A for [Stripe, FlyPay]. |
4834
4924
  | [style.button_type] | <code>object</code> | Used to select ApplePay button type (e.g: 'buy','donate', etc), check possible values at https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_css. Optional for [ApplePay]. N/A for other wallets. |
4835
- | [wallets] | <code>array</code> | By default if this is not sent or empty, we will try to show either Apple Pay or Google Pay buttons. This can be limited sending the following array in this field: ['apple','google]. Optional for [Stripe]. N/A for other wallets. |
4925
+ | [wallets] | <code>array</code> | By default if this is not sent or empty, we will try to show either Apple Pay or Google Pay buttons. This can be limited sending the following array in this field: ['apple','google]. Optional for [Stripe, ApplePay, GooglePay]. N/A for other wallets. |
4836
4926
 
4837
- <a name="IShippingOption" id="IShippingOption"></a>
4927
+ <a name="IApplePayShippingOption" id="IApplePayShippingOption"></a>
4838
4928
 
4839
- ## IShippingOption : <code>object</code>
4840
- Interface of Shipping Options.
4929
+ ## IApplePayShippingOption : <code>object</code>
4930
+ Interface of Shipping Options for ApplePay
4841
4931
 
4842
4932
  **Kind**: global interface
4843
4933
 
@@ -4846,9 +4936,37 @@ Interface of Shipping Options.
4846
4936
  | [id] | <code>string</code> | Identifier of the Shipping Option. Required. |
4847
4937
  | [label] | <code>string</code> | Identifier of the Shipping Option. Required. |
4848
4938
  | [amount] | <code>string</code> | Amount of the Shipping Option. Required. |
4939
+ | [detail] | <code>string</code> | Details of the Shipping Option. Required. |
4940
+ | [type] | <code>string</code> | Type of the Shipping Option. Values can be 'ELECTRONIC', 'GROUND', 'NOT_SHIPPED', 'OVERNIGHT', 'PICKUP', 'PRIORITY', 'SAME_DAY'. Optional. |
4941
+
4942
+ <a name="IGooglePayShippingOption" id="IGooglePayShippingOption"></a>
4943
+
4944
+ ## IGooglePayShippingOption : <code>object</code>
4945
+ Interface of Shipping Options for GooglePay
4946
+
4947
+ **Kind**: global interface
4948
+
4949
+ | Param | Type | Description |
4950
+ | --- | --- | --- |
4951
+ | [id] | <code>string</code> | Identifier of the Shipping Option. Required. |
4952
+ | [label] | <code>string</code> | Identifier of the Shipping Option. Required. |
4849
4953
  | [detail] | <code>string</code> | Details of the Shipping Option. Optional. |
4850
- | [currency] | <code>string</code> | Currency of the Shipping Option. Optional. |
4851
- | [type] | <code>string</code> | Type of the Shipping Option. Optional. |
4954
+ | [type] | <code>string</code> | Type of the Shipping Option. Values can be 'ELECTRONIC', 'GROUND', 'NOT_SHIPPED', 'OVERNIGHT', 'PICKUP', 'PRIORITY', 'SAME_DAY'. Optional. |
4955
+
4956
+ <a name="IPayPalShippingOption" id="IPayPalShippingOption"></a>
4957
+
4958
+ ## IPayPalShippingOption : <code>object</code>
4959
+ Interface of Shipping Options for PayPal
4960
+
4961
+ **Kind**: global interface
4962
+
4963
+ | Param | Type | Description |
4964
+ | --- | --- | --- |
4965
+ | [id] | <code>string</code> | Identifier of the Shipping Option. Required. |
4966
+ | [label] | <code>string</code> | Identifier of the Shipping Option. Required. |
4967
+ | [amount] | <code>string</code> | Amount of the Shipping Option. Required. |
4968
+ | [currency] | <code>string</code> | Currency of the Shipping Option. Required. |
4969
+ | [type] | <code>string</code> | Type of the Shipping Option. Values can be 'SHIPPING' or 'PICKUP'. Required. |
4852
4970
 
4853
4971
  <a name="WalletButtons" id="WalletButtons"></a>
4854
4972
 
@@ -4907,7 +5025,7 @@ var button = new WalletButtons(
4907
5025
 
4908
5026
  ### walletButtons.update()
4909
5027
  Triggers the update process of the wallet, if available.
4910
- Currently supported by Flypay, Paypal and ApplePay via MPGS Wallets.
5028
+ Currently supported by Flypay, Paypal and ApplePay/GooglePay via MPGS Wallets.
4911
5029
 
4912
5030
  **Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
4913
5031
  **Example**
@@ -5018,6 +5136,7 @@ button.on('unavailable').then(function () {
5018
5136
 
5019
5137
  ### walletButtons.onUnavailable([handler])
5020
5138
  User to subscribe to the no button available event. This method is used after loading when the button is not available.
5139
+ For MPGS, since can have more than one wallet button configured (ApplePay/GooglePay) you will receive a body (({ wallet: WALLET_TYPE.GOOGLE }) or ({ wallet: WALLET_TYPE.APPLE })) indicating which button is unavailable
5021
5140
  Important: Do not perform thread blocking operations in callback such as window.alert() calls.
5022
5141
 
5023
5142
  **Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
@@ -5036,6 +5155,10 @@ button.onUnavailable(() => {
5036
5155
  ```js
5037
5156
  button.onUnavailable().then(() => console.log('No wallet buttons available'));
5038
5157
  ```
5158
+ **Example**
5159
+ ```js
5160
+ button.onUnavailable(function (data) {console.log('data.wallet :: ', data.wallet)});
5161
+ ```
5039
5162
  <a name="WalletButtons+onUpdate" id="WalletButtons+onUpdate"></a>
5040
5163
 
5041
5164
  ### walletButtons.onUpdate([handler])