Completed
Push — master ( bb3faf...1c3da6 )
by Ibrahim
13:51
created

Transaction::getList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Yabacon\Paystack\Routes;
4
5
use Yabacon\Paystack\Contracts\RouteInterface;
6
7
/**
8
 * Transaction
9
 * Insert description here
10
 *
11
 * @category
12
 * @package
13
 * @author
14
 * @copyright
15
 * @license
16
 * @version
17
 * @link
18
 * @see
19
 * @since
20
 */
21
class Transaction implements RouteInterface
22
{
23
24
    /**
25
      Root
26
     */
27
    public static function root()
28
    {
29
        return '/transaction';
30
    }
31
    /**
32
     * Initialize transaction
33
     *
34
     * @return array - definition for this route
35
     *
36
     * @static
37
     */
38 View Code Duplication
    public static function initialize()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
41
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/initialize',
42
            RouteInterface::PARAMS_KEY   => ['reference',
43
                'amount',
44
                'email',
45
                'plan' ]
46
        ];
47
    }
48
    /**
49
     * Charge authorization
50
     *
51
     * @static
52
     */
53 View Code Duplication
    public static function charge()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
56
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/charge_authorization',
57
            RouteInterface::PARAMS_KEY   => ['reference',
58
                'authorization_code',
59
                'email',
60
                'amount' ] ];
61
    }
62
    /**
63
     * Charge token
64
     *
65
     * @static
66
     */
67 View Code Duplication
    public static function chargeToken()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
68
    {
69
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
70
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/charge_token',
71
            RouteInterface::PARAMS_KEY   => ['reference',
72
                'token',
73
                'email',
74
                'amount' ] ];
75
    }
76
    /**
77
     * Get transaction by ID
78
     *
79
     * @static
80
     */
81
    public static function fetch()
82
    {
83
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
84
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/{id}',
85
            RouteInterface::ARGS_KEY     => ['id' ] ];
86
    }
87
    
88
    /**
89
     * List transactions
90
     *
91
     * @static
92
     * @see
93
     * @since
94
     */
95
    public static function getList()
96
    {
97
        return [ RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
98
            RouteInterface::ENDPOINT_KEY => Transaction::root() ];
99
    }
100
    /**
101
     * Export transactions
102
     *
103
     * @static
104
     * @see
105
     * @since
106
     */
107
    public static function export()
108
    {
109
        return [ RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
110
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/export' ];
111
    }
112
    /*
113
      Get totals
114
     */
115
116
    /**
117
     * totals
118
     * Insert description here
119
     *
120
     * @return
121
     *
122
     * @access
123
     * @static
124
     * @see
125
     * @since
126
     */
127
    public static function totals()
128
    {
129
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
130
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/totals' ];
131
    }
132
    /*
133
      Verify transaction
134
     */
135
136
    /**
137
     * verify
138
     * Insert description here
139
     *
140
     * @return
141
     *
142
     * @access
143
     * @static
144
     * @see
145
     * @since
146
     */
147
    public static function verify()
148
    {
149
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
150
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/verify/{reference}',
151
            RouteInterface::ARGS_KEY     => ['reference' ] ];
152
    }
153
}
154