import requests from app.utils.logger import logger from app.config import settings class SimbrellaClient: BASE_URL = settings.SIMBRELLA_BASE_URL @staticmethod def rac_check(customer_id, account_id, transaction_id): """ Calls the RACCheck endpoit """ url = f"{SimbrellaClient.BASE_URL}/RACCheck" payload = { "customerId": customer_id, "accountId": account_id, "transactionId": transaction_id, "RAC_Array": [ { "salaryAccount": True, "bvn": "12345678901", "crc": False, "crms": True, "accountStatus": "active", "lien": False, "noBouncedCheck": True, "existingLoan": False, "whitelist": True, "noPastDueSalaryLoan": True, "noPastDueOtherLoans": False } ] } try: response = requests.post(url, json=payload, timeout=10) # Raise an error for non-200 responses # response.raise_for_status() return response.json() except requests.exceptions.RequestException as err: logger.error(f"RACCheck API call failed: {str(err)}", exc_info=True) return {"error": "RACCheck API error", "details": str(err)}