@paydock/client-sdk 1.103.1 → 1.103.11-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 -21
- package/bundles/widget.umd.js +433 -160
- package/bundles/widget.umd.min.js +1 -1
- package/lib/components/container.d.ts +1 -0
- package/lib/components/container.js +3 -0
- package/lib/components/container.js.map +1 -1
- package/lib/components/wallet-background.d.ts +2 -1
- package/lib/components/wallet-background.js +4 -1
- package/lib/components/wallet-background.js.map +1 -1
- package/lib/configs/sdk.js +1 -1
- package/lib/wallet-buttons/apple.wallet-service.d.ts +2 -0
- package/lib/wallet-buttons/apple.wallet-service.js +38 -5
- package/lib/wallet-buttons/apple.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/flypay-v2.wallet-service.d.ts +9 -1
- package/lib/wallet-buttons/flypay-v2.wallet-service.js +104 -131
- package/lib/wallet-buttons/flypay-v2.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/google.wallet-service.d.ts +3 -0
- package/lib/wallet-buttons/google.wallet-service.js +41 -8
- package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/helpers/flypay-v2.helper.d.ts +3 -0
- package/lib/wallet-buttons/helpers/flypay-v2.helper.js +151 -0
- package/lib/wallet-buttons/helpers/flypay-v2.helper.js.map +1 -0
- package/lib/wallet-buttons/index.d.ts +126 -0
- package/lib/wallet-buttons/index.js +126 -0
- package/lib/wallet-buttons/index.js.map +1 -1
- package/lib/wallet-buttons/interfaces.d.ts +3 -0
- package/lib/wallet-buttons/paypal.wallet-service.js +17 -2
- package/lib/wallet-buttons/paypal.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/wallet-buttons.d.ts +62 -120
- package/lib/wallet-buttons/wallet-buttons.js +84 -60
- package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
- package/lib/wallet-buttons/wallet-service.d.ts +7 -0
- package/lib/wallet-buttons/wallet-service.js +11 -0
- package/lib/wallet-buttons/wallet-service.js.map +1 -1
- package/package.json +1 -1
- package/slate.md +48 -19
package/slate.md
CHANGED
|
@@ -1206,6 +1206,14 @@ In some situations you may want to forcibly close the checkout so that your user
|
|
|
1206
1206
|
button.close();
|
|
1207
1207
|
```
|
|
1208
1208
|
|
|
1209
|
+
### Performing actions when the wallet button is clicked
|
|
1210
|
+
|
|
1211
|
+
In some situations you may want to perform some validations or actions when the user clicks on the wallet button, for which you can use this method. Currently supported by Paypal, ApplePay and GooglePay wallets.
|
|
1212
|
+
|
|
1213
|
+
```javascript
|
|
1214
|
+
button.onClick(() => console.log("Perform actions on button click"));
|
|
1215
|
+
```
|
|
1216
|
+
|
|
1209
1217
|
### Performing actions when shipping info is updated
|
|
1210
1218
|
|
|
1211
1219
|
In Flypay, Paypal, ApplePay via MPGS and GooglePay via MPGS integrations after each shipping info update the `onUpdate(data)` will be called with the selected shipping address information, plus selected shipping method when applicable for Paypal, ApplePay and GooglePay. Merchants should handle this callback, recalculate shipping costs in their server by analyzing the new data, and submit a backend to backend request to `POST charges/:id` with the new total amount and shipping amount (you can find the documentation of this call in the PayDock API documentation).
|
|
@@ -1333,30 +1341,51 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
|
|
|
1333
1341
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
1334
1342
|
<script>
|
|
1335
1343
|
let button = new paydock.WalletButtons(
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1344
|
+
"#widget",
|
|
1345
|
+
charge_token,
|
|
1346
|
+
{
|
|
1347
|
+
request_shipping: true,
|
|
1348
|
+
pay_later: true,
|
|
1349
|
+
standalone: false,
|
|
1350
|
+
style: {
|
|
1351
|
+
layout: 'horizontal',
|
|
1352
|
+
color: 'blue',
|
|
1353
|
+
shape: 'rect',
|
|
1354
|
+
label: 'paypal',
|
|
1355
|
+
},
|
|
1356
|
+
}
|
|
1357
|
+
);
|
|
1350
1358
|
button.setEnv('sandbox');
|
|
1351
1359
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
1352
1360
|
button.onUpdate((data) => {
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1361
|
+
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
1362
|
+
// call `POST charges/:id` to modify charge
|
|
1363
|
+
button.update({ success: true });
|
|
1364
|
+
});
|
|
1357
1365
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
1358
1366
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
1359
1367
|
button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
|
|
1368
|
+
|
|
1369
|
+
// Example 1: Asynchronous onClick handler
|
|
1370
|
+
const asyncLogic = async () => {
|
|
1371
|
+
// Perform asynchronous logic. Expectation is that a Promise is returned and attached to response via `attachResult`,
|
|
1372
|
+
// and resolve or reject of it will dictate how wallet behaves.
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
button.onClick(({ data: { attachResult } }) => {
|
|
1376
|
+
// Promise is attached to the result. On Paypal, when promise is resolved, the user Journey will continue.
|
|
1377
|
+
// If no promise is attached then the Paypal journey will not depend on the promise being resolved or rejected
|
|
1378
|
+
attachResult(asyncLogic());
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
// Example 2: Synchronous onClick handler
|
|
1382
|
+
// button.onClick(({ data: { attachResult } }) => {
|
|
1383
|
+
// // Perform synchronous logic
|
|
1384
|
+
// console.log("Synchronous onClick: Button clicked");
|
|
1385
|
+
// // Optionally return a boolean flag to halt the operation
|
|
1386
|
+
// attachResult(false);
|
|
1387
|
+
// });
|
|
1388
|
+
|
|
1360
1389
|
button.load();
|
|
1361
1390
|
</script>
|
|
1362
1391
|
</html>
|
|
@@ -1490,6 +1519,7 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `ra
|
|
|
1490
1519
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
1491
1520
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
1492
1521
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
1522
|
+
button.onClick(() => console.log("On WalletButton Click"));
|
|
1493
1523
|
button.onUpdate((data) => {
|
|
1494
1524
|
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
1495
1525
|
// call `POST charges/:id` to modify charge
|
|
@@ -1522,7 +1552,6 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `ra
|
|
|
1522
1552
|
Also, for **ApplePay via MPGS** you can initialize the `ApplePayPaymentRequest` with your own values instead of using the default ones. Below you can see an example on how to initialize the `ApplePayPaymentRequest` with the `raw_data_initialization` meta field.
|
|
1523
1553
|
|
|
1524
1554
|
Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpecification` with your own values instead of using the default ones. Below you can see an example on how to initialize the `PaymentMethodSpecification` with the `raw_data_initialization` meta field.
|
|
1525
|
-
|
|
1526
1555
|
### ApplePay and GooglePay via MPGS Raw data initialization example
|
|
1527
1556
|
|
|
1528
1557
|
```html
|