ag84ark/smartbill
最新稳定版本:v1.1.4
Composer 安装命令:
composer require ag84ark/smartbill
包简介
SmartBill.ro API wrapper compatible for Laravel
关键字:
README 文档
README
SmartBill.ro API integration for Laravel.
This started as a fork of from necenzurat/smartbill, and now it's a standalone package.
Installation
You can install the package via composer:
composer require ag84ark/smartbill
You can publish the config file with:
php artisan vendor:publish --provider="Ag84ark\SmartBill\SmartBillServiceProvider" --tag="laravel-smartbill-config"
Documentation
In the making
Usage
Invoice
Using resources
use Ag84ark\SmartBill\SmartBill; use Ag84ark\SmartBill\Resources\Invoice; use Ag84ark\SmartBill\Resources\Client; use Ag84ark\SmartBill\Resources\InvoiceProduct; $invoice = Invoice::make(); $invoice->setIsDraft(true); $invoice->setClient( Client::make() ->setName("ACME CO") ->setVatCode("RO12345678") ->setRegCom("") ->setAddress("Main street, no 10") ->setIsTaxPayer(false) ->setCity("Bucharest") ->setCounty("Bucharest") ->setCountry("Romania") ->setEmail("acme@example.com") ); $invoice->addProduct( InvoiceProduct::make() ->setName("Produs 1") ->setCode("ccd1") ->setMeasuringUnitName("buc") ->setCurrency("RON") ->setQuantity(2) ->setPrice(10) ->setIsTaxIncluded(true) ->setTaxName("Redusa") ->setTaxPercentage(9) ); $invoice->addProduct(InvoiceProduct::makeValoricDiscountItem("Discount", 5)); $invoice->setPayment( InvoicePayment::make() ->setIsCash(true) ->setType(Ag84ark\SmartBill\Enums\PaymentType::OrdinPlata) ->setValue(15) ); echo 'Emitere factura simpla: '; try { $smartbill = new SmartBill(); $output = $smartbill->invoiceEndpoint->createInvoice($invoice); $invoiceNumber = $output->getNumber(); $invoiceSeries = $output->getSeries(); echo $invoiceSeries . $invoiceNumber; } catch (\Exception $ex) { echo $ex->getMessage(); }
Using array data
$invoice = [ 'companyVatCode' => config('smartbill.vatCode'), 'client' => [ 'name' => "ACME CO", 'vatCode' => "RO12345678", 'regCom' => "", 'address' => "Main street, no 10", 'isTaxPayer' => false, 'city' => "Bucharest", 'country' => "Romania", 'email' => "acme@example.com", ], 'issueDate' => date('Y-m-d'), 'seriesName' => config('smartbill.invoiceSeries'), 'isDraft' => false, 'dueDate' => date('Y-m-d', time() + 3600 * 24 * 30), 'mentions' => '', 'observations' => '', 'deliveryDate' => date('Y-m-d', time() + 3600 * 24 * 10), 'precision' => 2, 'products' => [ [ 'name' => "Produs 1", 'code' => "ccd1", 'isDiscount' => false, 'measuringUnitName' => "buc", 'currency' => "RON", 'quantity' => 2, 'price' => 10, 'isTaxIncluded' => true, 'taxName' => "Redusa", 'taxPercentage' => 9, 'isService' => false, 'saveToDb' => false, ], ], ]; echo 'Emitere factura simpla: '; try { $smartbill = new SmartBill(); $output = $smartbill->invoiceEndpoint->createInvoiceFromArray($invoice); $invoiceNumber = $output->getNumber(); $invoiceSeries = $output->getSeries(); echo $invoiceSeries . $invoiceNumber; } catch (\Exception $ex) { echo $ex->getMessage(); }
Testing
Partially tested
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, use the issue tracker.
License
The WTFPL. Please see License File for more information.
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-23