Skip to content

Commit

Permalink
Merge pull request #2 from wirecard/updateToOpenCart2.3.0.2
Browse files Browse the repository at this point in the history
Update to OpenCart2.3.0.2 compatibility
  • Loading branch information
JueGer authored Nov 8, 2016
2 parents 22e31a4 + 1dd7702 commit 1850f5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 62 deletions.
28 changes: 10 additions & 18 deletions catalog/controller/extension/payment/wirecard.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,28 +107,25 @@ public function index()
*/
public function init()
{
/*if (!isset($_POST['wirecard_checkout_page_window_name']) || !isset($_SESSION['order_id'])) {
$this->response->redirect($this->url->link('checkout/checkout', '', true));
}*/
if (isset($_POST['wirecard_checkout_page_window_name'])) {
$data['window_name'] = $_POST['wirecard_checkout_page_window_name'];
}

if (($this->payment_type == WirecardCEE_QPay_PaymentType::INSTALLMENT || $this->payment_type == WirecardCEE_QPay_PaymentType::INVOICE) && !isset($_POST['birthday'])) {
$this->response->redirect($this->url->link('checkout/checkout', '', true));
$this->checkout();
}

$birthday = null;
if ($this->payment_type == WirecardCEE_QPay_PaymentType::INSTALLMENT || $this->payment_type == WirecardCEE_QPay_PaymentType::INVOICE) {
$birthday = date_create($_POST['birthday']);
if (!$birthday) {
$this->response->redirect($this->url->link('checkout/checkout', '', true));
$this->checkout();
}

$diff = $birthday->diff(new DateTime());
$customerAge = $diff->format('%y');
if ($customerAge < self::INVOICE_INSTALLMENT_MIN_AGE) {
$this->response->redirect($this->url->link('checkout/checkout', '', true));
$this->checkout();
}
}

Expand Down Expand Up @@ -176,7 +173,7 @@ public function init()
}
} else {
$this->session->data['error'] = $this->language->get('error_init');
$this->response->redirect($this->url->link('checkout/checkout', '', true));
$this->checkout();
}

// Template Output
Expand Down Expand Up @@ -282,20 +279,12 @@ public function callback()
/**
* @var $return WirecardCEE_QPay_Return_Cancel
*/
// $this->model_checkout_order->addOrderHistory($order_id, $cancelStatus);
// $this->model_checkout_order->update($order_id, $cancelStatus, $comment,
// false);
break;

case WirecardCEE_QPay_ReturnFactory::STATE_FAILURE:
/**
* @var $return WirecardCEE_QPay_Return_Failure
*/
// $this->model_checkout_order->addOrderHistory($order_id, $failureStatus, '',
// false);
//$this->model_checkout_order->update($order_id, $failureStatus, $return->getErrors()->getConsumerMessage(), false);
//$this->model_extension_payment_wirecard->write_log($e->getMessage());
$this->session->data['error'] = $return->getError()->getMessage();
break;

default:
Expand All @@ -313,22 +302,25 @@ public function callback()
*/
public function success()
{
$this->response->redirect($this->url->link('checkout/success', '', true));
echo '<script type="text/javascript"> parent.location ="' . $this->url->link('checkout/success') . '"</script>';
echo '<noscript>Javascript muss aktiviert sein</noscript>';
}

/**
* redirection of canceled or not finished payment
*/
public function checkout()
{
$this->response->redirect($this->url->link('checkout/checkout', '', true));
echo '<script type="text/javascript"> parent.location ="' . $this->url->link('checkout/checkout') . '"</script>';
echo '<noscript>Javascript muss aktiviert sein</noscript>';
}

/**
* redirection of failed payment
*/
public function failure()
{
$this->response->redirect($this->url->link('checkout/failure', '', true));
echo '<script type="text/javascript"> parent.location ="' . $this->url->link('checkout/failure') . '"</script>';
echo '<noscript>Javascript muss aktiviert sein</noscript>';
}
}

This file was deleted.

0 comments on commit 1850f5e

Please sign in to comment.