Merge pull request #3448 from expsa/ENS-3510
[IMP] applepay_fast_checkout: add initial amount
This commit is contained in:
commit
92291cd171
|
|
@ -2,7 +2,7 @@ var wpwlOptions = {
|
||||||
applePay: {
|
applePay: {
|
||||||
version: 3,
|
version: 3,
|
||||||
displayName: "ENSAN",
|
displayName: "ENSAN",
|
||||||
total: { label: "ENSAN", amount: "1" },
|
total: { label: "ENSAN", amount: "10" },
|
||||||
checkAvailability: "applePayCapabilities",
|
checkAvailability: "applePayCapabilities",
|
||||||
currencyCode: "SAR",
|
currencyCode: "SAR",
|
||||||
supportedNetworks: ["mada", "masterCard", "visa"],
|
supportedNetworks: ["mada", "masterCard", "visa"],
|
||||||
|
|
@ -32,9 +32,22 @@ var wpwlOptions = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const amounts = $('.donation-product-detail-layout .single-amount', window.parent.document);
|
||||||
|
const fixedQty = $('#fixedqtyinput-1', window.parent.document);
|
||||||
|
if (amounts.length > 0) {
|
||||||
|
window.wpwlOptions.applePay.total.amount = amounts.get(0).dataset.amount;
|
||||||
|
console.log("Apple Pay Amount updated to:", window.wpwlOptions.applePay.total.amount);
|
||||||
|
} else if(fixedQty.length > 0){
|
||||||
|
window.wpwlOptions.applePay.total.amount = fixedQty.data('price');
|
||||||
|
console.log("Apple Pay Amount updated to:", window.wpwlOptions.applePay.total.amount);
|
||||||
|
}
|
||||||
|
|
||||||
let isCheckoutPage = $("#oe_structure_website_sale_payment_1", window.parent.document).length;
|
let isCheckoutPage = $("#oe_structure_website_sale_payment_1", window.parent.document).length;
|
||||||
if (isCheckoutPage) {
|
if (isCheckoutPage) {
|
||||||
let applepayButton = $("apple-pay-button");
|
let applepayButton = $("apple-pay-button");
|
||||||
|
let totalAmount = $("tr#order_total", window.parent.document).find("span.oe_currency_value").text().replaceAll(",", "");
|
||||||
|
window.wpwlOptions.applePay.total.amount = totalAmount;
|
||||||
|
console.log("Apple Pay Amount updated to:", window.wpwlOptions.applePay.total.amount);
|
||||||
applepayButton.css({
|
applepayButton.css({
|
||||||
"--apple-pay-button-height": "60px",
|
"--apple-pay-button-height": "60px",
|
||||||
"--apple-pay-button-border-radius": "4px",
|
"--apple-pay-button-border-radius": "4px",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue