From cf076af88a3be98cab06490ec90ee83044d4855e Mon Sep 17 00:00:00 2001 From: Filip Kojic Date: Tue, 28 Jan 2025 12:06:18 +0100 Subject: [PATCH] Add qr code rendering before order details ISSUE: CS-6471 --- src/adyenofficial.php | 96 ++++++++----------- src/classes/Utility/Installer.php | 1 - ... => adyen-combined-order-confirmation.tpl} | 11 +++ src/views/templates/front/adyen-donations.tpl | 10 -- 4 files changed, 53 insertions(+), 65 deletions(-) rename src/views/templates/front/{adyen-order-confirmation.tpl => adyen-combined-order-confirmation.tpl} (58%) delete mode 100644 src/views/templates/front/adyen-donations.tpl diff --git a/src/adyenofficial.php b/src/adyenofficial.php index 4420442e..7b8ba946 100755 --- a/src/adyenofficial.php +++ b/src/adyenofficial.php @@ -519,40 +519,6 @@ public function hookPaymentOptions(array $params): array return $paymentOptions; } - /** - * @param array $params - * - * @return false|string|null - */ - public function hookDisplayPaymentReturn(array $params) - { - if (!$this->active) { - return null; - } - - $cartId = \AdyenPayment\Classes\Utility\SessionService::get('cartId'); - - $this->context->smarty->assign( - [ - 'adyenAction' => \AdyenPayment\Classes\Utility\SessionService::get('adyenAction'), - 'checkoutConfigUrl' => AdyenPayment\Classes\Utility\Url::getFrontUrl( - 'paymentconfig', - ['cartId' => $cartId] - ), - 'additionalDataUrl' => AdyenPayment\Classes\Utility\Url::getFrontUrl( - 'paymentredirect', - [ - 'adyenMerchantReference' => $cartId, - 'adyenPaymentType' => \AdyenPayment\Classes\Utility\SessionService::get('adyenPaymentMethodType'), - 'adyenPage' => 'thankYou' - ] - ), - ] - ); - - return $this->display(__FILE__, '/views/templates/front/adyen-order-confirmation.tpl'); - } - /** * @param array $params * @@ -887,35 +853,57 @@ public function hookDisplayOrderConfirmation(array $params) return null; } + $cartId = \AdyenPayment\Classes\Utility\SessionService::get('cartId'); + $adyenAction = \AdyenPayment\Classes\Utility\SessionService::get('adyenAction'); + $adyenPaymentType = \AdyenPayment\Classes\Utility\SessionService::get('adyenPaymentMethodType'); + + $additionalActionConfig = [ + 'adyenAction' => $adyenAction, + 'checkoutConfigUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl( + 'paymentconfig', + ['cartId' => $cartId] + ), + 'additionalDataUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl( + 'paymentredirect', + [ + 'adyenMerchantReference' => $cartId, + 'adyenPaymentType' => $adyenPaymentType, + 'adyenPage' => 'thankYou' + ] + ), + ]; + $storeId = $params['order']->id_shop; $adyenGivingInformation = \Adyen\Core\BusinessLogic\AdminAPI\AdminAPI::get()->adyenGivingSettings( $storeId )->getAdyenGivingSettings()->toArray(); $cart = new \Cart($params['order']->id_cart); + $donationConfig = [ + 'enabled' => $adyenGivingInformation['enableAdyenGiving'], + 'donationsConfigUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl( + 'adyendonationsconfig', + [ + 'merchantReference' => $cart->id, + 'key' => $cart->secure_key, + 'module' => $params['order']->module + ] + ), + 'makeDonationsUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl( + 'adyenmakedonation', + [ + 'merchantReference' => $cart->id, + 'key' => $cart->secure_key, + 'module' => $params['order']->module + ] + ) + ]; + $this->context->smarty->assign( - [ - 'enabled' => $adyenGivingInformation['enableAdyenGiving'], - 'donationsConfigUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl( - 'adyendonationsconfig', - [ - 'merchantReference' => $cart->id, - 'key' => $cart->secure_key, - 'module' => $params['order']->module - ] - ), - 'makeDonationsUrl' => \AdyenPayment\Classes\Utility\Url::getFrontUrl( - 'adyenmakedonation', - [ - 'merchantReference' => $cart->id, - 'key' => $cart->secure_key, - 'module' => $params['order']->module - ] - ) - ] + array_merge($additionalActionConfig, $donationConfig) ); - return $this->display(__FILE__, '/views/templates/front/adyen-donations.tpl'); + return $this->display(__FILE__, '/views/templates/front/adyen-combined-order-confirmation.tpl'); } /** diff --git a/src/classes/Utility/Installer.php b/src/classes/Utility/Installer.php index c5184a37..56d5f6c2 100755 --- a/src/classes/Utility/Installer.php +++ b/src/classes/Utility/Installer.php @@ -85,7 +85,6 @@ class Installer 'actionValidateOrder', 'sendMailAlterTemplateVars', 'displayOrderConfirmation', - 'displayPaymentReturn', 'actionObjectOrderUpdateAfter' ]; diff --git a/src/views/templates/front/adyen-order-confirmation.tpl b/src/views/templates/front/adyen-combined-order-confirmation.tpl similarity index 58% rename from src/views/templates/front/adyen-order-confirmation.tpl rename to src/views/templates/front/adyen-combined-order-confirmation.tpl index cb058f38..d9777cc1 100644 --- a/src/views/templates/front/adyen-order-confirmation.tpl +++ b/src/views/templates/front/adyen-combined-order-confirmation.tpl @@ -7,3 +7,14 @@
{/if} + +{if ($enabled)} +
+
+
+
+
+{/if} diff --git a/src/views/templates/front/adyen-donations.tpl b/src/views/templates/front/adyen-donations.tpl deleted file mode 100644 index d7c8a4d8..00000000 --- a/src/views/templates/front/adyen-donations.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{if ($enabled)} -
-
-
-
-
-{/if} \ No newline at end of file