[add]: Documentation Update
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
from .simbrella import SimbrellaIntegration
|
||||
from .kafka import KafkaIntegration
|
||||
from .kafka import KafkaIntegration
|
||||
from .events_service import EventServiceIntegration
|
||||
@@ -0,0 +1,49 @@
|
||||
import httpx
|
||||
from app.utils.logger import logger
|
||||
from app.config import settings
|
||||
|
||||
|
||||
class EventServiceIntegration:
|
||||
BASE_URL = settings.SIMBRELLA_BASE_URL
|
||||
ENDPOINT_DIRECT_LOAN = settings.ENDPOINT_DIRECT_LOAN
|
||||
ENDPOINT_DIRECT_REPAYMENT = settings.ENDPOINT_DIRECT_REPAYMENT
|
||||
|
||||
@staticmethod
|
||||
def direct_loan(transaction_id: str):
|
||||
"""
|
||||
Calls the Direct Loan endpoint
|
||||
"""
|
||||
url = f"{EventServiceIntegration.BASE_URL}{EventServiceIntegration.ENDPOINT_DIRECT_LOAN}"
|
||||
payload = {"transactionId": str(transaction_id)}
|
||||
|
||||
headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
try:
|
||||
response = httpx.post(url, json=payload, headers=headers, timeout=10.0)
|
||||
logger.info(f"Loan Response: {response.text}")
|
||||
return response
|
||||
except Exception as e:
|
||||
logger.error(f"Direct Loan API call failed: {str(e)}", exc_info=True)
|
||||
raise
|
||||
|
||||
@staticmethod
|
||||
def direct_repayment(transaction_id: str):
|
||||
"""
|
||||
Calls the Direct Repayment endpoint
|
||||
"""
|
||||
url = f"{EventServiceIntegration.BASE_URL}{EventServiceIntegration.ENDPOINT_DIRECT_REPAYMENT}"
|
||||
payload = {"transactionId": str(transaction_id)}
|
||||
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
try:
|
||||
response = httpx.post(url, json=payload, headers=headers, timeout=10.0)
|
||||
logger.info(f"Repayment Response: {response.text}")
|
||||
return response
|
||||
except Exception as e:
|
||||
logger.error(f"Direct Repayment API call failed: {str(e)}", exc_info=True)
|
||||
raise
|
||||
Reference in New Issue
Block a user