Passed
Push — master ( f980d8...9eb105 )
by Tim
09:53
created

Bank   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 15
c 2
b 0
f 0
dl 0
loc 75
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A resolveBvn() 0 6 1
A resolveBvnPremium() 0 5 1
A bvnMatch() 0 6 1
A resolveAccountNumber() 0 6 1
A resolveCardBin() 0 5 1
1
<?php
2
3
namespace Digikraaft\Paystack;
4
5
class Bank extends ApiResource
6
{
7
    use ApiOperations\All;
8
9
    /**
10
     * @param string $bvn
11
     *
12
     * @link https://paystack.com/docs/api/#verification-resolve-bvn
13
     *
14
     * @return array|object
15
     */
16
    public static function resolveBvn(string $bvn)
17
    {
18
        $url = "resolve_bvn/{$bvn}";
19
        $url = static::endPointUrl($url);
20
21
        return static::staticRequest('GET', $url);
22
    }
23
24
    /**
25
     * @param string $bvn
26
     * @return array|object
27
     * @throws Exceptions\InvalidArgumentException
28
     * @throws Exceptions\IsNullException
29
     * @link https://paystack.com/docs/api/#verification-resolve-bvn-premium
30
     */
31
    public static function resolveBvnPremium(string $bvn)
32
    {
33
        $url = "identity/bvn/resolve/{$bvn}";
34
35
        return static::staticRequest('GET', $url);
36
    }
37
38
    /**
39
     * @param array $params
40
     *
41
     * @link https://paystack.com/docs/api/#verification-match-bvn
42
     *
43
     * @return array|object
44
     */
45
    public static function bvnMatch($params)
46
    {
47
        self::validateParams($params);
48
        $url = urlencode('bvn/match');
49
50
        return static::staticRequest('POST', $url, $params);
51
    }
52
53
    /**
54
     * @param array $params
55
     *
56
     * @link https://paystack.com/docs/api/#verification-resolve-account
57
     *
58
     * @return array|object
59
     */
60
    public static function resolveAccountNumber($params)
61
    {
62
        self::validateParams($params, true);
63
        $url = static::buildQueryString('resolve', $params);
64
65
        return static::staticRequest('GET', $url);
66
    }
67
68
    /**
69
     * @param string $bin
70
     *
71
     * @link https://paystack.com/docs/api/#verification-resolve-card
72
     *
73
     * @return array|object
74
     */
75
    public static function resolveCardBin(string $bin)
76
    {
77
        $url = "decision/bin/{$bin}";
78
79
        return static::staticRequest('GET', $url);
80
    }
81
}
82