Skip to content

Commit a633767

Browse files
add new response for francophone payments
1 parent 225303a commit a633767

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

rave_python/rave_francophone.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import json
55
import webbrowser
66

7-
87
class Francophone(Payment):
98

109
def __init__(self, publicKey, secretKey, production, usingEnv):
@@ -30,7 +29,7 @@ def charge(self, accountDetails, hasFailed=False):
3029

3130
# It is faster to add boilerplate than to check if each one is present
3231
accountDetails.update(
33-
{"payment_type": "mobilemoneyfrancophone", "is_mobile_money_franco": "1"})
32+
{"payment_type": "mobilemoneyfranco", "is_mobile_money_franco": "1"})
3433

3534
# If transaction reference is not set
3635
if not ("txRef" in accountDetails):

rave_python/rave_payment.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ def _handleChargeResponse(self, response, txRef, request=None, isMpesa=False):
145145
"status": responseJson["status"],
146146
"validationRequired": True,
147147
"txRef": txRef,
148-
"flwRef": responseJson["data"]["flwRef"],
149-
"chargeResponseMessage": responseJson["data"]["chargeResponseMessage"]}
148+
"flwRef": responseJson["data"]["data"]["flw_reference"],
149+
"chargeResponseMessage": responseJson["data"]["response_message"],
150+
"redirect": responseJson["data"]["data"]["redirect"],
151+
"type": responseJson["data"]["data"]["type"],
152+
"provider": responseJson["data"]["data"]["provider"]
153+
}
154+
150155
else:
151156
return {
152157
"error": True,
@@ -313,30 +318,6 @@ def charge(
313318
response = requests.post(
314319
endpoint, headers=headers, data=json.dumps(payload))
315320

316-
# feature logging
317-
# if response.ok:
318-
# tracking_endpoint = self._trackingMap
319-
# responseTime = response.elapsed.total_seconds()
320-
# tracking_payload = {
321-
# "publicKey": self._getPublicKey(),
322-
# "language": "Python v2",
323-
# "version": "1.2.13",
324-
# "title": feature_name,
325-
# "message": responseTime}
326-
# tracking_response = requests.post(
327-
# tracking_endpoint, data=json.dumps(tracking_payload))
328-
# else:
329-
# tracking_endpoint = self._trackingMap
330-
# responseTime = response.elapsed.total_seconds()
331-
# tracking_payload = {
332-
# "publicKey": self._getPublicKey(),
333-
# "language": "Python v2",
334-
# "version": "1.2.13",
335-
# "title": feature_name + " error",
336-
# "message": responseTime}
337-
# tracking_response = requests.post(
338-
# tracking_endpoint, data=json.dumps(tracking_payload))
339-
340321
if shouldReturnRequest:
341322
if isMpesa:
342323
return self._handleChargeResponse(
@@ -350,6 +331,9 @@ def charge(
350331
return self._handleChargeResponse(
351332
response, paymentDetails["txRef"])
352333

334+
# print (paymentDetails, endpoint, headers, json.dumps(payload))
335+
# return response.json()
336+
353337
def validate(self, feature_name, flwRef, otp, endpoint=None):
354338
""" This is the base validate call.\n
355339
Parameters include:\n

0 commit comments

Comments
 (0)