Skip to content

Commit

Permalink
Merge pull request #87 from paynl/feature/PLUG-3247
Browse files Browse the repository at this point in the history
PLUG-3247 - Remove unused hook
  • Loading branch information
woutse authored Feb 26, 2024
2 parents 609ac5c + ff4d4a2 commit 46dc905
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions paynlpaymentmethods/paynlpaymentmethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down Expand Up @@ -105,10 +105,6 @@ public function __construct()
$this->unregisterHook('paymentReturn');
}

if (!$this->isRegisteredInHook('displayPaymentReturn')) {
$this->registerHook('displayPaymentReturn');
}

if ($this->isRegisteredInHook('actionProductCancel')) {
$this->unregisterHook('actionProductCancel');
}
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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();
Expand All @@ -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(),
Expand All @@ -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,
Expand Down

0 comments on commit 46dc905

Please sign in to comment.