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, country_code, msisdn): """ Calls the RACCheck endpoit """ url = f"{SimbrellaClient.BASE_URL}/RACCheck" payload = { "customerId": customer_id, "accountId": account_id, "transactionId": transaction_id, "countryCode": country_code, "msisdn": msisdn } 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)}