Skip to content

Commit

Permalink
Merge pull request conekta#30 from conekta/fix/error-display
Browse files Browse the repository at this point in the history
Sending all error messages in URL in order to allow the template to d…
  • Loading branch information
andreasantillana authored Jan 4, 2017
2 parents d0eea12 + 862566f commit 7454800
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions conektaprestashop.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function hookPayment($params)
$this->smarty->assign('banorte', Configuration::get('CONEKTA_BANORTE'));

if (Tools::getIsset("message")) {
$this->smarty->assign("message", Tools::getIsset("message"));
$this->smarty->assign("message", $_GET['message']);
return $this->fetchTemplate('payment-methods-all.tpl');
} else {
$this->smarty->assign("message", '');
Expand Down Expand Up @@ -648,13 +648,16 @@ public function processPayment($token, $type, $monthly_installments)

Tools::redirect($redirect);
} catch (\Conekta\ErrorList $e) {
$message = $e->details[0]->message_to_purchaser;
$message = "";
if (version_compare(_PS_VERSION_, '1.4.0.3', '>') && class_exists('Logger')) {
foreach ($e->details as $single_error) {
Logger::addLog($this->l('Payment transaction failed') . ' ' . $single_error->message_to_purchaser, 2, null, 'Cart', (int)$this->context->cart->id, true);
}

}
foreach($e->details as $single_error){
$message .= $single_error->message_to_purchaser . ' ';
}

$controller = Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc.php' : 'order.php';
$location = $this->context->link->getPageLink($controller, true) . (strpos($controller, '?') !== false ? '&' : '?') . 'step=3&conekta_error=1&message=' . $message . '#conekta_error';
Expand Down

0 comments on commit 7454800

Please sign in to comment.