public function notify() { $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($this->config->get('hutkigrosh_test')); if (isset($hg_data["purchaseid"])) { $this->_login = $this->config->get('hutkigrosh_login'); // имя пользователя $this->_pwd = $this->config->get('hutkigrosh_pswd'); // пароль $name = $this->_login; $pwd = $this->_pwd; $res = $hg->apiLogIn($name, $pwd); // Ошибка авторизации if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $info = $hg->apiBillInfo($hg_data["purchaseid"]); if (!$info) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $order_mer_code = IntVal($info['invId']); $this->load->model('checkout/order'); $this->model_checkout_order->update($order_mer_code, $this->config->get('processing_status_id')); } }
<?php require 'HootkiGrosh.php'; $is_test = $_POST['is_test'] == 1 ? true : false; $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($is_test); $name = $_POST['login']; $pwd = $_POST['pwd']; $res = $hg->apiLogIn($name, $pwd); if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $data = array('billid' => $_POST['billid'], 'phone' => $_POST['phone']); $responce = $hg->apiAlfaClick($data); $responceXML = simplexml_load_string($responce); echo $responceXML->__toString();
public function notify() { $pendingStatusId = $this->config->get('hutkigrosh_order_status_pending'); $payedStatusId = $this->config->get('hutkigrosh_order_status_payed'); $errorStatusId = $this->config->get('hutkigrosh_order_status_error'); if (is_numeric($pendingStatusId) || is_numeric($payedStatusId) || is_numeric($errorStatusId)) { if (isset($this->request->get['purchaseid'])) { $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($this->config->get('hutkigrosh_test')); $res = $hg->apiLogIn($this->config->get('hutkigrosh_login'), $this->config->get('hutkigrosh_pswd')); if (!$res) { echo $hg->getError(); $hg->apiLogOut(); exit; } $info = $hg->apiBillInfo($this->request->get['purchaseid']); if (empty($info)) { echo $hg->getError(); } else { $this->load->model('checkout/order'); if ($info['statusEnum'] == 'Payed') { if (is_numeric($payedStatusId)) { $this->model_checkout_order->update(IntVal($info['invId']), $payedStatusId); } } elseif (in_array($info['statusEnum'], array('Outstending', 'DeletedByUser', 'PaymentCancelled'))) { if (is_numeric($errorStatusId)) { $this->model_checkout_order->update(IntVal($info['invId']), $errorStatusId); } } elseif (in_array($info['statusEnum'], array('PaymentPending', 'NotSet'))) { if (is_numeric($pendingStatusId)) { $this->model_checkout_order->update(IntVal($info['invId']), $pendingStatusId); } } } $hg->apiLogOut(); } } }
function getUrlParams($pmconfigs) { $params = array(); require 'HootkiGrosh.php'; $is_test = $pmconfigs['hgrosh_test'] == 1 ? true : false; // тестовый api $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($is_test); $hg_data = JRequest::get('get'); if (isset($hg_data["purchaseid"])) { $res = $hg->apiLogIn($pmconfigs['hgrosh_login'], $pmconfigs['hgrosh_pswd']); // Ошибка авторизации if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $info = $hg->apiBillInfo($hg_data["purchaseid"]); if (!$info) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } if (!$info) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $params['order_id'] = IntVal($info['invId']); $params['hash'] = ''; $params['checkHash'] = false; $params['checkReturnParams'] = $params['order_id'] > 0 ? true : false; } return $params; }
function nzshpcrt_hutkigrosh_callback() { date_default_timezone_set('Europe/Minsk'); global $wpdb; if (isset($_GET['hutkigrosh_callback']) && $_GET['hutkigrosh_callback'] == 1) { if (isset($_GET['purchaseid'])) { $login = get_option('hutkigrosh_login'); $pwd = get_option('hutkigrosh_pswd'); $mode = get_option('hutkigrosh_debug'); $billID = $_GET['purchaseid']; $arError = array(); $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($mode); $res = $hg->apiLogIn($login, $pwd); // Ошибка авторизации if (!$res) { $arError[] = $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс } // получаем информацию о счете $info = $hg->apiBillInfo($billID); if (!$info) { $arError[] = $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс // exit; } $text = ''; foreach ($arError as $k) { $text = ' ' . $k; } $ORDER_ID = $info['invId']; $notes = "Оплачено через hutkigrosh. Номер платежа: " . $ORDER_ID . "; Дата платежа " . date("Y-m-d H:i:s"); $wpdb->query("UPDATE " . WPSC_TABLE_PURCHASE_LOGS . " SET processed = '3', date = '" . time() . "', notes = '" . $notes . "' WHERE id = " . $ORDER_ID . " LIMIT 1"); } } }