2017 © Pedro Peláez
 

library rave-widget

A light-weight payment request library for Rave; for Laravel apps and composer aware PHP apps in general

image

remade/rave-widget

A light-weight payment request library for Rave; for Laravel apps and composer aware PHP apps in general

  • Thursday, April 26, 2018
  • by remadelive
  • Repository
  • 1 Watchers
  • 2 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 33 % Grown

The README.md

Rave Widget

A light-weight library to manage rave payment requests and response for Laravel apps and PHP projects in General, (*1)

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system., (*2)

Prerequisites

PHP >= 7.1
PHP PDO Extension

For Laravel:, (*3)

Laravel >= 5.5.0

Installing

composer require remade/rave-widget

Afterwards, on Laravel, run php artisan vendor:publish --provider=Remade\RaveWidget\Laravel\ServiceProvider, (*4)

Usage

Define your Configuration values:, (*5)

$configuration_values = [
    'database' => [
        'database_type' => 'mysql',
        'database_name' => 'my_db_name',
        'server' => 'my_db_host_address',
        'username' => 'my_db_username',
        'password' => 'my_db_password',
    ],

    'widget' => [
        'payment_request_table_name' => 'payment_request_table', //default
    ],

    'rave' => [
        'public_key' => '*******************************************', //get from rave
        'secret_key' => '*******************************************', //get from rave
        'environment' => 'test|live',
    ]
];

For Laravel apps, the configuration is already published to the app's config path in a rave.widget.php file. Edit as necessary., (*6)

Instantiating the Widget Object can be done in one of two ways. There is no drawback irrespective of which way you choose., (*7)

You can create a new instance of the Configuration class and use it to instantiate the Widget:, (*8)

$config = new \Remade\RaveWidget\Core\Configuration($configuration_values);
$widget = new \Remade\RaveWidget\Widget($config);

or you can just initialize straight away with the configuration values:, (*9)

$widget = new \Remade\RaveWidget\Widget($configuration_values);

For Laravel, all these has already been taken care of. After you must have updated rave.widget.php file in Laravel's app config path, the widget instance will be available as, (*10)

$widget = RaveWidget::instance();

Setting up Payments

The payment details are set on the payment object. This object is available via $widget->payment(), (*11)

$wigdet->payment()->setEmail('mail4remi@yahoo.com')->setAmount(100)->setCurrency('NGN');

Available Methods are:, (*12)

setAmount(decimal)
setPaymentMethod(string)
setDescription(string)
setLogo(url)
setTitle(string)
setCountry(string)
setCurrency(string)
setEmail(email)
setFirstname(string)
setLastname(string)
setPhoneNumber(string)
setPayButtonText(string)
setRedirectUrl(url)
setMetaData(array)

All set property method have an equivalent get method e.g. setAmount(amount) and getAmount(), (*13)

Setting Configuration

You can update configuration values at run time. The Configuration instance is available on Widget instance i.e $widget->configuration(), (*14)

Making Payment Request

$widget = \RaveWidget::instance();
$widget->payment()->setEmail('mail4remi@gmail.com')->setAmount(100)->setCurrency('NGN');
$widget->makePaymentRequest($render)

Where $render is a string with default value self_hosted. Acceptable values are self_hosted, rave_hosted and data, (*15)

Verifying Payment

$transaction = $widget->verifyTransaction($transactionReference) This would be called typically on callback/webhook response., (*16)

Running the tests

phpunit

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us., (*17)

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository., (*18)

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*19)

The Versions

26/04 2018

dev-master

9999999-dev

A light-weight payment request library for Rave; for Laravel apps and composer aware PHP apps in general

  Sources   Download

The Requires

 

by Remade

26/04 2018

0.1.1-beta

0.1.1.0-beta

A light-weight payment request library for Rave; for Laravel apps and composer aware PHP apps in general

  Sources   Download

The Requires

 

by Remade

18/04 2018

0.1.0-beta

0.1.0.0-beta

A light-weight payment request library for Rave; for Laravel apps and composer aware PHP apps in general

  Sources   Download

The Requires

 

by Remade