From 9fc3104c79b7ca665c323b3334320d3911541171 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 31 May 2025 21:44:52 -0400 Subject: [PATCH] Verify transation s --- app/config.py | 2 +- app/integrations/simbrella.py | 30 ++++++++++++++++++++++-------- app/routes/autocall.py | 2 -- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/app/config.py b/app/config.py index 0175681..41a4a3f 100644 --- a/app/config.py +++ b/app/config.py @@ -39,6 +39,6 @@ class Config: BANK_CALL_BASE_URL = os.getenv("BANK_CALL_BASE_URL", "https://bank-emulator.dev.simbrellang.net") BANK_CALL_DISBURSE_LOAN_ENDPOINT = os.getenv("BANK_CALL_DISBURSE_LOAN_ENDPOINT","DisburseLoan") BANK_CALL_COLLECT_LOAN_ENDPOINT = os.getenv("BANK_CALL_COLLECT_LOAN_ENDPOINT","CollectLoan") - + BANK_CALL_TRANSACTION_VERIFY = os.getenv("BANK_CALL_TRANSACTION_VERIFY", "TransactionVerify") settings = Config() diff --git a/app/integrations/simbrella.py b/app/integrations/simbrella.py index 1e44b41..5fff2a2 100644 --- a/app/integrations/simbrella.py +++ b/app/integrations/simbrella.py @@ -15,6 +15,7 @@ class SimbrellaClient: BANK_CALL_BASE_URL = settings.BANK_CALL_BASE_URL BANK_CALL_DISBURSE_LOAN_ENDPOINT = settings.BANK_CALL_DISBURSE_LOAN_ENDPOINT BANK_CALL_COLLECT_LOAN_ENDPOINT = settings.BANK_CALL_COLLECT_LOAN_ENDPOINT + BANK_CALL_TRANSACTION_VERIFY = settings.BANK_CALL_TRANSACTION_VERIFY @staticmethod def disburse_loan(data): @@ -85,6 +86,7 @@ class SimbrellaClient: @staticmethod def collect_loan(data): api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/{SimbrellaClient.BANK_CALL_COLLECT_LOAN_ENDPOINT}" + logger.info(f"Calling CollectLoan api_url==> : {api_url}") logger.info(f"Calling CollectLoan endpoint with data: {data}") # Check if the repayment exists @@ -107,7 +109,7 @@ class SimbrellaClient: "fbnTransactionId": loan.reference, "debtId": repayment.loan_id, "customerId": repayment.customer_id, - "accountId": loan.account, + "accountId": loan.account_id, "productId": repayment.product_id, "collectAmount": collectAmount, "penalCharge": 0, @@ -131,17 +133,29 @@ class SimbrellaClient: @staticmethod def verify_transaction(): - try: + api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/{SimbrellaClient.BANK_CALL_DISBURSE_LOAN_ENDPOINT}" + logger.info(f"Calling TransactionVerify api_url==> : {api_url}") - data = { - "status": "00", - "message": "Transaction verified" - } - return ResponseHelper.success(data, "Successful") + verify_data = { + "channel": "string", + "accountId": "string", + "customerId": "string", + "transactionId": "string", + "transactionType": "string", + "countryId": "string", + "requestId": "string" + } + + try: + logger.info(f"Here is your TransactionVerify Request data ****** : {verify_data}") + response = requests.post(api_url, json=verify_data, timeout=10, headers=get_headers()) + logger.info(f"TransactionVerify Response: {response.json()}") + return ResponseHelper.success(response, "Successful") except Exception as e: logger.info(f"Failed to call TransactionVerify endpoint: {e}") - raise + return 0 + @staticmethod def refresh_disbursement(data): diff --git a/app/routes/autocall.py b/app/routes/autocall.py index 230cd4e..87f8b64 100644 --- a/app/routes/autocall.py +++ b/app/routes/autocall.py @@ -10,11 +10,9 @@ autocall_bp = Blueprint("autocall", __name__) @autocall_bp.route("/refresh-verify-disbursement", methods=["GET"]) def verify_transaction(): - # data = request.json() logger.info(f"Calling VerifyTransaction Components") response = SimbrellaClient.verify_transaction() - return response @autocall_bp.route("/refresh-disbursement", methods=["GET"])