Skip to content

Commit

Permalink
Improved logging and a minor fix in config retrieval.
Browse files Browse the repository at this point in the history
  • Loading branch information
QualityWorks-Dev committed Nov 8, 2017
1 parent 1a2a152 commit 37ea355
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion catalog/controller/extension/payment/mollie/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,15 @@ public function callback()
);
}

$this->writeToMollieLog("Received callback for order " . $order_id);

// Load required translations.
$this->load->language("extension/payment/mollie");

// Double-check whether or not the status of the order is correct.
$model = $this->getModuleModel();

$paid_status_id = intval($this->config->get("mollie_ideal_processing_status_id"));
$paid_status_id = intval($this->config->get($moduleCode . "_ideal_processing_status_id"));
$payment_id = $model->getPaymentID($order['order_id']);

if ($payment_id === false) {
Expand All @@ -409,6 +411,12 @@ public function callback()
$failed_status_id = $this->config->get($moduleCode . "_ideal_failed_status_id");

if (!$order || ($failed_status_id && $order['order_status_id'] == $failed_status_id)) {
if ($failed_status_id && $order['order_status_id'] == $failed_status_id) {
$this->writeToMollieLog("Error payment failed for order " . $order['order_id']);
} else {
$this->writeToMollieLog("Error couldn't find order");
}

return $this->showReturnPage(
$this->language->get("heading_failed"),
$this->language->get("msg_failed")
Expand All @@ -417,6 +425,8 @@ public function callback()

// If the order status is 'processing' (i.e. 'paid'), redirect to OpenCart's default 'success' page.
if ($order["order_status_id"] == $this->config->get($moduleCode . "_ideal_processing_status_id")) {
$this->writeToMollieLog("Success redirect to success page for order " . $order['order_id']);

if ($this->cart) {
$this->cart->clear();
}
Expand All @@ -428,6 +438,8 @@ public function callback()

// If the status is 'pending' (i.e. a bank transfer), the report is not delivered yet.
if ($order['order_status_id'] == $this->config->get($moduleCode . "_ideal_pending_status_id")) {
$this->writeToMollieLog("Unknown payment status for order " . $order['order_id']);

if ($this->cart) {
$this->cart->clear();
}
Expand All @@ -446,6 +458,8 @@ public function callback()
}

// Show a 'transaction failed' page if all else fails.
$this->writeToMollieLog("Everything else failed for order " . $order['order_id']);

return $this->showReturnPage(
$this->language->get("heading_failed"),
$this->language->get("msg_failed")
Expand Down

0 comments on commit 37ea355

Please sign in to comment.