@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/docs/api-widget.md
CHANGED
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
</dd>
|
|
16
16
|
</dl>
|
|
17
17
|
|
|
18
|
+
## Members
|
|
19
|
+
|
|
20
|
+
<dl>
|
|
21
|
+
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
22
|
+
<dd><p>Purposes</p>
|
|
23
|
+
</dd>
|
|
24
|
+
</dl>
|
|
25
|
+
|
|
18
26
|
## Constants
|
|
19
27
|
|
|
20
28
|
<dl>
|
|
@@ -27,9 +35,6 @@
|
|
|
27
35
|
<dt><a href="#user-content-w_PAYMENT_TYPE">PAYMENT_TYPE</a> : <code>object</code></dt>
|
|
28
36
|
<dd><p>List of available payment source types</p>
|
|
29
37
|
</dd>
|
|
30
|
-
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
31
|
-
<dd><p>Purposes</p>
|
|
32
|
-
</dd>
|
|
33
38
|
<dt><a href="#user-content-w_FORM_FIELD">FORM_FIELD</a> : <code>object</code></dt>
|
|
34
39
|
<dd><p>Current constant include available type of fields which can be included to widget</p>
|
|
35
40
|
</dd>
|
|
@@ -561,10 +566,10 @@ The method to set meta information for the checkout page
|
|
|
561
566
|
|
|
562
567
|
```javascript
|
|
563
568
|
config.setMeta({
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
569
|
+
brand_name: 'paydock',
|
|
570
|
+
reference: '15',
|
|
571
|
+
email: 'wault@paydock.com'
|
|
572
|
+
});
|
|
568
573
|
```
|
|
569
574
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
570
575
|
|
|
@@ -2267,6 +2272,19 @@ Method for setting a custom language code
|
|
|
2267
2272
|
```javascript
|
|
2268
2273
|
config.setLanguage('en');
|
|
2269
2274
|
```
|
|
2275
|
+
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2276
|
+
|
|
2277
|
+
## PURPOSE : <code>object</code>
|
|
2278
|
+
Purposes
|
|
2279
|
+
|
|
2280
|
+
**Kind**: global variable
|
|
2281
|
+
|
|
2282
|
+
| Param | Type | Default |
|
|
2283
|
+
| --- | --- | --- |
|
|
2284
|
+
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2285
|
+
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2286
|
+
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2287
|
+
|
|
2270
2288
|
<a name="w_EVENT" id="w_EVENT" href="#user-content-w_EVENT"> </a>
|
|
2271
2289
|
|
|
2272
2290
|
## EVENT : <code>object</code>
|
|
@@ -2316,19 +2334,6 @@ List of available payment source types
|
|
|
2316
2334
|
| BANK_ACCOUNT | <code>string</code> | <code>"bank_account"</code> |
|
|
2317
2335
|
| CHECKOUT | <code>string</code> | <code>"checkout"</code> |
|
|
2318
2336
|
|
|
2319
|
-
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2320
|
-
|
|
2321
|
-
## PURPOSE : <code>object</code>
|
|
2322
|
-
Purposes
|
|
2323
|
-
|
|
2324
|
-
**Kind**: global constant
|
|
2325
|
-
|
|
2326
|
-
| Param | Type | Default |
|
|
2327
|
-
| --- | --- | --- |
|
|
2328
|
-
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2329
|
-
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2330
|
-
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2331
|
-
|
|
2332
2337
|
<a name="w_FORM_FIELD" id="w_FORM_FIELD" href="#user-content-w_FORM_FIELD"> </a>
|
|
2333
2338
|
|
|
2334
2339
|
## FORM\_FIELD : <code>object</code>
|
package/docs/click-to-pay.md
CHANGED
|
@@ -103,6 +103,7 @@ When the flow type is src, masked checkoutData available is also returned
|
|
|
103
103
|
| --- | --- | --- |
|
|
104
104
|
| type | <code>string</code> | type of the checkout, can be `src` or `manual`. |
|
|
105
105
|
| token | <code>string</code> | one time token value. |
|
|
106
|
+
| token_type | <code>string</code> | one time token type value, can be `card` or `card_scheme_token`. |
|
|
106
107
|
| [checkoutData] | <code>object</code> | Optional checkout data related to the checkout information. Only available on src flow. |
|
|
107
108
|
| [checkoutData.card_number_bin] | <code>string</code> | The BIN of the card used for the transaction. |
|
|
108
109
|
| [checkoutData.card_number_last4] | <code>string</code> | The last four digits of the card number. |
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Fraud prevention
|
|
2
|
+
|
|
3
|
+
The Fraud Prevention module allows you to add security layers to your payment workflows
|
|
4
|
+
by integrating with any of our underlying fraud prevention providers.
|
|
5
|
+
|
|
6
|
+
## Real time user behavior analysis
|
|
7
|
+
|
|
8
|
+
### Forter
|
|
9
|
+
|
|
10
|
+
One of Forter's key features is our ability to track the user's real-time behavior on
|
|
11
|
+
the site and use it to separate fraudsters from legitimate buyers. To take advantage
|
|
12
|
+
of Forter's technology, a JavaScript snippet needs to be placed on EVERY page
|
|
13
|
+
of your commerce site beginning with the homepage and up to and including the final
|
|
14
|
+
"Thank you for your purchase" page.
|
|
15
|
+
|
|
16
|
+
The integration is simple and straightforward - you only need to configure event
|
|
17
|
+
listeners and then instantiate a FraudPreventionService with your site configuration.
|
|
18
|
+
|
|
19
|
+
Additional setup is required in case your website uses Content Security Policies (CSP)
|
|
20
|
+
|
|
21
|
+
#### Forter: Code snippet
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<!doctype html>
|
|
25
|
+
<html lang="en">
|
|
26
|
+
|
|
27
|
+
<head>
|
|
28
|
+
<meta charset="utf-8">
|
|
29
|
+
<title>Real time user behaviour anaylsis - Forter example</title>
|
|
30
|
+
<base href="/">
|
|
31
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
32
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
33
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
34
|
+
</head>
|
|
35
|
+
|
|
36
|
+
<body>
|
|
37
|
+
<main>
|
|
38
|
+
<h1>Real time user behaviour anaylsis - Forter example</h1>
|
|
39
|
+
<div class="forter-test">
|
|
40
|
+
<h2>Forter Integration</h2>
|
|
41
|
+
|
|
42
|
+
<div class="status-card">
|
|
43
|
+
<p>
|
|
44
|
+
<strong>Integration Status:</strong>
|
|
45
|
+
<span data-fraud-prevention="status-indicator" class="status pending">
|
|
46
|
+
Pending
|
|
47
|
+
</span>
|
|
48
|
+
</p>
|
|
49
|
+
<p>
|
|
50
|
+
<strong>Token Value:</strong>
|
|
51
|
+
<code data-fraud-prevention="forter-token">Not available</code>
|
|
52
|
+
</p>
|
|
53
|
+
<p data-fraud-prevention="error-container" style="display: none;">
|
|
54
|
+
<strong>Error Code:</strong>
|
|
55
|
+
<span data-fraud-prevention="error-code" class="error"></span>
|
|
56
|
+
</p>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</main>
|
|
60
|
+
<script>
|
|
61
|
+
const { FRAUD_PREVENTION_EVENTS, FraudPreventionService } = window.paydock
|
|
62
|
+
|
|
63
|
+
let token = '';
|
|
64
|
+
let errorCode = '';
|
|
65
|
+
|
|
66
|
+
const render = () => {
|
|
67
|
+
const statusIndicator = document.querySelector('[data-fraud-prevention="status-indicator"]');
|
|
68
|
+
const tokenValue = document.querySelector('[data-fraud-prevention="forter-token"]');
|
|
69
|
+
const errorContainer = document.querySelector('[data-fraud-prevention="error-container"]');
|
|
70
|
+
const errorCodeElement = document.querySelector('[data-fraud-prevention="error-code"]');
|
|
71
|
+
|
|
72
|
+
if (token) {
|
|
73
|
+
statusIndicator.className = 'status success';
|
|
74
|
+
statusIndicator.textContent = 'Active';
|
|
75
|
+
tokenValue.textContent = token;
|
|
76
|
+
} else {
|
|
77
|
+
statusIndicator.className = 'status pending';
|
|
78
|
+
statusIndicator.textContent = 'Pending';
|
|
79
|
+
tokenValue.textContent = 'Not available';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (errorCode) {
|
|
83
|
+
errorCodeElement.textContent = errorCode;
|
|
84
|
+
errorContainer.style.display = 'block';
|
|
85
|
+
} else {
|
|
86
|
+
errorContainer.style.display = 'none';
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
document.addEventListener(FRAUD_PREVENTION_EVENTS.NAMESPACE, (event) => {
|
|
91
|
+
switch (event.detail.type) {
|
|
92
|
+
case FRAUD_PREVENTION_EVENTS.TYPES.FINTERPRINT_TOKEN_READY: {
|
|
93
|
+
token = event.detail.payload.token;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case FRAUD_PREVENTION_EVENTS.TYPES.FINGERPRINT_TOKEN_ERROR: {
|
|
97
|
+
errorCode = event.detail.payload.code;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
default: {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`${FRAUD_PREVENTION_EVENTS.NAMESPACE} emitted an unsupported event: ${JSON.stringify(event.detail)}.`,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
render();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const fraudPreventionServiceConfig = {
|
|
111
|
+
environmentId: 'sandbox',
|
|
112
|
+
mode: 'test'
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Set "csp" to true if your website uses Content Security Policies
|
|
116
|
+
const csp = false;
|
|
117
|
+
|
|
118
|
+
new FraudPreventionService(fraudPreventionServiceConfig)
|
|
119
|
+
.withForter({
|
|
120
|
+
siteId: 'example_site_id_or_subsite_id',
|
|
121
|
+
csp,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// new FraudPreventionService(fraudPreventionServiceConfig)
|
|
125
|
+
// .withAccessTokenStrategy("eyJhb_access_token_example_...")
|
|
126
|
+
// .withForter({
|
|
127
|
+
// providerId: environment.forter.serviceId,
|
|
128
|
+
// csp,
|
|
129
|
+
// });
|
|
130
|
+
|
|
131
|
+
// new FraudPreventionService(fraudPreventionServiceConfig)
|
|
132
|
+
// .withPublicKeyStrategy("pk_example_...")
|
|
133
|
+
// .withForter({
|
|
134
|
+
// providerId: environment.forter.serviceId,
|
|
135
|
+
// csp,
|
|
136
|
+
// });
|
|
137
|
+
</script>
|
|
138
|
+
</body>
|
|
139
|
+
|
|
140
|
+
</html>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Forter: Content Security Policies
|
|
144
|
+
|
|
145
|
+
If your site enforces Content Security Policies (CSP), make sure to:
|
|
146
|
+
|
|
147
|
+
1. Set the `csp` option to `true` when invoking `withForter` on your `FraudPreventionService` instance.
|
|
148
|
+
2. Allowlist Forter's domains on `connect-src`, `script-src` and `worker-src` as shown below.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
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
|
|
152
|
+
script-src https://*.forter.com https://dlthst9q2beh8.cloudfront.net https://d2nww8zpyj5pk0.cloudfront.net https://d2w2nqfk3z9hdt.cloudfront.net
|
|
153
|
+
worker-src blob:
|
|
154
|
+
```
|
|
File without changes
|
|
@@ -17,7 +17,7 @@ const widget = new Paydock.HtmlWidget('#selector', 'publicKey', 'gatewayId');
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
|
-
// default import -
|
|
20
|
+
// default import - Not officially supported . They are handled differently by different tools / settings!
|
|
21
21
|
❌
|
|
22
22
|
import paydock from '@paydock/client-sdk'
|
|
23
23
|
>>> "Uncaught SyntaxError: The requested module does not provide an export named 'default'"
|
|
@@ -37,7 +37,7 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
|
|
|
37
37
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
38
38
|
<script>
|
|
39
39
|
let payPalDataCollector = new paydock.PayPalDataCollector(
|
|
40
|
-
|
|
40
|
+
'FLOW_ID',
|
|
41
41
|
{
|
|
42
42
|
mouse_movement: true
|
|
43
43
|
}
|
|
@@ -49,10 +49,11 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
|
|
|
49
49
|
console.log("On Error Callback", error);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
payPalDataCollector.collectDeviceData().then(function(collectedDeviceData) {
|
|
53
|
+
//Here when the promise is resolved, it should be able to see the correlation_id.
|
|
54
|
+
const correlationId = collectedDeviceData.correlation_id;
|
|
55
|
+
console.log("On Success", correlationId);
|
|
56
|
+
});
|
|
56
57
|
</script>
|
|
57
58
|
</html>
|
|
58
59
|
```
|
|
@@ -69,19 +69,19 @@ PayPal Data Collector Widget constructor
|
|
|
69
69
|
**Kind**: global class
|
|
70
70
|
|
|
71
71
|
* [PayPalDataCollector](#PayPalDataCollector)
|
|
72
|
-
* [new PayPalDataCollector(flowId, config)](#new_PayPalDataCollector_new)
|
|
72
|
+
* [new PayPalDataCollector([flowId], [config])](#new_PayPalDataCollector_new)
|
|
73
73
|
* [.collectDeviceData()](#PayPalDataCollector+collectDeviceData) ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
74
74
|
* [.onError([callback])](#PayPalDataCollector+onError)
|
|
75
75
|
* [.setEnv(env)](#PayPalDataCollector+setEnv)
|
|
76
76
|
|
|
77
77
|
<a name="new_PayPalDataCollector_new" id="new_PayPalDataCollector_new" href="#new_PayPalDataCollector_new"> </a>
|
|
78
78
|
|
|
79
|
-
### new PayPalDataCollector(flowId, config)
|
|
79
|
+
### new PayPalDataCollector([flowId], [config])
|
|
80
80
|
|
|
81
81
|
| Param | Type | Description |
|
|
82
82
|
| --- | --- | --- |
|
|
83
|
-
| flowId | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
84
|
-
| config | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
83
|
+
| [flowId] | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
84
|
+
| [config] | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
85
85
|
|
|
86
86
|
**Example**
|
|
87
87
|
```js
|
|
@@ -91,10 +91,10 @@ var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
|
|
|
91
91
|
|
|
92
92
|
### payPalDataCollector.collectDeviceData() ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
93
93
|
After configuring the PayPalDataCollector Widget, starts the process and returns
|
|
94
|
-
the correlation id used among the requests.
|
|
94
|
+
the correlation id used among the requests asynchronously.
|
|
95
95
|
|
|
96
96
|
**Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
|
|
97
|
-
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved,
|
|
97
|
+
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved, returns an object
|
|
98
98
|
that contains the `correlation_id` key.
|
|
99
99
|
**Example**
|
|
100
100
|
```js
|
|
@@ -111,6 +111,7 @@ For in-depth information, please refer to the [Paypal documentation](https://dev
|
|
|
111
111
|
| amount | <code>number</code> | Total amount of the transaction. Represents the money to be charged. |
|
|
112
112
|
| currency | <code>string</code> | Currency of the transaction in ISO 4217 currency code format. |
|
|
113
113
|
| [pay_later] | <code>boolean</code> | Flag to enable Pay Later feature of PayPal, allowing Pay in 4. Default false. |
|
|
114
|
+
| [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. |
|
|
114
115
|
| [standalone] | <code>boolean</code> | Flag to specify if the PayPal standalone button should be used. Default false. |
|
|
115
116
|
| [capture] | <code>boolean</code> | Flag to specify if the transaction amount should be captured immediately or authorized for later capture. Default false. |
|
|
116
117
|
| [style] | <code>object</code> | Styling configurations for the PayPal widget. |
|
package/docs/wallet-buttons.md
CHANGED
|
@@ -157,6 +157,7 @@ Interface of data used by the wallet checkout and payment proccess.
|
|
|
157
157
|
| [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]. |
|
|
158
158
|
| [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]. |
|
|
159
159
|
| [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. |
|
|
160
|
+
| [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. |
|
|
160
161
|
| [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. |
|
|
161
162
|
| [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. |
|
|
162
163
|
| [request_payer_name] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
|
package/docs/widget-examples.md
CHANGED
|
@@ -99,6 +99,20 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
|
|
|
99
99
|
|
|
100
100
|
This example shows how you can use a lot of other methods to settings your form
|
|
101
101
|
|
|
102
|
+
|
|
103
|
+
### Error handling
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
widget.on('error', (error) => {
|
|
107
|
+
const errorDiv = document.getElementById('error');
|
|
108
|
+
const errorMessage = document.getElementById('error-message');
|
|
109
|
+
|
|
110
|
+
errorMessage.textContent = error.data.message;
|
|
111
|
+
errorDiv.style.display = 'block';
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
|
|
102
116
|
### Full example
|
|
103
117
|
|
|
104
118
|
```html
|
|
@@ -114,7 +128,34 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
114
128
|
<div id="widget"
|
|
115
129
|
widget-style="text-color: #FFFFAA; border-color: #yellow"
|
|
116
130
|
title="Payment form"
|
|
117
|
-
finish-text="Payment resource was successfully accepted"
|
|
131
|
+
finish-text="Payment resource was successfully accepted">
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<div
|
|
135
|
+
id="error"
|
|
136
|
+
style="
|
|
137
|
+
display: none;
|
|
138
|
+
max-width: 600px;
|
|
139
|
+
margin: 16px auto;
|
|
140
|
+
padding: 16px 20px;
|
|
141
|
+
border-radius: 8px;
|
|
142
|
+
background-color: #FEF2F2;
|
|
143
|
+
border: 1px solid #FEE2E2;
|
|
144
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
145
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
146
|
+
color: #991B1B;
|
|
147
|
+
line-height: 1.5;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
"
|
|
150
|
+
title="error"
|
|
151
|
+
>
|
|
152
|
+
<div style="display: flex; align-items: flex-start; gap: 12px;">
|
|
153
|
+
<div>
|
|
154
|
+
<h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
|
|
155
|
+
<div id="error-message"></div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
118
159
|
</form>
|
|
119
160
|
|
|
120
161
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
@@ -124,11 +165,15 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
124
165
|
widget.setSupportedCardIcons(['mastercard', 'visa']);
|
|
125
166
|
widget.setFormFields(['phone', 'email']);
|
|
126
167
|
widget.setRefId('custom-ref-id');
|
|
127
|
-
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
168
|
+
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
128
169
|
|
|
170
|
+
widget.on('error', (error) => {
|
|
171
|
+
document.getElementById('error-message').textContent = error.data.message;
|
|
172
|
+
document.getElementById('error').style.display = 'block';
|
|
173
|
+
});
|
|
129
174
|
widget.load();
|
|
130
175
|
</script>
|
|
131
|
-
|
|
176
|
+
|
|
132
177
|
</body>
|
|
133
178
|
</html>
|
|
134
179
|
```
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
new paydock.Configuration('gatewayId', 'bank_account')
|
|
25
25
|
]);
|
|
26
26
|
|
|
27
|
+
// ### listen to access errors and handle them ###
|
|
28
|
+
widget.on('error', function (error) {
|
|
29
|
+
console.error('An error occurred', error);
|
|
30
|
+
});
|
|
31
|
+
|
|
27
32
|
widget.load();
|
|
28
33
|
</script>
|
|
29
34
|
</body>
|
package/package.json
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"name": "@paydock/client-sdk",
|
|
107
|
-
"version": "1.116.
|
|
107
|
+
"version": "1.116.8-beta",
|
|
108
108
|
"scripts": {
|
|
109
109
|
"build:doc": "node docs/html/marked.js",
|
|
110
110
|
"build:js": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
|
@@ -119,20 +119,21 @@
|
|
|
119
119
|
"compute:sha:bundles": "npm run compute:checksums:bundles | sha256sum",
|
|
120
120
|
"doc:cba": "run-s clean:lib tsc:cba markdown:cba",
|
|
121
121
|
"doc:paydock": "run-s clean:lib tsc:paydock markdown:paydock",
|
|
122
|
-
"lint": "tslint -c tslint.json 'src/**/*.ts{,x}'",
|
|
123
|
-
"lint:fix": "tslint -c tslint.json 'src/**/*.ts{,x}' --fix",
|
|
124
122
|
"markdown:cba": "grunt cba_docs",
|
|
125
123
|
"markdown:paydock": "grunt docs",
|
|
126
124
|
"publish:local": "./publish-to-local-registry.sh",
|
|
127
125
|
"replace:hosts": "grunt replace_hosts",
|
|
128
|
-
"test:browsers": "karma start --browsers Chrome,Firefox,ChromeHeadlessNoSandbox --single-run",
|
|
129
|
-
"test:chromium": "karma start --browsers ChromeHeadlessNoSandbox --single-run",
|
|
130
|
-
"test": "run
|
|
126
|
+
"test:mocha:browsers": "karma start --browsers Chrome,Firefox,ChromeHeadlessNoSandbox --single-run",
|
|
127
|
+
"test:mocha:chromium": "karma start --browsers ChromeHeadlessNoSandbox --single-run",
|
|
128
|
+
"test:vitest:coverage": "vitest run --coverage",
|
|
129
|
+
"test:vitest:watch": "vitest",
|
|
130
|
+
"test:vitest": "vitest run",
|
|
131
|
+
"test": "run-s test:mocha:chromium test:vitest",
|
|
131
132
|
"tsc:cba": "tsc --project tsconfig.cba.json",
|
|
132
133
|
"tsc:paydock": "tsc --project tsconfig.paydock.json",
|
|
133
134
|
"tidy:ci": "biome ci --no-errors-on-unmatched .",
|
|
134
|
-
"tidy:precommit": "biome
|
|
135
|
-
"tidy": "biome check --
|
|
135
|
+
"tidy:precommit": "biome check --no-errors-on-unmatched --staged --write .",
|
|
136
|
+
"tidy": "biome check --write --no-errors-on-unmatched --changed .",
|
|
136
137
|
"typecheck": "tsc --project tsconfig.json --noEmit"
|
|
137
138
|
},
|
|
138
139
|
"dependencies": {
|
|
@@ -151,7 +152,10 @@
|
|
|
151
152
|
"@babel/preset-env": "7.24.5",
|
|
152
153
|
"@babel/runtime": "7.24.5",
|
|
153
154
|
"@babel/runtime-corejs2": "7.24.5",
|
|
154
|
-
"@biomejs/biome": "1.
|
|
155
|
+
"@biomejs/biome": "1.9.4",
|
|
156
|
+
"@commitlint/cli": "19.5.0",
|
|
157
|
+
"@commitlint/config-conventional": "19.5.0",
|
|
158
|
+
"@golevelup/ts-vitest": "0.5.2",
|
|
155
159
|
"@rollup/plugin-babel": "6.0.4",
|
|
156
160
|
"@rollup/plugin-commonjs": "25.0.7",
|
|
157
161
|
"@rollup/plugin-json": "6.1.0",
|
|
@@ -194,6 +198,7 @@
|
|
|
194
198
|
"karma-jasmine": "1.1.2",
|
|
195
199
|
"karma-jasmine-ajax": "0.1.13",
|
|
196
200
|
"karma-mocha-reporter": "2.2.5",
|
|
201
|
+
"lefthook": "^1.10.10",
|
|
197
202
|
"marked": "4.3.0",
|
|
198
203
|
"npm-run-all2": "6.2.0",
|
|
199
204
|
"process": "0.11.10",
|
|
@@ -203,8 +208,8 @@
|
|
|
203
208
|
"rxjs": "7.8.1",
|
|
204
209
|
"tsify": "3.0.4",
|
|
205
210
|
"tslib": "2.6.2",
|
|
206
|
-
"tslint": "5.20.1",
|
|
207
211
|
"typescript": "5.4.5",
|
|
212
|
+
"vitest": "3.0.5",
|
|
208
213
|
"zod": "3.23.8"
|
|
209
214
|
},
|
|
210
215
|
"engines": {
|