@salla.sa/applepay 2.13.89 → 2.13.91
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/package.json +2 -2
- package/src/index.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/applepay",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.91",
|
|
4
4
|
"description": "Salla Apple Pay light",
|
|
5
5
|
"main": "dist/app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "^0.23.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "da55413491cf748624d3ca9ecbe8280a0d94fcbf"
|
|
30
30
|
}
|
package/src/index.js
CHANGED
|
@@ -456,10 +456,10 @@ window.SallaApplePay = {
|
|
|
456
456
|
salla.logger.log('Recalculate Total');
|
|
457
457
|
|
|
458
458
|
return Http.requestWithSupportAjax(SallaApplePay.detail.recalculateTotal.url.replace('{id}', SallaApplePay.id),{}, 'get').then((data) => {
|
|
459
|
-
|
|
459
|
+
let cart = data.data.initial_data?.cart || data.data.cart;
|
|
460
460
|
// todo :: enhance response from backend
|
|
461
|
-
SallaApplePay.detail.amount =
|
|
462
|
-
SallaApplePay.detail.items =
|
|
461
|
+
SallaApplePay.detail.amount = cart.total;
|
|
462
|
+
SallaApplePay.detail.items = (cart.totals || cart.items).map((item) => {
|
|
463
463
|
return {
|
|
464
464
|
label: item.title,
|
|
465
465
|
amount: item.amount === 'مجاني' ? 0 : item.amount.toString().replace('+', ''),
|
|
@@ -528,4 +528,4 @@ if (window.ApplePaySession?.canMakePayments()) {
|
|
|
528
528
|
} else {
|
|
529
529
|
// You can hide the Apple Pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
|
|
530
530
|
document.querySelectorAll('data-show-if-apple-pay-supported').forEach(element => element.style.display = 'none');
|
|
531
|
-
}
|
|
531
|
+
}
|