OpenCart 🇺🇦

Схема

public mixed callback ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

$this->language->load('payment/paymate');

if (isset($this->request->post['ref'])) {
	$order_id = $this->request->post['ref'];
} else {
	$order_id = 0;
}			

$this->load->model('checkout/order');

$order_info = $this->model_checkout_order->getOrder($order_id);	 	

if ($order_info) {
	$error = '';

	if (!isset($this->request->post['responseCode']) || !isset($this->request->get['hash'])) {
		$error = $this->language->get('text_unable');
	} elseif ($this->request->get['hash'] != md5($order_info['order_id'] . $this->currency->format($this->request->post['paymentAmount'], $this->request->post['currency'], 1.0000000, false) . $this->request->post['currency'] . $this->config->get('paymate_password'))) {
		$error = $this->language->get('text_unable');
	} elseif ($this->request->post['responseCode'] != 'PA' && $this->request->post['responseCode'] != 'PP') {
		$error = $this->language->get('text_declined');
	}
} else {
	$error = $this->language->get('text_unable');
}	

if ($error) {
	$this->data['breadcrumbs'] = array();

	$this->data['breadcrumbs'][] = array(
		'href'      => $this->url->link('common/home'),
		'text'      => $this->language->get('text_home'),
		'separator' => false
	);

	$this->data['breadcrumbs'][] = array(
		'href'      => $this->url->link('checkout/cart'),
		'text'      => $this->language->get('text_basket'),
		'separator' => $this->language->get('text_separator')
	);

	$this->data['breadcrumbs'][] = array(
		'href'      => $this->url->link('checkout/checkout', '', 'SSL'),
		'text'      => $this->language->get('text_checkout'),
		'separator' => $this->language->get('text_separator')
	);

	$this->data['breadcrumbs'][] = array(
		'href'      => $this->url->link('checkout/success'),
		'text'      => $this->language->get('text_failed'),
		'separator' => $this->language->get('text_separator')
	);

	$this->data['heading_title'] = $this->language->get('text_failed');

	$this->data['text_message'] = sprintf($this->language->get('text_failed_message'), $error, $this->url->link('information/contact'));

	$this->data['button_continue'] = $this->language->get('button_continue');

	$this->data['continue'] = $this->url->link('common/home');

	if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/success.tpl')) {
		$this->template = $this->config->get('config_template') . '/template/common/success.tpl';
	} else {
		$this->template = 'default/template/common/success.tpl';
	}

	$this->children = array(
		'common/column_left',
		'common/column_right',
		'common/content_top',
		'common/content_bottom',
		'common/footer',
		'common/header'
	);

	$this->response->setOutput($this->render());
} else {
	$this->model_checkout_order->confirm($order_id, $this->config->get('paymate_order_status_id'));

	$this->redirect($this->url->link('checkout/success'));			
}