public function callback($order_id, $price, $curr, $order_info)
 {
     // так как это с депозита то функция - приватная
     // тут мы сами делаем проверку - хватает ли на счету средств
     // тут остаток на депозите в валюте глобальной
     // надо сконвертировать цену заказа в валюту магазина
     //$curr_global = $this->config->get('config_currency');
     //$total = $this->currency->convert($price, $curr, $curr_global);
     $total = $price;
     $this->language->load('payment/multi_pay_dep');
     $this->load->model('account/transaction');
     $deposite = $transaction_total = $this->model_account_transaction->getTotalAmount();
     // trigger_error ( ' ' . $total . ' > ' . $deposite, E_USER_NOTICE );
     if ($total > $deposite) {
         // не хватает депозита - игнорируем
         $this->session->data['note'] = _note($this->language->get('note dep not enough'), 'warning');
     } elseif ((int) $order_info['order_status_id'] != 1) {
         // заказ не встадии ожидания оплаты
         $this->language->load('account/multi_pay_order');
         $this->session->data['note'] = _note($this->language->get('note_cant_pay'), 'warning');
     } else {
         // заказ оплачен!
         // поменяем и статус заказа
         $new_status_id = 2;
         // Обработка
         $this->load->model('payment/multi_pay_tools');
         $this->language->load('payment/multi_pay_tools');
         $note_status = ABR_DESCR . sprintf($this->language->get('bill_payed'), '+');
         $this->model_payment_multi_pay_tools->order_bill_update($order_id, $order_info, $new_status_id, $note_status, true);
         // теперь запись в депозит занесем
         $this->load->model('payment/multi_pay_tools');
         $rec_id = $this->model_payment_multi_pay_tools->update_deposit($order_info['customer_id'], -$total, $this->language->get('Paid order №') . $order_id . ': ' . $price . $curr . '<-');
         // сообщим об успехе
         $this->session->data['note'] = _note($this->language->get('note order payed'), 'success');
     }
     // так как платежной службы нет то перенаправим сразу на карточку заказа
     $this->redirect($this->url->link('account/order/info', '&order_id=' . $order_id, 'SSL'));
 }
Example #2
0
 public function edit()
 {
     $upkey = $this->segment(4);
     include YYS_CACHES . 'caches_codes/tag.sys.package.php';
     if (!isset($TAG[$upkey])) {
         _note("没有这个标签");
     }
     $TAG = array("key" => $upkey, "des" => $TAG[$upkey]);
     $TAG['content'] = htmlentities(include YYS_CACHES . 'caches_codes/tag.' . $TAG['key'] . '.php', ENT_NOQUOTES, "utf-8");
     if (isset($_POST['submit'])) {
         $this->create();
     }
     if (empty($_POST)) {
         include $this->dwt(DOWN_M, 'htmlcustom.create');
     }
 }
Example #3
0
 public function order()
 {
     $this->load->helper('multi_pay');
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link(_url($_GET), 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $order_id = _g($_GET, 'order_id', _g($this->session->data, 'order_id'));
     if (!$order_id) {
         $this->redirect($this->url->link('account/order', '', 'SSL'));
     }
     $this->session->data['order_id'] = $order_id;
     $this->language->load('account/multi_pay_order');
     $this->load->model('account/order');
     $order_info = $this->model_account_order->getOrder($order_id);
     $total = $order_info['total'];
     //trigger_error ( 'total:' . $total, E_USER_NOTICE );
     // если заказ с 0 оплатой или уже оплачен - то игнорируем
     if ($total == 0 || $order_info['order_status_id'] != 1) {
         $this->session->data['note'] = _note($this->language->get('note_cant_pay'), 'warning');
         $this->redirect($this->url->link('account/order/info', '&order_id=' . $order_id, 'SSL'));
     }
     //подключаем файл перевода
     $this->language->load('account/order');
     $this->load->model('account/order');
     $order_info = $this->model_account_order->getOrder($order_id);
     $this->load->model('payment/multi_pay');
     $payment_address_res = $this->model_payment_multi_pay->get_payment_address($order_info['customer_id'], $order_info['payment_address_1']);
     $payment_address = $payment_address_res->row;
     //trigger_error ( 'payment_address:' .json_encode($payment_address), E_USER_NOTICE );
     $method_data = $this->model_payment_multi_pay->get_payment_methods($payment_address, $total);
     //trigger_error ( 'method_data:' .json_encode($method_data), E_USER_NOTICE );
     if (empty($method_data)) {
         $this->data['error_warning'] = sprintf($this->language->get('error_no_payment'), $this->url->link('information/contact'));
     } else {
         $this->data['error_warning'] = '';
     }
     $this->document->setTitle($this->language->get('heading_title_ord'));
     $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('text' => $this->language->get('text_account'), 'href' => $this->url->link('account/account', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_order'), 'href' => $this->url->link('account/order/info', '&order_id=' . $order_id, 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title_ord');
     $this->template = _tpl('/template/common/default.tpl', $this->config->get('config_template'));
     $this->children = array('common/content_top', 'common/header');
     $b = '';
     $b .= $this->data['error_warning'];
     $b .= '<h3>' . $this->language->get('text_subtitle') . '</h3>';
     $b .= $this->model_payment_multi_pay->payment_methods($method_data);
     $b .= '';
     $this->data['body'] = $b;
     $this->data['column_left'] = '';
     $this->data['column_right'] = '';
     $this->data['content_bottom'] = '';
     $this->data['footer'] = '';
     $this->response->setOutput($this->render());
 }