- Notifications
You must be signed in to change notification settings - Fork8
This is a simple Laravel wrapper for Billingo (billingo.hu) API V3 SwaggerHUB PHP SDK.
License
deviddev/billingo-api-v3-php-and-laravel-wrapper
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
v2.2 -> v2.3.1Drop support: Laravel 8, 9, 10 and PHP 8.1Add support: Laravel 12 and PHP 8.2
This is a simple Laravel (PHP) wrapper for Billingo (billingo.hu) API V3 SwaggerHUB PHP SDK.
Compatible with: Laravel 11.x and 12.x or PHP 8.2<=
You can use the wrapper easily with all type of PHP projects (not just Laravel) from 1.0.0 version without changing except downloadInvoice method.
You can install the package via composer or just download it:
composer require deviddev/billingo-api-v3-wrapper
Publish config file:
php artisan vendor:publish --tag="billingo-config"
First set up your Billingo API V3 key in ./config/billingo-api-v3-wrapper.php config file.
Import wrapper with facade:
useBillingoApiV3WrapperasBillingoApi;
Import wrapper:
useDeviddev\BillingoApiV3Wrapper\BillingoApiV3WrapperasBillingoApi;
You must add your api key to BillingoApi object constructor:
$billingoApi =newBillingoApi('YOUR_API_KEY_HERE');
Make an api instance (eg.: BankAccount, Currency, Document, DocumentBlock, DocumentExport, Organization, Partner, Product, Util):
api(string$apiName);
Add some data to model:
make(array$data);
Make a model instance (eg: Address, BankAccount, Currency, Document, etc... - see in ./vendor/deviddev/billingo-api-v3-php-sdk/lib/model):
model(string$modelName, array$data =null);
(if you don't want usemake() method simply add necessary data as second parameter)
With http info (get http info (headers, response code, etc...)):
withHttpInfo();Get invoice, partner, product(call api class method with model instance):
get(int$id);
Delete partner, product (call api class method with model instance):
delete(int$id);
Delete payment (call api class method with model instance):
deletePayment(int$id);
Create model (call api class method with model instance):
create();Create Receipt on Document model:
createReceipt();Update model (call api class method with model instance and model id):
update(int$id);
Cancel invoice:
cancelInvoice(int$invoiceId);
Create invoice from proforma invoice:
createInvoiceFromProforma(int$invoiceId);
Create invoice from draft invoice:
createInvoiceFromDraft(int$invoiceId);
Create receipt from draft invoice:
createReceiptFromDraft(int$invoiceId);
Check tax number:
checkTaxNumber(string$taxNumber);
List model (call api class method with model instance):
list(array$conditions);
*** All conditions is optional!
Download invoice to server:
downloadInvoice(int$invoiceId, string$path =null, string$extension =null);
Send invoice in email:
sendInvoice(int$invoiceId);
Get invoice Online Számla status:
getOnlineSzamlaStatus(int$invoiceId);
Get invoice public url response:
getPublicUrl(int$id);
Get Billingo API response:
getResponse();Get Billingo API response id (eg.: partner id, invoice id, etc.):
getId();All pulic methods are chainable, exceptgetResponse() andgetId() methods.If you don't add some data tomodel(string $modelName, array $data = null) method secondarray $data = null parameter, youMUST usemake(array $data) methodBEFOREmodel() method, see in examples.ThewithHttpInfo() methodMUST be calledIMMEDIATELY AFTER theapi(),make() ormodel() methods.
Partner array:
$partner = ['name' =>'Test Company','address' => ['country_code' =>'HU','post_code' =>'1010','city' =>'Budapest','address' =>'Nagy Lajos 12.', ],'emails' => ['test@company.hu'],'taxcode' =>'',];
Create partner and get response:
BillingoApi::api('Partner')->model('PartnerUpsert',$partner)->create()->getResponse();
OR
Create partner with make and get response:
BillingoApi::api('Partner')->make($partner)->model('PartnerUpsert')->create()->getResponse();
OR
Create partner and get partner id:
BillingoApi::api('Partner')->model('PartnerUpsert',$partner)->create()->getId();
OR
Create partner with make and get partner id:
BillingoApi::api('Partner')->make($partner)->model('PartnerUpsert')->create()->getId();
Create partner and get response:
$billingoApi->api('Partner')->model('PartnerUpsert',$partner)->create()->getResponse();
OR
Create partner with make and get response:
$billingoApi->api('Partner')->make($partner)->model('PartnerUpsert')->create()->getResponse();
OR
Create partner and get partner id:
$billingoApi->api('Partner')->model('PartnerUpsert',$partner)->create()->getId();
OR
Create partner with make and get partner id:
$billingoApi->api('Partner')->make($partner)->model('PartnerUpsert')->create()->getId();
Partner array:
$partner = ['name' =>'Test Company updated','address' => ['country_code' =>'HU','post_code' =>'1010','city' =>'Budapest','address' =>'Nagy Lajos 12.', ],'emails' => ['test@company.hu'],'taxcode' =>'',];
Update partner and get response:
BillingoApi::api('Partner')->model('Partner',$partner)->update('BILLINGO_PARTNER_ID')->getResponse();
OR
Update partner with make and get response:
BillingoApi::api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getResponse();
OR
Update partner and get partner id:
BillingoApi::api('Partner')->model('Partner',$partner)->update('BILLINGO_PARTNER_ID')->getId();
OR
Update partner with make and get partner id:
BillingoApi::api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getId();
Update partner and get response:
$billingoApi->api('Partner')->model('Partner',$partner)->update('BILLINGO_PARTNER_ID')->getResponse();
OR
Update partner with make and get response:
$billingoApi->api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getResponse();
OR
Update partner and get partner id:
$billingoApi->api('Partner')->model('Partner',$partner)->update('BILLINGO_PARTNER_ID')->getId();
OR
Update partner with make and get partner id:
$billingoApi->api('Partner')->make($partner)->model('Partner')->update('BILLINGO_PARTNER_ID')->getId();
Invoice array:
$invoice = ['partner_id' =>BILLINGO_PARTNER_ID,// REQUIRED int'block_id' =>YOUR_BILLINGO_BLOCK_ID,// REQUIRED int'bank_account_id' =>YOUR_BILLINGO_BANK_ACCOUNT_ID,// int'type' =>'invoice',// REQUIRED'fulfillment_date' => Carbon::now('Europe/Budapest')->format('Y-m-d'),// REQUIRED, set up other time zone if it's necessaray'due_date' => Carbon::now('Europe/Budapest')->format('Y-m-d'),// REQUIRED, set up other time zone if it's necessaray'payment_method' =>'online_bankcard',// REQUIRED, see other types in billingo documentation'language' =>'hu',// REQUIRED, see others in billingo documentation'currency' =>'HUF',// REQUIRED, see others in billingo documentation'conversion_rate' =>1,// see others in billingo documentation'electronic' =>false,// see others in billingo documentation'paid' =>false,// see others in billingo documentation'items' => [ ['name' =>'Laptop',// REQUIRED'unit_price' =>'100000',// REQUIRED'unit_price_type' =>'gross',// REQUIRED'quantity' =>2,// REQUIRED int'unit' =>'db',// REQUIRED'vat' =>'27%',// REQUIRED'comment' =>'some comment here...', ], ],'comment' =>'some comment here...','settings' => ['mediated_servicíe' =>false,'without_financial_fulfillment' =>false,'online_payment' =>'','round' =>'five','place_id' =>0, ],];
Create invoice and get response:
BillingoApi::api('Document')->model('DocumentInsert',$invoice)->create()->getResponse();
OR
Create invoice with make and get response:
BillingoApi::api('Document')->make($invoice)->model('DocumentInsert')->create()->getResponse();
OR
Create invoice and get invoice id:
BillingoApi::api('Document')->model('DocumentInsert',$invoice)->create()->getId();
OR
Create invoice with make and get invoice id:
BillingoApi::api('Document')->make($invoice)->model('DocumentInsert')->create()->getId();
Create invoice and get response:
$billingo->api('Document')->model('DocumentInsert',$invoice)->create()->getResponse();
OR
Create invoice with make and get response:
$billingo->api('Document')->make($invoice)->model('DocumentInsert')->create()->getResponse();
OR
Create invoice and get invoice id:
$billingo->api('Document')->model('DocumentInsert',$invoice)->create()->getId();
OR
Create invoice with make and get invoice id:
$billingo->api('Document')->make($invoice)->model('DocumentInsert')->create()->getId();
Receipt array:
$receipt = ['partner_id' =>BILLINGO_PARTNER_ID,// REQUIRED int'block_id' =>YOUR_BILLINGO_BLOCK_ID,// REQUIRED int'type' =>'receipt',// REQUIRED'payment_method' =>'online_bankcard',// REQUIRED, see other types in billingo documentation'currency' =>'HUF',// REQUIRED, see others in billingo documentation'conversion_rate' =>1,// see others in billingo documentation'electronic' =>false,// see others in billingo documentation'items' => [ ['name' =>'Laptop',// REQUIRED'unit_price' =>'100000',// REQUIRED'vat' =>'27%',// REQUIRED ], ['product_id' =>YOUR_PRODUCT_ID,// REQUIRED ], ],];
Create receipt and get response:
BillingoApi::api('Document')->model('ReceiptInsert',$receipt)->create()->getResponse();
OR
Create receipt with make and get response:
BillingoApi::api('Document')->make($receipt)->model('ReceiptInsert')->create()->getResponse();
OR
Create receipt and get receipt id:
BillingoApi::api('Document')->model('ReceiptInsert',$receipt)->create()->getId();
OR
Create receipt with make and get receipt id:
BillingoApi::api('Document')->make($receipt)->model('ReceiptInsert')->create()->getId();
Create receipt and get response:
$billingo->api('Document')->model('ReceiptInsert',$receipt)->create()->getResponse();
OR
Create receipt with make and get response:
$billingo->api('Document')->make($receipt)->model('ReceiptInsert')->create()->getResponse();
OR
Create receipt and get receipt id:
$billingo->api('Document')->model('ReceiptInsert',$receipt)->create()->getId();
OR
Create receipt with make and get receipt id:
$billingo->api('Document')->make($receipt)->model('ReceiptInsert')->create()->getId();
List invoices:
BillingoApi::api('Document')->list(['page' =>1,'per_page' =>25,'block_id' =>42432,'partner_id' =>13123123,'payment_method' =>'cash','payment_status' =>'paid','start_date' =>'2020-05-10','end_date' =>'2020-05-15','start_number' =>'1','end_number' =>'10','start_year' =>2020,'end_year' =>2020,'type' =>'invoice'])->getResponse();
List partners:
BillingoApi::api('Partner')->list(['page' =>1,'per_page' =>5])->getResponse();
List partners with query string:
BillingoApi::api('Partner')->list(['page' =>1,'per_page' =>5,'query' =>'Teszt partner'])->getResponse();
List blocks:
BillingoApi::api('DocumentBlock')->list(['page' =>1,'per_page' =>5])->getResponse();
List banks accounts:
BillingoApi::api('BankAccount')->list(['page' =>1,'per_page' =>5])->getResponse();
List products:
BillingoApi::api('Products')->list(['page' =>1,'per_page' =>5])->getResponse();
List invoices:
$billingoApi->api('Document')->list(['page' =>1,'per_page' =>25,'block_id' =>42432,'partner_id' =>13123123,'payment_method' =>'cash','payment_status' =>'paid','start_date' =>'2020-05-10','end_date' =>'2020-05-15','start_number' =>'1','end_number' =>'10','start_year' =>2020,'end_year' =>2020,'type' =>'invoice'])->getResponse();
List partners:
$billingoApi->api('Partner')->list(['page' =>1,'per_page' =>5])->getResponse();
List partners with query string:
$billingoApi->api('Partner')->list(['page' =>1,'per_page' =>5,'query' =>'Teszt partner'])->getResponse();
List blocks:
$billingoApi->api('DocumentBlock')->list(['page' =>1,'per_page' =>5])->getResponse();
List banks accounts:
$billingoApi->api('BankAccount')->list(['page' =>1,'per_page' =>5])->getResponse();
List products:
$billingoApi->api('Products')->list(['page' =>1,'per_page' =>5])->getResponse();
Default path is:./storage/app/invoices
Default extension is:.pdf
File name is invoice id.
Return the path in the response, eg.:
path:"invoices/11246867.pdf"Download invoice:
BillingoApi::api('Document')->downloadInvoice(INVOICE_ID)->getResponse();
OR
Download to specified path and extension:
BillingoApi::api('Document')->downloadInvoice(INVOICE_ID,'PATH','EXTENSION')->getResponse();
Come in version 1.1.
Return the e-mails array where to send the invoce, eg.:
emails: ["kiss@kft.hu"]Send invoice:
BillingoApi::api('Document')->sendInvoice(INVOICE_ID)->getResponse();
Send invoice:
$billingoApi->api('Document')->sendInvoice(INVOICE_ID)->getResponse();
Return the public url array, eg.:
[ public_url:"https://api.billingo.hu/document-access/K3drE0Gvb2eRwQNYlypfasdOlJADB4Y"]Get invoice public url:
BillingoApi::api('Document')->getPublicUrl(INVOICE_ID)->getResponse();
Get invoice public url:
$billingoApi->api('Document')->getPublicUrl(INVOICE_ID)->getResponse();
Cancel invoice:
BillingoApi::api('Document')->cancelInvoice(INVOICE_ID)->getResponse();
Cancel invoice:
$billingoApi->api('Document')->cancelInvoice(INVOICE_ID)->getResponse();
Create invoice from proforma invoice:
BillingoApi::api('Document')->createInvoiceFromProforma(INVOICE_ID)->getResponse();
Create invoice from proforma invoice:
$billingoApi->api('Document')->createInvoiceFromProforma(INVOICE_ID)->getResponse();
Create invoice from draft invoice:
BillingoApi::api('Document')->createInvoiceFromDraft(INVOICE_ID)->getResponse();
Create invoice from draft invoice:
$billingoApi->api('Document')->createInvoiceFromDraft(INVOICE_ID)->getResponse();
Create receipt from draft invoice:
BillingoApi::api('Document')->createReceiptFromDraft(INVOICE_ID)->getResponse();
Create receipt from draft invoice:
$billingoApi->api('Document')->createReceiptFromDraft(INVOICE_ID)->getResponse();
First set up your NAV connection in your billingo account, because it always return "Invalid tax number!"
Check tax number:
BillingoApi::api('Util')->checkTaxNumber('tax_number')->getResponse();
Check tax number:
$billingoApi->api('Util')->checkTaxNumber('tax_number')->getResponse();
Get invoice:
BillingoApi::api('Document')->get(INVOICE_ID)->getResponse();
Get partner:
BillingoApi::api('Partner')->get(PARTNER_ID)->getResponse();
Get product:
BillingoApi::api('Product')->get(PRODUCT_ID)->getResponse();
Get invoice:
$billingoApi->api('Document')->get(INVOICE_ID)->getResponse();
Get partner:
$billingoApi->api('Partner')->get(PARTNER_ID)->getResponse();
Get product:
$billingoApi->api('Product')->get(PRODUCT_ID)->getResponse();
Delete partner:
BillingoApi::api('Partner')->delete(PARTNER_ID)->getResponse();
Delete product:
BillingoApi::api('Product')->get(PRODUCT_ID)->getResponse();
Delete partner:
$billingoApi->api('Partner')->delete(PARTNER_ID)->getResponse();
Delete product:
$billingoApi->api('Product')->get(PRODUCT_ID)->getResponse();
Get partner:
BillingoApi::api('Partner')->deletePayment(PAYMENT_ID)->getResponse();
Get partner:
$billingoApi->api('Partner')->deletePayment(PAYMENT_ID)->getResponse();
With http info:
BillingoApi::api('Product')->withHttpInfo()->list(['page' =>1,'per_page' =>5])->getResponse();
With http info:
$billingoApi->api('Product')->withHttpInfo()->list(['page' =>1,'per_page' =>5])->getResponse();
First set up your Billingo API V3 Key inconfig/config.php file.
Linux, MAC OS
$ ./vendor/bin/phpunitOR
$ composer testWindows
$ vendor\bin\phpunitOR
$ composer test-winPlease seeCONTRIBUTING for details.
If you discover any security related issues, please emaildavid.molnar.mega@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please seeLicense File for more information.
This package was generated using theLaravel Package Boilerplate.
About
This is a simple Laravel wrapper for Billingo (billingo.hu) API V3 SwaggerHUB PHP SDK.
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors5
Uh oh!
There was an error while loading.Please reload this page.