[FINERACT-152][FINERACT-153] - Dormant Savings Issues Corrections

This commit is contained in:
Adi Narayana Raju
2016-05-11 13:15:29 +05:30
parent d2b853561f
commit 9353a52013
7 changed files with 20 additions and 24 deletions
@@ -314,7 +314,7 @@ public class AccountingScenarioIntegrationTest {
ChargesHelper.getSavingsWithdrawalFeeJSON());
Assert.assertNotNull(withdrawalChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsID, withdrawalChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsID, withdrawalChargeId, false);
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsID);
Assert.assertEquals(1, chargesPendingState.size());
HashMap savingsChargeForPay = chargesPendingState.get(0);
@@ -238,7 +238,7 @@ public class ClientSavingsIntegrationTest {
ChargesHelper.getSavingsActivationFeeJSON());
Assert.assertNotNull(savingsActivationChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, savingsActivationChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, savingsActivationChargeId, true);
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
@@ -521,7 +521,7 @@ public class ClientSavingsIntegrationTest {
ChargesHelper.getSavingsWithdrawalFeeJSON());
Assert.assertNotNull(withdrawalChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false);
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(1, chargesPendingState.size());
@@ -547,7 +547,7 @@ public class ClientSavingsIntegrationTest {
ArrayList<HashMap> charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertTrue(charges == null || charges.size() == 0);
this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(1, charges.size());
@@ -592,7 +592,7 @@ public class ClientSavingsIntegrationTest {
ChargesHelper.getSavingsMonthlyFeeJSON());
Assert.assertNotNull(monthlyFeechargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(2, charges.size());
@@ -618,7 +618,7 @@ public class ClientSavingsIntegrationTest {
ChargesHelper.getSavingsWeeklyFeeJSON());
Assert.assertNotNull(weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(3, charges.size());
@@ -924,7 +924,7 @@ public class ClientSavingsIntegrationTest {
ACCOUNT_TYPE_INDIVIDUAL);
Assert.assertTrue(modifications.containsKey("submittedOnDate"));
this.savingsAccountHelper.addChargesForSavings(savingsId, savingsChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, savingsChargeId, false);
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
@@ -439,7 +439,7 @@ public class GroupSavingsIntegrationTest {
ChargesHelper.getSavingsWithdrawalFeeJSON());
Assert.assertNotNull(withdrawalChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, withdrawalChargeId, false);
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(1, chargesPendingState.size());
@@ -465,7 +465,7 @@ public class GroupSavingsIntegrationTest {
ArrayList<HashMap> charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertTrue(charges == null || charges.size() == 0);
this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, chargeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(1, charges.size());
@@ -486,7 +486,7 @@ public class GroupSavingsIntegrationTest {
ChargesHelper.getSavingsMonthlyFeeJSON());
Assert.assertNotNull(monthlyFeechargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, monthlyFeechargeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(2, charges.size());
@@ -504,7 +504,7 @@ public class GroupSavingsIntegrationTest {
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON());
Assert.assertNotNull(weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(3, charges.size());
@@ -126,7 +126,7 @@ public class SchedulerJobsTestResults {
ChargesHelper.getSavingsAnnualFeeJSON());
Assert.assertNotNull(annualFeeChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, annualFeeChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, annualFeeChargeId, true);
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(1, chargesPendingState.size());
@@ -347,7 +347,7 @@ public class SchedulerJobsTestResults {
ChargesHelper.getSavingsSpecifiedDueDateJSON());
Assert.assertNotNull(specifiedDueDateChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, specifiedDueDateChargeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, specifiedDueDateChargeId, true);
ArrayList<HashMap> chargesPendingState = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(1, chargesPendingState.size());
@@ -196,10 +196,10 @@ public class SavingsAccountHelper {
getCalculatedInterestForSavingsApplicationAsJSON(), "");
}
public Integer addChargesForSavings(final Integer savingsId, final Integer chargeId) {
public Integer addChargesForSavings(final Integer savingsId, final Integer chargeId, boolean addDueDate) {
System.out.println("--------------------------------- ADD CHARGES FOR SAVINGS --------------------------------");
return (Integer) performSavingActions(SAVINGS_ACCOUNT_URL + "/" + savingsId + "/charges?" + Utils.TENANT_IDENTIFIER,
getPeriodChargeRequestJSON(chargeId), CommonConstants.RESPONSE_RESOURCE_ID);
getPeriodChargeRequestJSON(chargeId, addDueDate), CommonConstants.RESPONSE_RESOURCE_ID);
}
public Integer payCharge(final Integer chargeId, final Integer savingsId, String amount, String dueDate) {
@@ -419,7 +419,7 @@ public class SavingsAccountHelper {
getCloseAccountJSON(withdrawBalance, closedOnDate), jsonAttributeToGetBack);
}
private String getPeriodChargeRequestJSON(Integer chargeId) {
private String getPeriodChargeRequestJSON(Integer chargeId, boolean addDueDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("chargeId", chargeId);
map.put("amount", 100);
@@ -427,7 +427,9 @@ public class SavingsAccountHelper {
map.put("locale", CommonConstants.locale);
map.put("monthDayFormat", "dd MMMM");
map.put("dateFormat", "dd MMMM yyy");
map.put("dueDate", "10 January 2013");
if(addDueDate){
map.put("dueDate", "10 January 2013");
}
String json = new Gson().toJson(map);
return json;
}
@@ -226,9 +226,6 @@ public class SavingsAccountCharge extends AbstractPersistable<Long> {
populateDerivedFields(transactionAmount, chargeAmount);
if (this.isWithdrawalFee()
|| this.isOverdraftFee()
|| this.isSavingsActivation()
|| this.isSavingsClosure()
|| this.isSavingsNoActivity()) {
this.amountOutstanding = BigDecimal.ZERO;
}
@@ -789,10 +789,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
Integer chargeTimeType = chargeDefinition.getChargeTimeType();
LocalDate dueAsOfDateParam = command.localDateValueOfParameterNamed(dueAsOfDateParamName);
if((chargeTimeType.equals(ChargeTimeType.WITHDRAWAL_FEE.getValue())
|| chargeTimeType.equals(ChargeTimeType.OVERDRAFT_FEE.getValue())
|| chargeTimeType.equals(ChargeTimeType.SAVINGS_ACTIVATION.getValue())
|| chargeTimeType.equals(ChargeTimeType.SAVINGS_NOACTIVITY_FEE.getValue())
|| chargeTimeType.equals(ChargeTimeType.SAVINGS_CLOSURE.getValue()))
|| chargeTimeType.equals(ChargeTimeType.SAVINGS_NOACTIVITY_FEE.getValue()))
&& dueAsOfDateParam != null){
baseDataValidator.reset().parameter(dueAsOfDateParamName).value(dueAsOfDateParam.toString(fmt))
.failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.invalid.for." + ChargeTimeType.fromInt(chargeTimeType).getCode());