OpenCart 🇺🇦

Схема

public mixed callback ( )

Аргументы

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

Описание

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

Исходный код

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

$this->data['title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name'));

if (!isset($this->request->server['HTTPS']) || ($this->request->server['HTTPS'] != 'on')) {
	$this->data['base'] = $this->config->get('config_url');
} else {
	$this->data['base'] = $this->config->get('config_ssl');
}

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

$this->data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name'));

$this->data['text_response'] = $this->language->get('text_response');
$this->data['text_success'] = $this->language->get('text_success');
$this->data['text_success_wait'] = sprintf($this->language->get('text_success_wait'), $this->url->link('checkout/success'));
$this->data['text_failure'] = $this->language->get('text_failure');
$this->data['text_failure_wait'] = sprintf($this->language->get('text_failure_wait'), $this->url->link('checkout/checkout', '', 'SSL'));

if (isset($this->request->post['transStatus']) && $this->request->post['transStatus'] == 'Y') { 
	$this->load->model('checkout/order');

	// If returned successful but callbackPW doesn't match, set order to pendind and record reason
	if (isset($this->request->post['callbackPW']) && ($this->request->post['callbackPW'] == $this->config->get('worldpay_password'))) {
		$this->model_checkout_order->confirm($this->request->post['cartId'], $this->config->get('worldpay_order_status_id'));
	} else {
		$this->model_checkout_order->confirm($this->request->post['cartId'], $this->config->get('config_order_status_id'), $this->language->get('text_pw_mismatch'));
	}

	$message = '';

	if (isset($this->request->post['transId'])) {
		$message .= 'transId: ' . $this->request->post['transId'] . "\n";
	}

	if (isset($this->request->post['transStatus'])) {
		$message .= 'transStatus: ' . $this->request->post['transStatus'] . "\n";
	}

	if (isset($this->request->post['countryMatch'])) {
		$message .= 'countryMatch: ' . $this->request->post['countryMatch'] . "\n";
	}

	if (isset($this->request->post['AVS'])) {
		$message .= 'AVS: ' . $this->request->post['AVS'] . "\n";
	}	

	if (isset($this->request->post['rawAuthCode'])) {
		$message .= 'rawAuthCode: ' . $this->request->post['rawAuthCode'] . "\n";
	}	

	if (isset($this->request->post['authMode'])) {
		$message .= 'authMode: ' . $this->request->post['authMode'] . "\n";
	}	

	if (isset($this->request->post['rawAuthMessage'])) {
		$message .= 'rawAuthMessage: ' . $this->request->post['rawAuthMessage'] . "\n";
	}	

	if (isset($this->request->post['wafMerchMessage'])) {
		$message .= 'wafMerchMessage: ' . $this->request->post['wafMerchMessage'] . "\n";
	}				

	$this->model_checkout_order->update($this->request->post['cartId'], $this->config->get('worldpay_order_status_id'), $message, false);

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

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

	$this->response->setOutput($this->render());				
} else {
	$this->data['continue'] = $this->url->link('checkout/cart');

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

	$this->response->setOutput($this->render());					
}