done with penal charge endpoint and fix some hardcoded values #16

Merged
ameye merged 1 commits from oluyemi into master 2025-04-17 21:07:23 +00:00
2 changed files with 11 additions and 13 deletions
+5 -8
View File
@@ -121,10 +121,11 @@ class SimbrellaClient:
def verify_transaction():
try:
return {
data = {
"status": "00",
"message": "Transaction verified"
}
return ResponseHelper.success(data, "Successful")
except Exception as e:
logger.info(f"Failed to call TransactionVerify endpoint: {e}")
@@ -136,7 +137,7 @@ class SimbrellaClient:
try:
logger.info(f"Here is your Disbursement Request data ***** : {data}")
return data
return ResponseHelper.success(data, "Successful")
except Exception as e:
logger.info(f"Failed to call Disbursement endpoint: {e}")
@@ -148,7 +149,7 @@ class SimbrellaClient:
try:
logger.info(f"Here is your Payment Callback Request data ***** : {data}")
return data
return ResponseHelper.success(data, "Successful")
except Exception as e:
logger.info(f"Failed to call Payment Callback endpoint: {e}")
@@ -167,16 +168,12 @@ class SimbrellaClient:
logger.info(f"Here is your Penal Charge Request data ****** : {data}")
response = requests.post(api_url, json=data, timeout=10, headers=get_headers())
logger.info(f"Penal Charge response: {response.json()}")
return ResponseHelper.success(response.json(), "Successful")
except Exception as e:
logger.info(f"Failed to call Penal Charge endpoint: {e}")
return ResponseHelper.error("An error occurred", 500)
return ResponseHelper.success({
"resultCode": "00",
"resultDescription": "Penal charge debited successfully"
}, "Successful")
except Exception as e:
logger.info(f"Failed to call Penal Charge endpoint: {e}")
raise
+6 -5
View File
@@ -1,6 +1,7 @@
from flask import Blueprint, request, jsonify, current_app
import requests
from app.config import settings
from app.helpers.response_helper import ResponseHelper
from app.utils.auth import get_headers
from app.utils.logger import logger
from app.integrations.simbrella import SimbrellaClient
@@ -14,7 +15,7 @@ def verify_transaction():
response = SimbrellaClient.verify_transaction()
return jsonify(response), 200
return response
@autocall_bp.route("/refresh-disbursement", methods=["GET"])
def disbursement():
@@ -23,7 +24,7 @@ def disbursement():
response = SimbrellaClient.verify_transaction()
return jsonify(response), 200
return response
@autocall_bp.route("/payment-callback", methods=["POST"])
@@ -33,13 +34,13 @@ def payment_callback():
response = SimbrellaClient.payment_callback(data)
return jsonify(response), 200
return response
@autocall_bp.route("/penal-charge", methods=["POST"])
def penal_charge():
data = request.get_json()
logger.info(f"Calling Penal Charge Endpoints")
response = SimbrellaClient.penal_charge(data)
response = SimbrellaClient.penal_charge(data[0])
return jsonify(response), 200
return response