-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathredirect.php
32 lines (25 loc) · 1.03 KB
/
redirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Redirect to PlacetoPay
*/
use PlacetoPay\Loggers\PaymentLogger;
try {
require_once 'helpers.php';
$pathCMS = getPathCMS('redirect.php');
require fixPath($pathCMS . '/config/config.inc.php');
require fixPath($pathCMS . '/init.php');
require fixPath(sprintf('%s/%2$s/%2$s.php', _PS_MODULE_DIR_, getModuleName()));
if (!Context::getContext()->customer->isLogged() && !Context::getContext()->customer->is_guest) {
PaymentLogger::log('Access not allowed', PaymentLogger::WARNING, 17, __FILE__, __LINE__);
Tools::redirect('authentication.php?back=order.php');
}
$cart = Context::getContext()->cart;
if (!Validate::isLoadedObject($cart)) {
PaymentLogger::log('Cart not found', PaymentLogger::ERROR, 18, __FILE__, __LINE__);
Tools::redirect('authentication.php?back=order.php');
}
(new PlacetoPayPayment())->redirect($cart);
} catch (Throwable $e) {
PaymentLogger::log($e->getMessage(), PaymentLogger::ERROR, 999, __FILE__, __LINE__);
die($e->getMessage());
}