balace onm payment
This commit is contained in:
@@ -42,6 +42,10 @@ class RepaymentsData(db.Model):
|
|||||||
Add a new repayment data entry.
|
Add a new repayment data entry.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
repaymentAmount = data.get('repaymentAmount', 0.0)
|
||||||
|
amountCollected = data.get('amountCollected',0.0)
|
||||||
|
accountBalance = repaymentAmount - amountCollected
|
||||||
|
|
||||||
new_data = cls(
|
new_data = cls(
|
||||||
transaction_id=data.get('transactionId'),
|
transaction_id=data.get('transactionId'),
|
||||||
response_code=data.get('responseCode'),
|
response_code=data.get('responseCode'),
|
||||||
@@ -49,8 +53,9 @@ class RepaymentsData(db.Model):
|
|||||||
fbn_transaction_id=data.get('fbnTransactionId'),
|
fbn_transaction_id=data.get('fbnTransactionId'),
|
||||||
account_id=data.get('accountId'),
|
account_id=data.get('accountId'),
|
||||||
customer_id=data.get('customerId'),
|
customer_id=data.get('customerId'),
|
||||||
amount_collected=data.get('amountCollected'),
|
amount_collected=amountCollected,
|
||||||
repayment_amount=data.get('repaymentAmount'),
|
repayment_amount=repaymentAmount,
|
||||||
|
balance=accountBalance
|
||||||
)
|
)
|
||||||
db.session.add(new_data)
|
db.session.add(new_data)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user