alphaolomi / simplify-vfd
Simplify VFD
Fund package maintenance!
alphaolomi
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- laravel/pint: ^1.0
- pestphp/pest: ^2.20
This package is auto-updated.
Last update: 2024-11-18 03:19:50 UTC
README
Simplify VFD is a PHP library to interact with the Simplify VFD API. This library provides a simple and easy-to-use interface to integrate VFD services into your PHP applications.
Features
- User Authentication: Authenticate users and obtain access tokens.
- Invoice Management: Create, retrieve, and manage invoices.
- Environment Configuration: Switch between live and stage environments.
- HTTP Client Integration: Uses Guzzle HTTP client for making API requests.
- Custom GUID Generation: Utility function for generating unique identifiers.
Installation
You can install the package via Composer:
composer require alphaolomi/simplify-vfd
Configuration
The SimplifyVfd
class requires a configuration array with the following keys:
environment
: The environment to use (live
orstage
).username
: Your Simplify VFD username.password
: Your Simplify VFD password.
Usage
Initializing the Service
use Alphaolomi\SimplifyVfd\SimplifyVfd; $config = [ 'environment' => 'stage', // or 'live' 'username' => 'your_username', 'password' => 'your_password', ]; $service = new SimplifyVfd($config, $client);
User Login
$data = [ 'username' => 'your_username', 'password' => 'your_password' ]; $response = $service->userLogin($data); print_r($response);
Create Issued Invoice
$data = [ 'dateTime' => date('Y-m-d'), 'customer' => [ 'identificationType' => 'ID', 'identificationNumber' => '1234567890', 'vatRegistrationNumber' => '123456789', 'name' => 'Customer Name', 'mobileNumber' => '255123456789', 'email' => 'customer@example.com', ], 'invoiceAmountType' => 'GROSS', 'items' => [ [ 'itemName' => 'Product 1', 'quantity' => 1, 'price' => 100.00 ] ], 'payments' => [ [ 'paymentType' => 'CASH', 'amount' => 100.00 ] ], 'partnerInvoiceId' => 'unique-invoice-id' ]; $response = $service->createIssuedInvoice($data); print_r($response);
Get Invoice by Partner Invoice ID
$partnerInvoiceId = 'unique-invoice-id'; $response = $service->getInvoiceByPartnerInvoiceId($partnerInvoiceId); print_r($response);
Testing
Using PestPHP for testing, Code coverage is generated by PHPUnit. Codecov is used to generate code coverage reports and badges.
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Alpha Olomi
- Ernest Malcolm
- All Contributors
License
The MIT License (MIT). Please see License File for more information.