Skip to content

Commit

Permalink
AM-119: added check for applepay
Browse files Browse the repository at this point in the history
  • Loading branch information
maexware-danny committed Feb 16, 2024
1 parent f3d8e23 commit 1586790
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions views/twig/payment/adyen_assets.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@
{% if isLog %}
console.log(checkout.paymentMethodsResponse);
{% endif %}
{% if isPaymentPage %}
const apple = checkout.create(
'applepay',
{
}
);
apple.isAvailable()
.then(() => { })
.catch(e => {
{% if isLog %}
console.error('Apple Pay not available');
console.error(e);
{% endif %}
hidePaymentOption();
});
{% endif %}
{% if isPaymentPage and oView.isAvailablePayment(adyenCreditCard) %}
const cardComponent = checkout.create(
'card',
Expand Down Expand Up @@ -157,7 +174,15 @@
}
// Call adyenAsync
adyenAsync();
function hidePaymentOption() {
var inputElement = document.getElementById('payment_oscadyenapplepay');
if (inputElement) {
var parentElement = inputElement.closest('.payment-option');
if (parentElement) {
parentElement.remove(); // remove parent-block
}
}
}
{% endcapture %}
{% if phpStorm %}</script>{% endif %}
{{ script({ add: adyenJS, dynamic: __oxid_include_dynamic }) }}
{{ script({ add: adyenJS, dynamic: __oxid_include_dynamic }) }}

0 comments on commit 1586790

Please sign in to comment.