forked from andela-sjames/paystack-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefund.py
More file actions
51 lines (37 loc) · 1.03 KB
/
refund.py
File metadata and controls
51 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from paystackapi.base import PayStackBase
class Refund(PayStackBase):
@classmethod
def create(cls, **kwargs):
"""
Function defined to create a refund.
Args:
transaction: Transaction reference or id
amount: How much in kobo to be refunded to the customer - Optional
currency: Three-letter ISO currency - Optional
customer_note: Customer reason - Optional
merchant_note: Merchant reason - Optional
Returns:
Json data from paystack API.
"""
return cls().requests.post('refund', data=kwargs)
@classmethod
def list(cls, **kwargs):
"""
List Refunds
Args:
reference: Identifier for transaction to be refunded - Optional
currency: Three-letter ISO currency - Optional
Returns:
JSON data from paystack's API.
"""
return cls().requests.get('refund', data=kwargs)
@classmethod
def fetch(cls, refund_id):
"""
Fetch a Refund
Args:
refund_id: Identifier for refund to be fetched
Return:
JSON data from paystack API
"""
return cls().requests.get(f"refund/{refund_id}")