Completed
Push — master ( 7800f2...43972c )
by Ibrahim
04:00
created

Transaction   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 12
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 98
ccs 59
cts 59
cp 1
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A root() 0 4 1
A initialize() 0 11 1
A charge() 0 9 1
A checkAuthorization() 0 8 1
A chargeAuthorization() 0 4 1
A chargeToken() 0 10 1
A fetch() 0 6 1
A getList() 0 5 1
A export() 0 9 1
A totals() 0 5 1
A verify() 0 6 1
A verifyAccessCode() 0 6 1
1
<?php
2
3
namespace Yabacon\Paystack\Routes;
4
5
use Yabacon\Paystack\Contracts\RouteInterface;
6
7
class Transaction implements RouteInterface
8
{
9
10 4
    public static function root()
11
    {
12 4
        return '/transaction';
13
    }
14
15 2
    public static function initialize()
16
    {
17 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
18 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/initialize',
19 2
            RouteInterface::PARAMS_KEY   => ['reference',
20 2
                'callback_url',
21 2
                'amount',
22 2
                'email',
23 2
                'plan' ]
24 2
        ];
25
    }
26
27 2
    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...
28
    {
29 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
30 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/charge_authorization',
31 2
            RouteInterface::PARAMS_KEY   => ['reference',
32 2
                'authorization_code',
33 2
                'email',
34 2
                'amount' ] ];
35
    }
36
37 2
    public static function checkAuthorization()
38
    {
39 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
40 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/check_authorization',
41 2
            RouteInterface::PARAMS_KEY   => ['authorization_code',
42 2
                'email',
43 2
                'amount' ] ];
44
    }
45
46 2
    public static function chargeAuthorization()
47
    {
48 2
        return Transaction::charge();
49
    }
50
51 2
    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...
52
    {
53 2
        trigger_error('This endpoint is deprecated!', E_USER_NOTICE);
54 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::POST_METHOD,
55 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/charge_token',
56 2
            RouteInterface::PARAMS_KEY   => ['reference',
57 2
                'token',
58 2
                'email',
59 2
                'amount' ] ];
60
    }
61
62 2
    public static function fetch()
63
    {
64 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
65 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/{id}',
66 2
            RouteInterface::ARGS_KEY     => ['id' ] ];
67
    }
68
69 2
    public static function getList()
70
    {
71 2
        return [ RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
72 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() ];
73
    }
74
75 2
    public static function export()
76
    {
77 2
        return [ RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
78 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/export',
79 2
            RouteInterface::PARAMS_KEY   => ['from',
80 2
                'to',
81 2
                'settled',
82 2
                'payment_page' ] ];
83
    }
84
85 2
    public static function totals()
86
    {
87 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
88 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/totals' ];
89
    }
90
91 3
    public static function verify()
92
    {
93 3
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
94 3
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/verify/{reference}',
95 3
            RouteInterface::ARGS_KEY     => ['reference' ] ];
96
    }
97
98 2
    public static function verifyAccessCode()
99
    {
100 2
        return [RouteInterface::METHOD_KEY   => RouteInterface::GET_METHOD,
101 2
            RouteInterface::ENDPOINT_KEY => Transaction::root() . '/verify_access_code/{access_code}',
102 2
            RouteInterface::ARGS_KEY     => ['access_code' ] ];
103
    }
104
}
105