iabdullahbeker/efatora-sdk

此包最新版本(dev-master)没有可用的许可信息。

dev-master 2022-11-21 11:08 UTC

This package is auto-updated.

Last update: 2024-09-21 15:17:01 UTC


README

此 SDK 帮助开发者轻松集成埃及的 Efatora。

安装

  composer require iabdullahbeker/efatora-sdk

发布配置

    php artisan vendor:publish --tag=config

更新配置文件 "config/efatora.php"

[
    "TAX_PAYER_ACTIVITY_CODE" => "",  // from portal 
    "PRODUCT_CODING_URL" => "https://api.preprod.invoicing.eta.gov.eg/api/v1.0/codetypes/requests/codes",
    "AUTH_URL" => "https://id.preprod.eta.gov.eg/connect/token",
    "CLIENT_ID" => "92d93edc-d330-4ea8-b969-65861b531e6b", // from portal 
    "CLIENT_SECRET" => "0e18b1c5-785a-4644-98c2-48eaf0ebe276", // from portal 
    "DOCUMENT_SUBMISSION" => "https://api.preprod.invoicing.eta.gov.eg/api/v1/documentsubmissions",
    "ISSUER" => [ // the data of issuer of the invoice 
        "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" => "376877448",
        "name" => "ايمان مجدى وشريكتها"
    ],
];

产品编码的示例代码

use Iabdullahbeker\EfatoraSdk\Facades\EFatoraSdk;
use Iabdullahbeker\EfatoraSdk\Utils\EfatoraProduct;
use Iabdullahbeker\EfatoraSdk\Utils\EfatoraProducts;

$product1 = new EfatoraProduct([
            "parentCode"=>"99999999",
            "productId"=> "123456",
            "nameEn"=>"aa",
            "nameAr"=>"aa",
            "dateTime"=>date('Y-m-d\Th:i:s'),
            // "activeTo"=>"2022-08-21T00:00:00.000",
            "descriptionEn"=>"asd",
            "descriptionAr"=>"asd",
            "requestReason"=>"asd"
        ]);
        $product2 = new EfatoraProduct([
            "parentCode"=>"99999999",
            "productId"=> "5689874",
            "nameEn"=>"aas",
            "nameAr"=>"aas",
            "dateTime"=>date('Y-m-d\Th:i:s'),
            // "activeTo"=>"2022-08-21T00:00:00.000",
            "descriptionEn"=>"asdl",
            "descriptionAr"=>"asdl",
            "requestReason"=>"asdl"
        ]);
        $products = new EfatoraProducts;
        $products->add($product1->toArray());
        $products->add($product2->toArray());
        $r = EFatoraSdk::createEGS($products); // response 

提交发票文件的示例代码

use Iabdullahbeker\EfatoraSdk\Utils\EfatoraReceiptItem;
use Iabdullahbeker\EfatoraSdk\Facades\EFatoraSdk;
use Iabdullahbeker\EfatoraSdk\Utils\DocumentReceiver;
use Iabdullahbeker\EfatoraSdk\Utils\EfatoraDocuments;
use Iabdullahbeker\EfatoraSdk\Utils\InvoiceLines;


        $item = new EfatoraReceiptItem([
            'id' => '123456',
            'item_type' => 'EGS',
            'description' => 'description',
            'item_code' => 'EG-376877448-RS01',
            'item_quantity' => 2,
            'item_price_each' => 300,
        ]);

        $invoiceLines = new InvoiceLines;
        $invoiceLines->add($item->toArray());

        $receiver = new DocumentReceiver([
            "country" => "EG",
            "governate" => "Cairo",
            "regionCity" => "Giza",
            "street" => "Giza",
            "buildingNumber" => "Bldg. 0",
            "postalCode" => "68030",
            "floor" => "1",
            "room" => "123",
            "landmark" => "7660 Melody Trail",
            "additionalInformation" => "Giza",
            "receiver_type" => "B",
            "receiver_id" => "123456789",
            "receiver_name" => "Abdullah Mohamed"
        ]);

        $document = new EfatoraDocuments($invoiceLines, $receiver);

        $r = EFatoraSdk::submitDocument($document->toArray()); // response