Skip to content

Commit

Permalink
Code polish
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse committed Jun 2, 2021
1 parent f08f8b0 commit cbc278b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 5 additions & 7 deletions Controller/Checkout/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,13 @@ public function execute()
$payment = $order->getPayment();
$info = $payment->getAdditionalInformation();
if (!empty($info['transactionId'])) {
if($info['transactionId'] != $payOrderId) {
$this->logger->critical('transaction not equal');
if ($info['transactionId'] != $payOrderId) {
$this->logger->critical('Transaction not equal');
return $this->result->setContents('FALSE| Cannot load order');
} else {
$this->logger->debug('transactions match!');
}
} else {
$this->logger->critical('transaction not set in order');
return $this->result->setContents('TRUE| Failed. transaction not set.');
$this->logger->critical('Transaction not set in order');
return $this->result->setContents('TRUE| Failed. Transaction not set.');
}

if ($order->getTotalDue() <= 0) {
Expand All @@ -196,7 +194,7 @@ public function execute()
return $this->result->setContents('TRUE| Already captured.');
}
}

if ($transaction->isPaid() || $transaction->isAuthorized()) {
return $this->processPaidOrder($transaction, $order);
} elseif ($transaction->isCanceled()) {
Expand Down
3 changes: 1 addition & 2 deletions Controller/Checkout/Finish.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function execute()
$bDenied = $orderStatusId === Config::ORDERSTATUS_DENIED;
$pinStatus = null;
$pinCanceled = null;

try {
$this->checkEmpty($payOrderId, 'payOrderid', 101);
$this->checkEmpty($magOrderId, 'magOrderId', 1012);
Expand All @@ -114,7 +114,6 @@ public function execute()

if (!empty($information['terminal_hash'])) {
$status = \Paynl\Instore::status(['hash' => $information['terminal_hash']]);
$this->logger->debug($status->getTransactionState(), $params);
$pinStatus = $status->getTransactionState();
$pinCanceled = false;
if (in_array($pinStatus, ['cancelled', 'expired', 'error'])) {
Expand Down

0 comments on commit cbc278b

Please sign in to comment.