(20241217) Payment message capture improved.

This commit is contained in:
2024-12-17 13:58:50 +05:30
parent 9de9542fda
commit 8b39393ed3
5 changed files with 23 additions and 12 deletions
@@ -346,12 +346,12 @@ class SafaricomMPesaExpress:
)
# If the call failed:
if api_response.httpCode == 400:
if api_response.httpCode not in [200]:
api_json = await api_response.get_json()
api_response.message = f"{api_json['errorCode']} -> {api_json['errorMessage']}"
# If the call failed:
if api_response.httpCode in [200]:
else:
api_json = await api_response.get_json()
success = True if str(api_json.get("ResponseCode")) == "0" else False
api_response.message = api_json.get("ResponseDescription", "N/A")