Skip to content

Commit

Permalink
AM-119: added check for applepay, remove element if it is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
maexware-danny committed Feb 16, 2024
1 parent 538b4a2 commit 00d8ef5
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions views/frontend/tpl/payment/adyen_assets.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,23 @@
[{if $isLog}]
console.log(checkout.paymentMethodsResponse);
[{/if}]
[{if $isPaymentPage && $oView->isAvailablePayment($adyenCreditCard)}]
[{if $isPaymentPage}]
const apple = checkout.create(
'applepay',
{
}
);
apple.isAvailable()
.then(() => { })
.catch(e => {
[{if $isLog}]
console.error('Apple Pay not available');
console.error(e);
[{/if}]
hidePaymentOption();
});
[{/if}]
[{if $isPaymentPage && $oView->isAvailablePayment($adyenCreditCard)}]
const cardComponent = checkout.create(
'card',
{
Expand Down Expand Up @@ -162,6 +178,15 @@
// Call adyenAsync
adyenAsync();
function hidePaymentOption() {
var inputElement = document.getElementById('payment_oscadyenapplepay');
if (inputElement) {
var parentElement = inputElement.closest('.well.well-sm');
if (parentElement) {
parentElement.remove(); // remove parent-block
}
}
}
[{/capture}]
[{if $phpStorm}]</script>[{/if}]
[{oxscript add=$adyenJS}]
[{oxscript add=$adyenJS}]

0 comments on commit 00d8ef5

Please sign in to comment.