Skip to content

Commit 6eff586

Browse files
authored
Merge pull request #96 from towoju5/master
2 parents 1f26169 + 42f0067 commit 6eff586

File tree

16 files changed

+121
-494
lines changed

16 files changed

+121
-494
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
- [Abhishek Prakash](https://github.com/abhishek6262)
2626
- [Wallace Myem Aboiyar](https://github.com/wallacemyem)
2727
- [Chigozie Ekwonu](https://github.com/chygoz2)
28-
- [Tolulope Adekunte](https://github.com/adtrex)
29-
- [Ogaba Emmanuel](https://github.com/ElmageAce)
30-
- [Sofolahan Eniola (Nattive)](https://github.com/nattive)
31-
- [Christian Jombo](https://github.com/christianjombo)
28+
- [Emmanuel Towoju](https://github.com/towoju5)
3229

3330
## Contributing
3431
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.

docs/getting-started/payment-implementation.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class FlutterwaveController extends Controller
6969
'redirect_url' => route('callback'),
7070
'customer' => [
7171
'email' => request()->email,
72-
"phone_number" => request()->phone,
72+
"phonenumber" => request()->phone,
7373
"name" => request()->name
7474
],
7575

@@ -96,25 +96,14 @@ class FlutterwaveController extends Controller
9696
*/
9797
public function callback()
9898
{
99-
100-
$status = request()->status;
10199

102-
//if payment is successful
103-
if ($status == 'successful') {
104-
105100
$transactionID = Flutterwave::getTransactionIDFromCallback();
106101
$data = Flutterwave::verifyTransaction($transactionID);
107102

108103
dd($data);
109-
}
110-
elseif ($status == 'cancelled'){
111-
//Put desired action/code after transaction has been cancelled here
112-
}
113-
else{
114-
//Put desired action/code after transaction has failed here
115-
}
116104
// Get the transaction from your DB using the transaction reference (txref)
117105
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
106+
// Confirm that the $data['data']['status'] is 'successful'
118107
// Confirm that the currency on your db transaction is equal to the returned currency
119108
// Confirm that the db transaction amount is equal to the returned amount
120109
// Update the db transaction record (including parameters that didn't exist before the transaction is completed. for audit purpose)

docs/payments/card.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

docs/subaccounts/create-subaccount.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/subaccounts/delete-subaccount.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/subaccounts/fetch-subaccount.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/subaccounts/list-subaccounts.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

resources/config/flutterwave.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,4 @@
2828
*
2929
*/
3030
'secretHash' => env('FLW_SECRET_HASH', ''),
31-
32-
/**
33-
* Encryption Key: Your Rave encryptionKey. Sign up on https://dashboard.flutterwave.com/ to get one from your settings page
34-
*
35-
*/
36-
'encryptionKey' => env('FLW_ENCRYPTION_KEY', ''),
37-
38-
3931
];

src/Facades/Rave.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,7 @@
1212
namespace KingFlamez\Rave\Facades;
1313

1414
use Illuminate\Support\Facades\Facade;
15-
use KingFlamez\Rave\Helpers\Banks;
16-
use KingFlamez\Rave\Helpers\Beneficiary;
17-
use KingFlamez\Rave\Helpers\Payments;
18-
use KingFlamez\Rave\Helpers\Transfers;
1915

20-
/**
21-
* Class Rave
22-
*
23-
* @method static string generateReference(String $transactionPrefix = null)
24-
* @method static object initializePayment(array $data)
25-
* @method static string getTransactionIDFromCallback()
26-
* @method static object verifyTransaction(string $transactionId)
27-
* @method static bool verifyWebhook()
28-
* @method static Payments payments()
29-
* @method static Banks banks()
30-
* @method static Transfers transfers()
31-
* @method static Beneficiary beneficiaries()
32-
*
33-
* @see \KingFlamez\Rave\Rave
34-
*
35-
*/
3616
class Rave extends Facade
3717
{
3818
/**

src/Helpers/Bills.php

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
3+
namespace KingFlamez\Rave\Helpers;
4+
5+
use Illuminate\Support\Facades\Log;
6+
use Illuminate\Support\Facades\Http;
7+
8+
/**
9+
* Flutterwave's Rave payment laravel package
10+
* @author Emmanuel A Towoju - Towoju5 <[email protected]>
11+
* @version 3
12+
**/
13+
class Bills
14+
{
15+
16+
protected $publicKey;
17+
protected $secretKey;
18+
protected $baseUrl;
19+
20+
/**
21+
* Construct
22+
*/
23+
function __construct(String $publicKey, String $secretKey, String $baseUrl)
24+
{
25+
$this->publicKey = $publicKey;
26+
$this->secretKey = $secretKey;
27+
$this->baseUrl = $baseUrl;
28+
}
29+
30+
31+
/**
32+
* Initiate a Bill payment
33+
* @param $data
34+
* @return object
35+
*/
36+
public function initiate(array $data)
37+
{
38+
return $data;
39+
$bill = Http::withToken($this->secretKey)->post(
40+
$this->baseUrl . '/bills',
41+
$data
42+
)->json();
43+
44+
return $bill;
45+
}
46+
47+
48+
/**
49+
* Initiate a bulk transfer
50+
* @param $data
51+
* @return object
52+
*/
53+
public function get_categories(array $data=[])
54+
{
55+
$bills_categories = Http::withToken($this->secretKey)->get(
56+
$this->baseUrl . '/bill-categories',
57+
$data
58+
)->json();
59+
60+
return $bills_categories;
61+
}
62+
63+
64+
/**
65+
* Validate bill payment
66+
* @param $item_code, array $data
67+
* @return object
68+
*/
69+
public function validate(string $item_code, array $data)
70+
{
71+
$validate = Http::withToken($this->secretKey)->get(
72+
$this->baseUrl . "/bill-items/$item_code/validate",
73+
$data
74+
)->json();
75+
76+
return $validate;
77+
}
78+
79+
80+
/**
81+
* Get All bills payment history
82+
* @param $data
83+
* @return object
84+
*/
85+
public function fetchAll(array $data = [])
86+
{
87+
$bills = Http::withToken($this->secretKey)->get(
88+
$this->baseUrl . '/bills',
89+
$data
90+
)->json();
91+
92+
return $bills;
93+
}
94+
95+
96+
/**
97+
* Get A Bill payment status
98+
* @param $reference
99+
* @return object
100+
*/
101+
public function fetch_status($reference)
102+
{
103+
$status = Http::withToken($this->secretKey)->get(
104+
$this->baseUrl . '/bills/'.$reference
105+
)->json();
106+
107+
return $status;
108+
}
109+
110+
}

0 commit comments

Comments
 (0)