Allow adjustment of deposited amount if there are any charges/withdrawan transactions on same day
This commit is contained in:
+4
@@ -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();
|
||||
|
||||
+9
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user