2017 © Pedro Peláez
 

library gateway-php

Hosanna e-Payment Gateway API PHP library

image

hosannahighertech/gateway-php

Hosanna e-Payment Gateway API PHP library

  • Monday, April 30, 2018
  • by Stefano Mtangoo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Hosanna e-Payment Gateway PHP library

Requirements

PHP 5.4.0 and later., (*1)

Composer

You can install the library via Composer. Run the following command:, (*2)

composer require hosannahighertech/gateway-php

To use the library, use Composer's autoload:, (*3)

require_once('vendor/autoload.php');

Dependencies

The library depends on Requests Http Library. The Library is included so you dont have to install anything., (*4)

Getting Started

1. Creating gateway Object.

To create the Gateway object you need to first define your configurations. Your configurations Object must implement hosannahighertech\gateway\interfaces\ConfigurationInterface. This gives you flexibility to use file, session or database to store your configurations. It also does not limit on how to get such a thing as access token though you can use the bundled library for that. See src/samples for an exmple. Assuming your configuration class is SampleConfiguration then you can create gateway object as simple as, (*5)

use hosannahighertech\gateway\Gateway;
use hosannahighertech\gateway\samples\SampleConfigurations; //Your configuration file

$gateway = new Gateway(new SampleConfigurations());

The Gateway object can then be used for creating Payment requests and Confirming for Receipts., (*6)

2. Sending Payment Request

To create Payment request, just create an object of PaymentRequest class and then use gateway sendRequest method to send that. The method returns object of RequestReceipt containing, upon success or a null upon failure. Use Gateway object's getError method to get the actual error message., (*7)

use hosannahighertech\Gateway\PaymentRequest;

$request = new PaymentRequest();
$request = $request->setCard('1234565432789054')
                 ->setDescription('Buying some soda')
                 ->setAmount(1500)
                 ->setCurrency("TZS")
                 ->setCompany(1)
                 ->setTransferTo(1234567890987654);

$reqReceipt = $gateway->sendRequest($request);
if($reqReceipt === null)
{
    echo $gateway->getError());
}
else
{
    //succesfully. Do something with Request Receipt
}

3. Confirming Payment

Confirming Payment will do the actual deducting/transfer of the money. To do that, just pass payment ID from RequestReceipt object you got from previous request, using getReceipt() method to confirmPayment method of the Gateway object. The result will be null in case of failure and an object of PaymentReceipt class in case of success. Use Gateway object's getError method to get the actual error message., (*8)


$paymentReceipt = $gateway->confirmPayment($reqReceipt->getReceipt()); if($paymentReceipt === null) { echo $gateway->getError()); } else { //succesfully. Do something with Payment Receipt }

Please refer to documentation for more details., (*9)

Documentation

Coming soon!, (*10)

4. Loging

TBD, (*11)

5. Testing

TBD, (*12)

The Versions

30/04 2018

dev-master

9999999-dev

Hosanna e-Payment Gateway API PHP library

  Sources   Download

MIT

by Hosanna Higher Technologies Co. Ltd

30/04 2018

1.0.3

1.0.3.0

Hosanna e-Payment Gateway API PHP library

  Sources   Download

MIT

by Hosanna Higher Technologies Co. Ltd

28/04 2018

1.0.2

1.0.2.0

Hosanna e-Payment Gateway API PHP library

  Sources   Download

MIT

by Hosanna Higher Technologies Co. Ltd

28/04 2018

1.0.1

1.0.1.0

Hosanna e-Payment Gateway API PHP library

  Sources   Download

MIT

by Hosanna Higher Technologies Co. Ltd

28/04 2018

1.0.0

1.0.0.0

Hosanna e-Payment Gateway API PHP library

  Sources   Download

MIT

by Hosanna Higher Technologies Co. Ltd