@@ -11,26 +11,35 @@ def __init__(self, publicKey, secretKey, production, usingEnv):
11
11
12
12
13
13
# returns true if further action is required, false if it isn't
14
- def _handleChargeResponse (self , response , txRef , request = None ):
15
- """ This handles charge responses """
16
- res = self ._preliminaryResponseChecks (response , MobileChargeError , txRef = txRef )
17
-
18
- responseJson = res ["json" ]
19
- flwRef = res ["flwRef" ]
20
-
21
- # Checking if there is redirect url
22
- if responseJson ["data" ]["data" ].get ("redirect_url" , "N/A" ) == "N/A" :
23
- redirectUrl = None
24
- else :
25
- redirectUrl = responseJson ["data" ]["data" ]["redirect_url" ]
26
-
27
- # If all preliminary checks passed
28
- if not (responseJson ["data" ].get ("chargeResponseCode" , None ) == "00" ):
29
- # Otherwise we return that further action is required, along with the response
30
- suggestedAuth = responseJson ["data" ].get ("suggested_auth" , None )
31
- return {"error" : False , "validationRequired" : True , "txRef" : txRef , "flwRef" : flwRef , "suggestedAuth" : suggestedAuth , "redirectUrl" : redirectUrl }
32
- else :
33
- return {"error" : False , "status" : responseJson ["status" ], "validationRequired" : False , "txRef" : txRef , "flwRef" : flwRef , "suggestedAuth" : None , "redirectUrl" : redirectUrl }
14
+ # def _handleChargeResponse(self, response, txRef, request=None):
15
+ # """ This handles charge responses """
16
+ # res = self._preliminaryResponseChecks(response, MobileChargeError, txRef=txRef)
17
+
18
+ # responseJson = res["json"]
19
+ # flwRef = res["flwRef"]
20
+
21
+ # # Checking if there is redirect url
22
+
23
+ # if responseJson["data"]["data"].get("redirect_url", "N/A") == "N/A":
24
+ # redirectUrl = None
25
+ # else:
26
+ # redirectUrl = responseJson["data"]["data"]["redirect_url"]
27
+
28
+ # # If all preliminary checks passed
29
+ # if not (responseJson["data"].get("chargeResponseCode", None) == "00"):
30
+ # # Otherwise we return that further action is required, along with the response
31
+ # # suggestedAuth = responseJson["data"].get("suggested_auth", None)
32
+ # return {
33
+ # "error": False,
34
+ # "status": responseJson["status"],
35
+ # "message": responseJson["message"],
36
+ # "code": responseJson["data"]["code"],
37
+ # "transaction status": responseJson["data"]["status"],
38
+ # "ts": responseJson["data"]["ts"],
39
+ # "link": responseJson["data"]["link"]
40
+ # }
41
+ # else:
42
+ # return {"error": False, "status": responseJson["status"], "validationRequired": False, "txRef": txRef, "flwRef": flwRef, "suggestedAuth": None, "redirectUrl": redirectUrl}
34
43
35
44
# Charge mobile money function
36
45
def charge (self , accountDetails , hasFailed = False ):
@@ -42,7 +51,7 @@ def charge(self, accountDetails, hasFailed=False):
42
51
43
52
endpoint = self ._baseUrl + self ._endpointMap ["account" ]["charge" ]
44
53
# It is faster to add boilerplate than to check if each one is present
45
- accountDetails .update ({"payment_type" : "mobilemoneyfrancophone" , "is_mobile_money_franco" :"1" , "currency" : "XOF" })
54
+ accountDetails .update ({"payment_type" : "mobilemoneyfrancophone" , "is_mobile_money_franco" :"1" })
46
55
47
56
# If transaction reference is not set
48
57
if not ("txRef" in accountDetails ):
@@ -51,5 +60,6 @@ def charge(self, accountDetails, hasFailed=False):
51
60
if not ("orderRef" in accountDetails ):
52
61
accountDetails .update ({"orderRef" : generateTransactionReference ()})
53
62
# Checking for required account components
54
- requiredParameters = ["amount" , "email" , "phonenumber" , "IP" , "redirect_url" ]
63
+ # requiredParameters = ["amount", "email", "phonenumber", "IP", "redirect_url"]
64
+ requiredParameters = ["amount" ]
55
65
return super (Francophone , self ).charge (accountDetails , requiredParameters , endpoint )
0 commit comments