承接 tobelyan/e-hdm 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-09