Skip to content

Commit 2b89f89

Browse files
committed
Added a verification class
1 parent 44cfcc3 commit 2b89f89

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

src/Helpers/Verification.php

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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 Oluwole Adebiyi - Flamez <[email protected]>
11+
* @version 3
12+
**/
13+
class Verification
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+
26+
$this->publicKey = $publicKey;
27+
$this->secretKey = $secretKey;
28+
$this->baseUrl = $baseUrl;
29+
}
30+
31+
32+
/**
33+
* Confirm bank account
34+
* @param $data
35+
* @return object
36+
*/
37+
public function account(array $data)
38+
{
39+
40+
$account = Http::withToken($this->secretKey)->post(
41+
$this->baseUrl . '/accounts/resolve',
42+
$data
43+
)->json();
44+
45+
return $account;
46+
}
47+
48+
49+
/**
50+
* Verify BVN
51+
* @param $bvn
52+
* @return object
53+
*/
54+
public function bvn($bvn)
55+
{
56+
$bvn = Http::withToken($this->secretKey)->get(
57+
$this->baseUrl . '/kyc/bvns/' . $bvn
58+
)->json();
59+
60+
return $bvn;
61+
}
62+
63+
/**
64+
* Verify reference
65+
* @param $reference
66+
* @return object
67+
*/
68+
public function transaction($reference)
69+
{
70+
$transaction = Http::withToken($this->secretKey)->get(
71+
$this->baseUrl . '/transactions/' . $reference . 'verify'
72+
)->json();
73+
74+
return $transaction;
75+
}
76+
77+
/**
78+
* Verify Card bin
79+
* @param $bin
80+
* @return object
81+
*/
82+
public function CardBin($bin)
83+
{
84+
$card = Http::withToken($this->secretKey)->get(
85+
$this->baseUrl . '/card-bins/' . $bin
86+
)->json();
87+
88+
return $card;
89+
}
90+
91+
92+
93+
}

src/Rave.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use KingFlamez\Rave\Helpers\Beneficiary;
99
use KingFlamez\Rave\Helpers\Payments;
1010
use KingFlamez\Rave\Helpers\Transfers;
11+
use KingFlamez\Rave\Helpers\Verification;
1112

1213
/**
1314
* Flutterwave's Rave payment laravel package
@@ -150,4 +151,14 @@ public function beneficiaries()
150151
$beneficiary = new Beneficiary($this->publicKey, $this->secretKey, $this->baseUrl);
151152
return $beneficiary;
152153
}
154+
155+
/**
156+
* Verification
157+
* @return Verification
158+
*/
159+
public function verification()
160+
{
161+
$verification = new Verification($this->publicKey, $this->secretKey, $this->baseUrl);
162+
return $verification;
163+
}
153164
}

0 commit comments

Comments
 (0)