Verify transation s
This commit is contained in:
+1
-1
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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"])
|
||||
|
||||
Reference in New Issue
Block a user