@paydock/client-sdk 1.116.2 → 1.116.8-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.
- package/README.md +245 -35
- package/bundles/index.cjs +1698 -365
- package/bundles/index.cjs.d.ts +2376 -2046
- package/bundles/index.mjs +1694 -362
- package/bundles/index.mjs.d.ts +2376 -2046
- package/bundles/types/api/api-base.d.ts +3 -3
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +1 -0
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/instruction-module.d.ts +1 -1
- package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/resource-helper.d.ts +4 -3
- package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/session-helper.d.ts +3 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +1 -0
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +39 -29
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/iframe.d.ts +2 -2
- package/bundles/types/components/iframe.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +2 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.cba.d.ts +8 -7
- package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.interface.d.ts +6 -6
- package/bundles/types/configs/env/environment.interface.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts +8 -7
- package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts +9 -0
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts +42 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts +163 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/index.d.ts +3 -0
- package/bundles/types/fraud-prevention/index.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts +79 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts +2 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts +20 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts.map +1 -0
- package/bundles/types/helper/access-token.d.ts +1 -0
- package/bundles/types/helper/access-token.d.ts.map +1 -1
- package/bundles/types/helper/browser.d.ts.map +1 -1
- package/bundles/types/helper/custom-error.d.ts +8 -0
- package/bundles/types/helper/custom-error.d.ts.map +1 -0
- package/bundles/types/index-cba.d.ts +3 -1
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +2 -1
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +4 -4
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +0 -1
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -1
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +0 -1
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/index.d.ts +2 -0
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +1 -0
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
- package/bundles/types/shared/http/authorization-strategy.d.ts +41 -0
- package/bundles/types/shared/http/authorization-strategy.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.d.ts +28 -0
- package/bundles/types/shared/http/http-fetcher.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts +17 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts.map +1 -0
- package/bundles/types/shared/http/http-request.d.ts +1 -1
- package/bundles/types/shared/http/http-request.d.ts.map +1 -1
- package/bundles/types/shared/http/http-response.dto.d.ts +19 -0
- package/bundles/types/shared/http/http-response.dto.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +12 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/types.d.ts +73 -0
- package/bundles/types/shared/services/configuration-validation/types.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +1 -1
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -1
- package/bundles/types/shared/shared.constants.d.ts +2 -0
- package/bundles/types/shared/shared.constants.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/enums.d.ts +12 -0
- package/bundles/types/wallet-buttons/enums.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +2 -1
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +28 -15
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +10 -10
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +1 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/widget/configuration.d.ts +13 -9
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +1 -2
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/html-widget.d.ts +15 -14
- package/bundles/types/widget/html-widget.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +5 -1
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +1698 -365
- package/bundles/widget.umd.js.d.ts +2376 -2046
- package/bundles/widget.umd.js.min.d.ts +2376 -2046
- package/bundles/widget.umd.min.js +1 -61
- package/docs/api-widget.md +25 -20
- package/docs/click-to-pay.md +1 -0
- package/docs/fraud-prevention-examples.md +154 -0
- package/docs/fraud-prevention.md +0 -0
- package/docs/install/npm.example.md +1 -1
- package/docs/paypal-data-collector-examples.md +6 -5
- package/docs/paypal-data-collector.md +6 -6
- package/docs/wallet-buttons-express.md +1 -0
- package/docs/wallet-buttons.md +1 -0
- package/docs/widget-examples.md +48 -3
- package/examples/multi-html-widget/extend.html +5 -0
- package/package.json +15 -10
- package/slate.md +204 -4
- package/bundles/types/shared/http/index.d.ts +0 -2
- package/bundles/types/shared/http/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ const widget = new Paydock.HtmlWidget('#selector', 'publicKey', 'gatewayId');
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
```js
|
|
62
|
-
// default import -
|
|
62
|
+
// default import - Not officially supported . They are handled differently by different tools / settings!
|
|
63
63
|
❌
|
|
64
64
|
import paydock from '@paydock/client-sdk'
|
|
65
65
|
>>> "Uncaught SyntaxError: The requested module does not provide an export named 'default'"
|
|
@@ -199,6 +199,20 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
|
|
|
199
199
|
|
|
200
200
|
This example shows how you can use a lot of other methods to settings your form
|
|
201
201
|
|
|
202
|
+
|
|
203
|
+
### Error handling
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
widget.on('error', (error) => {
|
|
207
|
+
const errorDiv = document.getElementById('error');
|
|
208
|
+
const errorMessage = document.getElementById('error-message');
|
|
209
|
+
|
|
210
|
+
errorMessage.textContent = error.data.message;
|
|
211
|
+
errorDiv.style.display = 'block';
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
|
|
202
216
|
### Full example
|
|
203
217
|
|
|
204
218
|
```html
|
|
@@ -214,7 +228,34 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
214
228
|
<div id="widget"
|
|
215
229
|
widget-style="text-color: #FFFFAA; border-color: #yellow"
|
|
216
230
|
title="Payment form"
|
|
217
|
-
finish-text="Payment resource was successfully accepted"
|
|
231
|
+
finish-text="Payment resource was successfully accepted">
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div
|
|
235
|
+
id="error"
|
|
236
|
+
style="
|
|
237
|
+
display: none;
|
|
238
|
+
max-width: 600px;
|
|
239
|
+
margin: 16px auto;
|
|
240
|
+
padding: 16px 20px;
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
background-color: #FEF2F2;
|
|
243
|
+
border: 1px solid #FEE2E2;
|
|
244
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
245
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
246
|
+
color: #991B1B;
|
|
247
|
+
line-height: 1.5;
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
"
|
|
250
|
+
title="error"
|
|
251
|
+
>
|
|
252
|
+
<div style="display: flex; align-items: flex-start; gap: 12px;">
|
|
253
|
+
<div>
|
|
254
|
+
<h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
|
|
255
|
+
<div id="error-message"></div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
218
259
|
</form>
|
|
219
260
|
|
|
220
261
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
@@ -224,11 +265,15 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
224
265
|
widget.setSupportedCardIcons(['mastercard', 'visa']);
|
|
225
266
|
widget.setFormFields(['phone', 'email']);
|
|
226
267
|
widget.setRefId('custom-ref-id');
|
|
227
|
-
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
268
|
+
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
228
269
|
|
|
270
|
+
widget.on('error', (error) => {
|
|
271
|
+
document.getElementById('error-message').textContent = error.data.message;
|
|
272
|
+
document.getElementById('error').style.display = 'block';
|
|
273
|
+
});
|
|
229
274
|
widget.load();
|
|
230
275
|
</script>
|
|
231
|
-
|
|
276
|
+
|
|
232
277
|
</body>
|
|
233
278
|
</html>
|
|
234
279
|
```
|
|
@@ -250,6 +295,14 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
250
295
|
</dd>
|
|
251
296
|
</dl>
|
|
252
297
|
|
|
298
|
+
## Members
|
|
299
|
+
|
|
300
|
+
<dl>
|
|
301
|
+
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
302
|
+
<dd><p>Purposes</p>
|
|
303
|
+
</dd>
|
|
304
|
+
</dl>
|
|
305
|
+
|
|
253
306
|
## Constants
|
|
254
307
|
|
|
255
308
|
<dl>
|
|
@@ -262,9 +315,6 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
262
315
|
<dt><a href="#user-content-w_PAYMENT_TYPE">PAYMENT_TYPE</a> : <code>object</code></dt>
|
|
263
316
|
<dd><p>List of available payment source types</p>
|
|
264
317
|
</dd>
|
|
265
|
-
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
266
|
-
<dd><p>Purposes</p>
|
|
267
|
-
</dd>
|
|
268
318
|
<dt><a href="#user-content-w_FORM_FIELD">FORM_FIELD</a> : <code>object</code></dt>
|
|
269
319
|
<dd><p>Current constant include available type of fields which can be included to widget</p>
|
|
270
320
|
</dd>
|
|
@@ -796,10 +846,10 @@ The method to set meta information for the checkout page
|
|
|
796
846
|
|
|
797
847
|
```javascript
|
|
798
848
|
config.setMeta({
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
849
|
+
brand_name: 'paydock',
|
|
850
|
+
reference: '15',
|
|
851
|
+
email: 'wault@paydock.com'
|
|
852
|
+
});
|
|
803
853
|
```
|
|
804
854
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
805
855
|
|
|
@@ -2502,6 +2552,19 @@ Method for setting a custom language code
|
|
|
2502
2552
|
```javascript
|
|
2503
2553
|
config.setLanguage('en');
|
|
2504
2554
|
```
|
|
2555
|
+
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2556
|
+
|
|
2557
|
+
## PURPOSE : <code>object</code>
|
|
2558
|
+
Purposes
|
|
2559
|
+
|
|
2560
|
+
**Kind**: global variable
|
|
2561
|
+
|
|
2562
|
+
| Param | Type | Default |
|
|
2563
|
+
| --- | --- | --- |
|
|
2564
|
+
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2565
|
+
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2566
|
+
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2567
|
+
|
|
2505
2568
|
<a name="w_EVENT" id="w_EVENT" href="#user-content-w_EVENT"> </a>
|
|
2506
2569
|
|
|
2507
2570
|
## EVENT : <code>object</code>
|
|
@@ -2551,19 +2614,6 @@ List of available payment source types
|
|
|
2551
2614
|
| BANK_ACCOUNT | <code>string</code> | <code>"bank_account"</code> |
|
|
2552
2615
|
| CHECKOUT | <code>string</code> | <code>"checkout"</code> |
|
|
2553
2616
|
|
|
2554
|
-
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2555
|
-
|
|
2556
|
-
## PURPOSE : <code>object</code>
|
|
2557
|
-
Purposes
|
|
2558
|
-
|
|
2559
|
-
**Kind**: global constant
|
|
2560
|
-
|
|
2561
|
-
| Param | Type | Default |
|
|
2562
|
-
| --- | --- | --- |
|
|
2563
|
-
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2564
|
-
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2565
|
-
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2566
|
-
|
|
2567
2617
|
<a name="w_FORM_FIELD" id="w_FORM_FIELD" href="#user-content-w_FORM_FIELD"> </a>
|
|
2568
2618
|
|
|
2569
2619
|
## FORM\_FIELD : <code>object</code>
|
|
@@ -5944,6 +5994,7 @@ Interface of data used by the wallet checkout and payment proccess.
|
|
|
5944
5994
|
| [amount_label] | <code>string</code> | Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, Flypay V2, PayPal, Afterpay]. |
|
|
5945
5995
|
| [country] | <code>string</code> | Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay, Afterpay]. N/A for [FlyPay, Flypay V2, PayPal]. |
|
|
5946
5996
|
| [pay_later] | <code>boolean</code> | Used to enable Pay Later feature in PayPal Smart Checkout WalletButton integration when available. Optional for [PayPal]. N/A for other wallets. |
|
|
5997
|
+
| [hide_message] | <code>boolean</code> | Used to hide Pay Later message in PayPal Smart Checkout WalletButton integration. Optional for [PayPal]. N/A for other wallets. |
|
|
5947
5998
|
| [standalone] | <code>boolean</code> | Used to enable Standalone Buttons feature in PayPal Smart Checkout WalletButton integration. Used together with `pay_later`. Optional for [PayPal]. N/A for other wallets. |
|
|
5948
5999
|
| [show_billing_address] | <code>boolean</code> | Used to hide/show the billing address on ApplePay and GooglePay popups. Default value is false. Optional for [ApplePay, GooglePay]. N/A for other wallets. |
|
|
5949
6000
|
| [request_payer_name] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
|
|
@@ -6723,6 +6774,7 @@ For in-depth information, please refer to the [Paypal documentation](https://dev
|
|
|
6723
6774
|
| amount | <code>number</code> | Total amount of the transaction. Represents the money to be charged. |
|
|
6724
6775
|
| currency | <code>string</code> | Currency of the transaction in ISO 4217 currency code format. |
|
|
6725
6776
|
| [pay_later] | <code>boolean</code> | Flag to enable Pay Later feature of PayPal, allowing Pay in 4. Default false. |
|
|
6777
|
+
| [hide_message] | <code>boolean</code> | Used to hide Pay Later message in PayPal Smart Checkout WalletButton integration. Optional for [PayPal]. N/A for other wallets. |
|
|
6726
6778
|
| [standalone] | <code>boolean</code> | Flag to specify if the PayPal standalone button should be used. Default false. |
|
|
6727
6779
|
| [capture] | <code>boolean</code> | Flag to specify if the transaction amount should be captured immediately or authorized for later capture. Default false. |
|
|
6728
6780
|
| [style] | <code>object</code> | Styling configurations for the PayPal widget. |
|
|
@@ -7734,6 +7786,7 @@ When the flow type is src, masked checkoutData available is also returned
|
|
|
7734
7786
|
| --- | --- | --- |
|
|
7735
7787
|
| type | <code>string</code> | type of the checkout, can be `src` or `manual`. |
|
|
7736
7788
|
| token | <code>string</code> | one time token value. |
|
|
7789
|
+
| token_type | <code>string</code> | one time token type value, can be `card` or `card_scheme_token`. |
|
|
7737
7790
|
| [checkoutData] | <code>object</code> | Optional checkout data related to the checkout information. Only available on src flow. |
|
|
7738
7791
|
| [checkoutData.card_number_bin] | <code>string</code> | The BIN of the card used for the transaction. |
|
|
7739
7792
|
| [checkoutData.card_number_last4] | <code>string</code> | The last four digits of the card number. |
|
|
@@ -7966,6 +8019,162 @@ List of available event data types
|
|
|
7966
8019
|
| SUCCESS | <code>string</code> | <code>"Success"</code> | |
|
|
7967
8020
|
|
|
7968
8021
|
|
|
8022
|
+
# Fraud prevention
|
|
8023
|
+
|
|
8024
|
+
The Fraud Prevention module allows you to add security layers to your payment workflows
|
|
8025
|
+
by integrating with any of our underlying fraud prevention providers.
|
|
8026
|
+
|
|
8027
|
+
## Real time user behavior analysis
|
|
8028
|
+
|
|
8029
|
+
### Forter
|
|
8030
|
+
|
|
8031
|
+
One of Forter's key features is our ability to track the user's real-time behavior on
|
|
8032
|
+
the site and use it to separate fraudsters from legitimate buyers. To take advantage
|
|
8033
|
+
of Forter's technology, a JavaScript snippet needs to be placed on EVERY page
|
|
8034
|
+
of your commerce site beginning with the homepage and up to and including the final
|
|
8035
|
+
"Thank you for your purchase" page.
|
|
8036
|
+
|
|
8037
|
+
The integration is simple and straightforward - you only need to configure event
|
|
8038
|
+
listeners and then instantiate a FraudPreventionService with your site configuration.
|
|
8039
|
+
|
|
8040
|
+
Additional setup is required in case your website uses Content Security Policies (CSP)
|
|
8041
|
+
|
|
8042
|
+
#### Forter: Code snippet
|
|
8043
|
+
|
|
8044
|
+
```html
|
|
8045
|
+
<!doctype html>
|
|
8046
|
+
<html lang="en">
|
|
8047
|
+
|
|
8048
|
+
<head>
|
|
8049
|
+
<meta charset="utf-8">
|
|
8050
|
+
<title>Real time user behaviour anaylsis - Forter example</title>
|
|
8051
|
+
<base href="/">
|
|
8052
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8053
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
8054
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
8055
|
+
</head>
|
|
8056
|
+
|
|
8057
|
+
<body>
|
|
8058
|
+
<main>
|
|
8059
|
+
<h1>Real time user behaviour anaylsis - Forter example</h1>
|
|
8060
|
+
<div class="forter-test">
|
|
8061
|
+
<h2>Forter Integration</h2>
|
|
8062
|
+
|
|
8063
|
+
<div class="status-card">
|
|
8064
|
+
<p>
|
|
8065
|
+
<strong>Integration Status:</strong>
|
|
8066
|
+
<span data-fraud-prevention="status-indicator" class="status pending">
|
|
8067
|
+
Pending
|
|
8068
|
+
</span>
|
|
8069
|
+
</p>
|
|
8070
|
+
<p>
|
|
8071
|
+
<strong>Token Value:</strong>
|
|
8072
|
+
<code data-fraud-prevention="forter-token">Not available</code>
|
|
8073
|
+
</p>
|
|
8074
|
+
<p data-fraud-prevention="error-container" style="display: none;">
|
|
8075
|
+
<strong>Error Code:</strong>
|
|
8076
|
+
<span data-fraud-prevention="error-code" class="error"></span>
|
|
8077
|
+
</p>
|
|
8078
|
+
</div>
|
|
8079
|
+
</div>
|
|
8080
|
+
</main>
|
|
8081
|
+
<script>
|
|
8082
|
+
const { FRAUD_PREVENTION_EVENTS, FraudPreventionService } = window.paydock
|
|
8083
|
+
|
|
8084
|
+
let token = '';
|
|
8085
|
+
let errorCode = '';
|
|
8086
|
+
|
|
8087
|
+
const render = () => {
|
|
8088
|
+
const statusIndicator = document.querySelector('[data-fraud-prevention="status-indicator"]');
|
|
8089
|
+
const tokenValue = document.querySelector('[data-fraud-prevention="forter-token"]');
|
|
8090
|
+
const errorContainer = document.querySelector('[data-fraud-prevention="error-container"]');
|
|
8091
|
+
const errorCodeElement = document.querySelector('[data-fraud-prevention="error-code"]');
|
|
8092
|
+
|
|
8093
|
+
if (token) {
|
|
8094
|
+
statusIndicator.className = 'status success';
|
|
8095
|
+
statusIndicator.textContent = 'Active';
|
|
8096
|
+
tokenValue.textContent = token;
|
|
8097
|
+
} else {
|
|
8098
|
+
statusIndicator.className = 'status pending';
|
|
8099
|
+
statusIndicator.textContent = 'Pending';
|
|
8100
|
+
tokenValue.textContent = 'Not available';
|
|
8101
|
+
}
|
|
8102
|
+
|
|
8103
|
+
if (errorCode) {
|
|
8104
|
+
errorCodeElement.textContent = errorCode;
|
|
8105
|
+
errorContainer.style.display = 'block';
|
|
8106
|
+
} else {
|
|
8107
|
+
errorContainer.style.display = 'none';
|
|
8108
|
+
}
|
|
8109
|
+
};
|
|
8110
|
+
|
|
8111
|
+
document.addEventListener(FRAUD_PREVENTION_EVENTS.NAMESPACE, (event) => {
|
|
8112
|
+
switch (event.detail.type) {
|
|
8113
|
+
case FRAUD_PREVENTION_EVENTS.TYPES.FINTERPRINT_TOKEN_READY: {
|
|
8114
|
+
token = event.detail.payload.token;
|
|
8115
|
+
break;
|
|
8116
|
+
}
|
|
8117
|
+
case FRAUD_PREVENTION_EVENTS.TYPES.FINGERPRINT_TOKEN_ERROR: {
|
|
8118
|
+
errorCode = event.detail.payload.code;
|
|
8119
|
+
break;
|
|
8120
|
+
}
|
|
8121
|
+
default: {
|
|
8122
|
+
throw new Error(
|
|
8123
|
+
`${FRAUD_PREVENTION_EVENTS.NAMESPACE} emitted an unsupported event: ${JSON.stringify(event.detail)}.`,
|
|
8124
|
+
);
|
|
8125
|
+
}
|
|
8126
|
+
}
|
|
8127
|
+
|
|
8128
|
+
render();
|
|
8129
|
+
});
|
|
8130
|
+
|
|
8131
|
+
const fraudPreventionServiceConfig = {
|
|
8132
|
+
environmentId: 'sandbox',
|
|
8133
|
+
mode: 'test'
|
|
8134
|
+
}
|
|
8135
|
+
|
|
8136
|
+
// Set "csp" to true if your website uses Content Security Policies
|
|
8137
|
+
const csp = false;
|
|
8138
|
+
|
|
8139
|
+
new FraudPreventionService(fraudPreventionServiceConfig)
|
|
8140
|
+
.withForter({
|
|
8141
|
+
siteId: 'example_site_id_or_subsite_id',
|
|
8142
|
+
csp,
|
|
8143
|
+
});
|
|
8144
|
+
|
|
8145
|
+
// new FraudPreventionService(fraudPreventionServiceConfig)
|
|
8146
|
+
// .withAccessTokenStrategy("eyJhb_access_token_example_...")
|
|
8147
|
+
// .withForter({
|
|
8148
|
+
// providerId: environment.forter.serviceId,
|
|
8149
|
+
// csp,
|
|
8150
|
+
// });
|
|
8151
|
+
|
|
8152
|
+
// new FraudPreventionService(fraudPreventionServiceConfig)
|
|
8153
|
+
// .withPublicKeyStrategy("pk_example_...")
|
|
8154
|
+
// .withForter({
|
|
8155
|
+
// providerId: environment.forter.serviceId,
|
|
8156
|
+
// csp,
|
|
8157
|
+
// });
|
|
8158
|
+
</script>
|
|
8159
|
+
</body>
|
|
8160
|
+
|
|
8161
|
+
</html>
|
|
8162
|
+
```
|
|
8163
|
+
|
|
8164
|
+
#### Forter: Content Security Policies
|
|
8165
|
+
|
|
8166
|
+
If your site enforces Content Security Policies (CSP), make sure to:
|
|
8167
|
+
|
|
8168
|
+
1. Set the `csp` option to `true` when invoking `withForter` on your `FraudPreventionService` instance.
|
|
8169
|
+
2. Allowlist Forter's domains on `connect-src`, `script-src` and `worker-src` as shown below.
|
|
8170
|
+
|
|
8171
|
+
```bash
|
|
8172
|
+
connect-src https://*.forter.com wss://cdn0.forter.com https://d2o5idwacg3gyw.cloudfront.net https://dz8rit8v72mig.cloudfront.net https://db7q4jg5rkhk8.cloudfront.net https://1.1.1.1 https://d94qwxh6czci4.cloudfront.net https://dr6vcclmzwk74.cloudfront.net https://d6rak4b14t5gp.cloudfront.net https://d3k4bt74u9esq1.cloudfront.net https://d1ezzflfzltk6e.cloudfront.net https://d3nocrch4qti4v.cloudfront.net https://duuytoqss3gu4.cloudfront.net https://df45ay5pw60dy.cloudfront.net
|
|
8173
|
+
script-src https://*.forter.com https://dlthst9q2beh8.cloudfront.net https://d2nww8zpyj5pk0.cloudfront.net https://d2w2nqfk3z9hdt.cloudfront.net
|
|
8174
|
+
worker-src blob:
|
|
8175
|
+
```
|
|
8176
|
+
|
|
8177
|
+
|
|
7969
8178
|
## PayPalSavePaymentSource Widget
|
|
7970
8179
|
|
|
7971
8180
|
PayPalSavePaymentSource Widget allows to obtain a Paydock one time token linked with a Paypal payment source from the customer.
|
|
@@ -8326,7 +8535,7 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
|
|
|
8326
8535
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
8327
8536
|
<script>
|
|
8328
8537
|
let payPalDataCollector = new paydock.PayPalDataCollector(
|
|
8329
|
-
|
|
8538
|
+
'FLOW_ID',
|
|
8330
8539
|
{
|
|
8331
8540
|
mouse_movement: true
|
|
8332
8541
|
}
|
|
@@ -8338,10 +8547,11 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
|
|
|
8338
8547
|
console.log("On Error Callback", error);
|
|
8339
8548
|
});
|
|
8340
8549
|
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8550
|
+
payPalDataCollector.collectDeviceData().then(function(collectedDeviceData) {
|
|
8551
|
+
//Here when the promise is resolved, it should be able to see the correlation_id.
|
|
8552
|
+
const correlationId = collectedDeviceData.correlation_id;
|
|
8553
|
+
console.log("On Success", correlationId);
|
|
8554
|
+
});
|
|
8345
8555
|
</script>
|
|
8346
8556
|
</html>
|
|
8347
8557
|
```
|
|
@@ -8417,19 +8627,19 @@ PayPal Data Collector Widget constructor
|
|
|
8417
8627
|
**Kind**: global class
|
|
8418
8628
|
|
|
8419
8629
|
* [PayPalDataCollector](#PayPalDataCollector)
|
|
8420
|
-
* [new PayPalDataCollector(flowId, config)](#new_PayPalDataCollector_new)
|
|
8630
|
+
* [new PayPalDataCollector([flowId], [config])](#new_PayPalDataCollector_new)
|
|
8421
8631
|
* [.collectDeviceData()](#PayPalDataCollector+collectDeviceData) ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
8422
8632
|
* [.onError([callback])](#PayPalDataCollector+onError)
|
|
8423
8633
|
* [.setEnv(env)](#PayPalDataCollector+setEnv)
|
|
8424
8634
|
|
|
8425
8635
|
<a name="new_PayPalDataCollector_new" id="new_PayPalDataCollector_new" href="#new_PayPalDataCollector_new"> </a>
|
|
8426
8636
|
|
|
8427
|
-
### new PayPalDataCollector(flowId, config)
|
|
8637
|
+
### new PayPalDataCollector([flowId], [config])
|
|
8428
8638
|
|
|
8429
8639
|
| Param | Type | Description |
|
|
8430
8640
|
| --- | --- | --- |
|
|
8431
|
-
| flowId | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
8432
|
-
| config | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
8641
|
+
| [flowId] | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
8642
|
+
| [config] | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
8433
8643
|
|
|
8434
8644
|
**Example**
|
|
8435
8645
|
```js
|
|
@@ -8439,10 +8649,10 @@ var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
|
|
|
8439
8649
|
|
|
8440
8650
|
### payPalDataCollector.collectDeviceData() ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
8441
8651
|
After configuring the PayPalDataCollector Widget, starts the process and returns
|
|
8442
|
-
the correlation id used among the requests.
|
|
8652
|
+
the correlation id used among the requests asynchronously.
|
|
8443
8653
|
|
|
8444
8654
|
**Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
|
|
8445
|
-
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved,
|
|
8655
|
+
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved, returns an object
|
|
8446
8656
|
that contains the `correlation_id` key.
|
|
8447
8657
|
**Example**
|
|
8448
8658
|
```js
|