added eco integration

This commit is contained in:
Chinenye Nmoh
2025-07-25 11:53:05 +01:00
parent c50b69e852
commit ca3ca1cac3
6 changed files with 33 additions and 30 deletions
+5 -4
View File
@@ -78,9 +78,10 @@ class SimbrellaClient:
insurance_fee = loan_charges.get("INSURANCE")['amount']
debtId = str(loan_data.get('debtId', "")).strip().zfill(6)
t_id = ''.join(random.choices(string.ascii_uppercase, k=22))
disbursement_data = {
"transactionId": loan_data.get('transactionId'),
"transactionId": t_id,
"FbnTransactionId": loan_data.get('transactionId'),
"debtId": debtId,
"customerId": loan_data.get('customerId'),
@@ -97,7 +98,7 @@ class SimbrellaClient:
try:
logger.info(f"Here is your Disbursement Request data ****** : {disbursement_data}")
response = requests.post(api_url, json=disbursement_data, timeout=10, headers=get_headers())
response = requests.post(api_url, json=disbursement_data, timeout=90, headers=get_headers())
if response.status_code == 404:
logger.error("Received 404 from external service")
return ResponseHelper.error("Disbursement Service url not found (404)", status_code=404)
@@ -178,7 +179,7 @@ class SimbrellaClient:
"unicode": True
}
try:
sms_response = requests.post(sms_url, json=sms_data, timeout=10, headers=get_headers())
sms_response = requests.post(sms_url, json=sms_data, timeout=90, headers=get_headers())
sms_response.raise_for_status() # Raise an exception for 4xx or 5xx status codes
result = sms_response.json()
@@ -194,7 +195,7 @@ class SimbrellaClient:
return 0
except Exception as e:
logger.info(f"Failed to call TransactionVerify endpoint: {e}")
return 0
return ResponseHelper.error("Unexpected error while processing loan disbursement", status_code=500, error=str(e))
@staticmethod
def collect_loan_user_initiated(data):