Fix Que calls
This commit is contained in:
@@ -7,20 +7,50 @@ 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):
|
||||
|
||||
api_url = f"{SimbrellaClient.BASE_URL}/Disbursement"
|
||||
|
||||
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}")
|
||||
|
||||
response = requests.post(
|
||||
api_url,
|
||||
json=data,
|
||||
headers=get_headers()
|
||||
)
|
||||
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()
|
||||
# )
|
||||
|
||||
logger.info(f"Disbursement response: {response.json()}")
|
||||
# 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 jsonify(response.json()), response.status_code
|
||||
return 1
|
||||
Reference in New Issue
Block a user