Repository navigation
Expand file tree
/
Copy pathverification.py
More file actions
94 lines (78 loc) · 2.63 KB
/
Copy pathverification.py
File metadata and controls
94 lines (78 loc) · 2.63 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"""Script used to define the paystack Verification class."""
from paystackapi.base import PayStackBase
class Verification(PayStackBase):
"""docstring for Verification."""
@classmethod
def verify_bvn(cls, bvn):
"""
Verify BVN
Args:
bvn: customer's BVN number
Returns:
Json data from paystack API.
"""
return cls().requests.get(f"bank/resolve_bvn/{bvn}")
@classmethod
def verify_bvn_match(cls, **kwargs):
"""
Verify bvn match with account number, first name and last name
Args:
bvn: customer's bvn
account_number: customer's account number
bank_code: customer's bank code
first_name: customer's first name (Optional)
last_name: customer's last name (Optional)
middle_name: customer's middle name (Optional)
Returns:
Json data from paystack API.
{
"status": true,
"message": "BVN lookup successful",
"data": {
"bvn": "xxxxxxxxxxx",
"is_blacklisted": false,
"account_number": true,
"first_name": true,
"middle_name": false,
"last_name": true
},
"meta": {
"calls_this_month": 1,
"free_calls_left": 9
}
}
"""
return cls().requests.post('bank/resolve', data=kwargs)
@classmethod
def verify_account(cls, **kwargs):
"""
Verify account
Args:
account_number: customer's account number
bank_code: customer's bank code
Returns:
Json data from paystack API.
"""
return cls().requests.get("bank/resolve", qs=kwargs,)
@classmethod
def verify_card_bin(cls, card_bin):
"""
Verify card bin
Args:
card_bin: customer's card bin number
Returns:
Json data from paystack API.
"""
return cls().requests.get(f"decision/bin/{card_bin}")
@classmethod
def verify_phone(cls, **kwargs):
"""
Verify customer phone number
Args:
verification_type: phone verification type
phone: customer's phone number
callback_url: url to receive verification details
Returns:
Json data from paystack API.
"""
return cls().requests.post('verifications', data=kwargs)