From caa77191c75fd6fb6286bafd328bb030417eb0d5 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 21 Jun 2025 10:43:31 -0400 Subject: [PATCH] balace onm payment --- app/models/repayments_data.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/repayments_data.py b/app/models/repayments_data.py index a790a78..ae84b18 100644 --- a/app/models/repayments_data.py +++ b/app/models/repayments_data.py @@ -42,6 +42,10 @@ class RepaymentsData(db.Model): Add a new repayment data entry. """ try: + repaymentAmount = data.get('repaymentAmount', 0.0) + amountCollected = data.get('amountCollected',0.0) + accountBalance = repaymentAmount - amountCollected + new_data = cls( transaction_id=data.get('transactionId'), response_code=data.get('responseCode'), @@ -49,8 +53,9 @@ class RepaymentsData(db.Model): fbn_transaction_id=data.get('fbnTransactionId'), account_id=data.get('accountId'), customer_id=data.get('customerId'), - amount_collected=data.get('amountCollected'), - repayment_amount=data.get('repaymentAmount'), + amount_collected=amountCollected, + repayment_amount=repaymentAmount, + balance=accountBalance ) db.session.add(new_data) db.session.commit()