GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Transaction   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 106
Duplicated Lines 0 %

Importance

Changes 13
Bugs 0 Features 0
Metric Value
c 13
b 0
f 0
dl 0
loc 106
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A totals() 0 12 1
A charge_token() 0 15 1
A initialize() 0 16 1
A get() 0 13 1
A verify() 0 13 1
A charge() 0 16 1
A list() 0 12 1
1
"""Script used to define the paystack Transaction class."""
2
3
from paystackapi.base import PayStackBase
4
5
6
class Transaction(PayStackBase):
7
    """docstring for Transaction."""
8
9
    @classmethod
10
    def initialize(cls, **kwargs):
11
        """
12
        Initialize transaction.
13
14
        Args:
15
            reference: unique transaction reference
16
            amount: amount
17
            email: email address
18
            plan: specified plan(optional)
19
20
        Returns:
21
            Json data from paystack API.
22
        """
23
24
        return cls().requests.post('transaction/initialize', data=kwargs)
25
26
    @classmethod
27
    def charge(cls, **kwargs):
28
        """
29
        Charge authorization.
30
31
        Args:
32
            reference: Unique transaction reference
33
            authorization_code: Authorization code for the transaction
34
            email: Email Address of the user with the authorization code
35
            amount: Amount in kobo
36
37
        Returns:
38
            Json data from paystack API.
39
        """
40
        return cls().requests.post('transaction/charge_authorization',
41
                                   data=kwargs)
42
43
    @classmethod
44
    def charge_token(cls, **kwargs):
45
        """
46
        Charge token.
47
48
        Args:
49
            reference: unique transaction reference
50
            token: paystack token
51
            email: Email Address
52
            amount: Amount in Kobo
53
54
        Returns:
55
            Json data from paystack API.
56
        """
57
        return cls().requests.post('transaction/charge_token', data=kwargs)
58
59
    @classmethod
60
    def get(cls, transaction_id):
61
        """
62
        Get a single transaction.
63
64
        Args:
65
            transaction_id: Transaction id(integer).
66
67
        Returns:
68
            Json data from paystack API.
69
        """
70
        return cls().requests.get('transaction/{transaction_id}'
71
                                  .format(**locals()))
72
73
    @classmethod
74
    def list(cls):
75
        """
76
        List transactions.
77
78
        Args:
79
            No argument required.
80
81
        Returns:
82
            Json data from paystack API.
83
        """
84
        return cls().requests.get('transaction')
85
86
    @classmethod
87
    def totals(cls):
88
        """
89
        Get totals.
90
91
        Args:
92
            No argument required.
93
94
        Returns:
95
            Json data from paystack API.
96
        """
97
        return cls().requests.get('transaction/totals')
98
99
    @classmethod
100
    def verify(cls, reference):
101
        """
102
        Verify transactions.
103
104
        Args:
105
            reference: a unique value needed for transaction.
106
107
        Returns:
108
            Json data from paystack API.
109
        """
110
        return cls().requests.get('transaction/verify/{reference}'
111
                                  .format(**locals()))
112