Skip to content

Commit

Permalink
Fixed HDFC issue where in for failed ATM transaction they reveert the…
Browse files Browse the repository at this point in the history
… amount using negative value in debit field
  • Loading branch information
MalayPalace committed Aug 25, 2023
1 parent 28fa0bd commit f78f903
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion bank_statement_utility/services/HdfcDebitStatementProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ def map_record(self, value_dict):
if Decimal(value_dict['Debit Amount']) > 0.00:
debit_amount = round(float(value_dict['Debit Amount']), 2)
credit_amount = None
else:
elif Decimal(value_dict['Debit Amount']) < 0.00:
debit_amount = None
credit_amount = round(abs(float(value_dict['Debit Amount'])), 2)
elif Decimal(value_dict['Credit Amount']) > 0.00:
debit_amount = None
credit_amount = round(float(value_dict['Credit Amount']), 2)
elif Decimal(value_dict['Credit Amount']) < 0.00:
debit_amount = round(abs(float(value_dict['Credit Amount'])), 2)
credit_amount = None
else:
raise AttributeError("Both Credit and Debit fields are zero")

# Date formatting
trans_date = datetime.strptime(value_dict['Date'], '%d/%m/%y')
Expand Down
2 changes: 1 addition & 1 deletion bank_statement_utility/services/VerificationService.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def process(self):
return validate_flag

@classmethod
def __calculate_difference_of_balance(self, newest_statement_row, oldest_statement_row, total_credit_amt,
def __calculate_difference_of_balance(cls, newest_statement_row, oldest_statement_row, total_credit_amt,
total_debit_amt):
closing_amt = float(oldest_statement_row.closing_balance)

Expand Down

0 comments on commit f78f903

Please sign in to comment.