Skip to content

Commit 39a2006

Browse files
add new payment methods
1 parent c348f3a commit 39a2006

File tree

13 files changed

+666
-134
lines changed

13 files changed

+666
-134
lines changed

.DS_Store

0 Bytes
Binary file not shown.

example.py

Lines changed: 192 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,204 @@
1-
from rave_python import Rave, RaveExceptions, Misc
2-
PublicKey = "FLWPUBK-45587fdb1c84335354ab0fa388b803d5-X"
3-
SecretKey = "FLWSECK-2c9a2a781e56760b5d9c29c67ec22347-X"
4-
5-
rave = Rave(PublicKey, SecretKey, production=True, usingEnv=False)
6-
7-
payload = {
8-
"amount": 30,
9-
"PBFPubKey": PublicKey,
10-
"currency": "NGN",
11-
"email": "user@example.com",
12-
"meta": [{"metaname": "test", "metavalue": "12383"}],
13-
"ip": "123.0.1.3",
14-
"firstname": "Flutterwave",
15-
"lastname": "Tester",
16-
"is_token": False
1+
# Raw responses
2+
apple_pay_refined_response = {
3+
"validationRequired":True,
4+
"flwref":"IDPC61011692106639837523",
5+
"authurl":"https://applepay-pilot.aq2-flutterwave.com?reference=IDPC61011692106639837523",
6+
"error":False,
7+
"message":"Kindly redirect your user to the authurl. This url is only supported by Safari browsers and Apple Pay enabled devices.",
8+
"txRef":"MC-1692104391859"
179
}
1810

19-
payload_2 = {
20-
"currency": "TZS",
21-
"country": "TZ",
22-
"amount": 1000,
23-
"email": "user@example.com",
24-
"firstname": "John",
25-
"lastname": "Doe",
26-
"phonenumber": "255123456789",
11+
apple_pay_response = {
12+
"status":"success",
13+
"message":"V-COMP",
14+
"data":{
15+
"authModelUsed":"APPLEPAY",
16+
"chargeResponseCode":"02",
17+
"updatedAt":"2023-08-15T13:37:20.000Z",
18+
"currency":"USD",
19+
"chargeResponseMessage":"Pending validation",
20+
"acctvalrespmsg":"None",
21+
"narration":"Flutterwave Developers",
22+
"id":4530898,
23+
"createdAt":"2023-08-15T13:37:19.000Z",
24+
"charge_type":"normal",
25+
"device_fingerprint":"N/A",
26+
"modalauditid":"3ca612e043c3788fe8b20a4d402d6647",
27+
"paymentPlan":"None",
28+
"charged_amount":10,
29+
"authurl":"https://applepay-pilot.aq2-flutterwave.com?reference=IDPC61011692106639837523",
30+
"merchantfee":0,
31+
"redirectUrl":"N/A",
32+
"deletedAt":"None",
33+
"txRef":"MC-1692106637194",
34+
"AccountId":20937,
35+
"status":"success-pending-validation",
36+
"raveRef":"None",
37+
"vbvrespmessage":"N/A",
38+
"IP":"123.0.1.3",
39+
"settlement_token":"None",
40+
"orderRef":"URF_1692106639015_36019",
41+
"vbvrespcode":"N/A",
42+
"appfee":0.38,
43+
"merchantbearsfee":1,
44+
"cycle":"one-time",
45+
"customer":{
46+
"email":"user@example.com",
47+
"phone":"None",
48+
"customertoken":"None",
49+
"updatedAt":"2023-08-15T13:37:19.000Z",
50+
"deletedAt":"None",
51+
"fullName":"Flutterwave Tester",
52+
"id":2177862,
53+
"createdAt":"2023-08-15T13:37:19.000Z",
54+
"AccountId":20937
55+
},
56+
"retry_attempt":"None",
57+
"paymentType":"applepay",
58+
"acctvalrespcode":"None",
59+
"fraud_status":"ok",
60+
"paymentPage":"None",
61+
"is_live":0,
62+
"flwRef":"IDPC61011692106639837523",
63+
"amount":10,
64+
"getpaidBatchId":"None",
65+
"paymentId":"20937",
66+
"customerId":2177862
67+
}
2768
}
2869

29-
payload_3 = {
30-
"cardno": "4187451811620618",
31-
"cvv": "306",
32-
"expirymonth": "05",
33-
"expiryyear": "25",
34-
"amount": "100",
35-
"email": "korneliosyaovi@gmail.com",
36-
"phonenumber": "08109328188",
37-
"firstname": "Cornelius",
38-
"lastname": "Ashley",
39-
"IP": "355426087298442",
40-
"pin": "7991",
41-
"currency": "NGN"
70+
fawry_pay_refined_response = {
71+
"validationRequired":True,
72+
"message":"Please make payment with the flwRef returned in the response which should be the same as the reference sent via SMS",
73+
"flwRef":"9265503142",
74+
"txRef":"MC-1692143784970",
75+
"error":False
4276
}
4377

44-
payload_4 = {
45-
"token": "flw-t1nf-45a7a6bfbe2fb30a70c1d974d84e31c5-k3n",
46-
"amount": "100",
47-
"email": "korneliosyaovi@gmail.com",
48-
"phonenumber": "08109328188",
49-
"firstname": "Cornelius",
50-
"lastname": "Ashley",
51-
"IP": "355426087298442",
52-
"currency": "NGN",
53-
"country": "NG"
78+
fawry_pay_response = {
79+
"status":"success",
80+
"message":"V-COMP",
81+
"data":{
82+
"authModelUsed":"CASH",
83+
"chargeResponseCode":"02",
84+
"updatedAt":"2023-08-15T23:39:57.000Z",
85+
"currency":"EGP",
86+
"chargeResponseMessage":"Request is pending",
87+
"acctvalrespmsg":"None",
88+
"narration":"Flutterwave Developers",
89+
"id":4531988,
90+
"createdAt":"2023-08-15T23:39:56.000Z",
91+
"charge_type":"normal",
92+
"device_fingerprint":"N/A",
93+
"modalauditid":"7584b58047cc2aec3ef904df01781021",
94+
"paymentPlan":"None",
95+
"charged_amount":10,
96+
"authurl":"N/A",
97+
"merchantfee":0,
98+
"redirectUrl":"N/A",
99+
"deletedAt":"None",
100+
"txRef":"MC-1692142795684",
101+
"AccountId":20937,
102+
"status":"success-pending-validation",
103+
"raveRef":"None",
104+
"vbvrespmessage":"N/A",
105+
"IP":"123.0.1.3",
106+
"settlement_token":"None",
107+
"orderRef":"URF_FAWRY_1692142796484_104335",
108+
"vbvrespcode":"N/A",
109+
"appfee":0.23,
110+
"merchantbearsfee":1,
111+
"cycle":"one-time",
112+
"customer":{
113+
"email":"user@example.com",
114+
"phone":"2348109328188",
115+
"customertoken":"None",
116+
"updatedAt":"2023-08-15T23:38:12.000Z",
117+
"deletedAt":"None",
118+
"fullName":"Flutterwave Tester",
119+
"id":2178310,
120+
"createdAt":"2023-08-15T23:38:12.000Z",
121+
"AccountId":20937
122+
},
123+
"retry_attempt":"None",
124+
"paymentType":"fawry_pay",
125+
"acctvalrespcode":"None",
126+
"fraud_status":"ok",
127+
"paymentPage":"None",
128+
"is_live":0,
129+
"flwRef":"9265567410",
130+
"amount":10,
131+
"getpaidBatchId":"None",
132+
"paymentId":"N/A",
133+
"customerId":2178310
134+
}
54135
}
55136

56-
payload_5 = {
57-
"amount": 30,
58-
"PBFPubKey": PublicKey,
59-
"currency": "NGN",
60-
"email": "user@example.com",
61-
"meta": [{"metaname": "test", "metavalue": "12383"}],
62-
"ip": "123.0.1.3",
63-
"firstname": "Flutterwave",
64-
"lastname": "Tester",
137+
google_pay_refined_response = {
138+
"validationRequired":True,
139+
"flwRef":"TGET926516921407133111897",
140+
"authurl":"https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaid/api/short-url/GHpqKbFft",
141+
"error":False,
142+
"message":"Kindly redirect your user to the authurl to complete the payment using their Google Pay Wallets.",
143+
"txRef":"MC-1692140395068"
65144
}
66145

67-
payload_6 = {
68-
"amount": 2,
69-
"PBFPubKey": PublicKey,
70-
"currency": "GBP",
71-
"email": "user@example.com",
72-
"meta": [{"metaname": "test", "metavalue": "12383"}],
73-
"ip": "123.0.1.3",
74-
"firstname": "Flutterwave",
75-
"lastname": "Tester"
146+
google_pay_response = {
147+
"status":"success",
148+
"message":"V-COMP",
149+
"data":{
150+
"authModelUsed":"GOOGLEPAY_NOAUTH",
151+
"chargeResponseCode":"02",
152+
"updatedAt":"2023-08-15T23:05:14.000Z",
153+
"currency":"USD",
154+
"chargeResponseMessage":"Payment token retrieval has been initiated",
155+
"acctvalrespmsg":"None",
156+
"narration":"GooglePay Transaction FOR Flutterwave Developers",
157+
"id":4531868,
158+
"createdAt":"2023-08-15T23:05:12.000Z",
159+
"charge_type":"normal",
160+
"device_fingerprint":"N/A",
161+
"modalauditid":"219d04a157cecb0b8eca4ef61cbd5c37",
162+
"paymentPlan":"None",
163+
"charged_amount":10,
164+
"authurl":"https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaid/api/short-url/GHpqKbFft",
165+
"merchantfee":0,
166+
"redirectUrl":"N/A",
167+
"deletedAt":"None",
168+
"txRef":"MC-1692140711651",
169+
"AccountId":20937,
170+
"status":"success-pending-validation",
171+
"raveRef":"None",
172+
"vbvrespmessage":"N/A",
173+
"IP":"123.0.1.3",
174+
"settlement_token":"None",
175+
"orderRef":"URF_1692140712483_39839",
176+
"vbvrespcode":"N/A",
177+
"appfee":0.38,
178+
"merchantbearsfee":1,
179+
"cycle":"one-time",
180+
"customer":{
181+
"email":"user@example.com",
182+
"phone":"None",
183+
"customertoken":"None",
184+
"updatedAt":"2023-08-15T23:05:12.000Z",
185+
"deletedAt":"None",
186+
"fullName":"Flutterwave Tester",
187+
"id":2178288,
188+
"createdAt":"2023-08-15T23:05:12.000Z",
189+
"AccountId":20937
190+
},
191+
"retry_attempt":"None",
192+
"paymentType":"googlepay",
193+
"acctvalrespcode":"None",
194+
"fraud_status":"ok",
195+
"paymentPage":"None",
196+
"is_live":0,
197+
"flwRef":"TGET926516921407133111897",
198+
"amount":10,
199+
"getpaidBatchId":"None",
200+
"paymentId":"N/A",
201+
"customerId":2178288
202+
}
76203
}
77204

78-
79-
# print(rave.Enaira.charge(payload))
80-
print(rave.Enaira.charge(payload))

rave_python/__pycache__/.DS_Store

-6 KB
Binary file not shown.

rave_python/rave.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from rave_python.rave_account import Account
2+
from rave_python.rave_applepay import ApplePay
23
from rave_python.rave_bills import Bills
34
from rave_python.rave_card import Card
45
from rave_python.rave_ebills import Ebills
6+
from rave_python.rave_fawrypay import FawryPay
57
from rave_python.rave_francophone import Francophone
68
from rave_python.rave_ghmobile import GhMobile
9+
from rave_python.rave_googlepay import GooglePay
710
from rave_python.rave_mpesa import Mpesa
811
from rave_python.rave_paymentplan import PaymentPlan
912
from rave_python.rave_preauth import Preauth
@@ -30,12 +33,15 @@ class Rave:
3033
def __init__(self, publicKey, secretKey, production=False, usingEnv=True):
3134
""" This is main organizing object. It contains the following:\n
3235
rave.Account -- For bank account transactions\n
36+
rave.ApplePay -- For Apple Pay wallet transactions\n
3337
rave.BankTransfer -- For pay with bank transfer transaction\n
3438
rave.Bills -- For Bills payments\n
3539
rave.Card -- For card transactions\n
3640
rave.Enaira -- For enaira wallet payments\n
41+
rave.FawryPay -- For Egyptian collections via Fawry Pay\n
3742
rave.Francophone -- For West African Francophone mobile money transactions\n
3843
rave.GhMobile -- For Ghana mobile money transactions\n
44+
rave.GooglePay -- For Google Pay wallet transactions\n
3945
rave.Mpesa -- For mpesa transactions\n
4046
rave.PaymentPlan -- For payment plan creation and operation\n
4147
rave.Preauth -- For preauthorized transactions\n
@@ -54,13 +60,16 @@ def __init__(self, publicKey, secretKey, production=False, usingEnv=True):
5460

5561
classes = (
5662
Account,
63+
ApplePay,
5764
BankTransfer,
5865
Bills,
5966
Card,
6067
Ebills,
6168
Enaira,
69+
FawryPay,
6270
Francophone,
6371
GhMobile,
72+
GooglePay,
6473
Mpesa,
6574
PaymentPlan,
6675
Preauth,

0 commit comments

Comments
 (0)