OpenCart 🇺🇦

Схема

public mixed callback ( )

Аргументы

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

Описание

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

Исходный код

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

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

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

if ($order_info) {
	$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));

	$verified = true;

	// md5sig validation
	if ($this->config->get('moneybookers_secret')) {
		$hash  = $this->request->post['merchant_id'];
		$hash .= $this->request->post['transaction_id'];
		$hash .= strtoupper(md5($this->config->get('moneybookers_secret')));
		$hash .= $this->request->post['mb_amount'];
		$hash .= $this->request->post['mb_currency'];
		$hash .= $this->request->post['status'];

		$md5hash = strtoupper(md5($hash));
		$md5sig = $this->request->post['md5sig'];

		if ($md5hash != $md5sig) {
			$verified = false;
		}
	}

	if ($verified) {
		switch($this->request->post['status']) {
			case '2':
				$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_id'), '', true);
				break;
			case '0':
				$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_pending_status_id'), '', true);
				break;
			case '-1':
				$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_canceled_status_id'), '', true);
				break;
			case '-2':
				$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_failed_status_id'), '', true);
				break;
			case '-3':
				$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_chargeback_status_id'), '', true);
				break;
		}
	} else {
		$this->log->write('md5sig returned (' + $md5sig + ') does not match generated (' + $md5hash + '). Verify Manually. Current order state: ' . $this->config->get('config_order_status_id'));
	}
}