FINERACT-822 Enabling UnnecessaryParentheses check

This commit is contained in:
percyashu
2020-06-04 02:14:25 +01:00
committed by Yemdjih Kaze Nasser
parent cc6bf4b4b0
commit 960e81af1c
57 changed files with 305 additions and 305 deletions
+1 -1
View File
@@ -306,7 +306,6 @@ tasks.withType(JavaCompile) {
disable( disable(
"UnusedVariable", "UnusedVariable",
"InconsistentCapitalization", "InconsistentCapitalization",
"UnnecessaryParentheses",
"ClassCanBeStatic", "ClassCanBeStatic",
"MissingCasesInEnumSwitch", "MissingCasesInEnumSwitch",
"OperatorPrecedence", "OperatorPrecedence",
@@ -339,6 +338,7 @@ tasks.withType(JavaCompile) {
"WaitNotInLoop", "WaitNotInLoop",
"ThreeLetterTimeZoneID", "ThreeLetterTimeZoneID",
"VariableNameSameAsType", "VariableNameSameAsType",
"UnnecessaryParentheses",
// "ReturnMissingNullable", // "ReturnMissingNullable",
// "InconsistentOverloads", // "InconsistentOverloads",
// "MethodCanBeStatic", // "MethodCanBeStatic",
@@ -775,8 +775,8 @@ public class ClientSavingsIntegrationTest {
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString()); final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestRateInFraction = (nominalAnnualInterest / 100); double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
@@ -922,8 +922,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
double interestRateInFraction = (nominalAnnualInterest / 100); double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
@@ -954,8 +954,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
@@ -990,8 +990,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
@@ -1029,8 +1029,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get( daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString()); "id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 19); interestPosted = (float) (interestPerDay * balance * 19);
@@ -1072,8 +1072,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get( daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString()); "id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 8); interestPosted = (float) (interestPerDay * balance * 8);
@@ -1108,8 +1108,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
@@ -1260,8 +1260,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
double interestRateInFraction = (nominalAnnualInterest / 100); double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
@@ -1292,8 +1292,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
@@ -1328,8 +1328,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
@@ -1367,8 +1367,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get( daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString()); "id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 19); interestPosted = (float) (interestPerDay * balance * 19);
@@ -1410,8 +1410,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get( daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get(
"id").toString()); "id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 8); interestPosted = (float) (interestPerDay * balance * 8);
@@ -1446,8 +1446,8 @@ public class ClientSavingsIntegrationTest {
.get("interestCalculationDaysInYearType"); .get("interestCalculationDaysInYearType");
daysInYear = Integer.valueOf(interestCalculationDaysInYearType daysInYear = Integer.valueOf(interestCalculationDaysInYearType
.get("id").toString()); .get("id").toString());
interestRateInFraction = (nominalAnnualInterest / 100); interestRateInFraction = nominalAnnualInterest / 100;
perDay = (double) 1 / (daysInYear); perDay = (double) 1 / daysInYear;
interestPerDay = interestRateInFraction * perDay; interestPerDay = interestRateInFraction * perDay;
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
@@ -1596,8 +1596,8 @@ public class ClientSavingsIntegrationTest {
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString()); final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestRateInFraction = (nominalAnnualInterest / 100); double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
@@ -1763,8 +1763,8 @@ public class ClientSavingsIntegrationTest {
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString()); final Integer daysInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestRateInFraction = (nominalAnnualInterest / 100); double interestRateInFraction = nominalAnnualInterest / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
@@ -1787,8 +1787,8 @@ public class ClientSavingsIntegrationTest {
final Float nominalLastAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalLastAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestLastCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestLastCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
final Integer daysLastInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString()); final Integer daysLastInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
double interestLastRateInFraction = (nominalAnnualInterest / 100); double interestLastRateInFraction = nominalAnnualInterest / 100;
double perLastDay = (double) 1 / (daysInYear); double perLastDay = (double) 1 / daysInYear;
double interestLastPerDay = interestLastRateInFraction * perLastDay; double interestLastPerDay = interestLastRateInFraction * perLastDay;
Float interestLastPosted = (float) (interestLastPerDay * balance * 1); Float interestLastPosted = (float) (interestLastPerDay * balance * 1);
@@ -60,7 +60,7 @@ public class ExternalServicesConfigurationTest {
ArrayList<HashMap> externalServicesConfig = this.externalServicesConfigurationHelper ArrayList<HashMap> externalServicesConfig = this.externalServicesConfigurationHelper
.getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3"); .getExternalServicesConfigurationByServiceName(requestSpec, responseSpec, "S3");
Assert.assertNotNull(externalServicesConfig); Assert.assertNotNull(externalServicesConfig);
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) { for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
String name = (String) externalServicesConfig.get(configIndex).get("name"); String name = (String) externalServicesConfig.get(configIndex).get("name");
String value = null; String value = null;
if (name.equals(configName)) { if (name.equals(configName)) {
@@ -88,7 +88,7 @@ public class ExternalServicesConfigurationTest {
externalServicesConfig = this.externalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec, externalServicesConfig = this.externalServicesConfigurationHelper.getExternalServicesConfigurationByServiceName(requestSpec,
responseSpec, "SMTP"); responseSpec, "SMTP");
Assert.assertNotNull(externalServicesConfig); Assert.assertNotNull(externalServicesConfig);
for (Integer configIndex = 0; configIndex < (externalServicesConfig.size()); configIndex++) { for (Integer configIndex = 0; configIndex < externalServicesConfig.size(); configIndex++) {
String name = (String) externalServicesConfig.get(configIndex).get("name"); String name = (String) externalServicesConfig.get(configIndex).get("name");
String value = null; String value = null;
if (name.equals(configName)) { if (name.equals(configName)) {
@@ -154,7 +154,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -290,7 +290,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -434,7 +434,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
Calendar closedOn = Calendar.getInstance(); Calendar closedOn = Calendar.getInstance();
closedOn.add(Calendar.MONTH, -6); closedOn.add(Calendar.MONTH, -6);
@@ -726,7 +726,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -897,7 +897,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -1225,8 +1225,8 @@ public class FixedDepositTest {
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId( ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1297,8 +1297,8 @@ public class FixedDepositTest {
ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId( ArrayList<ArrayList<HashMap>> interestRateChartData = this.fixedDepositProductHelper.getInterestRateChartSlabsByProductId(
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1374,8 +1374,8 @@ public class FixedDepositTest {
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1383,7 +1383,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -1); todaysDate.add(Calendar.DAY_OF_MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth; principal += interestPerMonth;
todaysDate.add(Calendar.DATE, daysInMonth); todaysDate.add(Calendar.DATE, daysInMonth);
@@ -1480,8 +1480,8 @@ public class FixedDepositTest {
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}", perDay); LOG.info("per day = {}", perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1489,7 +1489,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -1); todaysDate.add(Calendar.DAY_OF_MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth; principal += interestPerMonth;
todaysDate.add(Calendar.DATE, daysInMonth); todaysDate.add(Calendar.DATE, daysInMonth);
@@ -1591,8 +1591,8 @@ public class FixedDepositTest {
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1600,7 +1600,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -1); todaysDate.add(Calendar.DAY_OF_MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth; principal += interestPerMonth;
todaysDate.add(Calendar.DATE, daysInMonth); todaysDate.add(Calendar.DATE, daysInMonth);
@@ -1706,8 +1706,8 @@ public class FixedDepositTest {
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1715,7 +1715,7 @@ public class FixedDepositTest {
todaysDate.add(Calendar.DAY_OF_MONTH, -1); todaysDate.add(Calendar.DAY_OF_MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth; principal += interestPerMonth;
todaysDate.add(Calendar.DATE, daysInMonth); todaysDate.add(Calendar.DATE, daysInMonth);
@@ -1804,8 +1804,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1879,8 +1879,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1915,7 +1915,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -1961,8 +1961,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1998,7 +1998,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2044,8 +2044,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2082,7 +2082,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2125,8 +2125,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2163,7 +2163,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2206,8 +2206,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" ,perDay); LOG.info("per day = {}" ,perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2244,7 +2244,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2287,8 +2287,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2324,7 +2324,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2367,8 +2367,8 @@ public class FixedDepositTest {
this.requestSpec, this.responseSpec, fixedDepositProductId); this.requestSpec, this.responseSpec, fixedDepositProductId);
Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.fixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2421,7 +2421,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -2503,7 +2503,7 @@ public class FixedDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -66,10 +66,10 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
String configName = "interest-charged-from-date-same-as-disbursal-date"; String configName = "interest-charged-from-date-same-as-disbursal-date";
boolean newBooleanValue = true; boolean newBooleanValue = true;
for (Integer configIndex = 0; configIndex < (globalConfig.size()); configIndex++) { for (Integer configIndex = 0; configIndex < globalConfig.size(); configIndex++) {
if (globalConfig.get(configIndex).get("name") if (globalConfig.get(configIndex).get("name")
.equals(configName)) { .equals(configName)) {
String configId = (globalConfig.get(configIndex).get("id")) String configId = globalConfig.get(configIndex).get("id")
.toString(); .toString();
Integer updateConfigId = this.globalConfigurationHelper Integer updateConfigId = this.globalConfigurationHelper
.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec, .updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
@@ -66,7 +66,7 @@ public class GlobalConfigurationTest {
Assert.assertNotNull(globalConfig); Assert.assertNotNull(globalConfig);
String configName = "penalty-wait-period"; String configName = "penalty-wait-period";
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) { for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
if (globalConfig.get(configIndex).get("name").equals(configName)) { if (globalConfig.get(configIndex).get("name").equals(configName)) {
Integer configId = (Integer) globalConfig.get(configIndex).get("id"); Integer configId = (Integer) globalConfig.get(configIndex).get("id");
Assert.assertNotNull(configId); Assert.assertNotNull(configId);
@@ -120,7 +120,7 @@ public class GlobalConfigurationTest {
this.responseSpec); this.responseSpec);
Assert.assertNotNull(isCacheGlobalConfig); Assert.assertNotNull(isCacheGlobalConfig);
for (Integer cacheType = 0; cacheType <= ((isCacheGlobalConfig.size()) - 1); cacheType++) { for (Integer cacheType = 0; cacheType <= isCacheGlobalConfig.size() - 1; cacheType++) {
// Retrieving Is Cache Enabled Global Configuration details // Retrieving Is Cache Enabled Global Configuration details
isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec); isCacheGlobalConfig = this.globalConfigurationHelper.getGlobalConfigurationIsCacheEnabled(this.requestSpec, this.responseSpec);
@@ -155,7 +155,7 @@ public class GlobalConfigurationTest {
String newValue = "0"; String newValue = "0";
String newBooleanValue = "true"; String newBooleanValue = "true";
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) { for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
if (globalConfig.get(configIndex).get("name").equals(configName)) { if (globalConfig.get(configIndex).get("name").equals(configName)) {
Integer configId = (Integer) globalConfig.get(configIndex).get( Integer configId = (Integer) globalConfig.get(configIndex).get(
"id"); "id");
@@ -210,10 +210,10 @@ public class GlobalConfigurationTest {
} }
/* Update other global configuration property */ /* Update other global configuration property */
String otherConfigName = "maker-checker"; String otherConfigName = "maker-checker";
for (Integer configIndex = 0; configIndex < (globalConfig.size() - 1); configIndex++) { for (Integer configIndex = 0; configIndex < globalConfig.size() - 1; configIndex++) {
if (globalConfig.get(configIndex).get("name") if (globalConfig.get(configIndex).get("name")
.equals(otherConfigName)) { .equals(otherConfigName)) {
String configId = (globalConfig.get(configIndex).get("id")) String configId = globalConfig.get(configIndex).get("id")
.toString(); .toString();
Integer updateConfigId = this.globalConfigurationHelper Integer updateConfigId = this.globalConfigurationHelper
.updateValueForGlobalConfiguration(this.requestSpec, .updateValueForGlobalConfiguration(this.requestSpec,
@@ -223,4 +223,4 @@ public class GlobalConfigurationTest {
} }
} }
} }
} }
@@ -155,7 +155,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -307,7 +307,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -510,7 +510,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -724,7 +724,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
Calendar closedOn = Calendar.getInstance(); Calendar closedOn = Calendar.getInstance();
@@ -891,7 +891,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer numberOfDaysLeft = (daysInMonth - currentDate) + 1; Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
todaysDate.add(Calendar.DATE, numberOfDaysLeft); todaysDate.add(Calendar.DATE, numberOfDaysLeft);
final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime()); final String INTEREST_POSTED_DATE = dateFormat.format(todaysDate.getTime());
final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime()); final String CLOSED_ON_DATE = dateFormat.format(Calendar.getInstance().getTime());
@@ -1416,8 +1416,8 @@ public class RecurringDepositTest {
Float principal = (Float) recurringDepositSummary.get("accountBalance"); Float principal = (Float) recurringDepositSummary.get("accountBalance");
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1499,8 +1499,8 @@ public class RecurringDepositTest {
Float principal = (Float) recurringDepositSummary.get("accountBalance"); Float principal = (Float) recurringDepositSummary.get("accountBalance");
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1580,14 +1580,14 @@ public class RecurringDepositTest {
Float principal = (Float) recurringDepositSummary.get("totalDeposits"); Float principal = (Float) recurringDepositSummary.get("totalDeposits");
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestToBePosted = (float) (interestPerDay * principal * daysInMonth); Float interestToBePosted = (float) (interestPerDay * principal * daysInMonth);
principal += interestToBePosted; principal += interestToBePosted;
@@ -1686,8 +1686,8 @@ public class RecurringDepositTest {
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1695,7 +1695,7 @@ public class RecurringDepositTest {
calendar.add(Calendar.MONTH, -1); calendar.add(Calendar.MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime()));
Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE); Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth + depositAmount; principal += interestPerMonth + depositAmount;
calendar.add(Calendar.DATE, daysInMonth); calendar.add(Calendar.DATE, daysInMonth);
@@ -1816,8 +1816,8 @@ public class RecurringDepositTest {
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1825,7 +1825,7 @@ public class RecurringDepositTest {
calendar.add(Calendar.MONTH, -1); calendar.add(Calendar.MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime()));
Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE); Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth + depositAmount; principal += interestPerMonth + depositAmount;
calendar.add(Calendar.DATE, daysInMonth); calendar.add(Calendar.DATE, daysInMonth);
@@ -1953,8 +1953,8 @@ public class RecurringDepositTest {
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -1963,7 +1963,7 @@ public class RecurringDepositTest {
calendar.add(Calendar.DAY_OF_MONTH, -1); calendar.add(Calendar.DAY_OF_MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime()));
Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE); Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth + depositAmount; principal += interestPerMonth + depositAmount;
calendar.add(Calendar.DATE, daysInMonth); calendar.add(Calendar.DATE, daysInMonth);
@@ -2096,8 +2096,8 @@ public class RecurringDepositTest {
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod);
interestRate -= preClosurePenalInterestRate; interestRate -= preClosurePenalInterestRate;
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2106,7 +2106,7 @@ public class RecurringDepositTest {
calendar.add(Calendar.DAY_OF_MONTH, -1); calendar.add(Calendar.DAY_OF_MONTH, -1);
Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(calendar.getTime()));
Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE); Integer daysInMonth = calendar.getActualMaximum(Calendar.DATE);
daysInMonth = (daysInMonth - currentDate) + 1; daysInMonth = daysInMonth - currentDate + 1;
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth); Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
principal += interestPerMonth + depositAmount; principal += interestPerMonth + depositAmount;
calendar.add(Calendar.DATE, daysInMonth); calendar.add(Calendar.DATE, daysInMonth);
@@ -2209,8 +2209,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2292,8 +2292,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2333,7 +2333,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2381,8 +2381,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {}" , perDay); LOG.info("per day = {}" , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2423,7 +2423,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2471,8 +2471,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {} " , perDay); LOG.info("per day = {} " , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2512,7 +2512,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2561,8 +2561,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {} " , perDay); LOG.info("per day = {} " , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2602,7 +2602,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2651,8 +2651,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {} " , perDay); LOG.info("per day = {} " , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2693,7 +2693,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2741,8 +2741,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {} " , perDay); LOG.info("per day = {} " , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -2783,7 +2783,7 @@ public class RecurringDepositTest {
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime())); Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
Integer daysLeft = daysInMonth - currentDate; Integer daysLeft = daysInMonth - currentDate;
todaysDate.add(Calendar.DATE, (daysLeft + 1)); todaysDate.add(Calendar.DATE, daysLeft + 1);
daysInMonth = todaysDate.getActualMaximum(Calendar.DATE); daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
LOG.info("{}",dateFormat.format(todaysDate.getTime())); LOG.info("{}",dateFormat.format(todaysDate.getTime()));
final String VALID_FROM = dateFormat.format(todaysDate.getTime()); final String VALID_FROM = dateFormat.format(todaysDate.getTime());
@@ -2831,8 +2831,8 @@ public class RecurringDepositTest {
this.requestSpec, this.responseSpec, recurringDepositProductId); this.requestSpec, this.responseSpec, recurringDepositProductId);
Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod); Float interestRate = this.recurringDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
double interestRateInFraction = (interestRate / 100); double interestRateInFraction = interestRate / 100;
double perDay = (double) 1 / (daysInYear); double perDay = (double) 1 / daysInYear;
LOG.info("per day = {} " , perDay); LOG.info("per day = {} " , perDay);
double interestPerDay = interestRateInFraction * perDay; double interestPerDay = interestRateInFraction * perDay;
@@ -79,9 +79,9 @@ public class SkipRepaymentOnMonthFirstTest {
String configName = "skip-repayment-on-first-day-of-month"; String configName = "skip-repayment-on-first-day-of-month";
boolean newBooleanValue = true; boolean newBooleanValue = true;
for (Integer configIndex = 0; configIndex < (globalConfig.size()); configIndex++) { for (Integer configIndex = 0; configIndex < globalConfig.size(); configIndex++) {
if (globalConfig.get(configIndex).get("name").equals(configName)) { if (globalConfig.get(configIndex).get("name").equals(configName)) {
String configId = (globalConfig.get(configIndex).get("id")).toString(); String configId = globalConfig.get(configIndex).get("id").toString();
Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration( Integer updateConfigId = this.globalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue); this.requestSpec, this.responseSpec, configId.toString(), newBooleanValue);
Assert.assertNotNull(updateConfigId); Assert.assertNotNull(updateConfigId);
@@ -270,6 +270,6 @@ public class CenterDomain implements Comparable<CenterDomain> {
@Override @Override
public int compareTo(CenterDomain cd) { public int compareTo(CenterDomain cd) {
return ( this.id).compareTo(cd.getId()); return this.id.compareTo(cd.getId());
} }
} }
@@ -207,9 +207,9 @@ public class Utils {
final Random rnd = new Random(); final Random rnd = new Random();
final StringBuilder sb = new StringBuilder(len); final StringBuilder sb = new StringBuilder(len);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
sb.append((sourceSetString).charAt(rnd.nextInt(lengthOfSource))); sb.append(sourceSetString.charAt(rnd.nextInt(lengthOfSource)));
} }
return (prefix + (sb.toString())); return prefix + sb.toString();
} }
public static String randomStringGenerator(final String prefix, final int len) { public static String randomStringGenerator(final String prefix, final int len) {
@@ -162,7 +162,7 @@ public class CampaignsHelper {
public String getJSONForCampaignAction(String command, String actionDate) { public String getJSONForCampaignAction(String command, String actionDate) {
final HashMap<String, Object> map = new HashMap<>(); final HashMap<String, Object> map = new HashMap<>();
String dateString = ("close".equalsIgnoreCase(command)) ? "closureDate" : "activationDate"; String dateString = "close".equalsIgnoreCase(command) ? "closureDate" : "activationDate";
map.put(dateString, actionDate); map.put(dateString, actionDate);
map.put("locale", "en"); map.put("locale", "en");
map.put("dateFormat", DATE_FORMAT); map.put("dateFormat", DATE_FORMAT);
@@ -177,7 +177,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
accountMappingDetails.put(LoanProductAccountingDataParams.FEES_RECEIVABLE.getValue(), gLAccountData); accountMappingDetails.put(LoanProductAccountingDataParams.FEES_RECEIVABLE.getValue(), gLAccountData);
} else if (glAccountForLoan.equals(AccrualAccountsForLoan.PENALTIES_RECEIVABLE)) { } else if (glAccountForLoan.equals(AccrualAccountsForLoan.PENALTIES_RECEIVABLE)) {
accountMappingDetails.put(LoanProductAccountingDataParams.PENALTIES_RECEIVABLE.getValue(), gLAccountData); accountMappingDetails.put(LoanProductAccountingDataParams.PENALTIES_RECEIVABLE.getValue(), gLAccountData);
} else if ((glAccountForLoan.equals(AccrualAccountsForLoan.INCOME_FROM_RECOVERY))) { } else if (glAccountForLoan.equals(AccrualAccountsForLoan.INCOME_FROM_RECOVERY)) {
accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_RECOVERY.getValue(), gLAccountData); accountMappingDetails.put(LoanProductAccountingDataParams.INCOME_FROM_RECOVERY.getValue(), gLAccountData);
} }
} }
@@ -375,4 +375,4 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
return fetchChargeToIncomeAccountMappings(PortfolioProductType.SHARES, productId, false); return fetchChargeToIncomeAccountMappings(PortfolioProductType.SHARES, productId, false);
} }
} }
@@ -140,7 +140,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
// data scoping: head office (hierarchy = ".") can see all audit // data scoping: head office (hierarchy = ".") can see all audit
// entries // entries
if (!(hierarchy.equals("."))) { if (!hierarchy.equals(".")) {
partSql += " join m_office o2 on o2.id = aud.office_id and o2.hierarchy like '" + hierarchy + "%' "; partSql += " join m_office o2 on o2.id = aud.office_id and o2.hierarchy like '" + hierarchy + "%' ";
} }
@@ -166,7 +166,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
final CommandSource commandSourceInput = this.commandSourceRepository.findById(makerCheckerId) final CommandSource commandSourceInput = this.commandSourceRepository.findById(makerCheckerId)
.orElseThrow(() -> new CommandNotFoundException(makerCheckerId)); .orElseThrow(() -> new CommandNotFoundException(makerCheckerId));
if (!(commandSourceInput.isMarkedAsAwaitingApproval())) { throw new CommandNotAwaitingApprovalException(makerCheckerId); } if (!commandSourceInput.isMarkedAsAwaitingApproval()) { throw new CommandNotAwaitingApprovalException(makerCheckerId); }
this.context.authenticatedUser().validateHasCheckerPermissionTo(commandSourceInput.getPermissionCode()); this.context.authenticatedUser().validateHasCheckerPermissionTo(commandSourceInput.getPermissionCode());
@@ -49,14 +49,14 @@ public class SmsConfigUtils {
headers.add(SmsCampaignConstants.FINERACT_PLATFORM_TENANT_ID, tenant.getTenantIdentifier()); headers.add(SmsCampaignConstants.FINERACT_PLATFORM_TENANT_ID, tenant.getTenantIdentifier());
headers.add(SmsCampaignConstants.FINERACT_TENANT_APP_KEY, messageGatewayConfigurationData.getTenantAppKey()); headers.add(SmsCampaignConstants.FINERACT_TENANT_APP_KEY, messageGatewayConfigurationData.getTenantAppKey());
StringBuilder pathBuilder = new StringBuilder(); StringBuilder pathBuilder = new StringBuilder();
String endPoint = (messageGatewayConfigurationData.getEndPoint() == null || messageGatewayConfigurationData.getEndPoint().equals( String endPoint = messageGatewayConfigurationData.getEndPoint() == null || messageGatewayConfigurationData.getEndPoint().equals(
"/")) ? "" : messageGatewayConfigurationData.getEndPoint(); "/") ? "" : messageGatewayConfigurationData.getEndPoint();
pathBuilder = (messageGatewayConfigurationData.getEndPoint() == null || messageGatewayConfigurationData.getEndPoint().equals("/")) ? pathBuilder pathBuilder = messageGatewayConfigurationData.getEndPoint() == null || messageGatewayConfigurationData.getEndPoint().equals("/") ? pathBuilder
.append("{apiEndPoint}") : pathBuilder.append("{endPoint}/{apiEndPoint}"); .append("{apiEndPoint}") : pathBuilder.append("{endPoint}/{apiEndPoint}");
// pathBuilder.append("{endPoint}/{apiEndPoint}") ; // pathBuilder.append("{endPoint}/{apiEndPoint}") ;
UriBuilder builder = UriBuilder.fromPath(pathBuilder.toString()).host(messageGatewayConfigurationData.getHostName()).scheme("http") UriBuilder builder = UriBuilder.fromPath(pathBuilder.toString()).host(messageGatewayConfigurationData.getHostName()).scheme("http")
.port(messageGatewayConfigurationData.getPortNumber()); .port(messageGatewayConfigurationData.getPortNumber());
URI uri = (messageGatewayConfigurationData.getEndPoint() == null || messageGatewayConfigurationData.getEndPoint().equals("/")) ? builder URI uri = messageGatewayConfigurationData.getEndPoint() == null || messageGatewayConfigurationData.getEndPoint().equals("/") ? builder
.build(apiEndPoint) : builder.build(endPoint, apiEndPoint); .build(apiEndPoint) : builder.build(endPoint, apiEndPoint);
HttpEntity<?> entity = null; HttpEntity<?> entity = null;
if (apiQueueResourceDatas != null) { if (apiQueueResourceDatas != null) {
@@ -230,7 +230,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
} }
if (command.isChangeInLongParameterNamed(SmsCampaignValidator.runReportId, if (command.isChangeInLongParameterNamed(SmsCampaignValidator.runReportId,
(this.businessRuleId != null) ? this.businessRuleId.getId() : null)) { this.businessRuleId != null ? this.businessRuleId.getId() : null)) {
final String newValue = command.stringValueOfParameterNamed(SmsCampaignValidator.runReportId); final String newValue = command.stringValueOfParameterNamed(SmsCampaignValidator.runReportId);
actualChanges.put(SmsCampaignValidator.runReportId, newValue); actualChanges.put(SmsCampaignValidator.runReportId, newValue);
} }
@@ -324,11 +324,11 @@ public class SmsCampaignValidator {
if (client != null) { if (client != null) {
DeviceRegistration deviceRegistration = this.deviceRegistrationRepository DeviceRegistration deviceRegistration = this.deviceRegistrationRepository
.findDeviceRegistrationByClientId(client.getId()); .findDeviceRegistrationByClientId(client.getId());
return (deviceRegistration != null); return deviceRegistration != null;
} }
return false; return false;
} }
return (mobileNo != null); return mobileNo != null;
} }
} }
@@ -176,7 +176,7 @@ public class DataValidatorBuilder {
if(trueOfFalseField!=null) if(trueOfFalseField!=null)
{ {
if((!trueOfFalseField.toString().equalsIgnoreCase("true")) && (!trueOfFalseField.toString().equalsIgnoreCase("false")) ) if(!trueOfFalseField.toString().equalsIgnoreCase("true") && !trueOfFalseField.toString().equalsIgnoreCase("false"))
{ {
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
.append(this.parameter).append(".must.be.true.or.false"); .append(this.parameter).append(".must.be.true.or.false");
@@ -188,7 +188,7 @@ public final class Report extends AbstractPersistableCustom {
if (!actualChanges.isEmpty()) { if (!actualChanges.isEmpty()) {
if (isCoreReport()) { if (isCoreReport()) {
for (final String key : actualChanges.keySet()) { for (final String key : actualChanges.keySet()) {
if (!(key.equals("useReport"))) { throw new PlatformDataIntegrityException( if (!key.equals("useReport")) { throw new PlatformDataIntegrityException(
"error.msg.only.use.report.can.be.updated.for.core.report", "error.msg.only.use.report.can.be.updated.for.core.report",
"Only the Use Report field can be updated for Core Reports", key); } "Only the Use Report field can be updated for Core Reports", key); }
} }
@@ -238,7 +238,7 @@ public final class Report extends AbstractPersistableCustom {
baseDataValidator.reset().parameter("reportCategory").value(this.reportCategory).notExceedingLengthOf(45); baseDataValidator.reset().parameter("reportCategory").value(this.reportCategory).notExceedingLengthOf(45);
if (StringUtils.isNotBlank(this.reportType)) { if (StringUtils.isNotBlank(this.reportType)) {
if ((this.reportType.equals("Table")) || (this.reportType.equals("Chart"))) { if (this.reportType.equals("Table") || this.reportType.equals("Chart")) {
baseDataValidator.reset().parameter("reportSql").value(this.reportSql) baseDataValidator.reset().parameter("reportSql").value(this.reportSql)
.cantBeBlankWhenParameterProvidedIs("reportType", this.reportType); .cantBeBlankWhenParameterProvidedIs("reportType", this.reportType);
} else { } else {
@@ -272,7 +272,7 @@ public final class Report extends AbstractPersistableCustom {
private boolean changeInReportParameters(final Set<ReportParameterUsage> newReportParameterUsages) { private boolean changeInReportParameters(final Set<ReportParameterUsage> newReportParameterUsages) {
if (!(this.reportParameterUsages.equals(newReportParameterUsages))) { return true; } if (!this.reportParameterUsages.equals(newReportParameterUsages)) { return true; }
return false; return false;
} }
@@ -281,4 +281,4 @@ public final class Report extends AbstractPersistableCustom {
return this.reportParameterUsages; return this.reportParameterUsages;
} }
} }
@@ -499,7 +499,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private String datatableColumnNameToCodeValueName(final String columnName, final String code) { private String datatableColumnNameToCodeValueName(final String columnName, final String code) {
return (code + "_cd_" + columnName); return code + "_cd_" + columnName;
} }
private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) { private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
@@ -511,11 +511,11 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
final StringBuilder constrainBuilder, final String dataTableNameAlias, final Map<String, Long> codeMappings, final StringBuilder constrainBuilder, final String dataTableNameAlias, final Map<String, Long> codeMappings,
final boolean isConstraintApproach) { final boolean isConstraintApproach) {
String name = (column.has("name")) ? column.get("name").getAsString() : null; String name = column.has("name") ? column.get("name").getAsString() : null;
final String type = (column.has("type")) ? column.get("type").getAsString().toLowerCase() : null; final String type = column.has("type") ? column.get("type").getAsString().toLowerCase() : null;
final Integer length = (column.has("length")) ? column.get("length").getAsInt() : null; final Integer length = column.has("length") ? column.get("length").getAsInt() : null;
final Boolean mandatory = (column.has("mandatory")) ? column.get("mandatory").getAsBoolean() : false; final Boolean mandatory = column.has("mandatory") ? column.get("mandatory").getAsBoolean() : false;
final String code = (column.has("code")) ? column.get("code").getAsString() : null; final String code = column.has("code") ? column.get("code").getAsString() : null;
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
if (isConstraintApproach) { if (isConstraintApproach) {
@@ -662,14 +662,14 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
final StringBuilder constrainBuilder, final Map<String, Long> codeMappings, final List<String> removeMappings, final StringBuilder constrainBuilder, final Map<String, Long> codeMappings, final List<String> removeMappings,
final boolean isConstraintApproach) { final boolean isConstraintApproach) {
String name = (column.has("name")) ? column.get("name").getAsString() : null; String name = column.has("name") ? column.get("name").getAsString() : null;
final String lengthStr = (column.has("length")) ? column.get("length").getAsString() : null; final String lengthStr = column.has("length") ? column.get("length").getAsString() : null;
Integer length = (StringUtils.isNotBlank(lengthStr)) ? Integer.parseInt(lengthStr) : null; Integer length = StringUtils.isNotBlank(lengthStr) ? Integer.parseInt(lengthStr) : null;
String newName = (column.has("newName")) ? column.get("newName").getAsString() : name; String newName = column.has("newName") ? column.get("newName").getAsString() : name;
final Boolean mandatory = (column.has("mandatory")) ? column.get("mandatory").getAsBoolean() : false; final Boolean mandatory = column.has("mandatory") ? column.get("mandatory").getAsBoolean() : false;
final String after = (column.has("after")) ? column.get("after").getAsString() : null; final String after = column.has("after") ? column.get("after").getAsString() : null;
final String code = (column.has("code")) ? column.get("code").getAsString() : null; final String code = column.has("code") ? column.get("code").getAsString() : null;
final String newCode = (column.has("newCode")) ? column.get("newCode").getAsString() : null; final String newCode = column.has("newCode") ? column.get("newCode").getAsString() : null;
final String dataTableNameAlias = datatableName.toLowerCase().replaceAll("\\s", "_"); final String dataTableNameAlias = datatableName.toLowerCase().replaceAll("\\s", "_");
if (isConstraintApproach) { if (isConstraintApproach) {
if (StringUtils.isBlank(newName)) { if (StringUtils.isBlank(newName)) {
@@ -759,12 +759,12 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private void parseDatatableColumnForAdd(final JsonObject column, StringBuilder sqlBuilder, final String dataTableNameAlias, private void parseDatatableColumnForAdd(final JsonObject column, StringBuilder sqlBuilder, final String dataTableNameAlias,
final StringBuilder constrainBuilder, final Map<String, Long> codeMappings, final boolean isConstraintApproach) { final StringBuilder constrainBuilder, final Map<String, Long> codeMappings, final boolean isConstraintApproach) {
String name = (column.has("name")) ? column.get("name").getAsString() : null; String name = column.has("name") ? column.get("name").getAsString() : null;
final String type = (column.has("type")) ? column.get("type").getAsString().toLowerCase() : null; final String type = column.has("type") ? column.get("type").getAsString().toLowerCase() : null;
final Integer length = (column.has("length")) ? column.get("length").getAsInt() : null; final Integer length = column.has("length") ? column.get("length").getAsInt() : null;
final Boolean mandatory = (column.has("mandatory")) ? column.get("mandatory").getAsBoolean() : false; final Boolean mandatory = column.has("mandatory") ? column.get("mandatory").getAsBoolean() : false;
final String after = (column.has("after")) ? column.get("after").getAsString() : null; final String after = column.has("after") ? column.get("after").getAsString() : null;
final String code = (column.has("code")) ? column.get("code").getAsString() : null; final String code = column.has("code") ? column.get("code").getAsString() : null;
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
if (isConstraintApproach) { if (isConstraintApproach) {
@@ -803,7 +803,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private void parseDatatableColumnForDrop(final JsonObject column, StringBuilder sqlBuilder, final String datatableName, private void parseDatatableColumnForDrop(final JsonObject column, StringBuilder sqlBuilder, final String datatableName,
final StringBuilder constrainBuilder, final List<String> codeMappings) { final StringBuilder constrainBuilder, final List<String> codeMappings) {
final String datatableAlias = datatableName.toLowerCase().replaceAll("\\s", "_"); final String datatableAlias = datatableName.toLowerCase().replaceAll("\\s", "_");
final String name = (column.has("name")) ? column.get("name").getAsString() : null; final String name = column.has("name") ? column.get("name").getAsString() : null;
//sqlBuilder = sqlBuilder.append(", DROP COLUMN `" + name + "`"); //sqlBuilder = sqlBuilder.append(", DROP COLUMN `" + name + "`");
final StringBuilder findFKSql = new StringBuilder(); final StringBuilder findFKSql = new StringBuilder();
findFKSql.append("SELECT count(*)").append("FROM information_schema.TABLE_CONSTRAINTS i") findFKSql.append("SELECT count(*)").append("FROM information_schema.TABLE_CONSTRAINTS i")
@@ -855,9 +855,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
**/ **/
private void removeNullValuesFromStringColumn(final String datatableName, final JsonObject column, private void removeNullValuesFromStringColumn(final String datatableName, final JsonObject column,
final Map<String, ResultsetColumnHeaderData> mapColumnNameDefinition) { final Map<String, ResultsetColumnHeaderData> mapColumnNameDefinition) {
final Boolean mandatory = (column.has("mandatory")) ? column.get("mandatory").getAsBoolean() : false; final Boolean mandatory = column.has("mandatory") ? column.get("mandatory").getAsBoolean() : false;
final String name = (column.has("name")) ? column.get("name").getAsString() : ""; final String name = column.has("name") ? column.get("name").getAsString() : "";
final String type = (mapColumnNameDefinition.containsKey(name)) ? mapColumnNameDefinition.get(name).getColumnType() : ""; final String type = mapColumnNameDefinition.containsKey(name) ? mapColumnNameDefinition.get(name).getColumnType() : "";
if (StringUtils.isNotEmpty(type)) { if (StringUtils.isNotEmpty(type)) {
if (mandatory && stringDataTypes.contains(type.toLowerCase())) { if (mandatory && stringDataTypes.contains(type.toLowerCase())) {
@@ -1578,7 +1578,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
final String dateFormat = queryParams.get("dateFormat"); final String dateFormat = queryParams.get("dateFormat");
Locale clientApplicationLocale = null; Locale clientApplicationLocale = null;
final String localeQueryParam = queryParams.get("locale"); final String localeQueryParam = queryParams.get("locale");
if (!(StringUtils.isBlank(localeQueryParam))) { if (!StringUtils.isBlank(localeQueryParam)) {
clientApplicationLocale = new Locale(queryParams.get("locale")); clientApplicationLocale = new Locale(queryParams.get("locale"));
} }
@@ -1595,8 +1595,8 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
// ignores id and foreign key fields // ignores id and foreign key fields
// also ignores locale and dateformat fields that are used for // also ignores locale and dateformat fields that are used for
// validating numeric and date data // validating numeric and date data
if (!((key.equalsIgnoreCase("id")) || (key.equalsIgnoreCase(keyFieldName)) || (key.equals("locale")) if (!(key.equalsIgnoreCase("id") || key.equalsIgnoreCase(keyFieldName) || key.equals("locale")
|| (key.equals("dateFormat")))) { || key.equals("dateFormat"))) {
notFound = true; notFound = true;
// matches incoming fields with and without underscores (spaces // matches incoming fields with and without underscores (spaces
// and underscores considered the same) // and underscores considered the same)
@@ -1782,7 +1782,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
builder.append(" JOIN m_entity_datatable_check edc ON edc.`x_registered_table_name` = xrt.`registered_table_name`"); builder.append(" JOIN m_entity_datatable_check edc ON edc.`x_registered_table_name` = xrt.`registered_table_name`");
builder.append(" WHERE edc.`x_registered_table_name` = '" + datatableName + "'"); builder.append(" WHERE edc.`x_registered_table_name` = '" + datatableName + "'");
final Long count = this.jdbcTemplate.queryForObject(builder.toString(), Long.class); final Long count = this.jdbcTemplate.queryForObject(builder.toString(), Long.class);
return (count > 0) ? true : false; return count > 0 ? true : false;
} }
} }
@@ -127,7 +127,7 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
Collection<FineractEntityToEntityMappingData> entityAccessData = null; Collection<FineractEntityToEntityMappingData> entityAccessData = null;
GetOneEntityMapper mapper = new GetOneEntityMapper(); GetOneEntityMapper mapper = new GetOneEntityMapper();
if (includeAllSubOffices && (firstEntityType.getTable().equals("m_office"))) { if (includeAllSubOffices && firstEntityType.getTable().equals("m_office")) {
sql += " where firstentity.hierarchy like ? order by firstEntity.hierarchy"; sql += " where firstentity.hierarchy like ? order by firstEntity.hierarchy";
entityAccessData = this.jdbcTemplate.query(sql, mapper, new Object[] { fromEntityId, fromEntityId, hierarchySearchString }); entityAccessData = this.jdbcTemplate.query(sql, mapper, new Object[] { fromEntityId, fromEntityId, hierarchySearchString });
} else { } else {
@@ -135,7 +135,7 @@ public class SchedularWritePlatformServiceJpaRepositoryImpl implements Schedular
boolean isStopExecution = false; boolean isStopExecution = false;
final ScheduledJobDetail scheduledJobDetail = this.scheduledJobDetailsRepository.findByJobKeyWithLock(jobKey); final ScheduledJobDetail scheduledJobDetail = this.scheduledJobDetailsRepository.findByJobKeyWithLock(jobKey);
if (scheduledJobDetail.isCurrentlyRunning() if (scheduledJobDetail.isCurrentlyRunning()
|| (triggerType.equals(SchedulerServiceConstants.TRIGGER_TYPE_CRON) && (scheduledJobDetail.getNextRunTime().after(new Date())))) { || triggerType.equals(SchedulerServiceConstants.TRIGGER_TYPE_CRON) && scheduledJobDetail.getNextRunTime().after(new Date())) {
isStopExecution = true; isStopExecution = true;
} }
final SchedulerDetail schedulerDetail = retriveSchedulerDetail(); final SchedulerDetail schedulerDetail = retriveSchedulerDetail();
@@ -170,10 +170,10 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
} }
String pathURL = request.getRequestURI(); String pathURL = request.getRequestURI();
boolean isSelfServiceRequest = (pathURL != null && pathURL.contains("/self/")); boolean isSelfServiceRequest = pathURL != null && pathURL.contains("/self/");
boolean notAllowed = ((isSelfServiceRequest && !user.isSelfServiceUser()) boolean notAllowed = isSelfServiceRequest && !user.isSelfServiceUser()
||(!isSelfServiceRequest && user.isSelfServiceUser())); || !isSelfServiceRequest && user.isSelfServiceUser();
if(notAllowed){ if(notAllowed){
throw new BadCredentialsException("User not authorised to use the requested resource."); throw new BadCredentialsException("User not authorised to use the requested resource.");
@@ -30,7 +30,7 @@ public class RandomOTPGenerator {
public String generate() { public String generate() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for(int i = 0; i < tokenLength; i++) { for(int i = 0; i < tokenLength; i++) {
builder.append(allowedCharacters.charAt((int) (Math.random() * (allowedCharacters.length())))); builder.append(allowedCharacters.charAt((int) (Math.random() * allowedCharacters.length())));
} }
return builder.toString(); return builder.toString();
@@ -281,7 +281,7 @@ public class SmsMessageScheduledJobServiceImpl implements SmsMessageScheduledJob
Integer deliveryStatus = smsMessageDeliveryReportData.getDeliveryStatus(); Integer deliveryStatus = smsMessageDeliveryReportData.getDeliveryStatus();
if (!smsMessageDeliveryReportData.getHasError() if (!smsMessageDeliveryReportData.getHasError()
&& (deliveryStatus != 100)) { && deliveryStatus != 100) {
SmsMessage smsMessage = this.smsMessageRepository.findById(smsMessageDeliveryReportData.getId()).orElse(null); SmsMessage smsMessage = this.smsMessageRepository.findById(smsMessageDeliveryReportData.getId()).orElse(null);
Integer statusType = smsMessage.getStatusType(); Integer statusType = smsMessage.getStatusType();
@@ -131,7 +131,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public Collection<SmsData> retrieveAllPending(final Long campaignId, final Integer limit) { public Collection<SmsData> retrieveAllPending(final Long campaignId, final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.PENDING.getValue(); String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.PENDING.getValue();
if (campaignId != null) { if (campaignId != null) {
sql += " and smo.campaign_id = " + campaignId; sql += " and smo.campaign_id = " + campaignId;
@@ -144,7 +144,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public Collection<SmsData> retrieveAllSent(final Integer limit) { public Collection<SmsData> retrieveAllSent(final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum IN (" + SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue() final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum IN (" + SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue()
+ "," + SmsMessageStatusType.SENT.getValue() + ")" + sqlPlusLimit; + "," + SmsMessageStatusType.SENT.getValue() + ")" + sqlPlusLimit;
@@ -153,7 +153,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public List<Long> retrieveExternalIdsOfAllSent(final Integer limit) { public List<Long> retrieveExternalIdsOfAllSent(final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
final String sql = "select external_id from " + this.smsRowMapper.tableName() + " where status_enum = " final String sql = "select external_id from " + this.smsRowMapper.tableName() + " where status_enum = "
+ SmsMessageStatusType.SENT.getValue() + sqlPlusLimit; + SmsMessageStatusType.SENT.getValue() + sqlPlusLimit;
@@ -162,7 +162,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public Page<Long> retrieveAllWaitingForDeliveryReport(final Integer limit) { public Page<Long> retrieveAllWaitingForDeliveryReport(final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
final String sql = "select id from " + this.smsRowMapper.tableName() + " where status_enum = " final String sql = "select id from " + this.smsRowMapper.tableName() + " where status_enum = "
+ SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue() + sqlPlusLimit; + SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue() + sqlPlusLimit;
final String sqlCountRows = "SELECT FOUND_ROWS()"; final String sqlCountRows = "SELECT FOUND_ROWS()";
@@ -172,7 +172,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public List<Long> retrieveAllPending(final Integer limit) { public List<Long> retrieveAllPending(final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
final String sql = "select external_id from " + this.smsRowMapper.tableName() + " where status_enum = " final String sql = "select external_id from " + this.smsRowMapper.tableName() + " where status_enum = "
+ SmsMessageStatusType.PENDING.getValue() + sqlPlusLimit; + SmsMessageStatusType.PENDING.getValue() + sqlPlusLimit;
@@ -181,7 +181,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public Collection<SmsData> retrieveAllDelivered(final Integer limit) { public Collection<SmsData> retrieveAllDelivered(final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.DELIVERED.getValue() final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.DELIVERED.getValue()
+ sqlPlusLimit; + sqlPlusLimit;
@@ -190,7 +190,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
@Override @Override
public Collection<SmsData> retrieveAllFailed(final Integer limit) { public Collection<SmsData> retrieveAllFailed(final Integer limit) {
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : ""; final String sqlPlusLimit = limit > 0 ? " limit 0, " + limit : "";
final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.FAILED.getValue() final String sql = "select " + this.smsRowMapper.schema() + " where smo.status_enum = " + SmsMessageStatusType.FAILED.getValue()
+ sqlPlusLimit; + sqlPlusLimit;
@@ -247,4 +247,4 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), finalObjectArray, this.smsRowMapper); return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), finalObjectArray, this.smsRowMapper);
} }
} }
@@ -94,7 +94,7 @@ public class XBRLBuilder {
final String prefix = taxonomy.getNamespace(); final String prefix = taxonomy.getNamespace();
String qname = taxonomy.getName(); String qname = taxonomy.getName();
if (prefix != null && (!prefix.isEmpty())) { if (prefix != null && !prefix.isEmpty()) {
final NamespaceData ns = this.readNamespaceService.retrieveNamespaceByPrefix(prefix); final NamespaceData ns = this.readNamespaceService.retrieveNamespaceByPrefix(prefix);
if (ns != null) { if (ns != null) {
@@ -131,8 +131,8 @@ public class XBRLBuilder {
final String startDateStr = timeFormat.format(this.startDate); final String startDateStr = timeFormat.format(this.startDate);
final String endDateStr = timeFormat.format(this.endDate); final String endDateStr = timeFormat.format(this.endDate);
final String contextRefID = (context.getPeriodType() == 0) ? ("As_Of_" + endDateStr + (this.instantScenarioCounter++)) final String contextRefID = context.getPeriodType() == 0 ? "As_Of_" + endDateStr + this.instantScenarioCounter++
: ("Duration_" + startDateStr + "_To_" + endDateStr + (this.durationScenarioCounter++)); : "Duration_" + startDateStr + "_To_" + endDateStr + this.durationScenarioCounter++;
this.contextMap.put(context, contextRefID); this.contextMap.put(context, contextRefID);
} }
@@ -211,7 +211,7 @@ public class Holiday extends AbstractPersistableCustom {
final Set<Office> currentSetOfOffices = new HashSet<>(this.offices); final Set<Office> currentSetOfOffices = new HashSet<>(this.offices);
final Set<Office> newSetOfOffices = new HashSet<>(newOffices); final Set<Office> newSetOfOffices = new HashSet<>(newOffices);
if (!(currentSetOfOffices.equals(newSetOfOffices))) { if (!currentSetOfOffices.equals(newSetOfOffices)) {
updated = true; updated = true;
this.offices = newOffices; this.offices = newOffices;
} }
@@ -237,7 +237,7 @@ public class Money implements Comparable<Money> {
} }
public Money percentageOf(BigDecimal percentage, final RoundingMode roundingMode) { public Money percentageOf(BigDecimal percentage, final RoundingMode roundingMode) {
final BigDecimal newAmount = (this.amount.multiply(percentage)).divide(BigDecimal.valueOf(100), roundingMode); final BigDecimal newAmount = this.amount.multiply(percentage).divide(BigDecimal.valueOf(100), roundingMode);
return Money.of(monetaryCurrency(), newAmount); return Money.of(monetaryCurrency(), newAmount);
} }
@Override @Override
@@ -333,4 +333,4 @@ public class Money implements Comparable<Money> {
public Money zero() { public Money zero() {
return Money.zero(getCurrency()); return Money.zero(getCurrency());
} }
} }
@@ -129,7 +129,7 @@ public class Staff extends AbstractPersistableCustom {
this.externalId = StringUtils.defaultIfEmpty(externalId, null); this.externalId = StringUtils.defaultIfEmpty(externalId, null);
this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null); this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
this.loanOfficer = isLoanOfficer; this.loanOfficer = isLoanOfficer;
this.active = (isActive == null) ? true : isActive; this.active = isActive == null ? true : isActive;
deriveDisplayName(firstname); deriveDisplayName(firstname);
if (joiningDate != null) { if (joiningDate != null) {
this.joiningDate = joiningDate.toDateTimeAtStartOfDay().toDate(); this.joiningDate = joiningDate.toDateTimeAtStartOfDay().toDate();
@@ -274,4 +274,4 @@ public class Staff extends AbstractPersistableCustom {
public Image getImage() { public Image getImage() {
return this.image; return this.image;
} }
} }
@@ -164,8 +164,8 @@ public final class StaffCommandFromApiJsonDeserializer {
//Need to add here check to see if any clients, group, account and loans are assigned to this staff if staff is being set to inactive --LJB //Need to add here check to see if any clients, group, account and loans are assigned to this staff if staff is being set to inactive --LJB
final Boolean forceStatus = this.fromApiJsonHelper.extractBooleanNamed("forceStatus", element); final Boolean forceStatus = this.fromApiJsonHelper.extractBooleanNamed("forceStatus", element);
if ((!activeFlag && forceStatus == null) || if (!activeFlag && forceStatus == null ||
(!activeFlag && forceStatus)) { !activeFlag && forceStatus) {
Object[] result = staffReadPlatformService.hasAssociatedItems(staffId); Object[] result = staffReadPlatformService.hasAssociatedItems(staffId);
if (result != null && result.length > 0) { if (result != null && result.length > 0) {
@@ -160,8 +160,8 @@ public class TellerApiResource {
@QueryParam("todate") @ApiParam(value = "todate") final String toDateStr) { @QueryParam("todate") @ApiParam(value = "todate") final String toDateStr) {
final DateTimeFormatter dateFormatter = ISODateTimeFormat.basicDate(); final DateTimeFormatter dateFormatter = ISODateTimeFormat.basicDate();
final Date fromDate = (fromDateStr != null ? dateFormatter.parseDateTime(fromDateStr).toDate() : new Date()); final Date fromDate = fromDateStr != null ? dateFormatter.parseDateTime(fromDateStr).toDate() : new Date();
final Date toDate = (toDateStr != null ? dateFormatter.parseDateTime(toDateStr).toDate() : new Date()); final Date toDate = toDateStr != null ? dateFormatter.parseDateTime(toDateStr).toDate() : new Date();
final TellerData teller = this.readPlatformService.findTeller(tellerId); final TellerData teller = this.readPlatformService.findTeller(tellerId);
final Collection<CashierData> cashiers = this.readPlatformService.getCashiersForTeller(tellerId, fromDate, toDate); final Collection<CashierData> cashiers = this.readPlatformService.getCashiersForTeller(tellerId, fromDate, toDate);
@@ -74,7 +74,7 @@ public class StandingInstructionHistoryReadPlatformServiceImpl implements Standi
sqlBuilder.append(this.standingInstructionHistoryMapper.schema()); sqlBuilder.append(this.standingInstructionHistoryMapper.schema());
if (standingInstructionDTO.transferType() != null || standingInstructionDTO.clientId() != null if (standingInstructionDTO.transferType() != null || standingInstructionDTO.clientId() != null
|| standingInstructionDTO.clientName() != null || standingInstructionDTO.clientName() != null
|| (standingInstructionDTO.fromAccountType() != null && standingInstructionDTO.fromAccount() != null) || standingInstructionDTO.fromAccountType() != null && standingInstructionDTO.fromAccount() != null
|| standingInstructionDTO.startDateRange() != null || standingInstructionDTO.endDateRange() != null) { || standingInstructionDTO.startDateRange() != null || standingInstructionDTO.endDateRange() != null) {
sqlBuilder.append(" where "); sqlBuilder.append(" where ");
} }
@@ -279,4 +279,4 @@ public class StandingInstructionHistoryReadPlatformServiceImpl implements Standi
} }
} }
} }
@@ -222,7 +222,7 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
} }
BigDecimal transactionAmount = data.amount(); BigDecimal transactionAmount = data.amount();
if (data.toAccountType().isLoanAccount() if (data.toAccountType().isLoanAccount()
&& (recurrenceType.isDuesRecurrence() || (isDueForTransfer && instructionType.isDuesAmoutTransfer()))) { && (recurrenceType.isDuesRecurrence() || isDueForTransfer && instructionType.isDuesAmoutTransfer())) {
StandingInstructionDuesData standingInstructionDuesData = this.standingInstructionReadPlatformService StandingInstructionDuesData standingInstructionDuesData = this.standingInstructionReadPlatformService
.retriveLoanDuesData(data.toAccount().accountId()); .retriveLoanDuesData(data.toAccount().accountId());
if (data.instructionType().isDuesAmoutTransfer()) { if (data.instructionType().isDuesAmoutTransfer()) {
@@ -190,14 +190,14 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
final Address addobj = this.addressRepository.getOne(addressId); final Address addobj = this.addressRepository.getOne(addressId);
if (!(command.stringValueOfParameterNamed("street").isEmpty())) { if (!command.stringValueOfParameterNamed("street").isEmpty()) {
is_address_update = true; is_address_update = true;
final String street = command.stringValueOfParameterNamed("street"); final String street = command.stringValueOfParameterNamed("street");
addobj.setStreet(street); addobj.setStreet(street);
} }
if (!(command.stringValueOfParameterNamed("addressLine1").isEmpty())) { if (!command.stringValueOfParameterNamed("addressLine1").isEmpty()) {
is_address_update = true; is_address_update = true;
final String addressLine1 = command.stringValueOfParameterNamed("addressLine1"); final String addressLine1 = command.stringValueOfParameterNamed("addressLine1");
@@ -205,7 +205,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
} }
if (!(command.stringValueOfParameterNamed("addressLine2").isEmpty())) { if (!command.stringValueOfParameterNamed("addressLine2").isEmpty()) {
is_address_update = true; is_address_update = true;
final String addressLine2 = command.stringValueOfParameterNamed("addressLine2"); final String addressLine2 = command.stringValueOfParameterNamed("addressLine2");
@@ -213,34 +213,34 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
} }
if (!(command.stringValueOfParameterNamed("addressLine3").isEmpty())) { if (!command.stringValueOfParameterNamed("addressLine3").isEmpty()) {
is_address_update = true; is_address_update = true;
final String addressLine3 = command.stringValueOfParameterNamed("addressLine3"); final String addressLine3 = command.stringValueOfParameterNamed("addressLine3");
addobj.setAddressLine3(addressLine3); addobj.setAddressLine3(addressLine3);
} }
if (!(command.stringValueOfParameterNamed("townVillage").isEmpty())) { if (!command.stringValueOfParameterNamed("townVillage").isEmpty()) {
is_address_update = true; is_address_update = true;
final String townVillage = command.stringValueOfParameterNamed("townVillage"); final String townVillage = command.stringValueOfParameterNamed("townVillage");
addobj.setTownVillage(townVillage); addobj.setTownVillage(townVillage);
} }
if (!(command.stringValueOfParameterNamed("city").isEmpty())) { if (!command.stringValueOfParameterNamed("city").isEmpty()) {
is_address_update = true; is_address_update = true;
final String city = command.stringValueOfParameterNamed("city"); final String city = command.stringValueOfParameterNamed("city");
addobj.setCity(city); addobj.setCity(city);
} }
if (!(command.stringValueOfParameterNamed("countyDistrict").isEmpty())) { if (!command.stringValueOfParameterNamed("countyDistrict").isEmpty()) {
is_address_update = true; is_address_update = true;
final String countyDistrict = command.stringValueOfParameterNamed("countyDistrict"); final String countyDistrict = command.stringValueOfParameterNamed("countyDistrict");
addobj.setCountyDistrict(countyDistrict); addobj.setCountyDistrict(countyDistrict);
} }
if ((command.longValueOfParameterNamed("stateProvinceId") != null)) { if (command.longValueOfParameterNamed("stateProvinceId") != null) {
if ((command.longValueOfParameterNamed("stateProvinceId") != 0)) { if (command.longValueOfParameterNamed("stateProvinceId") != 0) {
is_address_update = true; is_address_update = true;
stateId = command.longValueOfParameterNamed("stateProvinceId"); stateId = command.longValueOfParameterNamed("stateProvinceId");
stateIdobj = this.codeValueRepository.getOne(stateId); stateIdobj = this.codeValueRepository.getOne(stateId);
@@ -248,8 +248,8 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
} }
} }
if ((command.longValueOfParameterNamed("countryId") != null)) { if (command.longValueOfParameterNamed("countryId") != null) {
if ((command.longValueOfParameterNamed("countryId") != 0)) { if (command.longValueOfParameterNamed("countryId") != 0) {
is_address_update = true; is_address_update = true;
countryId = command.longValueOfParameterNamed("countryId"); countryId = command.longValueOfParameterNamed("countryId");
countryIdObj = this.codeValueRepository.getOne(countryId); countryIdObj = this.codeValueRepository.getOne(countryId);
@@ -258,7 +258,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
} }
if (!(command.stringValueOfParameterNamed("postalCode").isEmpty())) { if (!command.stringValueOfParameterNamed("postalCode").isEmpty()) {
is_address_update = true; is_address_update = true;
final String postalCode = command.stringValueOfParameterNamed("postalCode"); final String postalCode = command.stringValueOfParameterNamed("postalCode");
addobj.setPostalCode(postalCode); addobj.setPostalCode(postalCode);
@@ -264,7 +264,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
// charges mapped to current user's office // charges mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.CHARGE); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.CHARGE);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if ((inClause != null) && !inClause.trim().isEmpty()) {
sql += " and c.id in ( " + inClause + " ) "; sql += " and c.id in ( " + inClause + " ) ";
} }
@@ -447,4 +447,4 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SHARES.getValue() }); return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.SHARES.getValue() });
} }
} }
@@ -338,7 +338,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
final GroupGeneralData group = this.groupReadPlatformService.retrieveOne(groupId); final GroupGeneralData group = this.groupReadPlatformService.retrieveOne(groupId);
// entityType should be center if it's within a center // entityType should be center if it's within a center
final CalendarEntityType entityType = (group.isChildGroup()) ? CalendarEntityType.CENTERS : CalendarEntityType.GROUPS; final CalendarEntityType entityType = group.isChildGroup() ? CalendarEntityType.CENTERS : CalendarEntityType.GROUPS;
Long entityId = null; Long entityId = null;
if(group.isChildGroup()){ if(group.isChildGroup()){
@@ -326,7 +326,7 @@ public final class GroupingTypesDataValidator {
final Boolean active = this.fromApiJsonHelper.extractBooleanNamed(GroupingTypesApiConstants.activeParamName, final Boolean active = this.fromApiJsonHelper.extractBooleanNamed(GroupingTypesApiConstants.activeParamName,
element); element);
if ((active != null && active) if ((active != null && active)
|| (this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.activationDateParamName, element))) { || this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.activationDateParamName, element)) {
final LocalDate joinedDate = this.fromApiJsonHelper final LocalDate joinedDate = this.fromApiJsonHelper
.extractLocalDateNamed(GroupingTypesApiConstants.activationDateParamName, element); .extractLocalDateNamed(GroupingTypesApiConstants.activationDateParamName, element);
baseDataValidator.reset().parameter(GroupingTypesApiConstants.activationDateParamName).value(joinedDate) baseDataValidator.reset().parameter(GroupingTypesApiConstants.activationDateParamName).value(joinedDate)
@@ -380,8 +380,8 @@ public final class GroupingTypesDataValidator {
final Boolean active = this.fromApiJsonHelper.extractBooleanNamed(GroupingTypesApiConstants.activeParamName, final Boolean active = this.fromApiJsonHelper.extractBooleanNamed(GroupingTypesApiConstants.activeParamName,
element); element);
if ((active != null && active) || (this.fromApiJsonHelper if ((active != null && active) || this.fromApiJsonHelper
.parameterExists(GroupingTypesApiConstants.activationDateParamName, element))) { .parameterExists(GroupingTypesApiConstants.activationDateParamName, element)) {
final LocalDate joinedDate = this.fromApiJsonHelper final LocalDate joinedDate = this.fromApiJsonHelper
.extractLocalDateNamed(GroupingTypesApiConstants.activationDateParamName, element); .extractLocalDateNamed(GroupingTypesApiConstants.activationDateParamName, element);
baseDataValidator.reset().parameter(GroupingTypesApiConstants.activationDateParamName).value(joinedDate) baseDataValidator.reset().parameter(GroupingTypesApiConstants.activationDateParamName).value(joinedDate)
@@ -590,4 +590,4 @@ public final class GroupingTypesDataValidator {
throwExceptionIfValidationWarningsExist(dataValidationErrors); throwExceptionIfValidationWarningsExist(dataValidationErrors);
} }
} }
@@ -1266,8 +1266,8 @@ public class Loan extends AbstractPersistableCustom {
if (installment.getFeeChargesCharged(getCurrency()).isLessThan(fee) if (installment.getFeeChargesCharged(getCurrency()).isLessThan(fee)
|| installment.getInterestCharged(getCurrency()).isLessThan(interest) || installment.getInterestCharged(getCurrency()).isLessThan(interest)
|| installment.getPenaltyChargesCharged(getCurrency()).isLessThan(penality) || installment.getPenaltyChargesCharged(getCurrency()).isLessThan(penality)
|| (getAccruedTill().isEqual(loanTransaction.getTransactionDate()) && !installment.getDueDate().isEqual( || getAccruedTill().isEqual(loanTransaction.getTransactionDate()) && !installment.getDueDate().isEqual(
getAccruedTill()))) { getAccruedTill())) {
interest = interest.minus(loanTransaction.getInterestPortion(getCurrency())); interest = interest.minus(loanTransaction.getInterestPortion(getCurrency()));
fee = fee.minus(loanTransaction.getFeeChargesPortion(getCurrency())); fee = fee.minus(loanTransaction.getFeeChargesPortion(getCurrency()));
penality = penality.minus(loanTransaction.getPenaltyChargesPortion(getCurrency())); penality = penality.minus(loanTransaction.getPenaltyChargesPortion(getCurrency()));
@@ -1751,21 +1751,21 @@ public class Loan extends AbstractPersistableCustom {
} }
if (jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive() if (jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).getAsString())) {
BigDecimal principal = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName).getAsBigDecimal(); BigDecimal principal = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName).getAsBigDecimal();
returnObject.put(LoanApiConstants.disbursementPrincipalParameterName, principal); returnObject.put(LoanApiConstants.disbursementPrincipalParameterName, principal);
} }
if (jsonObject.has(LoanApiConstants.disbursementIdParameterName) if (jsonObject.has(LoanApiConstants.disbursementIdParameterName)
&& jsonObject.get(LoanApiConstants.disbursementIdParameterName).isJsonPrimitive() && jsonObject.get(LoanApiConstants.disbursementIdParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanApiConstants.disbursementIdParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanApiConstants.disbursementIdParameterName).getAsString())) {
Long id = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementIdParameterName).getAsLong(); Long id = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementIdParameterName).getAsLong();
returnObject.put(LoanApiConstants.disbursementIdParameterName, id); returnObject.put(LoanApiConstants.disbursementIdParameterName, id);
} }
if (jsonObject.has(LoanApiConstants.loanChargeIdParameterName) if (jsonObject.has(LoanApiConstants.loanChargeIdParameterName)
&& jsonObject.get(LoanApiConstants.loanChargeIdParameterName).isJsonPrimitive() && jsonObject.get(LoanApiConstants.loanChargeIdParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanApiConstants.loanChargeIdParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanApiConstants.loanChargeIdParameterName).getAsString())) {
returnObject.put(LoanApiConstants.loanChargeIdParameterName, returnObject.put(LoanApiConstants.loanChargeIdParameterName,
jsonObject.getAsJsonPrimitive(LoanApiConstants.loanChargeIdParameterName).getAsString()); jsonObject.getAsJsonPrimitive(LoanApiConstants.loanChargeIdParameterName).getAsString());
} }
@@ -2384,7 +2384,7 @@ public class Loan extends AbstractPersistableCustom {
**/ **/
if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct() if (isNoneOrCashOrUpfrontAccrualAccountingEnabledOnLoanProduct()
&& ((isMultiDisburmentLoan() && getDisbursedLoanDisbursementDetails().size() == 1) || !isMultiDisburmentLoan())) { && (isMultiDisburmentLoan() && getDisbursedLoanDisbursementDetails().size() == 1 || !isMultiDisburmentLoan())) {
final LoanTransaction interestAppliedTransaction = LoanTransaction.accrueInterest(getOffice(), this, interestApplied, final LoanTransaction interestAppliedTransaction = LoanTransaction.accrueInterest(getOffice(), this, interestApplied,
actualDisbursementDate, createdDate, currentUser); actualDisbursementDate, createdDate, currentUser);
addLoanTransaction(interestAppliedTransaction) ; addLoanTransaction(interestAppliedTransaction) ;
@@ -2465,7 +2465,7 @@ public class Loan extends AbstractPersistableCustom {
} }
isMultiTrancheDisburse = true; isMultiTrancheDisburse = true;
} }
return (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus)) || isMultiTrancheDisburse); return !statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus)) || isMultiTrancheDisburse;
} }
public Money adjustDisburseAmount(final JsonCommand command, final LocalDate actualDisbursementDate) { public Money adjustDisburseAmount(final JsonCommand command, final LocalDate actualDisbursementDate) {
@@ -2519,7 +2519,7 @@ public class Loan extends AbstractPersistableCustom {
} else { } else {
this.loanRepaymentScheduleDetail.setPrincipal(this.loanRepaymentScheduleDetail.getPrincipal().minus(diff).getAmount()); this.loanRepaymentScheduleDetail.setPrincipal(this.loanRepaymentScheduleDetail.getPrincipal().minus(diff).getAmount());
} }
if (!(this.loanProduct().isMultiDisburseLoan()) && diff.compareTo(BigDecimal.ZERO) < 0) { if (!this.loanProduct().isMultiDisburseLoan() && diff.compareTo(BigDecimal.ZERO) < 0) {
final String errorMsg = "Loan can't be disbursed,disburse amount is exceeding approved amount "; final String errorMsg = "Loan can't be disbursed,disburse amount is exceeding approved amount ";
throw new LoanDisbursalException(errorMsg, "disburse.amount.must.be.less.than.approved.amount", principalDisbursed, throw new LoanDisbursalException(errorMsg, "disburse.amount.must.be.less.than.approved.amount", principalDisbursed,
this.loanRepaymentScheduleDetail.getPrincipal().getAmount()); this.loanRepaymentScheduleDetail.getPrincipal().getAmount());
@@ -2733,12 +2733,12 @@ public class Loan extends AbstractPersistableCustom {
final Integer installmentNumber = null; final Integer installmentNumber = null;
for (final LoanCharge charge : charges()) { for (final LoanCharge charge : charges()) {
Date actualDisbursementDate = getActualDisbursementDate(charge); Date actualDisbursementDate = getActualDisbursementDate(charge);
if ((charge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue()) if (charge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue())
&& disbursedOn.equals(new LocalDate(actualDisbursementDate)) && actualDisbursementDate != null && !charge.isWaived() && !charge && disbursedOn.equals(new LocalDate(actualDisbursementDate)) && actualDisbursementDate != null && !charge.isWaived() && !charge
.isFullyPaid()) .isFullyPaid()
|| (charge.getCharge().getChargeTimeType().equals(ChargeTimeType.TRANCHE_DISBURSEMENT.getValue()) || charge.getCharge().getChargeTimeType().equals(ChargeTimeType.TRANCHE_DISBURSEMENT.getValue())
&& disbursedOn.equals(new LocalDate(actualDisbursementDate)) && actualDisbursementDate != null && disbursedOn.equals(new LocalDate(actualDisbursementDate)) && actualDisbursementDate != null
&& !charge.isWaived() && !charge.isFullyPaid())) { && !charge.isWaived() && !charge.isFullyPaid()) {
if (totalFeeChargesDueAtDisbursement.isGreaterThanZero() && !charge.getChargePaymentMode().isPaymentModeAccountTransfer()) { if (totalFeeChargesDueAtDisbursement.isGreaterThanZero() && !charge.getChargePaymentMode().isPaymentModeAccountTransfer()) {
charge.markAsFullyPaid(); charge.markAsFullyPaid();
// Add "Loan Charge Paid By" details to this transaction // Add "Loan Charge Paid By" details to this transaction
@@ -3992,7 +3992,7 @@ public class Loan extends AbstractPersistableCustom {
boolean isRegenerationRequired = false; boolean isRegenerationRequired = false;
if (this.loanProduct.isMultiDisburseLoan()) { if (this.loanProduct.isMultiDisburseLoan()) {
LoanDisbursementDetails details = fetchLastDisburseDetail(); LoanDisbursementDetails details = fetchLastDisburseDetail();
if (details != null && !(details.expectedDisbursementDate().equals(details.actualDisbursementDate()))) { if (details != null && !details.expectedDisbursementDate().equals(details.actualDisbursementDate())) {
isRegenerationRequired = true; isRegenerationRequired = true;
} }
} }
@@ -4855,8 +4855,8 @@ public class Loan extends AbstractPersistableCustom {
} }
break; break;
case LOAN_DISBURSED: case LOAN_DISBURSED:
if ((!(isApproved() && isNotDisbursed()) && !this.loanProduct.isMultiDisburseLoan()) if (!(isApproved() && isNotDisbursed()) && !this.loanProduct.isMultiDisburseLoan()
|| (this.loanProduct.isMultiDisburseLoan() && !isAllTranchesNotDisbursed())) { || this.loanProduct.isMultiDisburseLoan() && !isAllTranchesNotDisbursed()) {
final String defaultUserMessage = "Loan Disbursal is not allowed. Loan Account is not in approved and not disbursed state."; final String defaultUserMessage = "Loan Disbursal is not allowed. Loan Account is not in approved and not disbursed state.";
final ApiParameterError error = ApiParameterError.generalError( final ApiParameterError error = ApiParameterError.generalError(
"error.msg.loan.disbursal.account.is.not.approve.not.disbursed.state", defaultUserMessage); "error.msg.loan.disbursal.account.is.not.approve.not.disbursed.state", defaultUserMessage);
@@ -5179,7 +5179,7 @@ public class Loan extends AbstractPersistableCustom {
for (final LoanCharge loanCharge : charges) { for (final LoanCharge loanCharge : charges) {
if (!loanCharge.isDueAtDisbursement()) { if (!loanCharge.isDueAtDisbursement()) {
updateOverdueScheduleInstallment(loanCharge); updateOverdueScheduleInstallment(loanCharge);
if (loanCharge.getDueLocalDate() == null || (!lastRepaymentDate.isBefore(loanCharge.getDueLocalDate()))) { if (loanCharge.getDueLocalDate() == null || !lastRepaymentDate.isBefore(loanCharge.getDueLocalDate())) {
if ((loanCharge.isInstalmentFee() || !loanCharge.isWaived()) if ((loanCharge.isInstalmentFee() || !loanCharge.isWaived())
&& (loanCharge.getDueLocalDate() == null || !lastTransactionDate.isAfter(loanCharge.getDueLocalDate()))) { && (loanCharge.getDueLocalDate() == null || !lastTransactionDate.isAfter(loanCharge.getDueLocalDate()))) {
recalculateLoanCharge(loanCharge, generatorDTO.getPenaltyWaitPeriod()); recalculateLoanCharge(loanCharge, generatorDTO.getPenaltyWaitPeriod());
@@ -5819,7 +5819,7 @@ public class Loan extends AbstractPersistableCustom {
} }
public Boolean shouldCreateStandingInstructionAtDisbursement() { public Boolean shouldCreateStandingInstructionAtDisbursement() {
return (this.createStandingInstructionAtDisbursement != null) && this.createStandingInstructionAtDisbursement; return this.createStandingInstructionAtDisbursement != null && this.createStandingInstructionAtDisbursement;
} }
public Collection<LoanCharge> getLoanCharges(LocalDate dueDate) { public Collection<LoanCharge> getLoanCharges(LocalDate dueDate) {
@@ -5827,7 +5827,7 @@ public class Loan extends AbstractPersistableCustom {
for (LoanCharge loanCharge : charges) { for (LoanCharge loanCharge : charges) {
if ((loanCharge.getDueLocalDate() != null) && loanCharge.getDueLocalDate().equals(dueDate)) { if (loanCharge.getDueLocalDate() != null && loanCharge.getDueLocalDate().equals(dueDate)) {
loanCharges.add(loanCharge); loanCharges.add(loanCharge);
} }
} }
@@ -6151,7 +6151,7 @@ public class Loan extends AbstractPersistableCustom {
public BigDecimal getDerivedAmountForCharge(final LoanCharge loanCharge) { public BigDecimal getDerivedAmountForCharge(final LoanCharge loanCharge) {
BigDecimal amount = BigDecimal.ZERO; BigDecimal amount = BigDecimal.ZERO;
if (isMultiDisburmentLoan() && (loanCharge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue()))) { if (isMultiDisburmentLoan() && loanCharge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue())) {
amount = getApprovedPrincipal(); amount = getApprovedPrincipal();
} else { } else {
// If charge type is specified due date and loan is multi disburment // If charge type is specified due date and loan is multi disburment
@@ -6186,7 +6186,7 @@ public class Loan extends AbstractPersistableCustom {
public LoanRepaymentScheduleInstallment fetchLoanForeclosureDetail(final LocalDate closureDate) { public LoanRepaymentScheduleInstallment fetchLoanForeclosureDetail(final LocalDate closureDate) {
Money[] receivables = retriveIncomeOutstandingTillDate(closureDate); Money[] receivables = retriveIncomeOutstandingTillDate(closureDate);
Money totalPrincipal = (Money.of(getCurrency(), this.getSummary().getTotalPrincipalOutstanding())); Money totalPrincipal = Money.of(getCurrency(), this.getSummary().getTotalPrincipalOutstanding());
totalPrincipal = totalPrincipal.minus(receivables[3]); totalPrincipal = totalPrincipal.minus(receivables[3]);
final Set<LoanInterestRecalcualtionAdditionalDetails> compoundingDetails = null; final Set<LoanInterestRecalcualtionAdditionalDetails> compoundingDetails = null;
final LocalDate currentDate = DateUtils.getLocalDateOfTenant(); final LocalDate currentDate = DateUtils.getLocalDateOfTenant();
@@ -6312,7 +6312,7 @@ public class Loan extends AbstractPersistableCustom {
} }
private double calculateInterestForDays(int daysInPeriod, BigDecimal interest, int days) { private double calculateInterestForDays(int daysInPeriod, BigDecimal interest, int days) {
if (interest.doubleValue() == 0) { return 0; } if (interest.doubleValue() == 0) { return 0; }
return ((interest.doubleValue()) / daysInPeriod) * days; return interest.doubleValue() / daysInPeriod * days;
} }
public Money[] getReceivableIncome(final LocalDate tillDate) { public Money[] getReceivableIncome(final LocalDate tillDate) {
@@ -6383,9 +6383,9 @@ public class Loan extends AbstractPersistableCustom {
double interest = calculateInterestForDays(daysInPeriod, installment.getInterestCharged(getCurrency()).getAmount(), double interest = calculateInterestForDays(daysInPeriod, installment.getInterestCharged(getCurrency()).getAmount(),
tillDays); tillDays);
actualAmountTobeAccrued = actualAmountTobeAccrued.plus(interest); actualAmountTobeAccrued = actualAmountTobeAccrued.plus(interest);
} else if ((tillDate.isAfter(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate())) } else if (tillDate.isAfter(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate())
|| (tillDate.isEqual(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate())) || tillDate.isEqual(installment.getFromDate()) && tillDate.isEqual(installment.getDueDate())
|| (tillDate.isAfter(installment.getFromDate()) && tillDate.isAfter(installment.getDueDate()))) { || tillDate.isAfter(installment.getFromDate()) && tillDate.isAfter(installment.getDueDate())) {
actualAmountTobeAccrued = actualAmountTobeAccrued.plus(installment.getInterestAccrued(getCurrency())); actualAmountTobeAccrued = actualAmountTobeAccrued.plus(installment.getInterestAccrued(getCurrency()));
} }
} }
@@ -6444,7 +6444,7 @@ public class Loan extends AbstractPersistableCustom {
LocalDate installmentStartDate = getDisbursementDate(); LocalDate installmentStartDate = getDisbursementDate();
if (newInstallments.size() > 0) { if (newInstallments.size() > 0) {
installmentStartDate = newInstallments.get((newInstallments.size() - 1)).getDueDate(); installmentStartDate = newInstallments.get(newInstallments.size() - 1).getDueDate();
} }
int installmentNumber = newInstallments.size(); int installmentNumber = newInstallments.size();
@@ -6465,7 +6465,7 @@ public class Loan extends AbstractPersistableCustom {
int penaltyWaitPeriod = 0; int penaltyWaitPeriod = 0;
for (LoanCharge loanCharge : charges) { for (LoanCharge loanCharge : charges) {
if (loanCharge.getDueLocalDate() != null if (loanCharge.getDueLocalDate() != null
&& (loanCharge.getDueLocalDate().isAfter(transactionDate))) { && loanCharge.getDueLocalDate().isAfter(transactionDate)) {
loanCharge.setActive(false); loanCharge.setActive(false);
} else if (loanCharge.getDueLocalDate() == null) { } else if (loanCharge.getDueLocalDate() == null) {
recalculateLoanCharge(loanCharge, penaltyWaitPeriod); recalculateLoanCharge(loanCharge, penaltyWaitPeriod);
@@ -6477,12 +6477,12 @@ public class Loan extends AbstractPersistableCustom {
if (loanTransaction.isChargesWaiver()) { if (loanTransaction.isChargesWaiver()) {
for (LoanChargePaidBy chargePaidBy : loanTransaction for (LoanChargePaidBy chargePaidBy : loanTransaction
.getLoanChargesPaid()) { .getLoanChargesPaid()) {
if ((chargePaidBy.getLoanCharge().isDueDateCharge() && chargePaidBy if (chargePaidBy.getLoanCharge().isDueDateCharge() && chargePaidBy
.getLoanCharge().getDueLocalDate() .getLoanCharge().getDueLocalDate()
.isAfter(transactionDate)) .isAfter(transactionDate)
|| (chargePaidBy.getLoanCharge().isInstalmentFee() && (chargePaidBy || chargePaidBy.getLoanCharge().isInstalmentFee() && chargePaidBy
.getInstallmentNumber() != null && chargePaidBy .getInstallmentNumber() != null && chargePaidBy
.getInstallmentNumber() > installmentNumber))) { .getInstallmentNumber() > installmentNumber) {
loanTransaction.reverse(); loanTransaction.reverse();
} }
} }
@@ -615,7 +615,7 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
installemntCharge = loanCharge; installemntCharge = loanCharge;
chargePerInstallment = paidLoanChargePerInstallment; chargePerInstallment = paidLoanChargePerInstallment;
} }
} else if (latestPaidCharge == null || (loanCharge.isPaidOrPartiallyPaid(currency)) } else if (latestPaidCharge == null || loanCharge.isPaidOrPartiallyPaid(currency)
&& loanCharge.getDueLocalDate().isAfter(latestPaidCharge.getDueLocalDate())) { && loanCharge.getDueLocalDate().isAfter(latestPaidCharge.getDueLocalDate())) {
latestPaidCharge = loanCharge; latestPaidCharge = loanCharge;
} }
@@ -716,4 +716,4 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
} }
} }
} }
@@ -72,7 +72,7 @@ public class HeavensFamilyLoanRepaymentScheduleTransactionProcessor extends Abst
final LoanRepaymentScheduleInstallment previousInstallment = installments.get(previousInstallmentIndex); final LoanRepaymentScheduleInstallment previousInstallment = installments.get(previousInstallmentIndex);
lastInstallmentDueDate = previousInstallment.getDueDate(); lastInstallmentDueDate = previousInstallment.getDueDate();
isInAdvance = !(transactionDate.isAfter(lastInstallmentDueDate) || (transactionDate.isEqual(lastInstallmentDueDate))); isInAdvance = !(transactionDate.isAfter(lastInstallmentDueDate) || transactionDate.isEqual(lastInstallmentDueDate));
return isInAdvance; return isInAdvance;
} }
@@ -246,4 +246,4 @@ public class HeavensFamilyLoanRepaymentScheduleTransactionProcessor extends Abst
} }
return transactionAmountRemaining; return transactionAmountRemaining;
} }
} }
@@ -195,7 +195,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
@Override @Override
public void releaseGuarantor(final GuarantorFundingDetails guarantorFundingDetails, final LocalDate transactionDate) { public void releaseGuarantor(final GuarantorFundingDetails guarantorFundingDetails, final LocalDate transactionDate) {
BigDecimal amoutForWithdraw = guarantorFundingDetails.getAmountRemaining(); BigDecimal amoutForWithdraw = guarantorFundingDetails.getAmountRemaining();
if (amoutForWithdraw.compareTo(BigDecimal.ZERO) > 0 && (guarantorFundingDetails.getStatus().isActive())) { if (amoutForWithdraw.compareTo(BigDecimal.ZERO) > 0 && guarantorFundingDetails.getStatus().isActive()) {
SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount(); SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount();
savingsAccount.releaseFunds(amoutForWithdraw); savingsAccount.releaseFunds(amoutForWithdraw);
DepositAccountOnHoldTransaction onHoldTransaction = DepositAccountOnHoldTransaction.release(savingsAccount, amoutForWithdraw, DepositAccountOnHoldTransaction onHoldTransaction = DepositAccountOnHoldTransaction.release(savingsAccount, amoutForWithdraw,
@@ -443,7 +443,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
final List<GuarantorFundingDetails> fundingDetails = guarantor.getGuarantorFundDetails(); final List<GuarantorFundingDetails> fundingDetails = guarantor.getGuarantorFundDetails();
for (GuarantorFundingDetails guarantorFundingDetails : fundingDetails) { for (GuarantorFundingDetails guarantorFundingDetails : fundingDetails) {
BigDecimal amoutForRelease = guarantorFundingDetails.getAmountRemaining(); BigDecimal amoutForRelease = guarantorFundingDetails.getAmountRemaining();
if (amoutForRelease.compareTo(BigDecimal.ZERO) > 0 && (guarantorFundingDetails.getStatus().isActive())) { if (amoutForRelease.compareTo(BigDecimal.ZERO) > 0 && guarantorFundingDetails.getStatus().isActive()) {
SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount(); SavingsAccount savingsAccount = guarantorFundingDetails.getLinkedSavingsAccount();
savingsAccount.releaseFunds(amoutForRelease); savingsAccount.releaseFunds(amoutForRelease);
DepositAccountOnHoldTransaction onHoldTransaction = DepositAccountOnHoldTransaction.release(savingsAccount, DepositAccountOnHoldTransaction onHoldTransaction = DepositAccountOnHoldTransaction.release(savingsAccount,
@@ -1101,7 +1101,7 @@ public final class LoanApplicationTerms {
} }
switch (this.interestCalculationPeriodMethod) { switch (this.interestCalculationPeriodMethod) {
case DAILY: case DAILY:
periodsInOneYear = (!this.daysInYearType.getCode().equalsIgnoreCase("DaysInYearType.actual")) ? this.daysInYearType periodsInOneYear = !this.daysInYearType.getCode().equalsIgnoreCase("DaysInYearType.actual") ? this.daysInYearType
.getValue().longValue() : calculator.calculate(PeriodFrequencyType.DAYS).longValue(); .getValue().longValue() : calculator.calculate(PeriodFrequencyType.DAYS).longValue();
break; break;
case INVALID: case INVALID:
@@ -1771,4 +1771,4 @@ public final class LoanApplicationTerms {
this.isEqualAmortization = isEqualAmortization; this.isEqualAmortization = isEqualAmortization;
} }
} }
@@ -518,7 +518,7 @@ public class LoanScheduleAssembler {
} }
if (jsonObject.has(LoanApiConstants.disbursementPrincipalParameterName) if (jsonObject.has(LoanApiConstants.disbursementPrincipalParameterName)
&& jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive() && jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).getAsString())) {
principal = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName).getAsBigDecimal(); principal = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName).getAsBigDecimal();
} }
BigDecimal waivedChargeAmount = null; BigDecimal waivedChargeAmount = null;
@@ -552,7 +552,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
if(gsimClientMembers.contains(BigDecimal.valueOf(newLoanApplication.getClientId()))) if(gsimClientMembers.contains(BigDecimal.valueOf(newLoanApplication.getClientId())))
{ {
savingsAccount = this.savingsAccountAssembler.assembleFrom((clientAccountMappings.get(BigDecimal.valueOf(newLoanApplication.getClientId()))).longValue()); savingsAccount = this.savingsAccountAssembler.assembleFrom(clientAccountMappings.get(BigDecimal.valueOf(newLoanApplication.getClientId())).longValue());
this.fromApiJsonDeserializer.validatelinkedSavingsAccount(savingsAccount, newLoanApplication); this.fromApiJsonDeserializer.validatelinkedSavingsAccount(savingsAccount, newLoanApplication);
boolean isActive = true; boolean isActive = true;
@@ -310,7 +310,7 @@ public class LoanUtilService {
} }
if (jsonObject.has(LoanApiConstants.disbursementPrincipalParameterName) if (jsonObject.has(LoanApiConstants.disbursementPrincipalParameterName)
&& jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive() && jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanApiConstants.disbursementPrincipalParameterName).getAsString())) {
principal = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName).getAsBigDecimal(); principal = jsonObject.getAsJsonPrimitive(LoanApiConstants.disbursementPrincipalParameterName).getAsBigDecimal();
} }
@@ -434,12 +434,12 @@ public class LoanProduct extends AbstractPersistableCustom {
} }
if (jsonObject.has(LoanProductConstants.minValueParameterName) if (jsonObject.has(LoanProductConstants.minValueParameterName)
&& jsonObject.get(LoanProductConstants.minValueParameterName).isJsonPrimitive() && jsonObject.get(LoanProductConstants.minValueParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanProductConstants.minValueParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.minValueParameterName).getAsString())) {
minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.minValueParameterName).getAsBigDecimal(); minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.minValueParameterName).getAsBigDecimal();
} }
if (jsonObject.has(LoanProductConstants.maxValueParameterName) if (jsonObject.has(LoanProductConstants.maxValueParameterName)
&& jsonObject.get(LoanProductConstants.maxValueParameterName).isJsonPrimitive() && jsonObject.get(LoanProductConstants.maxValueParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanProductConstants.maxValueParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.maxValueParameterName).getAsString())) {
maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.maxValueParameterName).getAsBigDecimal(); maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.maxValueParameterName).getAsBigDecimal();
} }
if (jsonObject.has(LoanProductConstants.borrowerCycleNumberParamName) if (jsonObject.has(LoanProductConstants.borrowerCycleNumberParamName)
@@ -502,12 +502,12 @@ public class LoanProduct extends AbstractPersistableCustom {
} }
if (jsonObject.has(LoanProductConstants.minValueParameterName) if (jsonObject.has(LoanProductConstants.minValueParameterName)
&& jsonObject.get(LoanProductConstants.minValueParameterName).isJsonPrimitive() && jsonObject.get(LoanProductConstants.minValueParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanProductConstants.minValueParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.minValueParameterName).getAsString())) {
minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.minValueParameterName).getAsBigDecimal(); minValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.minValueParameterName).getAsBigDecimal();
} }
if (jsonObject.has(LoanProductConstants.maxValueParameterName) if (jsonObject.has(LoanProductConstants.maxValueParameterName)
&& jsonObject.get(LoanProductConstants.maxValueParameterName).isJsonPrimitive() && jsonObject.get(LoanProductConstants.maxValueParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanProductConstants.maxValueParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.maxValueParameterName).getAsString())) {
maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.maxValueParameterName).getAsBigDecimal(); maxValue = jsonObject.getAsJsonPrimitive(LoanProductConstants.maxValueParameterName).getAsBigDecimal();
} }
if (jsonObject.has(LoanProductConstants.borrowerCycleNumberParamName) if (jsonObject.has(LoanProductConstants.borrowerCycleNumberParamName)
@@ -520,7 +520,7 @@ public class LoanProduct extends AbstractPersistableCustom {
} }
if (jsonObject.has(LoanProductConstants.borrowerCycleIdParameterName) if (jsonObject.has(LoanProductConstants.borrowerCycleIdParameterName)
&& jsonObject.get(LoanProductConstants.borrowerCycleIdParameterName).isJsonPrimitive() && jsonObject.get(LoanProductConstants.borrowerCycleIdParameterName).isJsonPrimitive()
&& StringUtils.isNotBlank((jsonObject.get(LoanProductConstants.borrowerCycleIdParameterName).getAsString()))) { && StringUtils.isNotBlank(jsonObject.get(LoanProductConstants.borrowerCycleIdParameterName).getAsString())) {
id = jsonObject.getAsJsonPrimitive(LoanProductConstants.borrowerCycleIdParameterName).getAsLong(); id = jsonObject.getAsJsonPrimitive(LoanProductConstants.borrowerCycleIdParameterName).getAsLong();
} }
LoanProductBorrowerCycleVariations borrowerCycleVariations = new LoanProductBorrowerCycleVariations(cycleNumber, LoanProductBorrowerCycleVariations borrowerCycleVariations = new LoanProductBorrowerCycleVariations(cycleNumber,
@@ -108,7 +108,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " where lp.id in ( " + inClause + " ) "; sql += " where lp.id in ( " + inClause + " ) ";
} }
@@ -124,7 +124,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
String sql = "select " + rm.schema(); String sql = "select " + rm.schema();
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " where lp.id in ("+inClause+") "; sql += " where lp.id in ("+inClause+") ";
//Here no need to check injection as this is internal where clause //Here no need to check injection as this is internal where clause
// SQLInjectionValidator.validateSQLInput(inClause); // SQLInjectionValidator.validateSQLInput(inClause);
@@ -155,7 +155,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
if (activeOnly) { if (activeOnly) {
sql += " and id in ( " + inClause + " )"; sql += " and id in ( " + inClause + " )";
} else { } else {
@@ -552,7 +552,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " and id in (" + inClause + ") "; sql += " and id in (" + inClause + ") ";
} }
@@ -572,7 +572,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " and lp.id in ( " + inClause + " ) "; sql += " and lp.id in ( " + inClause + " ) ";
} }
@@ -591,7 +591,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause1 = fineractEntityAccessUtil String inClause1 = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause1 != null) && (!(inClause1.trim().isEmpty()))) { if (inClause1 != null && !inClause1.trim().isEmpty()) {
sql += " and rp.id in ( " + inClause1 + " ) "; sql += " and rp.id in ( " + inClause1 + " ) ";
} }
@@ -601,7 +601,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause2 = fineractEntityAccessUtil String inClause2 = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause2 != null) && (!(inClause2.trim().isEmpty()))) { if (inClause2 != null && !inClause2.trim().isEmpty()) {
sql += " and lp.id in ( " + inClause2 + " ) "; sql += " and lp.id in ( " + inClause2 + " ) ";
} }
@@ -621,7 +621,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.LOAN_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " lp.id in ( " + inClause + " ) and "; sql += " lp.id in ( " + inClause + " ) and ";
} }
@@ -684,4 +684,4 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
} }
} }
} }
@@ -573,7 +573,7 @@ public class SavingsAccount extends AbstractPersistableCustom {
final List<SavingsAccountTransaction> withholdTransactions = new ArrayList<>(); final List<SavingsAccountTransaction> withholdTransactions = new ArrayList<>();
List<SavingsAccountTransaction> trans = getTransactions() ; List<SavingsAccountTransaction> trans = getTransactions() ;
for (final SavingsAccountTransaction transaction : trans) { for (final SavingsAccountTransaction transaction : trans) {
if ((transaction.isWithHoldTaxAndNotReversed())) { if (transaction.isWithHoldTaxAndNotReversed()) {
withholdTransactions.add(transaction); withholdTransactions.add(transaction);
} }
} }
@@ -658,7 +658,7 @@ public class SavingsProduct extends AbstractPersistableCustom {
final Set<Charge> currentSetOfCharges = new HashSet<>(this.charges); final Set<Charge> currentSetOfCharges = new HashSet<>(this.charges);
final Set<Charge> newSetOfCharges = new HashSet<>(newSavingsProductCharges); final Set<Charge> newSetOfCharges = new HashSet<>(newSavingsProductCharges);
if (!(currentSetOfCharges.equals(newSetOfCharges))) { if (!currentSetOfCharges.equals(newSetOfCharges)) {
updated = true; updated = true;
this.charges = newSavingsProductCharges; this.charges = newSavingsProductCharges;
} }
@@ -752,4 +752,4 @@ public class SavingsProduct extends AbstractPersistableCustom {
return this.daysToEscheat; return this.daysToEscheat;
} }
} }
@@ -68,7 +68,7 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " and sp.id in ( " + inClause + " ) "; sql += " and sp.id in ( " + inClause + " ) ";
} }
@@ -84,7 +84,7 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " and id in ( " + inClause + " ) "; sql += " and id in ( " + inClause + " ) ";
} }
@@ -254,7 +254,7 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " where id in ( " + inClause + " ) "; sql += " where id in ( " + inClause + " ) ";
inClauseAdded = true; inClauseAdded = true;
} }
@@ -288,10 +288,10 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
// products mapped to current user's office // products mapped to current user's office
String inClause = fineractEntityAccessUtil String inClause = fineractEntityAccessUtil
.getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT); .getSQLWhereClauseForProductIDsForUserOffice_ifGlobalConfigEnabled(FineractEntityType.SAVINGS_PRODUCT);
if ((inClause != null) && (!(inClause.trim().isEmpty()))) { if (inClause != null && !inClause.trim().isEmpty()) {
sql += " and id in ( " + inClause + " ) "; sql += " and id in ( " + inClause + " ) ";
} }
return this.jdbcTemplate.query(sql, this.savingsProductRowMapper, new Object[] {currencyCode}); return this.jdbcTemplate.query(sql, this.savingsProductRowMapper, new Object[] {currencyCode});
} }
} }
@@ -192,7 +192,7 @@ public class SelfServiceRegistrationWritePlatformServiceImpl implements SelfServ
Collection<SmsProviderData> smsProviders = this.smsCampaignDropdownReadPlatformService.retrieveSmsProviders(); Collection<SmsProviderData> smsProviders = this.smsCampaignDropdownReadPlatformService.retrieveSmsProviders();
if (smsProviders.isEmpty()) { throw new PlatformDataIntegrityException("error.msg.mobile.service.provider.not.available", if (smsProviders.isEmpty()) { throw new PlatformDataIntegrityException("error.msg.mobile.service.provider.not.available",
"Mobile service provider not available."); } "Mobile service provider not available."); }
Long providerId = (new ArrayList<>(smsProviders)).get(0).getId(); Long providerId = new ArrayList<>(smsProviders).get(0).getId();
final String message = "Hi " + selfServiceRegistration.getFirstName() + "," + "\n" final String message = "Hi " + selfServiceRegistration.getFirstName() + "," + "\n"
+ "To create user, please use following details \n" + "Request Id : " + selfServiceRegistration.getId() + "To create user, please use following details \n" + "Request Id : " + selfServiceRegistration.getId()
+ "\n Authentication Token : " + selfServiceRegistration.getAuthenticationToken(); + "\n Authentication Token : " + selfServiceRegistration.getAuthenticationToken();
@@ -109,6 +109,6 @@ public class ShareAccountChargeData implements Serializable {
private BigDecimal getAmountOrPercentage() { private BigDecimal getAmountOrPercentage() {
return (this.chargeCalculationType != null) && (this.chargeCalculationType.getId().intValue() > 1) ? this.percentage : this.amount; return this.chargeCalculationType != null && this.chargeCalculationType.getId().intValue() > 1 ? this.percentage : this.amount;
} }
} }
@@ -98,7 +98,7 @@ public class ShareAccountCharge extends AbstractPersistableCustom {
this.shareAccount = shareAccount; this.shareAccount = shareAccount;
this.charge = chargeDefinition; this.charge = chargeDefinition;
this.chargeTime = (chargeTime == null) ? chargeDefinition.getChargeTimeType() : chargeTime.getValue(); this.chargeTime = chargeTime == null ? chargeDefinition.getChargeTimeType() : chargeTime.getValue();
this.chargeCalculation = chargeDefinition.getChargeCalculation(); this.chargeCalculation = chargeDefinition.getChargeCalculation();
if (chargeCalculation != null) { if (chargeCalculation != null) {
@@ -490,7 +490,7 @@ public class ShareAccountDataSerializer {
if(totalSubsribedShares == null) { if(totalSubsribedShares == null) {
totalSubsribedShares = Long.valueOf(0); totalSubsribedShares = Long.valueOf(0);
} }
if((totalSubsribedShares+requested) > totalSharesIssuable) { if(totalSubsribedShares+requested > totalSharesIssuable) {
baseDataValidator.reset().parameter(ShareAccountApiConstants.requestedshares_paramname).value(requested) baseDataValidator.reset().parameter(ShareAccountApiConstants.requestedshares_paramname).value(requested)
.failWithCodeNoParameterAddedToErrorCode("shares.requested.can.not.be.approved.exceeding.totalshares.issuable"); .failWithCodeNoParameterAddedToErrorCode("shares.requested.can.not.be.approved.exceeding.totalshares.issuable");
} }
@@ -115,7 +115,7 @@ public class ShareProductDividendAssembler {
} }
if (lastDividendAppliedDate != null) { if (lastDividendAppliedDate != null) {
numberOfShareDaysPerAccount += (Days.daysBetween(lastDividendAppliedDate, shareStartDate).getDays() * numberOfShares); numberOfShareDaysPerAccount += Days.daysBetween(lastDividendAppliedDate, shareStartDate).getDays() * numberOfShares;
} }
lastDividendAppliedDate = shareStartDate; lastDividendAppliedDate = shareStartDate;
if (type.isPurchased()) { if (type.isPurchased()) {
@@ -127,7 +127,7 @@ public class ShareProductDividendAssembler {
} }
} }
if (lastDividendAppliedDate != null) { if (lastDividendAppliedDate != null) {
numberOfShareDaysPerAccount += (Days.daysBetween(lastDividendAppliedDate, postingDate).getDays() * numberOfShares); numberOfShareDaysPerAccount += Days.daysBetween(lastDividendAppliedDate, postingDate).getDays() * numberOfShares;
} }
numberOfShareDays += numberOfShareDaysPerAccount; numberOfShareDays += numberOfShareDaysPerAccount;
numberOfSharesdaysPerAccount.put(accountData.getId(), numberOfShareDaysPerAccount); numberOfSharesdaysPerAccount.put(accountData.getId(), numberOfShareDaysPerAccount);
@@ -134,7 +134,7 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr
TransferNotSupportedReason.SOURCE_AND_DESTINATION_GROUP_CANNOT_BE_SAME, sourceGroupId, destinationGroupId); } TransferNotSupportedReason.SOURCE_AND_DESTINATION_GROUP_CANNOT_BE_SAME, sourceGroupId, destinationGroupId); }
/*** Do not allow bulk client transfers across branches ***/ /*** Do not allow bulk client transfers across branches ***/
if (!(sourceOffice.getId().equals(destinationGroup.getOffice().getId()))) { throw new TransferNotSupportedException( if (!sourceOffice.getId().equals(destinationGroup.getOffice().getId())) { throw new TransferNotSupportedException(
TransferNotSupportedReason.BULK_CLIENT_TRANSFER_ACROSS_BRANCHES, sourceGroupId, destinationGroupId); } TransferNotSupportedReason.BULK_CLIENT_TRANSFER_ACROSS_BRANCHES, sourceGroupId, destinationGroupId); }
for (final Client client : clients) { for (final Client client : clients) {
@@ -529,4 +529,4 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr
* ClientNotAwaitingTransferApprovalException(group.getId()); } } * ClientNotAwaitingTransferApprovalException(group.getId()); } }
**/ **/
} }