56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
import requests
|
|
from app.config import settings
|
|
from app.utils.auth import get_headers
|
|
from app.utils.logger import logger
|
|
from flask import jsonify
|
|
|
|
class SimbrellaClient:
|
|
|
|
BASE_URL = settings.BANK_CALL_BASE_URL
|
|
BANK_CALL_BASE_URL = settings.BANK_CALL_BASE_URL
|
|
|
|
@staticmethod
|
|
def disbursement(data):
|
|
BANK_CALL_BASE_URL = "https://bank-emulator.dev.simbrellang.net"
|
|
api_url = f"{BANK_CALL_BASE_URL}/Disbursement"
|
|
logger.info(f"BANK_CALL_BASE_URL = {BANK_CALL_BASE_URL}")
|
|
logger.info(f"Calling disbursement endpoint with data: {data}")
|
|
|
|
data1 ={
|
|
"requestId": "7876786",
|
|
"transactionId": "T001",
|
|
"debtId": "273194670",
|
|
"customerId": "CN621868",
|
|
"accountId": "2017821799",
|
|
"productId": "101",
|
|
"provideAmount": 100000,
|
|
"collectAmountInterest": 5000,
|
|
"collectAmountMgtFee": 1000,
|
|
"collectAmountInsurance": 1000,
|
|
"collectAmountVAT": 75,
|
|
"countryId": "01",
|
|
"comment": "Testing LoanRequest"
|
|
}
|
|
try:
|
|
# response = requests.post(
|
|
# api_url,
|
|
# json=data1,
|
|
# headers=get_headers()
|
|
# )
|
|
|
|
# headers = {
|
|
# 'Content-Type': 'application/json',
|
|
# 'x-api_key': f'{settings.VALID_API_KEY}',
|
|
# 'App-Id': f'{settings.VALID_APP_ID}'
|
|
# }
|
|
#
|
|
response = requests.post(api_url, json=data1, timeout=10, headers=get_headers())
|
|
logger.info(f"Disbursement response: {response.json()}")
|
|
logger.info(f"Here is your disbursement data: {data1}")
|
|
except Exception as e:
|
|
logger.info(f"Failed to call disbursement endpoint: {e}")
|
|
#raise
|
|
return 0
|
|
|
|
# return jsonify(response.json()), response.status_code
|
|
return 1 |