-
Notifications
You must be signed in to change notification settings - Fork 0
/
Redirect.php
36 lines (31 loc) · 1.51 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
33
34
35
36
<?php
namespace Cardinity\Magento\Controller\Payment;
class Redirect extends \Cardinity\Magento\Controller\Payment
{
public function execute()
{
$authModel = $this->_getAuthModel();
$externalModel = $this->_getExternalModel();
$external = $this->_configData->getConfig('payment/cardinity/external_enabled');
$this->_log("External on redirect ".$external);
if($external == 1 && $externalModel){
$this->_log('redirecting buyer to external hosted page');
$this->_forceRedirect('cardinity/payment/external');
}elseif ($authModel && $authModel->getSuccess()) {
$this->_log('redirecting buyer to success page');
$this->_forceRedirect('cardinity/payment/success');
} elseif ($authModel && ($authModel->getThreeDSecureV2Needed()) ) {
$this->_log('redirecting buyer to authv2 page');
$this->_forceRedirect('cardinity/payment/authv2');
} elseif ($authModel && ($authModel->getThreeDSecureNeeded()) ) {
$this->_log('redirecting buyer to authv1 page');
$this->_forceRedirect('cardinity/payment/auth');
} elseif ($authModel && $authModel->getFailure()) {
$this->_log('redirecting buyer to failure page');
$this->_forceRedirect('cardinity/payment/failure');
} else {
$this->_setMessage(__('Internal error occurred. Please contact support.'), 'error');
$this->_forceRedirect('checkout');
}
}
}