some improvements on endpoints
This commit was merged in pull request #16.
This commit is contained in:
@@ -121,10 +121,11 @@ class SimbrellaClient:
|
|||||||
def verify_transaction():
|
def verify_transaction():
|
||||||
try:
|
try:
|
||||||
|
|
||||||
return {
|
data = {
|
||||||
"status": "00",
|
"status": "00",
|
||||||
"message": "Transaction verified"
|
"message": "Transaction verified"
|
||||||
}
|
}
|
||||||
|
return ResponseHelper.success(data, "Successful")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(f"Failed to call TransactionVerify endpoint: {e}")
|
logger.info(f"Failed to call TransactionVerify endpoint: {e}")
|
||||||
@@ -136,7 +137,7 @@ class SimbrellaClient:
|
|||||||
try:
|
try:
|
||||||
logger.info(f"Here is your Disbursement Request data ***** : {data}")
|
logger.info(f"Here is your Disbursement Request data ***** : {data}")
|
||||||
|
|
||||||
return data
|
return ResponseHelper.success(data, "Successful")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(f"Failed to call Disbursement endpoint: {e}")
|
logger.info(f"Failed to call Disbursement endpoint: {e}")
|
||||||
@@ -148,7 +149,7 @@ class SimbrellaClient:
|
|||||||
try:
|
try:
|
||||||
logger.info(f"Here is your Payment Callback Request data ***** : {data}")
|
logger.info(f"Here is your Payment Callback Request data ***** : {data}")
|
||||||
|
|
||||||
return data
|
return ResponseHelper.success(data, "Successful")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(f"Failed to call Payment Callback endpoint: {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}")
|
logger.info(f"Here is your Penal Charge Request data ****** : {data}")
|
||||||
response = requests.post(api_url, json=data, timeout=10, headers=get_headers())
|
response = requests.post(api_url, json=data, timeout=10, headers=get_headers())
|
||||||
logger.info(f"Penal Charge response: {response.json()}")
|
logger.info(f"Penal Charge response: {response.json()}")
|
||||||
|
return ResponseHelper.success(response.json(), "Successful")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(f"Failed to call Penal Charge endpoint: {e}")
|
logger.info(f"Failed to call Penal Charge endpoint: {e}")
|
||||||
return ResponseHelper.error("An error occurred", 500)
|
return ResponseHelper.error("An error occurred", 500)
|
||||||
|
|
||||||
return ResponseHelper.success({
|
|
||||||
"resultCode": "00",
|
|
||||||
"resultDescription": "Penal charge debited successfully"
|
|
||||||
}, "Successful")
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(f"Failed to call Penal Charge endpoint: {e}")
|
logger.info(f"Failed to call Penal Charge endpoint: {e}")
|
||||||
raise
|
raise
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
from flask import Blueprint, request, jsonify, current_app
|
from flask import Blueprint, request, jsonify, current_app
|
||||||
import requests
|
import requests
|
||||||
from app.config import settings
|
from app.config import settings
|
||||||
|
from app.helpers.response_helper import ResponseHelper
|
||||||
from app.utils.auth import get_headers
|
from app.utils.auth import get_headers
|
||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from app.integrations.simbrella import SimbrellaClient
|
from app.integrations.simbrella import SimbrellaClient
|
||||||
@@ -14,7 +15,7 @@ def verify_transaction():
|
|||||||
|
|
||||||
response = SimbrellaClient.verify_transaction()
|
response = SimbrellaClient.verify_transaction()
|
||||||
|
|
||||||
return jsonify(response), 200
|
return response
|
||||||
|
|
||||||
@autocall_bp.route("/refresh-disbursement", methods=["GET"])
|
@autocall_bp.route("/refresh-disbursement", methods=["GET"])
|
||||||
def disbursement():
|
def disbursement():
|
||||||
@@ -23,7 +24,7 @@ def disbursement():
|
|||||||
|
|
||||||
response = SimbrellaClient.verify_transaction()
|
response = SimbrellaClient.verify_transaction()
|
||||||
|
|
||||||
return jsonify(response), 200
|
return response
|
||||||
|
|
||||||
|
|
||||||
@autocall_bp.route("/payment-callback", methods=["POST"])
|
@autocall_bp.route("/payment-callback", methods=["POST"])
|
||||||
@@ -33,13 +34,13 @@ def payment_callback():
|
|||||||
|
|
||||||
response = SimbrellaClient.payment_callback(data)
|
response = SimbrellaClient.payment_callback(data)
|
||||||
|
|
||||||
return jsonify(response), 200
|
return response
|
||||||
|
|
||||||
@autocall_bp.route("/penal-charge", methods=["POST"])
|
@autocall_bp.route("/penal-charge", methods=["POST"])
|
||||||
def penal_charge():
|
def penal_charge():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
logger.info(f"Calling Penal Charge Endpoints")
|
logger.info(f"Calling Penal Charge Endpoints")
|
||||||
|
|
||||||
response = SimbrellaClient.penal_charge(data)
|
response = SimbrellaClient.penal_charge(data[0])
|
||||||
|
|
||||||
return jsonify(response), 200
|
return response
|
||||||
Reference in New Issue
Block a user