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')); } }
error_reporting(0); $hg_data = JRequest::get('get'); require 'HootkiGrosh.php'; $is_test = $pmconfigs['hgrosh_test'] == 1 ? true : false; // тестовый api $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($is_test); 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; } define('_JEXEC', 1); define('DS', DIRECTORY_SEPARATOR); $option = 'com_jshopping';
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; }
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(); } } }
$arRes = CSalePaySystemAction::GetList(array(), array('ACTION_FILE' => '/bitrix/php_interface/include/sale_payment/hutkigrosh'), false, false, array('PARAMS')); $obRes = $arRes->Fetch(); $arParam = unserialize($obRes['PARAMS']); $arPropPS['LOGIN'] = $arParam['LOGIN']['VALUE']; $arPropPS['PWD'] = $arParam['PWD']['VALUE']; $arPropPS['MODE'] = $arParam['MODE']['VALUE']; $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($arPropPS['MODE']); $res = $hg->apiLogIn($arPropPS['LOGIN'], $arPropPS['PWD']); // Ошибка авторизации if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс } // получаем информацию о счете $info = $hg->apiBillInfo($billID); if (!$info) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $ORDER_ID = $info['invId']; $resOrder = CSaleOrder::GetByID($ORDER_ID); // проверяем статус счета $status = $hg->apiBillStatus($billID); if ($status == 'Payed') { ?> Счет <?php echo $ORDER_ID; ?>
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"); } } }