Skip to content

Commit

Permalink
added meta in verify response for card charges
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusyaovi committed Jul 22, 2021
1 parent 34b3fdb commit 3745bf2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions rave_python/rave_bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create(self, details):
tracking_payload = {
"publicKey": self._getPublicKey(),
"language": "Python v2",
"version": "1.2.12",
"version": "1.2.13",
"title": "Create-Bills-error",
"message": responseTime
}
Expand All @@ -68,7 +68,7 @@ def create(self, details):
tracking_payload = {
"publicKey": self._getPublicKey(),
"language": "Python v2",
"version": "1.2.12",
"version": "1.2.13",
"title": "Create-Bills",
"message": responseTime
}
Expand Down
5 changes: 3 additions & 2 deletions rave_python/rave_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def _handleVerifyResponse(self, response, txRef):
chargemessage = responseJson["data"]["chargemessage"]
chargecode = responseJson["data"]["chargecode"]
currency = responseJson["data"]["currency"]
meta = responseJson["data"]["meta"]

# Check if the call returned something other than a 200
if not response.ok:
Expand All @@ -79,10 +80,10 @@ def _handleVerifyResponse(self, response, txRef):

# if the chargecode is not 00
elif not (responseJson["data"].get("chargecode", None) == "00"):
return {"error": False, "transactionComplete": False, "txRef": txRef, "flwRef":flwRef, "amount": amount, "chargedamount": chargedamount, "cardToken": cardToken, "vbvmessage": vbvmessage, "chargemessage": chargemessage, "chargecode": chargecode, "currency": currency}
return {"error": False, "transactionComplete": False, "txRef": txRef, "flwRef":flwRef, "amount": amount, "chargedamount": chargedamount, "cardToken": cardToken, "vbvmessage": vbvmessage, "chargemessage": chargemessage, "chargecode": chargecode, "currency": currency, "meta": meta}

else:
return {"error":False, "transactionComplete": True, "txRef": txRef, "flwRef": flwRef, "amount": amount, "chargedamount": chargedamount, "cardToken": cardToken, "vbvmessage": vbvmessage, "chargemessage": chargemessage, "chargecode": chargecode, "currency": currency}
return {"error":False, "transactionComplete": True, "txRef": txRef, "flwRef": flwRef, "amount": amount, "chargedamount": chargedamount, "cardToken": cardToken, "vbvmessage": vbvmessage, "chargemessage": chargemessage, "chargecode": chargecode, "currency": currency, "meta": meta}


# Charge card function
Expand Down
16 changes: 8 additions & 8 deletions rave_python/rave_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ def charge(self, feature_name, paymentDetails, requiredParameters, endpoint, sho
if response.ok:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name, "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name, "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error", "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error", "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

if shouldReturnRequest:
Expand Down Expand Up @@ -266,12 +266,12 @@ def validate(self, feature_name, flwRef, otp, endpoint=None):
if response.ok:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name, "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name, "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error", "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error", "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

return self._handleValidateResponse(response, flwRef)
Expand Down Expand Up @@ -301,12 +301,12 @@ def verify(self, feature_name, txRef, endpoint=None):
if response.ok:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name, "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name, "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error", "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error", "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

return self._handleVerifyResponse(response, txRef)
Expand All @@ -333,12 +333,12 @@ def refund(self, feature_name, flwRef, amount, ):
if response.ok:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name, "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name, "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error", "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error", "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

try:
Expand Down
20 changes: 10 additions & 10 deletions rave_python/rave_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def _handleTransferStatusRequests(self, feature_name, endpoint, isPostRequest=Fa
if response.ok:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name,"message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name,"message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
return {"error": False, "returnedData": responseJson}
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error","message": responseTime}
raise TransferFetchError({"error": True, "returnedData": responseJson })

def _handleTransferRetriesRequests(self, feature_name, endpoint, isPostRequest=False, data=None):
Expand All @@ -101,13 +101,13 @@ def _handleTransferRetriesRequests(self, feature_name, endpoint, isPostRequest=F
if response.ok:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name,"message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name,"message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
return {"error": False, "returnedData": responseJson}
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error","message": responseTime}
return {"error": True, "returnedData": errorMessage }


Expand Down Expand Up @@ -140,12 +140,12 @@ def initiate(self, transferDetails):
#feature logging
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Initiate-Transfer-error","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Initiate-Transfer-error","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Initiate-Transfer","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Initiate-Transfer","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
return self._handleInitiateResponse(response, transferDetails)

Expand All @@ -172,12 +172,12 @@ def bulk(self, bulkDetails):
#feature logging
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Initiate-Bulk-error","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Initiate-Bulk-error","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Initiate-Bulk","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Initiate-Bulk","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

return self._handleBulkResponse(response, bulkDetails)
Expand Down Expand Up @@ -254,12 +254,12 @@ def fetchRetries(self, transfer_id):
# #feature logging
# tracking_endpoint = self._trackingMap
# responseTime = response.elapsed.total_seconds()
# tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "interwallet_transfers-error","message": responseTime}
# tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "interwallet_transfers-error","message": responseTime}
# tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
# else:
# tracking_endpoint = self._trackingMap
# responseTime = response.elapsed.total_seconds()
# tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "interwallet_transfers","message": responseTime}
# tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "interwallet_transfers","message": responseTime}
# tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
# return self._handleInitiateInterWalletResponse(response, data)

Expand Down
4 changes: 2 additions & 2 deletions rave_python/rave_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def _handleVerifyStatusRequests(self, endpoint, feature_name, isPostRequest=Fals
#feature logging
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name,"message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name,"message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
return {"error": False, "returnedData": responseJson}
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error", "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error", "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

raise BVNFetchError({"error": True, "returnedData": responseJson })
Expand Down
4 changes: 2 additions & 2 deletions rave_python/rave_virtualaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def create(self, accountDetails):
if response.ok == False:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Create-virtual-account-error","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Create-virtual-account-error","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Create-virtual-account","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Create-virtual-account","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

return self._handleCreateResponse(response, accountDetails)
8 changes: 4 additions & 4 deletions rave_python/rave_virtualcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def _handleCardStatusRequests(self, type, endpoint, feature_name, isPostRequest=
#feature logging
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name,"message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name,"message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

return {"error": False, "returnedData": responseJson}
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": feature_name + "-error","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": feature_name + "-error","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

raise CardStatusError(type, {"error": True, "returnedData": responseJson })
Expand All @@ -84,12 +84,12 @@ def create(self, vcardDetails):
if response.ok == False:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Create-card-error", "message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Create-card-error", "message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
else:
tracking_endpoint = self._trackingMap
responseTime = response.elapsed.total_seconds()
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.12", "title": "Create-card","message": responseTime}
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.13", "title": "Create-card","message": responseTime}
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))

return self._handleCreateResponse(response, vcardDetails)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="rave_python",
version="1.2.12",
version="1.2.13",
author="Flutterwave",
author_email="[email protected]",
description="Official Rave Python Wrapper By Flutterwave",
Expand Down

0 comments on commit 3745bf2

Please sign in to comment.