[add]: loan charges and offers. Fix RACCheck

This commit is contained in:
VivianDee
2025-04-16 21:36:26 +01:00
parent 359621dc9d
commit 93ed8b3d17
12 changed files with 161 additions and 71 deletions
+5 -6
View File
@@ -36,6 +36,7 @@ class SimbrellaIntegration:
}
logger.error(f"This is PayLoad: {str(payload)}",exc_info=True)
headers = {
'Content-Type': 'application/json',
'x-api-key': f'{settings.VALID_API_KEY}',
@@ -44,12 +45,10 @@ class SimbrellaIntegration:
try:
response = requests.post(url, json=payload, timeout=10, headers=headers)
logger.error(f"This is Response: {str(response)}", exc_info=True)
# Raise an error for non-200 responses
if response.status_code != 200:
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"}
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)}")