alexantr / hootkigrosh
该软件包已被废弃,不再维护。未建议替代软件包。
与 Hutki Grosh API (www.hutkigrosh.by) 合作
v1.1
2017-04-19 15:52 UTC
Requires
- php: >=5.3.3
- ext-curl: *
This package is not auto-updated.
Last update: 2022-02-05 03:43:57 UTC
README
用于操作“Хуткі Грош”API服务的类
安装
通过 Composer 安装
composer require alexantr/hootkigrosh "~1.0"
使用示例
初始化
require 'HootkiGrosh.php'; $user = 'user@org.com'; // имя пользователя $pwd = 'paSSwo_rd'; // пароль $is_test = true; // тестовый api $hg = new \Alexantr\HootkiGrosh\HootkiGrosh($is_test);
授权
$res = $hg->apiLogIn($user, $pwd); // Ошибка авторизации if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; }
将新账户添加到系统中
$data = array( 'eripId' => '40000001', 'invId' => 'C-1234', 'fullName' => 'Пупкин Василий Иванович', 'mobilePhone' => '+333 33 3332221', 'email' => 'pupkin@org.com', 'fullAddress' => 'г.Минск, пр.Победителей, д.1, кв.1', 'amt' => 120000, 'products' => array( array( 'invItemId' => 'Артикул 123', 'desc' => 'Услуга, за которую производят оплату', 'count' => 1, 'amt' => 119000, ), array( 'invItemId' => '-нет-', 'desc' => 'Доставка', 'count' => 1, 'amt' => 1000, ), ), ); $billID = $hg->apiBillNew($data); if (!$billID) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } echo 'bill ID: ' . $billID . '<br>';
账户状态
$status = $hg->apiBillStatus($billID); if (!$status) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } echo 'Статус: ' . $status . ' (' . $hg->getPurchItemStatus($status) . ')<br>';
账户信息
$info = $hg->apiBillInfo($billID); if (!$info) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } echo '<pre>' . print_r($info, true) . '</pre>';
删除账户
$res = $hg->apiBillDelete($billID); if (!$res) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; }
最近支付列表
$info = $hg->apiPayedBills($eripID, $lastBillID); if (!$info) { echo $hg->getError(); $hg->apiLogOut(); // Завершаем сеанс exit; } echo '<pre>' . print_r($info, true) . '</pre>';
响应数据转储
$response = $hg->getResponse(); echo '<hr><pre>' . htmlspecialchars($response) . '</pre>';
结束会话
$res = $hg->apiLogOut();