Allow adjustment of deposited amount if there are any charges/withdrawan transactions on same day

This commit is contained in:
ashok-conflux
2013-10-08 13:42:24 +05:30
parent c676e01872
commit c79b876193
3 changed files with 16 additions and 2 deletions
@@ -205,6 +205,10 @@ public final class SavingsAccountTransaction extends AbstractPersistable<Long> {
public boolean isDeposit() {
return SavingsAccountTransactionType.fromInt(this.typeOf).isDeposit();
}
public boolean isDepositAndNotReversed() {
return SavingsAccountTransactionType.fromInt(this.typeOf).isDeposit() && isNotReversed();
}
public boolean isWithdrawal() {
return SavingsAccountTransactionType.fromInt(this.typeOf).isWithdrawal();
@@ -23,6 +23,15 @@ public class SavingsAccountTransactionComparator implements Comparator<SavingsAc
compareResult = -1;
} else if (!o1.isInterestPostingAndNotReversed() && o2.isInterestPostingAndNotReversed()) {
compareResult = 1;
} else if (!o1.isDepositAndNotReversed() && o2.isDepositAndNotReversed()) {
// push all deposit transactions before charge/withdrawal transactions on same day.
// activation charge is charged on account activation date, any
// adjustments with deposit amount
// resulting into negative balance, to fix this push deposit
// transactions before charge/withdrawal charges transactions.
compareResult = 1;
} else if (o1.isDepositAndNotReversed() && !o2.isDepositAndNotReversed()) {
compareResult = -1;
} else {
compareResult = 0;
}