fritak/eet
Composer 安装命令:
composer require fritak/eet
包简介
API for EET (electronic sales record) client in PHP
README 文档
README
This code is an implementation of the EET ("elektronická evidence tržeb") in a PHP. Be aware that this library is working even from your localhost, if you have an internet connection.
INSTALLATION
composer require "fritak/eet"
REQUIREMENTS
The minimum requirement is PHP 5.6 on your Web Server. Prerequisite are these libraries and php extensions:
- robrichards/wse-php
- robrichards/xmlseclibs
- ramsey/uuid
- Soap client. See http://php.net/manual/en/soap.setup.php
- Open SSL. See http://php.net/manual/en/openssl.setup.php
SETUP
Example of config:
{
"certificate": {
"path": "./certificate/01000003.p12",
"password": "eet"
},
"wsdlPath": "./soapFiles/EETServiceSOAP.wsdl",
"defaultValues": {
"dic_popl": "CZ1212121218",
"id_provoz": "273",
"id_pokl": "1"
},
"timeout": 10,
"connectionTimeout": 3
}
- Move certificate (PKCS#12) to your path. (See information on how to get one, or use the certificate from "/example/certificate" for playground - TEST only)
- Set path to wsdl file for EET (you need to include XSD schema too).
Note:
- Example file for playground (EETServiceSOAP.wsdl) is v3 from http://www.etrzby.cz and XSD from http://www.etrzby.cz
BASIC USAGE
use Fritak\eet\Sender; $sender = new Sender(__DIR__ . '/config.json'); // load Sender with configuration $sender->addReceipt(['uuid_zpravy' => 'b3a09b52-7c87-4014-a496-4c7a53cf9125', 'porad_cis' => 68, 'celk_trzba' => 546]); // You can let uuid_zpravy empty, it will be automatically generated $sender->addReceipt(['porad_cis' => 69, 'celk_trzba' => 748]); foreach($sender->sendAllReceipts() AS $response) { $response->Potvrzeni->fik; // Your FIK - Fiscal Identification Code ("Fiskální identifikační kód") }
Change certificate or defalut values later on
$sender->changeCertificate($certificate, $password); $sender->changeDefaultValues($dic, $workshopId, $cashRegisterId);
ADVANCED USAGE - Receipt
use Fritak\eet\Sender; use Fritak\eet\Receipt; $sender = new Sender(__DIR__ . '/config.json'); // load Sender with configuration $receipt = new Receipt(); $receipt->uuid_zpravy = 'b3a09b52-7c87-4014-a496-4c7a53cf9125'; // Or empty, it will be automatically generated $receipt->porad_cis = '68'; $receipt->celk_trzba = 546; $receipt->dic_popl = 'CZ1212121218'; $receipt->id_provoz = '273'; $receipt->id_pokl = '1'; $receipt->dat_trzby = new \DateTime(); // Now we try dry run. Returns boolean TRUE/FALSE if ($sender->dryRunSend($receipt)) { // Send receipt $fik = $sender->send($receipt)->Potvrzeni->fik; }
Nette integration
Nette Framework is an open-source framework for creating web applications in PHP 5 and 7. There is basic integration into your application.
Include library to your project. Include config files to your parameters.neon:
parameters: senderEetParameters: certificate: path: '' password: '' wsdlPath : '' defaultValues: dic_popl: '' id_provoz: '' id_pokl: '' services: senderEet: Fritak\eet\Sender(%senderEetParameters%)
That's it! Now you can use it as noted above, for example action in presenter:
$sender = $this->context->getService('senderEet'); $sender->addReceipt(['porad_cis' => 85, 'celk_trzba' => 9875]); foreach($sender->sendAllReceipts() AS $response) { $response->Potvrzeni->fik; }
Information
- eTrzby Information
- eTrzby - How to get certificate
- technicka-specifikace Technická specifikace
- soap
- openssl
fritak/eet 适用场景与选型建议
fritak/eet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.04k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 09 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fritak/eet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fritak/eet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-19