itsnasser/egyptian-e-invoice
Composer 安装命令:
composer require itsnasser/egyptian-e-invoice
包简介
PHP Package for Egyptian eInvoicing SDK, eInvoicing is the solution of the Egyptian Tax Authority used by taxpayers to register their issued documents with the Tax Authority
README 文档
README
PHP Package for Egyptian eInvoicing SDK, eInvoicing is the solution of the Egyptian Tax Authority used by taxpayers to register their issued documents with the Tax Authority
Install
Via Composer
$ composer require kindy/egyptian-e-invoice
Examples
Please see Examples Files.
Usage
To view all example please vist Examples Files.
require_once "../vendor/autoload.php"; require_once "./config.php"; use Kindy\EgyaptianEInvoice\Document\Document; use Kindy\EgyaptianEInvoice\Document\DocumentInvoiceLine; use Kindy\EgyaptianEInvoice\ETAInvoice; $issuer = [ "address" => [ "branchID" => "0", "country" => "EG", "governate" => "Cairo", "regionCity" => "Nasr City", "street" => "580 Clementina Key", "buildingNumber" => "Bldg. 0", "postalCode" => "68030", "floor" => "1", "room" => "123", "landmark" => "7660 Melody Trail", "additionalInformation" => "beside Townhall" ], "type" => "B", "id" => "500100200", "name" => "Issuer Company" ]; $receiver = [ "address" => [ "country" => "EG", "governate" => "Cairo", "regionCity" => "Nasr City", "street" => "580 Clementina Key", "buildingNumber" => "Bldg. 0", ], "type" => "B", "id" => "674859545", "name" => "Recievr Company" ]; $document = new Document(); $document->setIssuer($issuer) ->setReceiver($receiver) ->setDateTimeIssued('2022-05-13T12:35:00Z'); $document->setPurchaseOrderReference('3asd1as'); $invoiceLine = new DocumentInvoiceLine(); $invoiceLine->setDescription('Software ERP') ->setInternalCode('MA123') ->setItemType('EGS') ->setItemCode('EG-500100200-001') ->setUnitType('JOB') ->setQuantity(2) ->setUnitValue('EGP',985) ->setDiscount(137.9,'A') ->setTaxableItems('T1',256.494,14,'V001') ->setItemsDiscount(71.804) ->setTotal(); $document->setInvoiceLine($invoiceLine); $invoiceLine = new DocumentInvoiceLine(); $invoiceLine->setDescription('Software CRM') ->setInternalCode('CRM123') ->setItemType('EGS') ->setItemCode('EG-500100200-001') ->setUnitType('JOB') ->setQuantity(1) ->setUnitValue('EGP',600) ->setTaxableItems('T1',84,14,'V001') ->setTotal(); $document->setInvoiceLine($invoiceLine); $document->setInternalID('103333')->setTaxpayerActivityCode('6920')->calculate(); if(isset($_POST['signature'])) { $document->setSignatures( [ [ 'signatureType' => 'I', 'value' => $_POST['signature'] ] ] ); $invoice = new ETAInvoice($config['client_id'],$config['client_secret'], 'uat'); $finalDocument = [$document->toArray()]; $documentSubmit = $invoice->submitDocument($finalDocument); echo $documentSubmit->acceptedDocuments[0]->uuid.'-'.$documentSubmit->acceptedDocuments[0]->longId.'-'.$documentSubmit->acceptedDocuments[0]->internalId; } ?> <button id="sign" type="button">Sign</button> <button id="sendToEta" type="button" style="display: none;">Send To Eta</button> <div id="result"></div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script type = "text/javascript"> var signature; var socket = new WebSocket("ws://localhost:18088"); $("#sign").click(function(){ ConnectToSignatureServer(); }); $("#sendToEta").click(function(){ $.ajax({ type: "POST", url: "", data: {signature:signature}, success: function(data){ $("#result").html('Document Sent To Eta'); } }); }) function ConnectToSignatureServer() { socket.send('{Document:\'<?php echo $document->getSerialize()?>\',TokenCertificate:\'Egypt Trust Sealing CA\',Password:\'15775108\'}'); socket.onmessage = function (response) { var responseObj = JSON.parse(response.data); if(responseObj.cades != 'NO_SOLTS_FOUND' && responseObj.cades != 'PASSWORD_INVAILD' && responseObj.cades != 'CERTIFICATE_NOT_FOUND' && responseObj.cades != 'NO_DEVICE_DETECTED') { $("#sendToEta").show(); $("#result").html('Document Signed'); signature = responseObj.cades; }else{ $("#result").html(responseObj.cades); } }; } socket.onclose = function() { $("#result").html('Connection is closed'); }; socket.onerror = function() { $("#result").html('Connection Error'); }; socket.onopen = function() { $("#result").html('Connection Open'); }; </script>
Integrate with eSign token
I have developed a small tool that you can use to sign invoices through WebSocket before send it to EAT, you can find this tool on Egyptian Tax EInvoice HttpSignature
Contributing
Your contribution is welcome
Credits
License
The MIT License (MIT). Please see License File for more information.
itsnasser/egyptian-e-invoice 适用场景与选型建议
itsnasser/egyptian-e-invoice 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「eta」 「einvoicing」 「EEI」 「Egyptian eInvoicing SDK」 「Egyptian eInvoicing Package」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 itsnasser/egyptian-e-invoice 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 itsnasser/egyptian-e-invoice 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 itsnasser/egyptian-e-invoice 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Library to count progress and estimated time of arrival
MyInvois SDK for PHP
PHP Package for Egyptian eInvoicing SDK, eInvoicing is the solution of the Egyptian Tax Authority used by taxpayers to register their issued documents with the Tax Authority
Laravel package for ZATCA e-invoicing integration (Saudi Arabia Phase 2)
PHP library for creating, parsing and validating electronic invoices (XRechnung, ZUGFeRD/Factur-X) according to EN 16931.
PHP SDK for Uganda Revenue Authority (URA) EFRIS System-to-System (S2S) API integration
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-11