From 61b16565c730a675b9d86505b54ba37c3d41155d Mon Sep 17 00:00:00 2001 From: kevinverschoor <61683999+kevinverschoor@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:47:17 +0100 Subject: [PATCH 1/2] PLUG-3247 - Remove unused hook --- paynlpaymentmethods/paynlpaymentmethods.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index 60f72df..de23e15 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -65,7 +65,7 @@ public function __construct() { $this->name = 'paynlpaymentmethods'; $this->tab = 'payments_gateways'; - $this->version = '4.17.0'; + $this->version = '4.17.1'; $this->payLogEnabled = null; $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); $this->author = 'PAY.'; @@ -104,11 +104,7 @@ public function __construct() if ($this->isRegisteredInHook('paymentReturn')) { $this->unregisterHook('paymentReturn'); } - - if (!$this->isRegisteredInHook('displayPaymentReturn')) { - $this->registerHook('displayPaymentReturn'); - } - + if ($this->isRegisteredInHook('actionProductCancel')) { $this->unregisterHook('actionProductCancel'); } @@ -139,7 +135,6 @@ public function install() if ( !parent::install() || !$this->registerHook('paymentOptions') - || !$this->registerHook('displayPaymentReturn') || !$this->registerHook('displayAdminOrder') || !$this->registerHook('actionAdminControllerSetMedia') || !$this->registerHook('displayHeader') @@ -226,13 +221,14 @@ public function hookDisplayAdminOrder($params) } $payOrderAmount = 0; + $amountRefunded = 0; $methodName = 'PAY.'; try { $transaction = $this->getTransaction($transactionId); $arrTransactionDetails = $transaction->getData(); $payOrderAmount = $transaction->getPaidAmount(); $status = $arrTransactionDetails['paymentDetails']['stateName']; - $amoutRefunded = $arrTransactionDetails['paymentDetails']['refundAmount'] / 100; + $amountRefunded = $arrTransactionDetails['paymentDetails']['refundAmount'] / 100; $profileId = $transaction->getPaymentProfileId(); $methodName = PaymentMethod::getName($transactionId, $profileId); $showCaptureButton = $transaction->isAuthorized(); @@ -242,12 +238,13 @@ public function hookDisplayAdminOrder($params) $showRefundButton = false; $showCaptureButton = false; $showCaptureRemainingButton = false; + $this->payLog('Pay. Panel', 'Unable to load Pay panel correctly, error: ' . $exception->getMessage(), $cartId, $transactionId); } $amountFormatted = number_format($order->total_paid, 2, ',', '.'); $amountPayFormatted = number_format($payOrderAmount, 2, ',', '.'); - $amountFormattedRefunded = number_format($amoutRefunded, 2, ',', '.'); - $amountFormattedRefundable = number_format($order->total_paid - $amoutRefunded, 2, ',', '.'); + $amountFormattedRefunded = number_format($amountRefunded, 2, ',', '.'); + $amountFormattedRefundable = number_format($order->total_paid - $amountRefunded, 2, ',', '.'); $this->context->smarty->assign(array( 'lang' => $this->getMultiLang(), @@ -258,8 +255,8 @@ public function hookDisplayAdminOrder($params) 'amountFormattedRefunded' => $amountFormattedRefunded, 'amountFormattedRefundable' => $amountFormattedRefundable, 'amount' => $order->total_paid, - 'amoutRefunded' => $amoutRefunded, - 'currency' => $currency->iso_code, + 'amountRefunded' => $amountRefunded, + 'currency' => $currency, 'pay_orderid' => $transactionId, 'status' => $status, 'method' => $methodName, From ff4d4a204990aa77afc63bd07e5c6b005f509ec5 Mon Sep 17 00:00:00 2001 From: kevinverschoor <61683999+kevinverschoor@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:52:56 +0100 Subject: [PATCH 2/2] Code Polish --- paynlpaymentmethods/paynlpaymentmethods.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index de23e15..b23bc71 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -104,7 +104,7 @@ public function __construct() if ($this->isRegisteredInHook('paymentReturn')) { $this->unregisterHook('paymentReturn'); } - + if ($this->isRegisteredInHook('actionProductCancel')) { $this->unregisterHook('actionProductCancel'); }