myckhel/laravel-vtpass

:package_description

Fund package maintenance!
Ko Fi

v0.1.2-alpha 2020-07-30 17:55 UTC

This package is auto-updated.

Last update: 2024-10-14 19:30:26 UTC


README

Latest Version on Packagist Total Downloads Build Status

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require myckhel/laravel-vtpass

Setup

The package will automatically register a service provider.

You need to publish the configuration file:

php artisan vendor:publish --provider="Myckhel\Vtpass\VtpassServiceProvider"

This is the default content of the config file vtpass.php:

<?php

return [
  "username"          => env("VTPASS_USERNAME"),
  "password"          => env("VTPASS_PASSWORD"),
  // specify to use sandbox mode or live mode
   "mode"              => env("VTPASS_MODE", "sandbox"), // app mode sandbox ?? live
];

Update Your Projects .env with:

VTPASS_USERNAME=user@email.extension
VTPASS_PASSWORD=XXXXXXXXXXXXXXXXXXXX
VTPASS_MODE=sandbox

Basic Usage

use Vtpass;

Vtpass::verify($parameters);
Vtpass::purchase($parameters);
Vtpass::status($parameters);
Vtpass::variations($parameters);

Available Api's Model

Myckhel\Vtpass\Support\MobileAirtime;
Myckhel\Vtpass\Support\MobileData;
Myckhel\Vtpass\Support\Electric;
Myckhel\Vtpass\Support\TvSub;
Myckhel\Vtpass\Support\Education;

Explicit Usage

Airtime

use Myckhel\Vtpass\Support\MobileAirtime;

public function buyAirtime(){ 
  $serviceID = 'mtn'
  $phone = '111111111'
  $amount = 100

  return MobileAirtime::purchase([
    'serviceID'   => $serviceID,
    'phone'       => $phone,
    'amount'      => $amount,
  ]);
}

Response

{  
   "code":"000",
   "response_description":"TRANSACTION SUCCESSFUL",
   "requestId":"SAND0192837465738253A1HSD",
   "transactionId":"1563873435424",
   "amount":"50.00",
   "transaction_date":{  
      "date":"2019-07-23 10:17:16.000000",
      "timezone_type":3,
      "timezone":"Africa/Lagos"
   },
   "purchased_code":""
}

Status

MobileAirtime::status([
  'request_id' => '24545544'
]);

Verify Electricity

use Myckhel\Vtpass\Support\Electric;

$serviceID = 'ikeja-electric'
$meter = '111111111'
$type = 'prepaid'

Electric::verify([
  'serviceID'   => $serviceID,
  'billersCode' => $meter,
  'type'        => $type,
]);

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.