import httpx import json from app.utils.logger import logger from app.config import settings import logging class SimbrellaIntegration: BASE_URL = settings.SIMBRELLA_BASE_URL @staticmethod def rac_check(customer_id, account_id, transaction_id): """ Calls the RACCheck endpoit """ url = f"{SimbrellaIntegration.BASE_URL}/RACCheck" payload = { "customerId": customer_id, "accountId": account_id, "transactionId": str(transaction_id), "fbnTransactionId": f"FBN{transaction_id}", "RAC_Array": [ "SalaryAccount", "BVN", "BVNAttachedtoAccount", "CRC", "CRMS", "AccountStatus", "Lien", "NoBouncedCheck", "Whitelist", "NoPastDueSalaryLoan", "NoPastDueOtherLoan", ], } logger.info(f"This is PayLoad: {str(payload)}", exc_info=True) headers = { "Content-Type": "application/json", "x-api-key": f"{settings.VALID_API_KEY}", "App-Id": f"{settings.VALID_APP_ID}", } try: response = httpx.post(url, json=payload, headers=headers, timeout=10.0) logger.info(f"This is Response: {str(response)}", exc_info=True) return response except Exception as e: logger.error(f"RACCheck API call failed: {str(e)}", exc_info=True) raise Exception(f"RACCheck API call failed: {str(e)}")