From 060a5e304d54306060fb550980ce5d587a511c68 Mon Sep 17 00:00:00 2001 From: "nils.baczynski@fatchip.de" Date: Thu, 13 Feb 2025 15:49:19 +0100 Subject: [PATCH 1/8] 0117261 - apply backend changes from 6.5 branch --- src/Controller/OrderController.php | 17 +++++++++++++++++ src/Controller/PaymentController.php | 20 +++++++++++++++----- src/Core/ViewConfig.php | 5 +++++ src/Model/Payment.php | 8 ++++++++ src/Service/JSAPIConfigurationService.php | 5 ++--- src/Service/JSAPITemplateConfiguration.php | 3 ++- src/Service/Module.php | 5 +++++ src/Service/PaymentConfigService.php | 8 ++++++++ translations/de/osc_adyen_de_lang.php | 1 + translations/en/osc_adyen_en_lang.php | 1 + 10 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/Controller/OrderController.php b/src/Controller/OrderController.php index 559623e1..60c138fd 100644 --- a/src/Controller/OrderController.php +++ b/src/Controller/OrderController.php @@ -49,4 +49,21 @@ public function return(): ?string return null; } + + /* + * before the adyen credit card payment can be finalized, + * it needs to be validated because this step is skipped for this payment type + */ + public function execute() + { + if ($this->getPayment()->isAdyenCreditCardPayment()) { + $paymentController = oxNew(\OxidEsales\Eshop\Application\Controller\PaymentController::class); + + if ($paymentController->validatePayment() !== "order") { + Registry::getUtils()->redirect(Registry::getConfig()->getShopHomeUrl() . 'cl=payment'); + } + } + + return parent::execute(); + } } diff --git a/src/Controller/PaymentController.php b/src/Controller/PaymentController.php index 01b49b77..2e7fec87 100644 --- a/src/Controller/PaymentController.php +++ b/src/Controller/PaymentController.php @@ -14,6 +14,7 @@ use OxidSolutionCatalysts\Adyen\Model\Payment as AdyenPayment; use OxidSolutionCatalysts\Adyen\Service\CountryRepository; use OxidSolutionCatalysts\Adyen\Service\PaymentCancel; +use OxidSolutionCatalysts\Adyen\Service\PaymentConfigService; use OxidSolutionCatalysts\Adyen\Service\SessionSettings; use OxidSolutionCatalysts\Adyen\Traits\RequestGetter; use OxidSolutionCatalysts\Adyen\Service\ModuleSettings; @@ -133,15 +134,19 @@ public function getPaymentError() public function validatePayment() { $session = $this->getServiceFromContainer(SessionSettings::class); - $moduleService = $this->getServiceFromContainer(ModuleService::class); - $actualPaymentId = $session->getPaymentId(); - $newPaymentId = $this->getStringRequestData('paymentid'); - $pspReference = $session->getPspReference(); + $moduleService = $this->getServiceFromContainer(ModuleService::class); + $actualPaymentId = $session->getPaymentId(); + $newPaymentId = $this->getStringRequestData('paymentid'); + $pspReference = $session->getPspReference(); + + //if the payment is adyen credit card, it will be validated from the order step where a new paymentId is impossible + $isAdyenCreditCard = $this->getAdyenPaymentConfigService()->isAdyenCreditCardPayment($actualPaymentId); + $paymentChanged = !$isAdyenCreditCard && ($actualPaymentId !== $newPaymentId); // remove a possible old adyen payment if another one was selected if ( $actualPaymentId && - $actualPaymentId !== $newPaymentId && + $paymentChanged && $moduleService->isAdyenPayment($actualPaymentId) ) { $this->removeAdyenPaymentFromSession(); @@ -208,4 +213,9 @@ protected function removeAdyenPaymentFromSession(): void $session->deletePaymentSession(); } } + + protected function getAdyenPaymentConfigService(): PaymentConfigService + { + return $this->getServiceFromContainer(PaymentConfigService::class); + } } diff --git a/src/Core/ViewConfig.php b/src/Core/ViewConfig.php index afa1ce37..eac1a3e2 100644 --- a/src/Core/ViewConfig.php +++ b/src/Core/ViewConfig.php @@ -211,6 +211,11 @@ public function getAdyenErrorInvalidSession(): string return Module::ADYEN_ERROR_INVALIDSESSION_NAME; } + public function getAdyenCreditCardTooltipText(): string + { + return Registry::getLang()->translateString("OSC_ADYEN_ORDER_TOOLTIP"); + } + /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface diff --git a/src/Model/Payment.php b/src/Model/Payment.php index e61b6ad1..c14a9a80 100644 --- a/src/Model/Payment.php +++ b/src/Model/Payment.php @@ -31,6 +31,14 @@ public function isAdyenPayment(): bool return $this->getAdyenPaymentConfigService()->isAdyenPayment($this->getId()); } + /** + * Checks if the payment method is an Adyen credit card payment method + */ + public function isAdyenCreditCardPayment() :bool + { + return $this->getAdyenPaymentConfigService()->isAdyenCreditCardPayment($this->getId()); + } + /** * Checks if the payment method is show on Payment Controller */ diff --git a/src/Service/JSAPIConfigurationService.php b/src/Service/JSAPIConfigurationService.php index c1832fa8..409a1886 100644 --- a/src/Service/JSAPIConfigurationService.php +++ b/src/Service/JSAPIConfigurationService.php @@ -74,11 +74,10 @@ private function getPaymentPageConfigFields( ViewConfig $viewConfig ): array { /** @var AdyenViewConfig $viewConfig */ - return ($viewConfig->getTopActiveClassName() === 'payment') ? + return [ 'paymentMethodsResponse' => $viewConfig->getAdyenPaymentMethods(), - ] : - []; + ]; } private function getOrderPageConfigFields( diff --git a/src/Service/JSAPITemplateConfiguration.php b/src/Service/JSAPITemplateConfiguration.php index c077eb07..bda221d8 100644 --- a/src/Service/JSAPITemplateConfiguration.php +++ b/src/Service/JSAPITemplateConfiguration.php @@ -72,6 +72,8 @@ private function getViewData( && $paymentId === Module::PAYMENT_GOOGLE_PAY_ID, 'orderPaymentApplePay' => $controller instanceof OrderController && $paymentId === Module::PAYMENT_APPLE_PAY_ID, + 'orderPaymentCreditCard' => $controller instanceof Ordercontroller + && $paymentId === Module::PAYMENT_CREDITCARD_ID, 'paymentConfigNeedsCard' => $this->paymentMethodsConfigurationNeedsCardField( $controller, $viewConfig, @@ -168,7 +170,6 @@ private function paymentMethodsConfigurationNeedsCardField( /** @var AdyenViewConfig $viewConfig */ return $controller instanceof PaymentController && $payment instanceof Payment - && $payment->showInPaymentCtrl() && $payment->getId() === $viewConfig->getAdyenPaymentCreditCardId(); } } diff --git a/src/Service/Module.php b/src/Service/Module.php index 1518329d..dea8574d 100644 --- a/src/Service/Module.php +++ b/src/Service/Module.php @@ -11,6 +11,11 @@ public function isAdyenPayment(string $paymentId): bool return (isset(ModuleCore::PAYMENT_DEFINTIONS[$paymentId])); } + public function isAdyenCreditCardPayment(string $paymentId) :bool + { + return $paymentId === ModuleCore::PAYMENT_CREDITCARD_ID; + } + public function showInPaymentCtrl(string $paymentId): bool { return ($this->isAdyenPayment($paymentId) && diff --git a/src/Service/PaymentConfigService.php b/src/Service/PaymentConfigService.php index df61223c..0043b626 100644 --- a/src/Service/PaymentConfigService.php +++ b/src/Service/PaymentConfigService.php @@ -34,6 +34,14 @@ public function isAdyenPayment(string $paymentId): bool return $this->moduleService->isAdyenPayment($paymentId); } + /** + * Checks if the payment method is an Adyen credit card payment method + */ + public function isAdyenCreditCardPayment(string $paymentId) : bool + { + return $this->moduleService->isAdyenCreditCardPayment($paymentId); + } + /** * Checks if the payment allow manual Capture */ diff --git a/translations/de/osc_adyen_de_lang.php b/translations/de/osc_adyen_de_lang.php index 4b2c702f..8666de49 100644 --- a/translations/de/osc_adyen_de_lang.php +++ b/translations/de/osc_adyen_de_lang.php @@ -20,4 +20,5 @@ 'OSC_ADYEN_RETURN_NOT_SUCCESSFUL' => 'Die Zahlung war aus folgendem Grund nicht erfolgreich' . ', wählen sie ggf. eine andere Zahlart.', 'OSC_ADYEN_PAYMENT_STATUS_PENDING' => 'Die Zahlung ist derzeit noch schwebend.', + 'OSC_ADYEN_ORDER_TOOLTIP' => 'Bitte füllen Sie die Kreditkartendaten an um die Bestellung abzuschließen zu können.', ]; diff --git a/translations/en/osc_adyen_en_lang.php b/translations/en/osc_adyen_en_lang.php index 17756328..2d878d09 100644 --- a/translations/en/osc_adyen_en_lang.php +++ b/translations/en/osc_adyen_en_lang.php @@ -20,4 +20,5 @@ 'OSC_ADYEN_RETURN_NOT_SUCCESSFUL' => 'The payment was not successful for the following reason' . ', choose another payment method if applicable.', 'OSC_ADYEN_PAYMENT_STATUS_PENDING' => 'The payment is currently pending.', + 'OSC_ADYEN_ORDER_TOOLTIP' => 'Please fill out the credit card form to complete the order.', ]; From 13aac2ed506476f0182d2c9ea9ccbef0fd52e5a5 Mon Sep 17 00:00:00 2001 From: "nils.baczynski@fatchip.de" Date: Mon, 17 Feb 2025 17:19:11 +0100 Subject: [PATCH 2/8] 0117261 - ensure correct configuration for adyen credit card payment in order step --- src/Core/Module.php | 1 - src/Service/JSAPITemplateCheckoutCreate.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/Module.php b/src/Core/Module.php index 4ca8b9e5..46053ce0 100644 --- a/src/Core/Module.php +++ b/src/Core/Module.php @@ -102,7 +102,6 @@ final class Module 'constraints' => self::PAYMENT_CONSTRAINTS, 'sort' => -1, 'capturedelay' => true, - 'paymentCtrl' => true, 'handleAssets' => true, 'hideInitially' => false, ], diff --git a/src/Service/JSAPITemplateCheckoutCreate.php b/src/Service/JSAPITemplateCheckoutCreate.php index ef3f14d5..bac991dc 100644 --- a/src/Service/JSAPITemplateCheckoutCreate.php +++ b/src/Service/JSAPITemplateCheckoutCreate.php @@ -16,6 +16,7 @@ class JSAPITemplateCheckoutCreate Module::PAYMENT_KLARNA_LATER_ID => 'klarna', Module::PAYMENT_KLARNA_IMMEDIATE_ID => 'klarna_paynow', Module::PAYMENT_KLARNA_OVER_TIME_ID => 'klarna_account', + Module::PAYMENT_CREDITCARD_ID => 'oscadyencreditcard', ]; public function getCreateId(string $paymentId): string From 0f0ad45da0927186690d35f9c3715cac57e6c776 Mon Sep 17 00:00:00 2001 From: "nils.baczynski@fatchip.de" Date: Mon, 17 Feb 2025 17:20:33 +0100 Subject: [PATCH 3/8] 0117261 - implement twig frontend changes for adyen credit card payment in order step --- src/Core/ViewConfig.php | 8 ++++ src/Service/JSAPITemplateConfiguration.php | 10 ++++ .../themes/apex/page/checkout/order.html.twig | 24 ++++++++++ views/twig/payment/adyen_assets.html.twig | 46 +++++++++---------- .../adyen_assets_configuration.html.twig | 9 ++-- .../twig/payment/adyen_order_submit.html.twig | 10 ++-- 6 files changed, 73 insertions(+), 34 deletions(-) diff --git a/src/Core/ViewConfig.php b/src/Core/ViewConfig.php index eac1a3e2..5c7ddae7 100644 --- a/src/Core/ViewConfig.php +++ b/src/Core/ViewConfig.php @@ -308,6 +308,14 @@ public function isApplePay( ->isApplePay($payment); } + public function isOrderPaymentCreditCard( + FrontendController $oView, + ?Payment $payment + ): string { + return $this->getServiceFromContainer(JSAPITemplateConfiguration::class) + ->isOrderPaymentCreditCard($oView, $payment); + } + /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface diff --git a/src/Service/JSAPITemplateConfiguration.php b/src/Service/JSAPITemplateConfiguration.php index bda221d8..3d0f2aec 100644 --- a/src/Service/JSAPITemplateConfiguration.php +++ b/src/Service/JSAPITemplateConfiguration.php @@ -54,6 +54,16 @@ public function isApplePay( return $paymentId === Module::PAYMENT_APPLE_PAY_ID; } + public function isOrderPaymentCreditCard( + FrontendController $controller, + ?Payment $payment + ): bool { + $paymentId = $payment instanceof Payment ? $payment->getId() : ''; + + return $controller instanceof Ordercontroller + && $paymentId === Module::PAYMENT_CREDITCARD_ID; + } + private function getViewData( ViewConfig $viewConfig, FrontendController $controller, diff --git a/views/twig/extensions/themes/apex/page/checkout/order.html.twig b/views/twig/extensions/themes/apex/page/checkout/order.html.twig index 36f8df48..cb8bf5d1 100644 --- a/views/twig/extensions/themes/apex/page/checkout/order.html.twig +++ b/views/twig/extensions/themes/apex/page/checkout/order.html.twig @@ -41,7 +41,31 @@ {% include sModuleId ~ "/payment/adyen_payment_psp.html.twig" %} + {% if payment.isAdyenCreditCardPayment() %} + {% set payment=oView.getPayment()%} +

+ {{ payment.oxpayments__oxdesc.value|raw }} +

+
+
+ +
+ +
+ {% endif %} + {% endif %} diff --git a/views/twig/payment/adyen_assets.html.twig b/views/twig/payment/adyen_assets.html.twig index f2b68ade..52a159c2 100644 --- a/views/twig/payment/adyen_assets.html.twig +++ b/views/twig/payment/adyen_assets.html.twig @@ -49,9 +49,13 @@ const adyenResultCodeEl = document.getElementById('{{ oViewConf.getAdyenHtmlParamResultCodeName() }}'); const adyenAmountCurrencyEl = document.getElementById('{{ oViewConf.getAdyenHtmlParamAmountCurrencyName() }}'); const adyenAmountValueEl = document.getElementById('{{ oViewConf.getAdyenHtmlParamAmountValueName() }}'); + {% if isOrderPage %} + const orderSubmitButton = document.getElementById("orderConfirmAgbBottom"); + {% endif %} const adyenAsync = async function () { {{ oViewConf.getTemplateConfiguration(oView, payment)|raw }} + {% set orderPaymentCreditCard = oViewConf.isOrderPaymentCreditCard(oView, payment) %} const checkout = await AdyenCheckout(configuration); // Access the available payment methods for the session. @@ -85,22 +89,31 @@ } }); {% endif %} - {% if oView.handleAdyenAssets(adyenCreditCard) %} + {% elseif isOrderPage %} + {% if orderPaymentCreditCard %} + orderSubmitButton.disabled = true; + orderSubmitButton.title = '{{ oViewConf.getAdyenCreditCardTooltipText()|raw }}'; const cardComponent = checkout.create( 'card', { onFieldValid : function() { - const paymentIdEl = document.getElementById('payment_{{adyenCreditCard}}'); - paymentIdEl.checked = true; - nextStepEl.disabled = true; + orderSubmitButton.disabled = false; }, - + onLoad: function () { + document.querySelector("#oscadyencreditcard-container button").style.display = 'none'; + } } ).mount('#{{adyenCreditCard}}-container'); - cardComponent.paymentIdViewEl = document.getElementById('payment_{{adyenCreditCard}}').parentElement; - {% endif %} - {% elseif isOrderPage %} - {% if oViewConf.isApplePay(payment) %} + + submitForm.addEventListener('submit', function(event) { + event.preventDefault(); + this.disabled = true; + {% if isLog %} + console.log("cardComp:", cardComponent) + {% endif %} + cardComponent.submit(); + }); + {% elseif oViewConf.isApplePay(payment) %} const applePayComponent = checkout.create('{{ templateCheckoutCreateId }}', configuration); applePayComponent.isAvailable() .then(() => { @@ -171,21 +184,6 @@ } return result; } - - {% if isPaymentPage %} - nextStepEl.addEventListener("click", function(e) { - if (this.dataset.adyensubmit !== '') { - e.preventDefault(); - this.disabled = true; - if (this.dataset.adyensubmit === '{{ adyenCreditCard }}') { - cardComponent.submit(); - } - } - }, false); - {% if paymentID is same as(adyenCreditCard) %} - nextStepEl.disabled = true; - {% endif %} - {% endif %} } // Call adyenAsync adyenAsync(); diff --git a/views/twig/payment/adyen_assets_configuration.html.twig b/views/twig/payment/adyen_assets_configuration.html.twig index 447fb11b..8f981dc4 100644 --- a/views/twig/payment/adyen_assets_configuration.html.twig +++ b/views/twig/payment/adyen_assets_configuration.html.twig @@ -2,6 +2,7 @@ const isLog = {% if isLog %}true{% else %}false{% endif %}; const isPaymentPage = {% if isPaymentPage %}true{% else %}false{% endif %}; const isOrderPage = {% if isOrderPage %}true{% else %}false{% endif %}; +const isCreditCard = {% if orderPaymentCreditCard %}true{% else %}false{% endif %}; const configuration = { {{ configFields|raw }}, onError: (error, component) => { @@ -29,21 +30,17 @@ const configuration = { console.log('onSubmit:', state.data); } component.setStatus('loading'); - if (isPaymentPage) { + if (isPaymentPage || isCreditCard) { state.data.deliveryAddress = configuration.deliveryAddress; state.data.shopperEmail = configuration.shopperEmail; state.data.shopperIP = configuration.shopperIP; } - makePayment(state.data) + makePayment(state.data) //this function is declared in adyen_assets.html.twig .then(response => { if (isLog) { console.log('onSubmit-response:', response); } if (response.action) { - // Drop-in handles the action object from the /payments response - if ('paymentIdViewEl' in component) { - component.paymentIdViewEl.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}); - } component.handleAction(response.action); } else { setPspReference(response); diff --git a/views/twig/payment/adyen_order_submit.html.twig b/views/twig/payment/adyen_order_submit.html.twig index 0ffed738..5b40aeb8 100644 --- a/views/twig/payment/adyen_order_submit.html.twig +++ b/views/twig/payment/adyen_order_submit.html.twig @@ -2,8 +2,10 @@ {% set containerId = oViewConf.getTemplatePayButtonContainerId(payment) %} {% set sModuleId = '@' ~ constant('\\OxidSolutionCatalysts\\Adyen\\Core\\Module::MODULE_ID') %}
- {{ translate({ ident: "OSC_ADYEN_BUY_NOW_PAY_WITH" }) }} -
+ {% if not payment.isAdyenCreditCardPayment() %} + {{ translate({ ident: "OSC_ADYEN_BUY_NOW_PAY_WITH" }) }} +
+ {% endif %}
\ No newline at end of file From 846896ced2ce6bfc422e16e9c21c2e1b0b05ed5f Mon Sep 17 00:00:00 2001 From: FC-NilsBaczynski <88329301+FC-NilsBaczynski@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:15:20 +0100 Subject: [PATCH 4/8] fix Namespace Co-authored-by: SebastianGoral-fc --- src/Service/JSAPITemplateConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/JSAPITemplateConfiguration.php b/src/Service/JSAPITemplateConfiguration.php index 3d0f2aec..849bf57b 100644 --- a/src/Service/JSAPITemplateConfiguration.php +++ b/src/Service/JSAPITemplateConfiguration.php @@ -60,7 +60,7 @@ public function isOrderPaymentCreditCard( ): bool { $paymentId = $payment instanceof Payment ? $payment->getId() : ''; - return $controller instanceof Ordercontroller + return $controller instanceof OrderController && $paymentId === Module::PAYMENT_CREDITCARD_ID; } From f316153ac8feb5a448dd4f695e85c7121d33b9e5 Mon Sep 17 00:00:00 2001 From: FC-NilsBaczynski <88329301+FC-NilsBaczynski@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:17:33 +0100 Subject: [PATCH 5/8] fix grammar --- translations/de/osc_adyen_de_lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/de/osc_adyen_de_lang.php b/translations/de/osc_adyen_de_lang.php index 8666de49..77248ee3 100644 --- a/translations/de/osc_adyen_de_lang.php +++ b/translations/de/osc_adyen_de_lang.php @@ -20,5 +20,5 @@ 'OSC_ADYEN_RETURN_NOT_SUCCESSFUL' => 'Die Zahlung war aus folgendem Grund nicht erfolgreich' . ', wählen sie ggf. eine andere Zahlart.', 'OSC_ADYEN_PAYMENT_STATUS_PENDING' => 'Die Zahlung ist derzeit noch schwebend.', - 'OSC_ADYEN_ORDER_TOOLTIP' => 'Bitte füllen Sie die Kreditkartendaten an um die Bestellung abzuschließen zu können.', + 'OSC_ADYEN_ORDER_TOOLTIP' => 'Bitte füllen Sie die Kreditkartendaten aus, um die Bestellung abzuschließen zu können.', ]; From 65ff812ce7fcf9cb518fc13acf819d0d62c3f3dd Mon Sep 17 00:00:00 2001 From: FC-NilsBaczynski <88329301+FC-NilsBaczynski@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:18:12 +0100 Subject: [PATCH 6/8] delete unnecessary setter --- .../twig/extensions/themes/apex/page/checkout/order.html.twig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/views/twig/extensions/themes/apex/page/checkout/order.html.twig b/views/twig/extensions/themes/apex/page/checkout/order.html.twig index cb8bf5d1..9f77069f 100644 --- a/views/twig/extensions/themes/apex/page/checkout/order.html.twig +++ b/views/twig/extensions/themes/apex/page/checkout/order.html.twig @@ -42,7 +42,6 @@ {% if payment.isAdyenCreditCardPayment() %} - {% set payment=oView.getPayment()%}

{{ payment.oxpayments__oxdesc.value|raw }}

@@ -69,4 +68,4 @@ document.getElementById('orderConfirmAgbBottom').appendChild(document.getElementById('adyenApexPsp')); {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} From 4b0dc72d5d1a7cca5f9533612f6393a6090e5eb6 Mon Sep 17 00:00:00 2001 From: "nils.baczynski@fatchip.de" Date: Thu, 13 Feb 2025 15:49:19 +0100 Subject: [PATCH 7/8] AM-153 - remove unnecessary variable referring to a button that no longer exists --- views/twig/payment/adyen_assets.html.twig | 8 -------- 1 file changed, 8 deletions(-) diff --git a/views/twig/payment/adyen_assets.html.twig b/views/twig/payment/adyen_assets.html.twig index 52a159c2..0acccaf0 100644 --- a/views/twig/payment/adyen_assets.html.twig +++ b/views/twig/payment/adyen_assets.html.twig @@ -49,9 +49,6 @@ const adyenResultCodeEl = document.getElementById('{{ oViewConf.getAdyenHtmlParamResultCodeName() }}'); const adyenAmountCurrencyEl = document.getElementById('{{ oViewConf.getAdyenHtmlParamAmountCurrencyName() }}'); const adyenAmountValueEl = document.getElementById('{{ oViewConf.getAdyenHtmlParamAmountValueName() }}'); - {% if isOrderPage %} - const orderSubmitButton = document.getElementById("orderConfirmAgbBottom"); - {% endif %} const adyenAsync = async function () { {{ oViewConf.getTemplateConfiguration(oView, payment)|raw }} @@ -91,14 +88,9 @@ {% endif %} {% elseif isOrderPage %} {% if orderPaymentCreditCard %} - orderSubmitButton.disabled = true; - orderSubmitButton.title = '{{ oViewConf.getAdyenCreditCardTooltipText()|raw }}'; const cardComponent = checkout.create( 'card', { - onFieldValid : function() { - orderSubmitButton.disabled = false; - }, onLoad: function () { document.querySelector("#oscadyencreditcard-container button").style.display = 'none'; } From ba635c5d8363811f0cc27d3d87afc9a82ea693e1 Mon Sep 17 00:00:00 2001 From: "nils.baczynski@fatchip.de" Date: Wed, 19 Feb 2025 18:23:38 +0100 Subject: [PATCH 8/8] AM-153 - only enable button for valid input --- .../extensions/themes/apex/page/checkout/order.html.twig | 2 +- views/twig/payment/adyen_assets.html.twig | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/views/twig/extensions/themes/apex/page/checkout/order.html.twig b/views/twig/extensions/themes/apex/page/checkout/order.html.twig index 9f77069f..925f07ef 100644 --- a/views/twig/extensions/themes/apex/page/checkout/order.html.twig +++ b/views/twig/extensions/themes/apex/page/checkout/order.html.twig @@ -49,7 +49,7 @@
-
diff --git a/views/twig/payment/adyen_assets.html.twig b/views/twig/payment/adyen_assets.html.twig index 0acccaf0..957e11bb 100644 --- a/views/twig/payment/adyen_assets.html.twig +++ b/views/twig/payment/adyen_assets.html.twig @@ -88,9 +88,15 @@ {% endif %} {% elseif isOrderPage %} {% if orderPaymentCreditCard %} + const submitAdyenCCButton = document.getElementById("submitAdyenCCButton"); + submitAdyenCCButton.disabled = true; + submitAdyenCCButton.title = '{{ oViewConf.getAdyenCreditCardTooltipText()|raw }}'; const cardComponent = checkout.create( 'card', { + onFieldValid : function() { + submitAdyenCCButton.disabled = false; + }, onLoad: function () { document.querySelector("#oscadyencreditcard-container button").style.display = 'none'; }