Charge::submitPin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 6
c 1
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Digikraaft\Paystack;
4
5
class Charge extends ApiResource
6
{
7
    const OBJECT_NAME = 'charge';
8
9
    /**
10
     * Paystack Documentation Reference.
11
     *
12
     * @link https://developers.paystack.co/reference#charge
13
     */
14
    use ApiOperations\Create;
15
    use ApiOperations\Fetch;
16
17
    /**
18
     * @param array $params
19
     *
20
     * @link https://paystack.com/docs/api/#charge-submit-pin
21
     *
22
     * @return array|object
23
     */
24
    public static function submitPin($params)
25
    {
26
        self::validateParams($params, true);
27
        $url = static::endPointUrl('submit_pin');
28
29
        return static::staticRequest('POST', $url, $params);
30
    }
31
32
    /**
33
     * @param array $params
34
     *
35
     * @link https://paystack.com/docs/api/#charge-submit-otp
36
     *
37
     * @return array|object
38
     */
39
    public static function submitOtp($params)
40
    {
41
        self::validateParams($params, true);
42
        $url = static::endPointUrl('submit_otp');
43
44
        return static::staticRequest('POST', $url, $params);
45
    }
46
47
    /**
48
     * @param array $params
49
     *
50
     * @link https://paystack.com/docs/api/#charge-submit-phone
51
     *
52
     * @return array|object
53
     */
54
    public static function submitPhone($params)
55
    {
56
        self::validateParams($params, true);
57
        $url = static::endPointUrl('submit_phone');
58
59
        return static::staticRequest('POST', $url, $params);
60
    }
61
62
    /**
63
     * @param array $params dates in the format 2016-09-21
64
     *
65
     * @link https://paystack.com/docs/api/#charge-submit-birthday
66
     *
67
     * @return array|object
68
     */
69
    public static function submitBirthday($params)
70
    {
71
        self::validateParams($params, true);
72
        $url = static::endPointUrl('submit_birthday');
73
74
        return static::staticRequest('POST', $url, $params);
75
    }
76
77
    /**
78
     * @param array $params
79
     *
80
     * @link https://paystack.com/docs/api/#charge-submit-address
81
     *
82
     * @return array|object
83
     */
84
    public static function submitAddress($params)
85
    {
86
        self::validateParams($params, true);
87
        $url = static::endPointUrl('submit_address');
88
89
        return static::staticRequest('POST', $url, $params);
90
    }
91
92
    /**
93
     * @param string $reference Charge reference to check
94
     *
95
     * @link https://paystack.com/docs/api/#charge-check
96
     *
97
     * @return array|object
98
     */
99
    public static function checkPending($reference)
100
    {
101
        $url = "{$reference}";
102
        $url = static::endPointUrl($url);
103
104
        return static::staticRequest('GET', $url);
105
    }
106
}
107