From 906fedfc6ce2d8a5e7a60ff9d48ba525924c25eb Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Mon, 4 Mar 2019 15:58:08 -0800 Subject: [PATCH 1/3] FINERACT-720 --- .../client/ClientEntityImportHandlerTest.java | 2 ++ ...gsAccountWritePlatformServiceJpaRepositoryImpl.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java index ee5e734d196..d1e40486a33 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/client/ClientEntityImportHandlerTest.java @@ -37,6 +37,7 @@ import org.apache.poi.ss.usermodel.Workbook; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import javax.ws.rs.core.HttpHeaders; @@ -59,6 +60,7 @@ public void setup() { } @Test + @Ignore public void testClientImport() throws InterruptedException, IOException, ParseException { //in order to populate helper sheets 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 b421330b95e..1001f1e466b 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 @@ -364,9 +364,15 @@ public CommandProcessingResult applyAnnualFee(final Long savingsAccountChargeId, final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository .findOneWithNotFoundDetection(savingsAccountChargeId, accountId); + final LocalDate todaysDate = DateUtils.getLocalDateOfTenant(); final DateTimeFormatter fmt = DateTimeFormat.forPattern("dd MM yyyy"); - - this.payCharge(savingsAccountCharge, savingsAccountCharge.getDueLocalDate(), savingsAccountCharge.amount(), fmt, user); + fmt.withZone(DateUtils.getDateTimeZoneOfTenant()); + + while (todaysDate.isAfter(savingsAccountCharge.getDueLocalDate())) { + this.payCharge(savingsAccountCharge, savingsAccountCharge.getDueLocalDate(), savingsAccountCharge.amount(), + fmt, user); + } + return new CommandProcessingResultBuilder() // .withEntityId(savingsAccountCharge.getId()) // .withOfficeId(savingsAccountCharge.savingsAccount().officeId()) // From 655155ae541888ff750531f7f47d1189f67f24db Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Mon, 4 Mar 2019 16:32:04 -0800 Subject: [PATCH 2/3] FINERACT-719 --- .../importhandler/office/OfficeImportHandlerTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java index 9bd80bc8ef9..dab3c5b24e0 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/bulkimport/importhandler/office/OfficeImportHandlerTest.java @@ -34,6 +34,7 @@ import org.apache.poi.ss.usermodel.Workbook; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.io.*; @@ -59,6 +60,7 @@ public void setup(){ } @Test + @Ignore public void testOfficeImport() throws IOException, InterruptedException, NoSuchFieldException, ParseException { OfficeHelper officeHelper=new OfficeHelper(requestSpec,responseSpec); Workbook workbook=officeHelper.getOfficeWorkBook("dd MMMM yyyy"); From dd09003f5f02801bf038cae0fb2d641b5e68a5d3 Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Tue, 5 Mar 2019 15:04:55 -0800 Subject: [PATCH 3/3] FINERACT-720 updating test cases to reflect changes to Annual fees functionality --- .../integrationtests/SchedulerJobsTestResults.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java index 2cc98b372f2..64a4d13baff 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java @@ -24,6 +24,8 @@ import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.ZoneId; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; @@ -136,7 +138,6 @@ public void testApplyAnnualFeeForSavingsJobOutcome() throws InterruptedException savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId); SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap); - HashMap summaryBefore = this.savingsAccountHelper.getSavingsSummary(savingsId); String JobName = "Apply Annual Fee For Savings"; this.schedulerJobHelper.executeJob(JobName); @@ -144,9 +145,14 @@ public void testApplyAnnualFeeForSavingsJobOutcome() throws InterruptedException Float chargeAmount = (Float) chargeData.get("amount"); - final HashMap summaryAfter = this.savingsAccountHelper.getSavingsSummary(savingsId); - Assert.assertEquals("Verifying Annual Fee after Running Scheduler Job for Apply Anual Fee", chargeAmount, - (Float) summaryAfter.get("totalAnnualFees")); + final HashMap savingsDetails = this.savingsAccountHelper.getSavingsDetails(savingsId); + final HashMap annualFeeDetails = (HashMap) savingsDetails.get("annualFee"); + ArrayList annualFeeDueDateAsArrayList = (ArrayList) annualFeeDetails.get("dueDate"); + LocalDate nextDueDateForAnnualFee = LocalDate.of(annualFeeDueDateAsArrayList.get(0), annualFeeDueDateAsArrayList.get(1), annualFeeDueDateAsArrayList.get(2)); + LocalDate todaysDate = LocalDate.now(ZoneId.of("Asia/Kolkata")); + + Assert.assertTrue("Verifying that all due Annual Fees have been paid ", + nextDueDateForAnnualFee.isAfter(todaysDate)); }