[IMP] ensan_website_donation: applepay fast checkout refactor
This commit is contained in:
parent
7ac0950524
commit
18e65160c7
|
|
@ -14,7 +14,7 @@ class ApplePayFastCheckout(Controller):
|
|||
else:
|
||||
url = "https://oppwa.com/v1/paymentWidgets.js"
|
||||
|
||||
response = request.render("applepay_fast_checkout.apple_pay_iframe", {'hyperpay_src': url})
|
||||
response = request.render("applepay_fast_checkout.apple_pay_iframe", {'hyperpay_src': url, 'merchant_id': acquirer_id.applepay_entity_id})
|
||||
response.headers['Content-Security-Policy'] = "script-src blob: 'self' 'unsafe-inline' 'unsafe-eval' https://*; worker-src blob: 'self' 'unsafe-inline' 'unsafe-eval' https://*;connect-src 'self' https://* wss://*;frame-src 'self' blob: https://*;"
|
||||
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -25,3 +25,9 @@ apple-pay-button {
|
|||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
#payment_method apple-pay-button {
|
||||
--apple-pay-button-height: 60px;
|
||||
--apple-pay-button-border-radius: 4px;
|
||||
--apple-pay-button-padding: 15px 5px;
|
||||
--apple-pay-button-box-sizing: border-box;
|
||||
}
|
||||
|
|
@ -2,12 +2,12 @@ var wpwlOptions = {
|
|||
applePay: {
|
||||
version: 3,
|
||||
displayName: "ENSAN",
|
||||
total: { label: "ENSAN", amount: "10" },
|
||||
total: { label: "ENSAN", amount: "1" },
|
||||
checkAvailability: "applePayCapabilities",
|
||||
currencyCode: "SAR",
|
||||
supportedNetworks: ["mada", "masterCard", "visa"],
|
||||
merchantCapabilities: ["supports3DS", "supportsCredit", "supportsDebit"],
|
||||
merchantIdentifier: "8ac9a4ca811e7d6f018132e7a3654ddf",
|
||||
merchantIdentifier: window.merchant_id,
|
||||
supportedCountries: ["SA"],
|
||||
buttonSource: "css",
|
||||
buttonStyle: "white",
|
||||
|
|
@ -32,19 +32,16 @@ var wpwlOptions = {
|
|||
}
|
||||
});
|
||||
|
||||
// let isCheckoutPage = $("#oe_structure_website_sale_payment_1", window.parent.document).length;
|
||||
// if (isCheckoutPage) {
|
||||
// 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({
|
||||
// "--apple-pay-button-height": "60px",
|
||||
// "--apple-pay-button-border-radius": "4px",
|
||||
// "--apple-pay-button-padding": "15px 5px",
|
||||
// "--apple-pay-button-box-sizing": "border-box",
|
||||
// });
|
||||
// }
|
||||
let isCheckoutPage = $("#oe_structure_website_sale_payment_1", window.parent.document).length;
|
||||
if (isCheckoutPage) {
|
||||
let applepayButton = $("apple-pay-button");
|
||||
applepayButton.css({
|
||||
"--apple-pay-button-height": "60px",
|
||||
"--apple-pay-button-border-radius": "4px",
|
||||
"--apple-pay-button-padding": "15px 5px",
|
||||
"--apple-pay-button-box-sizing": "border-box",
|
||||
});
|
||||
}
|
||||
},
|
||||
createCheckout: function () {
|
||||
const iframeElement = window.frameElement; // The <iframe> element in the parent
|
||||
|
|
|
|||
|
|
@ -6,8 +6,11 @@
|
|||
<head>
|
||||
<script t-att-src="hyperpay_src" />
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" />
|
||||
<script>
|
||||
merchant_id = "<t t-esc="merchant_id" />";
|
||||
</script>
|
||||
<script src="/applepay_fast_checkout/static/src/js/applepay_iframe.js" />
|
||||
<link rel="stylesheet" href="/applepay_fast_checkout/static/src/scss/applepay_iframe_content.scss" />
|
||||
<link rel="stylesheet" href="/applepay_fast_checkout/static/src/css/applepay_iframe_content.css" />
|
||||
</head>
|
||||
<body>
|
||||
<form t-attf-action="{{request.httprequest.url_root}}payment/applepay/return"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div id="applepay_parent_root">
|
||||
<!-- JSON Object contains all the details of the current checkout and will be sent to the backend for processing before -->
|
||||
<!-- sending a checkout request to ApplePay, DEFAULTS TO THE CURRENT ORDER-->
|
||||
<input type="hidden" name="applepay_checkout_details_json" value="{}"/>
|
||||
<input type="hidden" id="applepay_checkout_details_json" name="applepay_checkout_details_json" value="{}"/>
|
||||
|
||||
<iframe t-attf-style="width: {{iframe_width}}; height: {{iframe_height}}; border: none;"
|
||||
t-attf-src="{{request.httprequest.url_root}}applepay">
|
||||
|
|
|
|||
Loading…
Reference in New Issue