[add]: RACCHECK

This commit is contained in:
VivianDee
2025-03-31 16:24:05 +01:00
parent d9c99627ae
commit c826bdc36b
5 changed files with 57 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
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)}