repayment status
This commit is contained in:
@@ -3,4 +3,5 @@ from enum import Enum
|
||||
class LoanStatus(str, Enum):
|
||||
PENDING = "pending"
|
||||
ACTIVE = "active"
|
||||
START_REPAY = "start_repay"
|
||||
REPAID = "repaid"
|
||||
@@ -45,17 +45,14 @@ class RepaymentService(BaseService):
|
||||
loan_id = loan_id,
|
||||
product_id = product_id,
|
||||
transaction_id=transaction_id
|
||||
|
||||
)
|
||||
|
||||
if not repayment:
|
||||
logger.error(f"Failed to save repayment details")
|
||||
return ResponseHelper.error(result_description="Failed to save repayment details.")
|
||||
|
||||
|
||||
|
||||
#Update Loan status
|
||||
Loan.update_status(loan_id = loan_id, status = LoanStatus.REPAID)
|
||||
|
||||
Loan.update_status(loan_id = loan_id, status = LoanStatus.START_REPAY) # repay started bu user
|
||||
transaction = RepaymentService.log_transaction(validated_data = validated_data)
|
||||
|
||||
if not transaction:
|
||||
@@ -63,8 +60,6 @@ class RepaymentService(BaseService):
|
||||
return ResponseHelper.error(result_description="Failed to log transaction.")
|
||||
else:
|
||||
return ResponseHelper.error(result_description="Invalid Customer or Account")
|
||||
|
||||
|
||||
|
||||
# Simulated processing logic
|
||||
response_data = {
|
||||
|
||||
Reference in New Issue
Block a user