-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBank.php
More file actions
62 lines (54 loc) · 1.57 KB
/
Bank.php
File metadata and controls
62 lines (54 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace Matscode\Paystack\Resources;
use GuzzleHttp\Exception\GuzzleException;
use Matscode\Paystack\Exceptions\JsonException;
use Matscode\Paystack\Interfaces\ResourceInterface;
use Matscode\Paystack\Traits\ResourcePath;
use Matscode\Paystack\Utility\Helpers;
use Matscode\Paystack\Utility\HTTP\HTTPClient;
use stdClass;
class Bank implements ResourceInterface
{
use ResourcePath;
protected $httpClient;
/**
* @throws \Exception
*/
public function __construct(HTTPClient $HTTPClient)
{
$this->setBasePath('bank');
$this->httpClient = $HTTPClient;
}
/**
* List available bank information
*
* @link https://paystack.com/docs/api/#miscellaneous-bank
*
* @throws GuzzleException
* @throws JsonException
*/
public function list(): stdClass
{
return Helpers::JSONStringToObj($this->httpClient->get($this->makePath())->getBody());
}
/**
* Resolve account number to get account name for valid account verification
*
* @link https://paystack.com/docs/api/#verification-resolve-account
*
* @param $bank_code
* @param $account_number
* @return stdClass
* @throws GuzzleException
* @throws JsonException
*/
public function resolve($bank_code, $account_number): StdClass
{
return Helpers::JSONStringToObj($this->httpClient->get($this->makePath('/resolve'), [
'query' => [
'bank_code' => $bank_code,
'account_number' => $account_number,
]
])->getBody());
}
}