tobelyan/e-hdm
Composer 安装命令:
composer require tobelyan/e-hdm
包简介
A PHP package for integrating with the Armenian electronic cash register (HDM) API.
关键字:
README 文档
README
A PHP package for integrating with the Armenian electronic cash register (HDM) API. This package provides a set of tools to interact with the electronic cash register system, making it easier to manage receipts, activate devices, configure departments, and more.
Sponsored by Turn.am
Installation
You can install the package via Composer:
composer require tobelyan/e-hdm
EHDM_API_BASE_URL=http://example.com/api/v1.0
## Use the Service in Laravel
namespace App\Http\Controllers;
use Tobelyan\EHDM\Services\HDMService;
class ExampleController extends Controller { public function index() { $baseUrl = config('ehdm.api_base_url'); $hdmService = new HDMService($baseUrl);
try {
$status = $hdmService->checkServiceStatus();
return response()->json($status);
} catch (HDMException $e) {
return response()->json(['error' => $e->getMessage()], 500);
}
}
}
Exception Handling
use Tobelyan\EHDM\Services\HDMService;
use Tobelyan\EHDM\Exceptions\HDMException;
$baseUrl = 'http://example.com/api/v1.0';
$hdmService = new HDMService($baseUrl);
try {
$response = $hdmService->activate('31801118');
echo 'Service activated: ' . json_encode($response);
} catch (HDMException $e) {
echo 'Failed to activate service: ' . $e->getErrorMessage();
echo 'Error Code: ' . $e->getErrorCode();
}
## Available Methods
1. checkServiceStatus()
Description: Checks the availability of the HDM API service.
Request Method: GET
Returns: An array containing the service status details.
2. activate(string $crn)
Description: Activates the electronic cash register (ՀԴՄ).
Request Method: POST
Parameters:
crn (string): The registration number of the cash register.
Returns: An array with the result of the activation request.
3. configureDepartments(array $data)
Description: Configures the departments and their tax regimes for the electronic cash register.
Request Method: POST
Parameters:
data (array): An associative array containing department configurations:
crn (string): Registration number of the cash register.
seq (int): The sequence number of the request.
departments (array): List of department configurations, where each entry includes:
departmentId (int): Department ID.
taxRegime (int): Tax regime (1 - VAT, 2 - non-VAT, etc.).
Returns: An array with the configuration status.
4. printReceipt(array $data)
Description: Prints a receipt via the electronic cash register.
Request Method: POST
Parameters:
data (array): An associative array containing receipt details, such as:
crn (string): Registration number of the cash register.
seq (int): The sequence number of the request.
cashierId (int): ID of the cashier.
items (array): List of items in the receipt.
Returns: An array with the receipt print status.
5. printReceiptCopy(string $crn, int $seq, int $receiptId)
Description: Prints a copy of an existing receipt.
Request Method: POST
Parameters:
crn (string): Registration number of the cash register.
seq (int): The sequence number of the request.
receiptId (int): ID of the receipt to print a copy of.
Returns: An array with the receipt copy print status.
6. getReturnedReceiptInfo(string $crn, int $receiptId, int $seq)
Description: Retrieves information about a returned receipt.
Request Method: POST
Parameters:
crn (string): Registration number of the cash register.
receiptId (int): ID of the returned receipt.
seq (int): The sequence number of the request.
Returns: An array with the returned receipt details.
7. printReturnReceipt(array $data)
Description: Prints a return receipt for a transaction.
Request Method: POST
Parameters:
data (array): An associative array containing return receipt details, such as:
crn (string): Registration number of the cash register.
seq (int): The sequence number of the request.
returnItemList (array): List of items to return.
Returns: An array with the return receipt print status.
tobelyan/e-hdm 适用场景与选型建议
tobelyan/e-hdm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「hdm」 「ՀԴՄ」 「Է-ՀԴՄ」 「Էլեկտրոնային ՀԴՄ」 「ՊԵԿ」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tobelyan/e-hdm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tobelyan/e-hdm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-09