You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ra...@apache.org on 2016/05/10 12:27:31 UTC
[1/5] incubator-fineract git commit:
[FINERACT-152][FINERACT-153][FINERACT-154] - Dormant savings issues
Repository: incubator-fineract
Updated Branches:
refs/heads/develop f3f6f4bf8 -> d2b853561
[FINERACT-152][FINERACT-153][FINERACT-154] - Dormant savings issues
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/b3f66660
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/b3f66660
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/b3f66660
Branch: refs/heads/develop
Commit: b3f6666087eb5ab781db2fb7a19002f69d159899
Parents: d1067e5
Author: Adi Narayana Raju <ad...@confluxtechnologies.com>
Authored: Tue May 10 14:17:53 2016 +0530
Committer: Adi Narayana Raju <ad...@confluxtechnologies.com>
Committed: Tue May 10 14:17:53 2016 +0530
----------------------------------------------------------------------
.../savings/domain/SavingsAccountCharge.java | 6 +++++-
...AccountWritePlatformServiceJpaRepositoryImpl.java | 15 +++++++++++++--
...06__add_domancy_tracking_job_to_savings_group.sql | 3 +++
3 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b3f66660/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java
index fe40f3b..f7c048d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java
@@ -225,7 +225,11 @@ public class SavingsAccountCharge extends AbstractPersistable<Long> {
populateDerivedFields(transactionAmount, chargeAmount);
- if (this.isWithdrawalFee()) {
+ if (this.isWithdrawalFee()
+ || this.isOverdraftFee()
+ || this.isSavingsActivation()
+ || this.isSavingsClosure()
+ || this.isSavingsNoActivity()) {
this.amountOutstanding = BigDecimal.ZERO;
}
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b3f66660/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
index 6612c88..7bc0311 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
@@ -45,6 +45,7 @@ import org.apache.fineract.portfolio.account.service.AccountAssociationsReadPlat
import org.apache.fineract.portfolio.account.service.AccountTransfersReadPlatformService;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
+import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
import org.apache.fineract.portfolio.group.domain.Group;
@@ -785,6 +786,17 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final Long chargeDefinitionId = command.longValueOfParameterNamed(chargeIdParamName);
final Charge chargeDefinition = this.chargeRepository.findOneWithNotFoundDetection(chargeDefinitionId);
+ 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()))
+ && dueAsOfDateParam != null){
+ baseDataValidator.reset().parameter(dueAsOfDateParamName).value(dueAsOfDateParam.toString(fmt))
+ .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.invalid.for." + ChargeTimeType.fromInt(chargeTimeType).getCode());
+ }
final SavingsAccountCharge savingsAccountCharge = SavingsAccountCharge.createNewFromJson(savingsAccount, chargeDefinition, command);
if (savingsAccountCharge.getDueLocalDate() != null) {
@@ -793,16 +805,15 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
&& this.holidayRepository.isHoliday(savingsAccount.officeId(), savingsAccountCharge.getDueLocalDate())) {
baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt))
.failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.on.holiday");
- if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
}
if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled()
&& !this.workingDaysRepository.isWorkingDay(savingsAccountCharge.getDueLocalDate())) {
baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt))
.failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.a.nonworking.day");
- if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
}
}
+ if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
savingsAccount.addCharge(fmt, savingsAccountCharge, chargeDefinition);
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/b3f66660/fineract-provider/src/main/resources/sql/migrations/core_db/V306__add_domancy_tracking_job_to_savings_group.sql
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V306__add_domancy_tracking_job_to_savings_group.sql b/fineract-provider/src/main/resources/sql/migrations/core_db/V306__add_domancy_tracking_job_to_savings_group.sql
new file mode 100644
index 0000000..ff7e468
--- /dev/null
+++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V306__add_domancy_tracking_job_to_savings_group.sql
@@ -0,0 +1,3 @@
+UPDATE `job`
+SET `task_priority`=3, `scheduler_group`=1
+WHERE `name`='Update Savings Dormant Accounts';
\ No newline at end of file
[2/5] incubator-fineract git commit: FINERACT-108 : disbursement
change with tranche loan
Posted by ra...@apache.org.
FINERACT-108 : disbursement change with tranche loan
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/e58e591c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/e58e591c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/e58e591c
Branch: refs/heads/develop
Commit: e58e591c8912b748aaae3154b3d43f476b5eec83
Parents: f3f6f4b
Author: pramod <pr...@confluxtechnologies.com>
Authored: Tue May 10 16:58:09 2016 +0530
Committer: pramod <pr...@confluxtechnologies.com>
Committed: Tue May 10 16:58:46 2016 +0530
----------------------------------------------------------------------
.../fineract/portfolio/loanaccount/domain/Loan.java | 8 +++++---
.../loanaccount/service/LoanReadPlatformServiceImpl.java | 10 ++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/e58e591c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
index 85725d2..dae03dd 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
@@ -1683,7 +1683,7 @@ public class Loan extends AbstractPersistable<Long> {
public void updateDisbursementDetails(final JsonCommand jsonCommand, final Map<String, Object> actualChanges) {
List<Long> disbursementList = fetchDisbursementIds();
- List<Long> loanChargeIds = fetchLoanChargeIds();
+ List<Long> loanChargeIds = fetchLoanTrancheChargeIds();
int chargeIdLength = loanChargeIds.size();
String chargeIds = null;
// From modify application page, if user removes all charges, we should
@@ -1807,10 +1807,12 @@ public class Loan extends AbstractPersistable<Long> {
}
}
- private List<Long> fetchLoanChargeIds() {
+ private List<Long> fetchLoanTrancheChargeIds() {
List<Long> list = new ArrayList<>();
for (LoanCharge charge : this.charges) {
- list.add(charge.getId());
+ if (charge.isTrancheDisbursementCharge() && charge.isActive()) {
+ list.add(charge.getId());
+ }
}
return list;
}
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/e58e591c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
index ba0ee0a..d0712ce 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
@@ -1027,6 +1027,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
final MonetaryCurrency monCurrency = new MonetaryCurrency(this.currency.code(), this.currency.decimalPlaces(),
this.currency.currencyInMultiplesOf());
BigDecimal totalPrincipalDisbursed = BigDecimal.ZERO;
+ BigDecimal disbursementChargeAmount = this.totalFeeChargesDueAtDisbursement;
if (disbursementData == null || disbursementData.isEmpty()) {
periods.add(disbursementPeriod);
totalPrincipalDisbursed = Money.of(monCurrency, this.disbursement.amount()).getAmount();
@@ -1034,6 +1035,11 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
if (!this.disbursement.isDisbursed()) {
excludePastUndisbursed = false;
}
+ for(DisbursementData disbursementData : disbursementData){
+ if(disbursementData.getChargeAmount() != null){
+ disbursementChargeAmount = disbursementChargeAmount.subtract(disbursementData.getChargeAmount());
+ }
+ }
this.outstandingLoanPrincipalBalance = BigDecimal.ZERO;
}
@@ -1072,11 +1078,11 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
principal = principal.add(data.amount());
if (data.getChargeAmount() == null) {
final LoanSchedulePeriodData periodData = LoanSchedulePeriodData.disbursementOnlyPeriod(
- data.disbursementDate(), data.amount(), BigDecimal.ZERO, data.isDisbursed());
+ data.disbursementDate(), data.amount(), disbursementChargeAmount, data.isDisbursed());
periods.add(periodData);
} else {
final LoanSchedulePeriodData periodData = LoanSchedulePeriodData.disbursementOnlyPeriod(
- data.disbursementDate(), data.amount(), data.getChargeAmount(), data.isDisbursed());
+ data.disbursementDate(), data.amount(), disbursementChargeAmount.add(data.getChargeAmount()), data.isDisbursed());
periods.add(periodData);
}
this.outstandingLoanPrincipalBalance = this.outstandingLoanPrincipalBalance.add(data.amount());
[5/5] incubator-fineract git commit: Merge branch 'PR107' into develop
Posted by ra...@apache.org.
Merge branch 'PR107' into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/d2b85356
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/d2b85356
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/d2b85356
Branch: refs/heads/develop
Commit: d2b853561fc1e9cce30613303b6e6c6cb638e586
Parents: 83e2d3e e58e591
Author: Adi Narayana Raju <ad...@confluxtechnologies.com>
Authored: Tue May 10 17:56:24 2016 +0530
Committer: Adi Narayana Raju <ad...@confluxtechnologies.com>
Committed: Tue May 10 17:56:24 2016 +0530
----------------------------------------------------------------------
.../fineract/portfolio/loanaccount/domain/Loan.java | 8 +++++---
.../loanaccount/service/LoanReadPlatformServiceImpl.java | 10 ++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[3/5] incubator-fineract git commit: Integration tests for Savings
Dormancy Tracking feature
Posted by ra...@apache.org.
Integration tests for Savings Dormancy Tracking feature
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/a4aee1a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/a4aee1a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/a4aee1a3
Branch: refs/heads/develop
Commit: a4aee1a3c0add338b6a873ab7e87f25ca23f0f78
Parents: f3f6f4b
Author: Adi Narayana Raju <ad...@confluxtechnologies.com>
Authored: Tue May 10 17:51:09 2016 +0530
Committer: Adi Narayana Raju <ad...@confluxtechnologies.com>
Committed: Tue May 10 17:51:09 2016 +0530
----------------------------------------------------------------------
.../ClientSavingsIntegrationTest.java | 160 ++++++++++++++++++-
.../common/charges/ChargesHelper.java | 9 ++
.../savings/SavingsApplicationTestBuilder.java | 11 ++
.../common/savings/SavingsProductHelper.java | 20 +++
.../common/savings/SavingsStatusChecker.java | 33 +++-
5 files changed, 228 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/a4aee1a3/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
index 48a186b..ef8a19f 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientSavingsIntegrationTest.java
@@ -34,6 +34,7 @@ import java.util.Locale;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CommonConstants;
+import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
import org.apache.fineract.integrationtests.common.TaxComponentHelper;
import org.apache.fineract.integrationtests.common.TaxGroupHelper;
import org.apache.fineract.integrationtests.common.Utils;
@@ -42,6 +43,8 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
import org.joda.time.LocalDate;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -806,7 +809,7 @@ public class ClientSavingsIntegrationTest {
final String percentage = "10";
final Integer taxGroupId = createTaxGroup(percentage);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
- minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId));
+ minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), false);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -854,7 +857,7 @@ public class ClientSavingsIntegrationTest {
final String percentage = "10";
final Integer taxGroupId = createTaxGroup(percentage);
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
- minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId));
+ minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), false);
Assert.assertNotNull(savingsProductID);
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
@@ -890,6 +893,152 @@ public class ClientSavingsIntegrationTest {
Assert.assertEquals(expected, actual, 1);
}
+
+ @Test
+ public void testSavingsAccount_DormancyTracking() {
+ this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
+
+ final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
+ Assert.assertNotNull(clientID);
+ final String minBalanceForInterestCalculation = null;
+ final String minRequiredBalance = null;
+ final String enforceMinRequiredBalance = "false";
+ final boolean allowOverdraft = false;
+ final String percentage = "10";
+ final Integer taxGroupId = createTaxGroup(percentage);
+ final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
+ minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), true);
+ Assert.assertNotNull(savingsProductID);
+
+ final Integer savingsChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
+ ChargesHelper.getSavingsNoActivityFeeJSON());
+ Assert.assertNotNull(savingsChargeId);
+
+ ArrayList<Integer> savingsList = new ArrayList<>();
+
+ for(int i=0; i< 5; i++){
+ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
+ Assert.assertNotNull(savingsProductID);
+
+ HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
+ ACCOUNT_TYPE_INDIVIDUAL);
+ Assert.assertTrue(modifications.containsKey("submittedOnDate"));
+
+ this.savingsAccountHelper.addChargesForSavings(savingsId, savingsChargeId);
+
+ HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
+ SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
+
+ savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
+ SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
+
+ savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
+ SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+ savingsList.add(savingsId);
+ }
+
+ final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
+ Assert.assertNotNull(savingsProductID);
+
+ HashMap modifications = this.savingsAccountHelper.updateSavingsAccount(clientID, savingsProductID, savingsId,
+ ACCOUNT_TYPE_INDIVIDUAL);
+ Assert.assertTrue(modifications.containsKey("submittedOnDate"));
+
+ HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
+ SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
+
+ savingsList.add(savingsId);
+
+ final DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMMM yyyy");
+ LocalDate transactionDate = new LocalDate();
+ for(int i=0; i< 4; i++){
+ String TRANSACTION_DATE = formatter.print(transactionDate);
+ Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(i), DEPOSIT_AMOUNT,
+ TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
+ transactionDate = transactionDate.minusDays(30);
+ }
+
+ SchedulerJobHelper jobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
+ try {
+ jobHelper.executeJob("Update Savings Dormant Accounts");
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ //VERIFY WITHIN PROVIDED RANGE DOESN'T INACTIVATE
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(0));
+ SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(0));
+ SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
+ HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(0));
+ Float balance = 3000f;
+ Float chargeAmt = 0f;
+ balance -= chargeAmt;
+ assertEquals("Verifying account Balance", balance, summary.get("accountBalance"));
+
+
+ //VERIFY INACTIVE
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
+ SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
+ SavingsStatusChecker.verifySavingsSubStatusInactive(savingsStatusHashMap);
+ summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(1));
+ balance = 3000f;
+ chargeAmt = 100f;
+ balance -= chargeAmt;
+ assertEquals("Verifying account Balance", balance, summary.get("accountBalance"));
+
+ String TRANSACTION_DATE = formatter.print(new LocalDate());
+ Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(1), DEPOSIT_AMOUNT,
+ TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
+ SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
+ SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
+
+ //VERIFY DORMANT
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
+ SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
+ SavingsStatusChecker.verifySavingsSubStatusDormant(savingsStatusHashMap);
+ summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(2));
+ balance = 3000f;
+ chargeAmt = 100f;
+ balance -= chargeAmt;
+ assertEquals("Verifying account Balance", balance, summary.get("accountBalance"));
+
+ TRANSACTION_DATE = formatter.print(new LocalDate());
+ depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(2), DEPOSIT_AMOUNT,
+ TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
+ SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
+ SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
+
+ //VERIFY ESCHEAT DUE TO OLD TRANSACTION
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(3));
+ SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(3));
+ SavingsStatusChecker.verifySavingsSubStatusEscheat(savingsStatusHashMap);
+ summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(3));
+ assertEquals("Verifying account Balance", 2900f, summary.get("accountBalance"));
+
+ //VERIFY ESCHEAT DUE NO TRANSACTION FROM ACTIVATION
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(4));
+ SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(4));
+ SavingsStatusChecker.verifySavingsSubStatusEscheat(savingsStatusHashMap);
+ summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(4));
+ assertEquals("Verifying account Balance", 900f, summary.get("accountBalance"));
+
+ //VERIFY NON ACTIVE ACCOUNTS ARE NOT AFFECTED
+ savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(5));
+ SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
+ savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(5));
+ SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
+
+
+ }
private HashMap activateSavingsAccount(final Integer savingsId, final String activationDate) {
@@ -902,18 +1051,21 @@ public class ClientSavingsIntegrationTest {
String enforceMinRequiredBalance, final boolean allowOverdraft) {
final String taxGroupId = null;
return createSavingsProduct(requestSpec, responseSpec, minOpenningBalance, minBalanceForInterestCalculation, minRequiredBalance,
- enforceMinRequiredBalance, allowOverdraft, taxGroupId);
+ enforceMinRequiredBalance, allowOverdraft, taxGroupId, false);
}
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance, String minBalanceForInterestCalculation, String minRequiredBalance,
- String enforceMinRequiredBalance, final boolean allowOverdraft, final String taxGroupId) {
+ String enforceMinRequiredBalance, final boolean allowOverdraft, final String taxGroupId, boolean withDormancy) {
System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
if (allowOverdraft) {
final String overDraftLimit = "2000.0";
savingsProductHelper = savingsProductHelper.withOverDraft(overDraftLimit);
}
+ if(withDormancy){
+ savingsProductHelper = savingsProductHelper.withDormancy();
+ }
final String savingsProductJSON = savingsProductHelper
//
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/a4aee1a3/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
index 6b17468..c8134a6 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/charges/ChargesHelper.java
@@ -48,6 +48,7 @@ public class ChargesHelper {
private static final Integer CHARGE_OVERDUE_INSTALLMENT_FEE = 9;
private static final Integer CHARGE_OVERDRAFT_FEE = 10;
private static final Integer WEEKLY_FEE = 11;
+ private static final Integer CHARGE_SAVINGS_NO_ACTIVITY_FEE = 16;
private static final Integer CHARGE_CLIENT_SPECIFIED_DUE_DATE = 1;
@@ -88,6 +89,14 @@ public class ChargesHelper {
return chargesCreateJson;
}
+ public static String getSavingsNoActivityFeeJSON() {
+ final HashMap<String, Object> map = populateDefaultsForSavings();
+ map.put("chargeTimeType", CHARGE_SAVINGS_NO_ACTIVITY_FEE);
+ String chargesCreateJson = new Gson().toJson(map);
+ System.out.println(chargesCreateJson);
+ return chargesCreateJson;
+ }
+
public static String getSavingsWithdrawalFeeJSON() {
final HashMap<String, Object> map = populateDefaultsForSavings();
map.put("chargeTimeType", CHARGE_WITHDRAWAL_FEE);
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/a4aee1a3/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsApplicationTestBuilder.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsApplicationTestBuilder.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsApplicationTestBuilder.java
index fc02831..7fbceca 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsApplicationTestBuilder.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsApplicationTestBuilder.java
@@ -27,6 +27,8 @@ public class SavingsApplicationTestBuilder {
private static final String LOCALE = "en_GB";
private String submittedOnDate = "";
+
+ private HashMap<String, String> addParams = null;
public String build(final String ID, final String savingsProductId, final String accountType) {
@@ -40,6 +42,9 @@ public class SavingsApplicationTestBuilder {
map.put("productId", savingsProductId);
map.put("locale", LOCALE);
map.put("submittedOnDate", this.submittedOnDate);
+ if(addParams!=null && addParams.size() > 0){
+ map.putAll(addParams);
+ }
String savingsApplicationJSON = new Gson().toJson(map);
System.out.println(savingsApplicationJSON);
return savingsApplicationJSON;
@@ -49,4 +54,10 @@ public class SavingsApplicationTestBuilder {
this.submittedOnDate = savingsApplicationSubmittedDate;
return this;
}
+
+ public SavingsApplicationTestBuilder withParams(
+ HashMap<String, String> params) {
+ this.addParams = params;
+ return this;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/a4aee1a3/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
index 0eca50b..929e49e 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsProductHelper.java
@@ -88,6 +88,10 @@ public class SavingsProductHelper {
private String enforceMinRequiredBalance = "false";
private Boolean withHoldTax = false;
private String taxGroupId = null;
+ private boolean isDormancyTrackingActive = false;
+ private String daysToInactive = null;
+ private String daysToDormancy = null;
+ private String daysToEscheat = null;
public String build() {
final HashMap<String, String> map = new HashMap<>();
@@ -130,6 +134,13 @@ public class SavingsProductHelper {
if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
}
+ if(this.isDormancyTrackingActive){
+ map.put("isDormancyTrackingActive", Boolean.toString(this.isDormancyTrackingActive));
+ map.put("daysToInactive", this.daysToInactive);
+ map.put("daysToDormancy", this.daysToDormancy);
+ map.put("daysToEscheat", this.daysToEscheat);
+
+ }
String savingsProductCreateJson = new Gson().toJson(map);
System.out.println(savingsProductCreateJson);
return savingsProductCreateJson;
@@ -263,4 +274,13 @@ public class SavingsProductHelper {
assertEquals("ERROR IN CREATING THE Savings Product", generatedProductID, responseSavingsProductID);
}
+ public SavingsProductHelper withDormancy() {
+ this.isDormancyTrackingActive = true;
+ this.daysToInactive = "30";
+ this.daysToDormancy = "60";
+ this.daysToEscheat = "90";
+
+ return this;
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/a4aee1a3/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java
index fe0b62e..3c6c387 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/savings/SavingsStatusChecker.java
@@ -80,7 +80,38 @@ public class SavingsStatusChecker {
return Utils.performServerGet(requestSpec, responseSpec, url, "status");
}
- private static boolean getStatus(final HashMap savingsStatusMap, final String nameOfSavingsStatusString) {
+ public static HashMap getSubStatusOfSavings(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
+ final Integer savingsID) {
+ final String url = SAVINGS_ACCOUNT_URL+"/" + savingsID + "?"+Utils.TENANT_IDENTIFIER;
+ return Utils.performServerGet(requestSpec, responseSpec, url, "subStatus");
+ }
+
+ private static boolean getStatus(final HashMap savingsStatusMap, final String nameOfSavingsStatusString) {
return (Boolean) savingsStatusMap.get(nameOfSavingsStatusString);
}
+
+ public static void verifySavingsSubStatusInactive(HashMap savingsStatusHashMap) {
+ System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------");
+ assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "inactive"));
+ System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
+ }
+
+ public static void verifySavingsSubStatusDormant(HashMap savingsStatusHashMap) {
+ System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------");
+ assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "dormant"));
+ System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
+ }
+
+ public static void verifySavingsSubStatusEscheat(HashMap savingsStatusHashMap) {
+ System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------");
+ assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "escheat"));
+ System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
+ }
+
+ public static void verifySavingsSubStatusNone(HashMap savingsStatusHashMap) {
+ System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------");
+ assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "none"));
+ System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
+ }
+
}
\ No newline at end of file
[4/5] incubator-fineract git commit: Merge branch 'PR106' into develop
Posted by ra...@apache.org.
Merge branch 'PR106' into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/83e2d3e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/83e2d3e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/83e2d3e6
Branch: refs/heads/develop
Commit: 83e2d3e6fc4e8fcd3715cffde7d368cac222db0d
Parents: a4aee1a b3f6666
Author: Adi Narayana Raju <ad...@confluxtechnologies.com>
Authored: Tue May 10 17:56:19 2016 +0530
Committer: Adi Narayana Raju <ad...@confluxtechnologies.com>
Committed: Tue May 10 17:56:19 2016 +0530
----------------------------------------------------------------------
.../savings/domain/SavingsAccountCharge.java | 6 +++++-
...AccountWritePlatformServiceJpaRepositoryImpl.java | 15 +++++++++++++--
...06__add_domancy_tracking_job_to_savings_group.sql | 3 +++
3 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------