Skip to content

Commit

Permalink
bills payment added
Browse files Browse the repository at this point in the history
  • Loading branch information
towoju5 committed Jan 8, 2023
1 parent 1f26169 commit 3a4dfc8
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 494 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
- [Abhishek Prakash](https://github.com/abhishek6262)
- [Wallace Myem Aboiyar](https://github.com/wallacemyem)
- [Chigozie Ekwonu](https://github.com/chygoz2)
- [Tolulope Adekunte](https://github.com/adtrex)
- [Ogaba Emmanuel](https://github.com/ElmageAce)
- [Sofolahan Eniola (Nattive)](https://github.com/nattive)
- [Christian Jombo](https://github.com/christianjombo)

## Contributing
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. I will appreciate that a lot. Also please add your name to the credits.
Expand Down
15 changes: 2 additions & 13 deletions docs/getting-started/payment-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FlutterwaveController extends Controller
'redirect_url' => route('callback'),
'customer' => [
'email' => request()->email,
"phone_number" => request()->phone,
"phonenumber" => request()->phone,
"name" => request()->name
],

Expand All @@ -96,25 +96,14 @@ class FlutterwaveController extends Controller
*/
public function callback()
{

$status = request()->status;

//if payment is successful
if ($status == 'successful') {

$transactionID = Flutterwave::getTransactionIDFromCallback();
$data = Flutterwave::verifyTransaction($transactionID);

dd($data);
}
elseif ($status == 'cancelled'){
//Put desired action/code after transaction has been cancelled here
}
else{
//Put desired action/code after transaction has failed here
}
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Confirm that the $data['data']['status'] is 'successful'
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)
Expand Down
71 changes: 0 additions & 71 deletions docs/payments/card.md

This file was deleted.

26 changes: 0 additions & 26 deletions docs/subaccounts/create-subaccount.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/subaccounts/delete-subaccount.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/subaccounts/fetch-subaccount.md

This file was deleted.

26 changes: 0 additions & 26 deletions docs/subaccounts/list-subaccounts.md

This file was deleted.

8 changes: 0 additions & 8 deletions resources/config/flutterwave.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,4 @@
*
*/
'secretHash' => env('FLW_SECRET_HASH', ''),

/**
* Encryption Key: Your Rave encryptionKey. Sign up on https://dashboard.flutterwave.com/ to get one from your settings page
*
*/
'encryptionKey' => env('FLW_ENCRYPTION_KEY', ''),


];
20 changes: 0 additions & 20 deletions src/Facades/Rave.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,7 @@
namespace KingFlamez\Rave\Facades;

use Illuminate\Support\Facades\Facade;
use KingFlamez\Rave\Helpers\Banks;
use KingFlamez\Rave\Helpers\Beneficiary;
use KingFlamez\Rave\Helpers\Payments;
use KingFlamez\Rave\Helpers\Transfers;

/**
* Class Rave
*
* @method static string generateReference(String $transactionPrefix = null)
* @method static object initializePayment(array $data)
* @method static string getTransactionIDFromCallback()
* @method static object verifyTransaction(string $transactionId)
* @method static bool verifyWebhook()
* @method static Payments payments()
* @method static Banks banks()
* @method static Transfers transfers()
* @method static Beneficiary beneficiaries()
*
* @see \KingFlamez\Rave\Rave
*
*/
class Rave extends Facade
{
/**
Expand Down
110 changes: 110 additions & 0 deletions src/Helpers/Bills.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

namespace KingFlamez\Rave\Helpers;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;

/**
* Flutterwave's Rave payment laravel package
* @author Emmanuel A Towoju - Towoju5 <[email protected]>
* @version 3
**/
class Bills
{

protected $publicKey;
protected $secretKey;
protected $baseUrl;

/**
* Construct
*/
function __construct(String $publicKey, String $secretKey, String $baseUrl)
{
$this->publicKey = $publicKey;
$this->secretKey = $secretKey;
$this->baseUrl = $baseUrl;
}


/**
* Initiate a Bill payment
* @param $data
* @return object
*/
public function initiate(array $data)
{
return $data;
$bill = Http::withToken($this->secretKey)->post(
$this->baseUrl . '/bills',
$data
)->json();

return $bill;
}


/**
* Initiate a bulk transfer
* @param $data
* @return object
*/
public function get_categories(array $data=[])
{
$bills_categories = Http::withToken($this->secretKey)->get(
$this->baseUrl . '/bill-categories',
$data
)->json();

return $bills_categories;
}


/**
* Validate bill payment
* @param $item_code, array $data
* @return object
*/
public function validate(string $item_code, array $data)
{
$validate = Http::withToken($this->secretKey)->get(
$this->baseUrl . "/bill-items/$item_code/validate",
$data
)->json();

return $validate;
}


/**
* Get All bills payment history
* @param $data
* @return object
*/
public function fetchAll(array $data = [])
{
$bills = Http::withToken($this->secretKey)->get(
$this->baseUrl . '/bills',
$data
)->json();

return $bills;
}


/**
* Get A Bill payment status
* @param $reference
* @return object
*/
public function fetch_status($reference)
{
$status = Http::withToken($this->secretKey)->get(
$this->baseUrl . '/bills/'.$reference
)->json();

return $status;
}

}
25 changes: 0 additions & 25 deletions src/Helpers/Helper.php

This file was deleted.

Loading

0 comments on commit 3a4dfc8

Please sign in to comment.