В OcStore 0.2.2 просто катастрофическая ошибка в контроллере приёма оплаты через qiwi
в файле
catalog/controller/payment/qiwi.php
в строке 143
нужно вместо
if( $param->status = 60 ) {сделать
if( $param->status == 60 ) {
иначе при любом ответе от qiwi товар проставляется как оплаченный.
В новой версии модуля не проверял, может и там ошибка есть.
также сегодня когда испраил это, добавил расширенные комментарии при обработке ответов с сервера qiwi
в итоге вот мой исправленный контроллер (может кому пригодится)
ВНИМАНИЕ !!! Контроллер из версии OcStore 0.2.2.
<?php
class ControllerPaymentQiwi extends Controller {
protected function index() {
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
$this->data['action'] = 'https://w.qiwi.ru/setInetBill_utf.do';
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
// TETS
$this->load->language('payment/qiwi');
$this->data['sub_text_info'] = $this->language->get('sub_text_info');
$this->data['sub_text_info_phone'] = $this->language->get('sub_text_info_phone');
// Переменные
$this->data['from'] = $this->config->get('qiwi_shop_id');
$this->data['txn_id'] = $this->session->data['order_id'];
$this->data['com'] = html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8');
$this->data['summ'] = $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
$this->data['check_agt'] = false;
$this->data['lifetime'] = (int)$this->config->get('qiwi_lifetime');
$this->data['return'] = HTTP_SERVER . 'index.php?route=checkout/success';
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$this->data['cancel_return'] = HTTP_SERVER . 'index.php?route=checkout/payment';
} else {
$this->data['cancel_return'] = HTTP_SERVER . 'index.php?route=checkout/guest_step_2';
}
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$this->data['back'] = HTTP_SERVER . 'index.php?route=checkout/payment';
} else {
$this->data['back'] = HTTP_SERVER . 'index.php?route=checkout/guest_step_2';
}
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/qiwi.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/qiwi.tpl';
} else {
$this->template = 'default/template/payment/qiwi.tpl';
}
$this->render();
}
public function confirm() {
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
if(!$order_info) return;
$order_id = $this->session->data['order_id'];
if( $order_info['order_status_id'] == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('qiwi_order_status_progress_id'), 'QIWI');
return;
}
if( $order_info['order_status_id'] != $this->config->get('qiwi_order_status_progress_id')) {
$this->model_checkout_order->update($order_id, $this->config->get('qiwi_order_status_progress_id'),'QIWI',TRUE);
}
}
public function fail() {
$this->redirect(HTTP_SERVER . 'index.php?route=checkout/payment');
return TRUE;
}
public function success() {
$this->redirect(HTTP_SERVER . 'index.php?route=checkout/success');
return TRUE;
}
public function callback() {
$s = new SoapServer(DIR_CONFIG . 'ishopclientws.wsdl');
$s->setClass('qiwiSoap');
$s->handle();
exit;
}
}
class qiwiSoap extends model {
public function __construct() {
global $registry;
$this->registry = $registry;
}
public function updateBill($param) {
/*
$k = var_export($param, true);
$this->log->write('PHP Fatal Error: ' . $k . ' in qiwi');
*/
// Проверка на ID магазина
if($param->login != $this->config->get('qiwi_shop_id')) {
$param->updateBillResult = 150;
return $param;
}
$order_id = (int)$param->txn;
$hash = strtoupper( md5( $order_id . strtoupper( md5($this->config->get('qiwi_password')))));
// Проверка на пароль
if($param->password != $hash) {
$param->updateBillResult = 150;
return $param;
}
// Проверка на номер заказа
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ( ! $order_info) {
$param->updateBillResult = 210;
return $param;
}
$param->updateBillResult = 0;
// Изменяем статус заказа
$comment = 'QIWI';
$comments[50] = 'счёт выставлен';
$comments[52] = 'счёт проводится';
$comments[60] = 'счёт оплачен';
$comments[150] = 'счёт отменен пользователем или ошибка на терминале';
$comments[151] = 'счёт отменен (ошибка авторизации: недостаточно средств на балансе, отклонен абонентом оплате с лицевого счета оператора сотовой связи и т.п.)';
$comments[160] = 'счёт отменен';
$comments[161] = 'счёт отменен (истекло время)';
if(isset($comments[$param->status])) $comment .= ': '.$comments[$param->status];
// Стутс проведения счета.
if( $param->status == 60 ) {
if( $order_info['order_status_id'] == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('qiwi_order_status_id'), $comment);
return $param;
}
if( $order_info['order_status_id'] != $this->config->get('qiwi_order_status_id')) {
$this->model_checkout_order->update($order_id, $this->config->get('qiwi_order_status_id'), $comment, TRUE);
}
} elseif( $param->status >= 150) {
if( $order_info['order_status_id'] == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('qiwi_order_status_cancel_id'), $comment);
return $param;
}
if( $order_info['order_status_id'] != $this->config->get('qiwi_order_status_cancel_id')) {
$this->model_checkout_order->update($order_id, $this->config->get('qiwi_order_status_cancel_id'), $comment, TRUE);
}
} else {
if( $order_info['order_status_id'] == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('qiwi_order_status_progress_id'), $comment);
return $param;
}
if( $order_info['order_status_id'] != $this->config->get('qiwi_order_status_progress_id')) {
$this->model_checkout_order->update($order_id, $this->config->get('qiwi_order_status_progress_id'), $comment, TRUE);
}
}
return $param;
}
}
?>