Payment::onetimeDebitStatus()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
4
    namespace Digikraaft\Mono;
5
6
    class Payment extends ApiResource
7
    {
8
        const OBJECT_NAME = 'payments';
9
10
        /**
11
         * @param array $params
12
         * @return array|object
13
         * @throws Exceptions\InvalidArgumentException
14
         * @throws Exceptions\IsNullException
15
         * @link https://docs.mono.co/reference#initiate-payment
16
         */
17
        public static function initiate(array $params)
18
        {
19
            $url = self::endPointUrl("initiate");
20
21
            return self::staticRequest('POST', $url, $params);
22
        }
23
24
        /**
25
         * @param string $paymentId
26
         * @return array|object
27
         * @throws Exceptions\InvalidArgumentException
28
         * @throws Exceptions\IsNullException
29
         * @link https://docs.mono.co/reference#pull-status
30
         */
31
        public static function onetimeDebitStatus(string $paymentId)
32
        {
33
            $url = self::endPointUrl("debits/{$paymentId}");
34
35
            return self::staticRequest('GET', $url);
36
        }
37
38
        public static function recurringDebitStatus(string $paymentId)
39
        {
40
            $url = self::endPointUrl("recurring-debits/{$paymentId}");
41
42
            return self::staticRequest('GET', $url);
43
        }
44
    }
45