From aded1bfd82c830baba208c7e42ce2350a2f8966a Mon Sep 17 00:00:00 2001 From: Emanuele Acito Date: Thu, 11 Jan 2024 17:13:00 +0100 Subject: [PATCH] AM-109_Default_payment - function isAdyenPaymentOxChecked() added to check if adyenCreditcard has flag oxpayments__oxchecked - if oxpayments__oxchecked (fnc) is true, then in tpl the jsVar (paymentIdEl.checked) will be setup to true, else to false --- src/Core/ViewConfig.php | 8 ++++++++ views/frontend/tpl/payment/adyen_assets.tpl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Core/ViewConfig.php b/src/Core/ViewConfig.php index 79dca3ac..dbcfd896 100644 --- a/src/Core/ViewConfig.php +++ b/src/Core/ViewConfig.php @@ -106,6 +106,14 @@ public function isAdyenLoggingActive(): bool return $this->getModuleSettingsSrvc()->isLoggingActive(); } + public function isAdyenPaymentOxChecked(): bool + { + /** @var Payment $oPayment */ + $oPayment = oxNew(Payment::class); + $oPayment->load('oscadyencreditcard'); + return $oPayment->oxpayments__oxchecked->value; + } + /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface diff --git a/views/frontend/tpl/payment/adyen_assets.tpl b/views/frontend/tpl/payment/adyen_assets.tpl index bf1a7451..6eb26f6d 100644 --- a/views/frontend/tpl/payment/adyen_assets.tpl +++ b/views/frontend/tpl/payment/adyen_assets.tpl @@ -95,7 +95,7 @@ const setPaymentIdEl = (component, nextStepElDisabled) => { const paymentIdEl = document.getElementById(component._node.attributes.getNamedItem('data-paymentid').value); - paymentIdEl.checked = true; + paymentIdEl.checked = [{if $oViewConf->isAdyenPaymentOxChecked()}]true[{else}]false[{/if}]; nextStepEl.disabled = nextStepElDisabled; nextStepEl.dataset.adyensubmit = ''; return paymentIdEl;