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