changed amount to salaryAmount

This commit was merged in pull request #28.
This commit is contained in:
Chinenye Nmoh
2025-06-20 13:49:10 +01:00
parent bcd9513a10
commit 79b22e6d4f
4 changed files with 16 additions and 18 deletions
+9 -15
View File
@@ -183,23 +183,17 @@ class SimbrellaClient:
# InitiatedBy = USER_INITIATED
logger.info(f"Calling CollectLoan collect_loan_user_initiated ******* endpoint with data: {data}")
return SimbrellaClient._collect_loan(data,"1")
@staticmethod
def collect_loan_user_salary_detect(data):
#InitiatedBy = SALARY_DETECT
# logger.info(f"salary data: {data}")
# try:
# salary = SalaryService.add_salary_data(data)
# if salary:
# return ResponseHelper.success(salary.to_dict(), "Successful")
#
# except Exception as e:
# logger.info(f"Failed to save salary: {e}")
# return ResponseHelper.error(message="Failed to call salary endpoint",
# status_code=400,
# error=str(e) )
return SimbrellaClient._collect_loan(data,"2")
try:
return SimbrellaClient._collect_loan(data, "2")
except Exception as e:
logger.error(f"Error in collect_loan_user_salary_detect: {e}")
return ResponseHelper.error(
message="Failed to collect loan for salary detection",
status_code=500,
error=str(e)
)
@staticmethod
+2 -2
View File
@@ -29,7 +29,7 @@ class Salary(db.Model):
'id': self.id,
'customerId': self.customer_id,
'accountId' : self.account_id,
'amount': self.amount,
'salaryAmount': self.amount,
'status': self.status,
'createdAt': self.created_at.isoformat() if self.created_at else None,
'updatedAt': self.updated_at.isoformat() if self.updated_at else None,
@@ -45,7 +45,7 @@ class Salary(db.Model):
try:
new_data = cls(
customer_id=data.get('customerId'),
amount=data.get('amount', 0.0),
amount=data.get('salaryAmount', 0.0),
status='START',
salary_date = datetime.strptime(data.get('salaryDate'), "%Y-%m-%d").date() if data.get('salaryDate') else None,
account_id=data.get('accountId')
+4
View File
@@ -121,6 +121,10 @@ def salary_detect():
payload = request.get_json()
logger.info("Calling Salary Detect endpoint")
if payload is None:
logger.warning("No payload received in request")
return ResponseHelper.error("Missing request payload", status_code=400)
# Step 1: Try to add new salary data
try:
new_salary = SalaryService.add_salary_data(payload)
+1 -1
View File
@@ -192,7 +192,7 @@ paths:
example: "OP621868"
status:
type: string
amount:
salaryAmount:
type: number
example: 200000
salaryDate: