Skip to content

Commit

Permalink
BOD-7160 (#77)
Browse files Browse the repository at this point in the history
* Reformatting

* [BOD-7160] Changes needed for 1.7.7 etc.

* Reformatting

* Remove old logo and fix header
  • Loading branch information
sessan authored Nov 9, 2023
1 parent 76df61e commit 0631400
Show file tree
Hide file tree
Showing 6 changed files with 3,603 additions and 2,995 deletions.
123 changes: 65 additions & 58 deletions epay/controllers/front/accept.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,65 @@
<?php
/**
* Copyright (c) 2019. All rights reserved ePay A/S (a Bambora Company).
*
* This program is free software. You are allowed to use the software but NOT allowed to modify the software.
* It is also not legal to do any changes to the software and distribute it in your own name / brand.
*
* All use of the payment modules happens at your own risk. We offer a free test account that you can use to test the module.
*
* @author ePay A/S (a Bambora Company)
* @copyright Bambora (http://bambora.com) (http://www.epay.dk)
* @license ePay A/S (a Bambora Company)
*/
include 'baseaction.php';

class EPayAcceptModuleFrontController extends BaseAction
{
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
$message = '';
$responseCode = '400';
$cart = null;
if ($this->validateAction(false, $message, $cart)) {
$message = $this->processAction($cart, false, $responseCode);
if ($responseCode != 200) {
$this->handleError($message, $cart);
}
$this->redirectToAccept($cart);
} else {
$message = empty($message) ? $this->l('Unknown error') : $message;
$this->handleError($message, $cart);
}
}

/**
* Redirect To Accept.
*
* @param mixed $cart
*/
private function redirectToAccept($cart)
{
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $cart->secure_key . '&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) Order::getOrderByCartId($cart->id));
}

private function handleError($message, $cart)
{
$this->createLogMessage($message, 3, $cart);
Context::getContext()->smarty->assign('paymenterror', $message);
if ($this->module->getPsVersion() === EPay::V17) {
$this->setTemplate('module:epay/views/templates/front/paymenterror17.tpl');
} else {
$this->setTemplate('paymenterror.tpl');
}
}
}
<?php

/**
* Copyright (c) 2019. All rights reserved ePay A/S (a Bambora Company).
*
* This program is free software. You are allowed to use the software but NOT allowed to modify the software.
* It is also not legal to do any changes to the software and distribute it in your own name / brand.
*
* All use of the payment modules happens at your own risk. We offer a free test account that you can use to test the module.
*
* @author ePay A/S (a Bambora Company)
* @copyright Bambora (http://bambora.com) (http://www.epay.dk)
* @license ePay A/S (a Bambora Company)
*/
include 'baseaction.php';

class EPayAcceptModuleFrontController extends BaseAction
{
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
$message = '';
$responseCode = '400';
$cart = null;
if ($this->validateAction(false, $message, $cart)) {
$message = $this->processAction($cart, false, $responseCode);
if ($responseCode != 200) {
$this->handleError($message, $cart);
}
$this->redirectToAccept($cart);
} else {
$message = empty($message) ? $this->l('Unknown error') : $message;
$this->handleError($message, $cart);
}
}

/**
* Redirect To Accept.
*
* @param mixed $cart
*/
private function redirectToAccept($cart)
{
Tools::redirectLink(
__PS_BASE_URI__ . 'order-confirmation.php?key=' . $cart->secure_key . '&id_cart=' . (int)$cart->id . '&id_module=' . (int)$this->module->id . '&id_order=' . (int)Order::getOrderByCartId(
$cart->id
)
);
}

private function handleError($message, $cart)
{
$this->createLogMessage($message, 3, $cart);
Context::getContext()->smarty->assign('paymenterror', $message);
if ($this->module->getPsVersion() === EPay::V17) {
$this->setTemplate(
'module:epay/views/templates/front/paymenterror17.tpl'
);
} else {
$this->setTemplate('paymenterror.tpl');
}
}
}
Loading

0 comments on commit 0631400

Please sign in to comment.