Merge pull request #626 from ashok-conflux/MIFOSX-723

Allow adjustment of deposited amount if there are any charges/withdrawan transactions on same day
This commit is contained in:
Vishwas Babu A J
2013-10-08 01:17:52 -07:00
3 changed files with 16 additions and 2 deletions
+3 -2
View File
@@ -11231,7 +11231,7 @@ Request Body:
"amount": "230.56",
"chargeTimeType": "1",
"chargeCalculationType": "1",
"chargePaymentMode": "1"
"chargePaymentMode": "1",
"active": true
}
</code>
@@ -11252,7 +11252,7 @@ Request Body:
"chargeAppliesTo": "1",
"chargeTimeType": "2",
"chargeCalculationType": "2",
"chargeCalculationType": "1",
"chargePaymentMode": "1",
"active": "true",
"penalty": "true"
}
@@ -11275,6 +11275,7 @@ Request Body:
"chargeAppliesTo": "2",
"chargeTimeType": "6",
"chargeCalculationType": "1",
"chargePaymentMode": "1",
"active": "true",
"penalty": "false"
}
@@ -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;
}