diff --git a/app/integrations/simbrella.py b/app/integrations/simbrella.py index 792746f..d1f0f2f 100644 --- a/app/integrations/simbrella.py +++ b/app/integrations/simbrella.py @@ -10,9 +10,8 @@ class SimbrellaClient: @staticmethod def disbursement(data): - BANK_CALL_BASE_URL = "https://bank-emulator.dev.simbrellang.net" - api_url = f"{BANK_CALL_BASE_URL}/Disbursement" - logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}") + api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/Disbursement" + logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") logger.info(f"Calling Disbursement endpoint with data: {data}") data={ @@ -55,9 +54,8 @@ class SimbrellaClient: @staticmethod def collect_loan(data): - BANK_CALL_BASE_URL = "https://bank-emulator.dev.simbrellang.net" - api_url = f"{BANK_CALL_BASE_URL}/CollectLoan" - logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}") + api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/CollectLoan" + logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") logger.info(f"Calling CollectLoan endpoint with data: {data}") collect_loan_data = { @@ -88,9 +86,8 @@ class SimbrellaClient: @staticmethod def verify_transaction(data): - BANK_CALL_BASE_URL = "https://bank-emulator.dev.simbrellang.net" - api_url = f"{BANK_CALL_BASE_URL}/TransactionVerify" - logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}") + api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/TransactionVerify" + logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") logger.info(f"Calling TransactionVerify endpoint with data: {data}") try: @@ -103,3 +100,22 @@ class SimbrellaClient: except Exception as e: logger.info(f"Failed to call TransactionVerify endpoint: {e}") raise + + @staticmethod + def refresh_disbursement(data): + api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/Disbursement" + logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") + logger.info(f"Calling Disbursement endpoint with data: {data}") + + try: + logger.info(f"Here is your Disbursement Request data ***** : {data}") + # response = requests.post(api_url, json=data, headers=get_headers()) + logger.info(f"Disbursement response: {response.json()}") + + # return response.json() + + return data + + except Exception as e: + logger.info(f"Failed to call Disbursement endpoint: {e}") + raise diff --git a/app/routes/autocall.py b/app/routes/autocall.py index e55d5c6..8d6aba8 100644 --- a/app/routes/autocall.py +++ b/app/routes/autocall.py @@ -10,7 +10,7 @@ autocall_bp = Blueprint("autocall", __name__) @autocall_bp.route("/refresh-verify-disbursement", methods=["GET"]) def verify_transaction(): data = request.json() - logger.info(f"Calling Verify Components") + logger.info(f"Calling VerifyTransaction Components") response = SimbrellaClient.verify_transaction(data) @@ -20,7 +20,10 @@ def verify_transaction(): def disbursement(): data = request.json() logger.info(f"Calling Disbursement Components") - return jsonify(data), 200 + + response = SimbrellaClient.verify_transaction(data) + + return jsonify(response), 200 @autocall_bp.route("/payment-callback", methods=["POST"])