<?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() { $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 /* * @info Платёжный модуль hutkigrosh для JoomShopping * @package JoomShopping for Joomla! * @subpackage payment * @author hutkigrosh.by */ 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) {
$arPropPS['HG_CANCEL_RETURN_URL'] = CSalePaySystemAction::GetParamValue("HG_CANCEL_RETURN_URL"); $arPropPS['HG_NOTIFY_URL'] = CSalePaySystemAction::GetParamValue("HG_NOTIFY_URL"); $ORDER_ID = CSalePaySystemAction::GetParamValue("ORDER_ID"); //выберем все товары из корзины $arBasketItems = array(); $dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => $ORDER_ID), false, false, array("ID", "NAME", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT")); while ($arItems = $dbBasketItems->Fetch()) { if (strlen($arItems["CALLBACK_FUNC"]) > 0) { CSaleBasket::UpdatePrice($arItems["ID"], $arItems["CALLBACK_FUNC"], $arItems["MODULE"], $arItems["PRODUCT_ID"], $arItems["QUANTITY"]); $arItems = CSaleBasket::GetByID($arItems["ID"]); } $arBasketItems[] = $arItems; } $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($arPropPS['MODE']); if (!$_GET['alfaclick']) { $res = $hg->apiLogIn($arPropPS['LOGIN'], $arPropPS['PWD']); } else { $res = $hg->apiLogIn($_SESSION['HG_LOGIN'], $_SESSION['HG_PWD']); } // Ошибка авторизации if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } /// создаем заказ if (is_array($arBasketItems)) { $totalSummOrder = 0; foreach ($arBasketItems as $line_item) { $arItem['invItemId'] = $line_item['ID'];
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(); } } }
<?php require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php"; $APPLICATION->SetTitle("Оплата заказа"); include 'HootkiGrosh.php'; if (CModule::IncludeModule("sale")) { if ($_REQUEST['purchaseid']) { $billID = $_REQUEST['purchaseid']; $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'];
<?php require 'HootkiGrosh.php'; $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($_SESSION['hg_test']); $res = $hg->apiLogIn($_SESSION['hg_login'], $_SESSION['hg_pwd']); if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } $data = array('billid' => htmlspecialchars($_POST['billid']), 'phone' => htmlspecialchars($_POST['phone'])); $hg->apiLogOut(); $responceXML = simplexml_load_string($hg->apiAlfaClick($data)); echo $responceXML->__toString();
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"); } } }