Skip to content

Commit

Permalink
Merge pull request #109 from paynl/feature/PLUG-264
Browse files Browse the repository at this point in the history
Feature/plug 264
  • Loading branch information
woutse authored Dec 21, 2020
2 parents dca85c4 + bb14b3b commit d2db45e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Controller/Checkout/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ public function execute()
\Paynl\Config::setApiToken($this->config->getApiToken());

$params = $this->getRequest()->getParams();
$action = !empty($params['action']) ? strtolower($params['action']) : '';

if ($action == 'pending') {
return $this->result->setContents('TRUE| Ignore pending');
}

if (!isset($params['order_id'])) {
$this->logger->critical('Exchange: order_id is not set in the request', $params);

Expand All @@ -136,7 +142,7 @@ public function execute()
}

if ($transaction->isPending()) {
if (isset($params['action']) && $params['action'] == 'new_ppt') {
if ($action == 'new_ppt') {
return $this->result->setContents("FALSE| Payment is pending");
}
return $this->result->setContents("TRUE| Ignoring pending");
Expand All @@ -152,16 +158,19 @@ public function execute()
return $this->result->setContents('FALSE| Cannot load order');
}
if ($order->getTotalDue() <= 0) {
$this->logger->debug('Total due <= 0, so iam not touching the status of the order: ' . $orderEntityId);
$this->logger->debug('Total due <= 0, so not touching the status of the order: ' . $orderEntityId);

return $this->result->setContents('TRUE| Total due <= 0, so iam not touching the status of the order');
return $this->result->setContents('TRUE| Ignoring: order has already been paid');
}

if ($transaction->isPaid() || $transaction->isAuthorized()) {
return $this->processPaidOrder($transaction, $order);

} elseif ($transaction->isCanceled()) {
return $this->cancelOrder($order);
if ($order->isCanceled()) {
return $this->result->setContents("TRUE| ALLREADY CANCELED");
} else {
return $this->cancelOrder($order);
}
}

}
Expand Down

0 comments on commit d2db45e

Please sign in to comment.