gituyu / jenga
JengaPG and JengaAPI library with minimal dependancy + laravel ready.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-09-19 02:26:29 UTC
README
Installtion
composer require gituyu/jenga
On Laravel, do publish package files.
php artsan vendor:publish
Select Provider: Finserve\Jenga\JengaServiceProvider
or Tag: jenga-config
Usage
In laravel controller use helper jengaCheckout($amount, $orderReference, $callbackurl, $custName = 'Client', $title = 'Pay Via EazzyPay',$is_sandbox = true, $website = 'NA', $extraData = 'NA', $currency = "KES", $outletCode = "0000000000")*
As used in example below,the output is a HTML string which should be injected on the checkout page. The visible part is a Payment Button that redirect to EazzyPayment Checkout Portal.After the client completes payment they are redirected back and a callback is triggered on payment update.
$payment_button= \App\Helpers\jengaCheckout(22,'dff','https://webhook.site/0a75a3f0-b545-4ce3-8c1f-926e7bded3df','John Doe','Pay now',true);
Configuration
Once you publish package files, a configuration in config/jenga.php is created.
Alternatively:
At your project root, create a .env file set these configs:
JENGA_USERNAME=[username]
JENGA_PASSWORD=[password]
JENGA_API_KEY=[api_key]
JENGA_PRIVATE_KEY=[/relative/path/to/private.pem]
JENGA_BASE_ENDPOINT=https://uat.jengahq.io
NB: The package is autodiscovered by laravel: For Laravel older version (less than 5.5) users.
open the Config/App.php file and add \Finserve\Jenga\JengaServiceProvider::class
under providers
and 'Jenga'=> \Finserve\Jenga\JengaServiceProvider::class
under aliases.
Forex
It supports optional paramenters. Supported service are:
currencyconverterapi.com .
API (https://free.currconv.com/api/) Limits to 100Req/min updates are quotes upto 45min.
getForex($baseCurrency = 'KES', $foreignCurrency = 'USD', $exchangeService = '1', $apiKey = '')
Example:
$forex=(new \Finserve\Jenga\Forex())->getForex('USD','KES');
Callback
Usage:
Route::get('/callback/route/here', function () { $data=\Finserve\Jenga\Callback(); //Do something });
Formated to as below:
{ "customernumber": "A N Other", "customermobileNumber": "", "customerRef": null, "txDate": "2018-11-27 00:00:00.0", "txRef": " S2596405", "txPaymentMode": "TPG", "txAmount": "10", "txTill": null, "txBillNumber": "A N Other", "txOrderAmount": "", "txServiceCharge": "", "txServedBy": "EQ", "txAdditionalInfo": "MPS 254723000000 MKR35QEKV7 A N Other/537620", "bnkRef": " S2596405", "bnkTransactionType": "C", "bnkAccount": "0111234241028" }