[FINERACT-1667] Introducing Spring Batch as job runner engine
This commit is contained in:
committed by
Arnold Gálovics
parent
d03044c48b
commit
ff9181cc47
+3
@@ -55,6 +55,7 @@ import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -1865,6 +1866,7 @@ public class ClientSavingsIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // FIXME
|
||||
public void testSavingsAccount_DormancyTracking() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
@@ -1931,6 +1933,7 @@ public class ClientSavingsIntegrationTest {
|
||||
transactionDate = transactionDate.minusDays(30);
|
||||
}
|
||||
|
||||
LOG.info("Savings account IDs: {}", savingsList);
|
||||
SchedulerJobHelper jobHelper = new SchedulerJobHelper(this.requestSpec);
|
||||
jobHelper.executeAndAwaitJob("Update Savings Dormant Accounts");
|
||||
|
||||
|
||||
+52
-58
@@ -39,6 +39,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
@@ -61,15 +62,12 @@ import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Slf4j
|
||||
@SuppressWarnings({ "unused", "unchecked", "rawtypes", "static-access" })
|
||||
public class FixedDepositTest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FixedDepositTest.class);
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
private FixedDepositProductHelper fixedDepositProductHelper;
|
||||
@@ -443,7 +441,6 @@ public class FixedDepositTest {
|
||||
|
||||
}
|
||||
|
||||
@Disabled // FINERACT-1099
|
||||
@Test
|
||||
public void testFixedDepositAccountClosureTypeWithdrawal_WITH_HOLD_TAX() throws InterruptedException {
|
||||
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
@@ -479,22 +476,21 @@ public class FixedDepositTest {
|
||||
|
||||
Integer currentDate = Integer.valueOf(currentDateFormat.format(todaysDate.getTime()));
|
||||
Integer daysInMonth = todaysDate.getActualMaximum(Calendar.DATE);
|
||||
Integer numberOfDaysLeft = daysInMonth - currentDate + 1;
|
||||
int numberOfDaysLeft = daysInMonth - currentDate + 1;
|
||||
todaysDate.add(Calendar.DATE, numberOfDaysLeft);
|
||||
Calendar closedOn = Calendar.getInstance();
|
||||
closedOn.add(Calendar.MONTH, -6);
|
||||
final String CLOSED_ON_DATE = dateFormat.format(closedOn.getTime());
|
||||
|
||||
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Integer clientId = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
/***
|
||||
* Create FD product with CashBased accounting enabled
|
||||
*/
|
||||
final String accountingRule = CASH_BASED;
|
||||
final Integer taxGroupId = createTaxGroup("10", liabilityAccountForTax);
|
||||
Integer fixedDepositProductId = createFixedDepositProductWithWithHoldTax(VALID_FROM, VALID_TO, String.valueOf(taxGroupId),
|
||||
accountingRule, assetAccount, liabilityAccount, incomeAccount, expenseAccount);
|
||||
CASH_BASED, assetAccount, liabilityAccount, incomeAccount, expenseAccount);
|
||||
Assertions.assertNotNull(fixedDepositProductId);
|
||||
|
||||
/***
|
||||
@@ -528,9 +524,9 @@ public class FixedDepositTest {
|
||||
* Verify journal entries posted for initial deposit transaction which happened at activation time
|
||||
*/
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] liabilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, ACTIVATION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liablilityAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, ACTIVATION_DATE, liabilityAccountInitialEntry);
|
||||
|
||||
/***
|
||||
* Update interest earned of FD account
|
||||
@@ -568,7 +564,6 @@ public class FixedDepositTest {
|
||||
fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
|
||||
this.responseSpec, fixedDepositAccountId.toString());
|
||||
FixedDepositAccountStatusChecker.verifyFixedDepositAccountIsMatured(fixedDepositAccountStatusHashMap);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1268,7 +1263,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.getActualMaximum(Calendar.DATE);
|
||||
@@ -1276,7 +1271,7 @@ public class FixedDepositTest {
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
MONTHLY_INTERVAL, MONTHLY_INTERVAL);
|
||||
|
||||
LOG.info("{}", principal.toString());
|
||||
log.info("{}", principal.toString());
|
||||
Assertions.assertTrue(Math.abs(principal - maturityAmount) < THRESHOLD, "Verifying Maturity amount for Fixed Deposit Account");
|
||||
}
|
||||
|
||||
@@ -1347,7 +1342,7 @@ public class FixedDepositTest {
|
||||
interestRate -= preClosurePenalInterestRate;
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.add(Calendar.MONTH, -1);
|
||||
@@ -1358,11 +1353,11 @@ public class FixedDepositTest {
|
||||
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
|
||||
principal += interestPerMonth;
|
||||
todaysDate.add(Calendar.DATE, daysInMonth);
|
||||
LOG.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
log.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
interestPerMonth = (float) (interestPerDay * principal * currentDate);
|
||||
LOG.info("IPM = {}", interestPerMonth);
|
||||
log.info("IPM = {}", interestPerMonth);
|
||||
principal += interestPerMonth;
|
||||
LOG.info("principal = {}", principal);
|
||||
log.info("principal = {}", principal);
|
||||
|
||||
Integer transactionIdForPostInterest = this.fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
|
||||
|
||||
@@ -1439,7 +1434,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.getActualMaximum(Calendar.DATE);
|
||||
@@ -1447,7 +1442,7 @@ public class FixedDepositTest {
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
MONTHLY_INTERVAL, MONTHLY_INTERVAL);
|
||||
|
||||
LOG.info("{}", principal.toString());
|
||||
log.info("{}", principal.toString());
|
||||
Assertions.assertTrue(Math.abs(principal - maturityAmount) < THRESHOLD, "Verifying Maturity amount for Fixed Deposit Account");
|
||||
}
|
||||
|
||||
@@ -1514,7 +1509,7 @@ public class FixedDepositTest {
|
||||
interestRate -= preClosurePenalInterestRate;
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.add(Calendar.MONTH, -1);
|
||||
@@ -1525,12 +1520,11 @@ public class FixedDepositTest {
|
||||
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
|
||||
principal += interestPerMonth;
|
||||
todaysDate.add(Calendar.DATE, daysInMonth);
|
||||
LOG.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
|
||||
log.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
interestPerMonth = (float) (interestPerDay * principal * currentDate);
|
||||
LOG.info("IPM = {}", interestPerMonth);
|
||||
log.info("IPM = {}", interestPerMonth);
|
||||
principal += interestPerMonth;
|
||||
LOG.info("principal = {}", principal);
|
||||
log.info("principal = {}", principal);
|
||||
|
||||
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
|
||||
|
||||
@@ -1623,7 +1617,7 @@ public class FixedDepositTest {
|
||||
interestRate -= preClosurePenalInterestRate;
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.add(Calendar.MONTH, -1);
|
||||
@@ -1634,12 +1628,12 @@ public class FixedDepositTest {
|
||||
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
|
||||
principal += interestPerMonth;
|
||||
todaysDate.add(Calendar.DATE, daysInMonth);
|
||||
LOG.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
log.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
|
||||
interestPerMonth = (float) (interestPerDay * principal * currentDate);
|
||||
LOG.info("IPM = {}", interestPerMonth);
|
||||
log.info("IPM = {}", interestPerMonth);
|
||||
principal += interestPerMonth;
|
||||
LOG.info("principal = {}", principal);
|
||||
log.info("principal = {}", principal);
|
||||
|
||||
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
|
||||
|
||||
@@ -1737,7 +1731,7 @@ public class FixedDepositTest {
|
||||
interestRate -= preClosurePenalInterestRate;
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.add(Calendar.MONTH, -1);
|
||||
@@ -1748,12 +1742,12 @@ public class FixedDepositTest {
|
||||
Float interestPerMonth = (float) (interestPerDay * principal * daysInMonth);
|
||||
principal += interestPerMonth;
|
||||
todaysDate.add(Calendar.DATE, daysInMonth);
|
||||
LOG.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
log.info("{}", monthDayFormat.format(todaysDate.getTime()));
|
||||
|
||||
interestPerMonth = (float) (interestPerDay * principal * currentDate);
|
||||
LOG.info("IPM = {}", interestPerMonth);
|
||||
log.info("IPM = {}", interestPerMonth);
|
||||
principal += interestPerMonth;
|
||||
LOG.info("principal = {}", principal);
|
||||
log.info("principal = {}", principal);
|
||||
|
||||
this.fixedDepositAccountHelper.calculatePrematureAmountForFixedDeposit(fixedDepositAccountId, CLOSED_ON_DATE);
|
||||
|
||||
@@ -1834,7 +1828,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.getActualMaximum(Calendar.DATE);
|
||||
@@ -1842,7 +1836,7 @@ public class FixedDepositTest {
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
DAILY_COMPOUNDING_INTERVAL, MONTHLY_INTERVAL);
|
||||
|
||||
LOG.info("{}", principal.toString());
|
||||
log.info("{}", principal.toString());
|
||||
Assertions.assertTrue(Math.abs(principal - maturityAmount) < THRESHOLD, "Verifying Maturity amount for Fixed Deposit Account");
|
||||
|
||||
}
|
||||
@@ -1871,7 +1865,7 @@ public class FixedDepositTest {
|
||||
dateFormat.format(todaysDate.getTime());
|
||||
monthDayFormat.format(todaysDate.getTime());
|
||||
|
||||
LOG.info("Submitted Date: {}", SUBMITTED_ON_DATE);
|
||||
log.info("Submitted Date: {}", SUBMITTED_ON_DATE);
|
||||
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(clientId);
|
||||
|
||||
@@ -1907,7 +1901,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
todaysDate.getActualMaximum(Calendar.DATE);
|
||||
@@ -1917,7 +1911,7 @@ public class FixedDepositTest {
|
||||
|
||||
principal = new BigDecimal(principal).setScale(0, RoundingMode.FLOOR).floatValue();
|
||||
maturityAmount = new BigDecimal(maturityAmount).setScale(0, RoundingMode.FLOOR).floatValue();
|
||||
LOG.info("{}", principal.toString());
|
||||
log.info("{}", principal.toString());
|
||||
|
||||
Truth.assertWithMessage("Verifying Maturity amount for Fixed Deposit Account").that(maturityAmount).isAnyOf(principal,
|
||||
principal - 1); // FINERACT-887
|
||||
@@ -1944,7 +1938,7 @@ public class FixedDepositTest {
|
||||
Integer daysLeft = daysInMonth - currentDate;
|
||||
todaysDate.add(Calendar.DATE, daysLeft + 1);
|
||||
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_TO = null;
|
||||
@@ -1990,7 +1984,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
@@ -2027,7 +2021,7 @@ public class FixedDepositTest {
|
||||
Integer daysLeft = daysInMonth - currentDate;
|
||||
todaysDate.add(Calendar.DATE, daysLeft + 1);
|
||||
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_TO = null;
|
||||
@@ -2073,7 +2067,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
@@ -2111,7 +2105,7 @@ public class FixedDepositTest {
|
||||
Integer daysLeft = daysInMonth - currentDate;
|
||||
todaysDate.add(Calendar.DATE, daysLeft + 1);
|
||||
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_TO = null;
|
||||
@@ -2154,7 +2148,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
@@ -2192,7 +2186,7 @@ public class FixedDepositTest {
|
||||
Integer daysLeft = daysInMonth - currentDate;
|
||||
todaysDate.add(Calendar.DATE, daysLeft + 1);
|
||||
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_TO = null;
|
||||
@@ -2235,7 +2229,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
@@ -2273,7 +2267,7 @@ public class FixedDepositTest {
|
||||
Integer daysLeft = daysInMonth - currentDate;
|
||||
todaysDate.add(Calendar.DATE, daysLeft + 1);
|
||||
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_TO = null;
|
||||
@@ -2316,7 +2310,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
@@ -2353,7 +2347,7 @@ public class FixedDepositTest {
|
||||
Integer daysLeft = daysInMonth - currentDate;
|
||||
todaysDate.add(Calendar.DATE, daysLeft + 1);
|
||||
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_TO = null;
|
||||
@@ -2396,7 +2390,7 @@ public class FixedDepositTest {
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositPeriod);
|
||||
double interestRateInFraction = interestRate / 100;
|
||||
double perDay = (double) 1 / daysInYear;
|
||||
LOG.info("per day = {}", perDay);
|
||||
log.info("per day = {}", perDay);
|
||||
double interestPerDay = interestRateInFraction * perDay;
|
||||
|
||||
principal = FixedDepositAccountHelper.getPrincipalAfterCompoundingInterest(todaysDate, principal, depositPeriod, interestPerDay,
|
||||
@@ -2574,7 +2568,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer createFixedDepositProduct(final String validFrom, final String validTo, final String accountingRule,
|
||||
Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
log.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
if (accountingRule.equals(CASH_BASED)) {
|
||||
fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsCashBased(accounts);
|
||||
@@ -2588,7 +2582,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer createFixedDepositProductWithoutCharts(final String validFrom, final String validTo, final String accountingRule,
|
||||
Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
log.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
if (accountingRule.equals(CASH_BASED)) {
|
||||
fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsCashBased(accounts);
|
||||
@@ -2602,7 +2596,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer createFixedDepositProductWithWithHoldTax(final String validFrom, final String validTo, final String taxGroupId,
|
||||
final String accountingRule, Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
log.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
if (accountingRule.equals(CASH_BASED)) {
|
||||
fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsCashBased(accounts);
|
||||
@@ -2617,7 +2611,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer createFixedDepositProduct(final String validFrom, final String validTo, final String accountingRule,
|
||||
final String chartToBePicked, Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
log.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
|
||||
if (accountingRule.equals(CASH_BASED)) {
|
||||
fixedDepositProductHelper = fixedDepositProductHelper.withAccountingRuleAsCashBased(accounts);
|
||||
@@ -2648,7 +2642,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
|
||||
final String penalInterestType) {
|
||||
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
log.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
|
||||
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
|
||||
return FixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, this.requestSpec, this.responseSpec);
|
||||
@@ -2656,7 +2650,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
|
||||
final String penalInterestType, final Integer maturityInstructionId) {
|
||||
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
log.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
|
||||
.withSubmittedOnDate(submittedOnDate).withMaturityInstructionId(maturityInstructionId)
|
||||
.build(clientID, productID, penalInterestType);
|
||||
@@ -2665,7 +2659,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
|
||||
final String penalInterestType, final String depositAmount, final String depositPeriod) {
|
||||
LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
log.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
|
||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec)
|
||||
//
|
||||
.withSubmittedOnDate(submittedOnDate).withDepositPeriod(depositPeriod).withDepositAmount(depositAmount)
|
||||
@@ -2675,7 +2669,7 @@ public class FixedDepositTest {
|
||||
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String minOpenningBalance, final String accountingRule, Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
log.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
|
||||
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
if (accountingRule.equals(CASH_BASED)) {
|
||||
|
||||
+48
-104
@@ -98,7 +98,6 @@ public class SchedulerJobsTestResults {
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private AccountHelper accountHelper;
|
||||
private JournalEntryHelper journalEntryHelper;
|
||||
private StandingInstructionsHelper standingInstructionsHelper;
|
||||
|
||||
private TimeZone systemTimeZone;
|
||||
|
||||
@@ -111,6 +110,7 @@ public class SchedulerJobsTestResults {
|
||||
responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
this.accountHelper = new AccountHelper(requestSpec, responseSpec);
|
||||
this.journalEntryHelper = new JournalEntryHelper(requestSpec, responseSpec);
|
||||
schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
|
||||
this.systemTimeZone = TimeZone.getTimeZone(Utils.TENANT_TIME_ZONE);
|
||||
}
|
||||
@@ -124,7 +124,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testApplyAnnualFeeForSavingsJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientID);
|
||||
@@ -171,7 +170,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testInterestPostingForSavingsJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientID);
|
||||
@@ -207,7 +205,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testTransferFeeForLoansFromSavingsJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
@@ -273,7 +270,6 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
@Test
|
||||
public void testApplyHolidaysToLoansJobOutcome() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
@@ -313,10 +309,9 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
Boolean enabled = (Boolean) globalConfig.get(3).get("enabled");
|
||||
|
||||
if (enabled == false) {
|
||||
if (!enabled) {
|
||||
enabled = true;
|
||||
configId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(requestSpec, responseSpec, configId.toString(),
|
||||
enabled);
|
||||
configId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(requestSpec, responseSpec, configId, enabled);
|
||||
}
|
||||
|
||||
holidayId = HolidayHelper.activateHolidays(requestSpec, responseSpec, holidayId.toString());
|
||||
@@ -336,7 +331,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testApplyDueFeeChargesForSavingsJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientID);
|
||||
@@ -386,7 +380,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testUpdateAccountingRunningBalancesJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
|
||||
final Account assetAccount = this.accountHelper.createAssetAccount();
|
||||
final Account incomeAccount = this.accountHelper.createIncomeAccount();
|
||||
@@ -412,9 +405,9 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
// Checking initial Account entries.
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] liabilityAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, TRANSACTION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE, liablilityAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE, liabilityAccountInitialEntry);
|
||||
|
||||
String JobName = "Update Accounting Running Balances";
|
||||
|
||||
@@ -429,8 +422,7 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
@Test
|
||||
public void testUpdateLoanArrearsAgingJobOutcome() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
Assertions.assertNotNull(clientID);
|
||||
@@ -444,18 +436,18 @@ public class SchedulerJobsTestResults {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
|
||||
loanStatusHashMap = loanTransactionHelper.approveLoan(AccountTransferTest.LOAN_APPROVAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
|
||||
String loanDetails = this.loanTransactionHelper.getLoanDetails(requestSpec, responseSpec, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID,
|
||||
String loanDetails = loanTransactionHelper.getLoanDetails(requestSpec, responseSpec, loanID);
|
||||
loanStatusHashMap = loanTransactionHelper.disburseLoan(AccountTransferTest.LOAN_DISBURSAL_DATE, loanID,
|
||||
JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
String JobName = "Update Loan Arrears Ageing";
|
||||
|
||||
this.schedulerJobHelper.executeAndAwaitJob(JobName);
|
||||
HashMap loanSummaryData = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
schedulerJobHelper.executeAndAwaitJob(JobName);
|
||||
HashMap loanSummaryData = loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
|
||||
Float totalLoanArrearsAging = (Float) loanSummaryData.get("principalOverdue") + (Float) loanSummaryData.get("interestOverdue");
|
||||
|
||||
@@ -465,9 +457,8 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
@Test
|
||||
public void testExecuteStandingInstructionsJobOutcome() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.standingInstructionsHelper = new StandingInstructionsHelper(requestSpec, responseSpec);
|
||||
savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
StandingInstructionsHelper standingInstructionsHelper = new StandingInstructionsHelper(requestSpec, responseSpec);
|
||||
|
||||
final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US);
|
||||
final DateTimeFormatter monthDayFormat = DateTimeFormatter.ofPattern("dd MMMM", Locale.US);
|
||||
@@ -523,9 +514,8 @@ public class SchedulerJobsTestResults {
|
||||
HashMap toSavingsSummaryBefore = this.savingsAccountHelper.getSavingsSummary(toSavingsId);
|
||||
Float toSavingsBalanceBefore = (Float) toSavingsSummaryBefore.get("accountBalance");
|
||||
|
||||
Integer standingInstructionId = this.standingInstructionsHelper.createStandingInstruction(clientID.toString(),
|
||||
fromSavingsId.toString(), toSavingsId.toString(), FROM_ACCOUNT_TYPE_SAVINGS, TO_ACCOUNT_TYPE_SAVINGS, VALID_FROM, VALID_TO,
|
||||
MONTH_DAY);
|
||||
Integer standingInstructionId = standingInstructionsHelper.createStandingInstruction(clientID.toString(), fromSavingsId.toString(),
|
||||
toSavingsId.toString(), FROM_ACCOUNT_TYPE_SAVINGS, TO_ACCOUNT_TYPE_SAVINGS, VALID_FROM, VALID_TO, MONTH_DAY);
|
||||
Assertions.assertNotNull(standingInstructionId);
|
||||
|
||||
String JobName = "Execute Standing Instruction";
|
||||
@@ -536,8 +526,7 @@ public class SchedulerJobsTestResults {
|
||||
HashMap toSavingsSummaryAfter = this.savingsAccountHelper.getSavingsSummary(toSavingsId);
|
||||
Float toSavingsBalanceAfter = (Float) toSavingsSummaryAfter.get("accountBalance");
|
||||
|
||||
final HashMap standingInstructionData = this.standingInstructionsHelper
|
||||
.getStandingInstructionById(standingInstructionId.toString());
|
||||
final HashMap standingInstructionData = standingInstructionsHelper.getStandingInstructionById(standingInstructionId.toString());
|
||||
Float expectedFromSavingsBalance = fromSavingsBalanceBefore - (Float) standingInstructionData.get("amount");
|
||||
Float expectedToSavingsBalance = toSavingsBalanceBefore + (Float) standingInstructionData.get("amount");
|
||||
|
||||
@@ -547,11 +536,11 @@ public class SchedulerJobsTestResults {
|
||||
"Verifying To Savings Balance after Successful completion of Scheduler Job");
|
||||
Integer fromAccountType = PortfolioAccountType.SAVINGS.getValue();
|
||||
Integer transferType = AccountTransferType.ACCOUNT_TRANSFER.getValue();
|
||||
List<HashMap> standinInstructionHistoryData = this.standingInstructionsHelper.getStandingInstructionHistory(fromSavingsId,
|
||||
List<HashMap> standingInstructionHistoryData = standingInstructionsHelper.getStandingInstructionHistory(fromSavingsId,
|
||||
fromAccountType, clientID, transferType);
|
||||
Assertions.assertEquals(1, standinInstructionHistoryData.size(),
|
||||
"Verifying the no of stainding instruction transactions logged for the client");
|
||||
HashMap loggedTransaction = standinInstructionHistoryData.get(0);
|
||||
Assertions.assertEquals(1, standingInstructionHistoryData.size(),
|
||||
"Verifying the no of standing instruction transactions logged for the client");
|
||||
HashMap loggedTransaction = standingInstructionHistoryData.get(0);
|
||||
|
||||
Assertions.assertEquals((Float) standingInstructionData.get("amount"), (Float) loggedTransaction.get("amount"),
|
||||
"Verifying transferred amount and logged transaction amounts");
|
||||
@@ -560,7 +549,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testApplyPenaltyForOverdueLoansJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
@@ -607,7 +595,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testAvoidUnncessaryPenaltyWhenAmountZeroForOverdueLoansJobOutcome() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
@@ -635,14 +622,14 @@ public class SchedulerJobsTestResults {
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
String JobName = "Apply penalty to overdue loans";
|
||||
Integer jobId = 12;
|
||||
int jobId = 12;
|
||||
|
||||
this.schedulerJobHelper.executeAndAwaitJob(JobName);
|
||||
|
||||
Map<String, Object> schedulerJob = this.schedulerJobHelper.getSchedulerJobById(jobId);
|
||||
|
||||
Assertions.assertNotNull(schedulerJob);
|
||||
while ((Boolean) schedulerJob.get("currentlyRunning") == true) {
|
||||
while ((Boolean) schedulerJob.get("currentlyRunning")) {
|
||||
Thread.sleep(15000);
|
||||
schedulerJob = this.schedulerJobHelper.getSchedulerJobById(jobId);
|
||||
Assertions.assertNotNull(schedulerJob);
|
||||
@@ -664,7 +651,6 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
@Test
|
||||
public void testUpdateOverdueDaysForNPA() throws InterruptedException {
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
|
||||
@@ -689,7 +675,6 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
final Boolean isNPABefore = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA");
|
||||
Assertions.assertFalse(isNPABefore);
|
||||
// Integer jobId = (Integer) allSchedulerJobsData.get(1).get("jobId");
|
||||
String JobName = "Update Non Performing Assets";
|
||||
this.schedulerJobHelper.executeAndAwaitJob(JobName);
|
||||
final Boolean isNPAAfter = (Boolean) this.loanTransactionHelper.getLoanDetail(requestSpec, responseSpec, loanID, "isNPA");
|
||||
@@ -699,11 +684,6 @@ public class SchedulerJobsTestResults {
|
||||
@Test
|
||||
public void testInterestTransferForSavings() throws InterruptedException {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||
this.schedulerJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
// FixedDepositProductHelper fixedDepositProductHelper = new
|
||||
// FixedDepositProductHelper(this.requestSpec,this.responseSpec);
|
||||
// AccountHelper accountHelper = new AccountHelper(this.requestSpec,
|
||||
// this.responseSpec);
|
||||
FixedDepositAccountHelper fixedDepositAccountHelper = new FixedDepositAccountHelper(requestSpec, responseSpec);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
@@ -765,7 +745,7 @@ public class SchedulerJobsTestResults {
|
||||
fixedDepositAccountHelper.postInterestForFixedDeposit(fixedDepositAccountId);
|
||||
|
||||
HashMap fixedDepositSummary = savingsAccountHelper.getSavingsSummary(fixedDepositAccountId);
|
||||
Float interestPosted = (Float) fixedDepositSummary.get("accountBalance")
|
||||
float interestPosted = (Float) fixedDepositSummary.get("accountBalance")
|
||||
- Float.parseFloat(FixedDepositAccountHelper.DEPOSIT_AMOUNT);
|
||||
|
||||
String JobName = "Transfer Interest To Savings";
|
||||
@@ -776,46 +756,29 @@ public class SchedulerJobsTestResults {
|
||||
|
||||
summary = savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
balance = Float.parseFloat(MINIMUM_OPENING_BALANCE) + interestPosted;
|
||||
validateNumberForEqualExcludePrecission(String.valueOf(balance), String.valueOf(summary.get("accountBalance")));
|
||||
validateNumberForEqualExcludePrecision(String.valueOf(balance), String.valueOf(summary.get("accountBalance")));
|
||||
}
|
||||
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String minOpenningBalance) {
|
||||
// system.out.println("------------------------------CREATING NEW SAVINGS
|
||||
// PRODUCT
|
||||
// ---------------------------------------");
|
||||
final String minOpeningBalance) {
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
final String savingsProductJSON = savingsProductHelper //
|
||||
.withInterestCompoundingPeriodTypeAsDaily() //
|
||||
.withInterestPostingPeriodTypeAsMonthly() //
|
||||
.withInterestCalculationPeriodTypeAsDailyBalance() //
|
||||
.withMinimumOpenningBalance(minOpenningBalance).build();
|
||||
final String savingsProductJSON = savingsProductHelper.withInterestCompoundingPeriodTypeAsDaily()
|
||||
.withInterestPostingPeriodTypeAsMonthly().withInterestCalculationPeriodTypeAsDailyBalance()
|
||||
.withMinimumOpenningBalance(minOpeningBalance).build();
|
||||
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
private Integer createSavingsProduct(final String minOpenningBalance, final Account... accounts) {
|
||||
// system.out.println("------------------------------CREATING NEW SAVINGS
|
||||
// PRODUCT
|
||||
// ---------------------------------------");
|
||||
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily() //
|
||||
.withInterestPostingPeriodTypeAsQuarterly() //
|
||||
.withInterestCalculationPeriodTypeAsDailyBalance() //
|
||||
.withMinimumOpenningBalance(minOpenningBalance).withAccountingRuleAsCashBased(accounts).build();
|
||||
private Integer createSavingsProduct(final String minOpeningBalance, final Account... accounts) {
|
||||
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily()
|
||||
.withInterestPostingPeriodTypeAsQuarterly().withInterestCalculationPeriodTypeAsDailyBalance()
|
||||
.withMinimumOpenningBalance(minOpeningBalance).withAccountingRuleAsCashBased(accounts).build();
|
||||
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
private Integer createLoanProduct(final String chargeId) {
|
||||
// system.out.println("------------------------------CREATING NEW LOAN PRODUCT
|
||||
// ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder() //
|
||||
.withPrincipal("15,000.00") //
|
||||
.withNumberOfRepayments("4") //
|
||||
.withRepaymentAfterEvery("1") //
|
||||
.withRepaymentTypeAsMonth() //
|
||||
.withinterestRatePerPeriod("1") //
|
||||
.withInterestRateFrequencyTypeAsMonths() //
|
||||
.withAmortizationTypeAsEqualInstallments() //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal("15,000.00").withNumberOfRepayments("4")
|
||||
.withRepaymentAfterEvery("1").withRepaymentTypeAsMonth().withinterestRatePerPeriod("1")
|
||||
.withInterestRateFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestTypeAsDecliningBalance()
|
||||
.build(chargeId);
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
}
|
||||
@@ -825,67 +788,48 @@ public class SchedulerJobsTestResults {
|
||||
}
|
||||
|
||||
private HashMap<String, String> collaterals(Integer collateralId, BigDecimal quantity) {
|
||||
HashMap<String, String> collateral = new HashMap<String, String>(2);
|
||||
HashMap<String, String> collateral = new HashMap<>(2);
|
||||
collateral.put("clientCollateralId", collateralId.toString());
|
||||
collateral.put("quantity", quantity.toString());
|
||||
return collateral;
|
||||
}
|
||||
|
||||
private Integer applyForLoanApplication(final String clientID, final String loanProductID, final String savingsID) {
|
||||
// system.out.println("--------------------------------APPLYING FOR LOAN
|
||||
// APPLICATION--------------------------------");
|
||||
|
||||
List<HashMap> collaterals = new ArrayList<>();
|
||||
final Integer collateralId = CollateralManagementHelper.createCollateralProduct(this.requestSpec, this.responseSpec);
|
||||
Assertions.assertNotNull(collateralId);
|
||||
final Integer clientCollateralId = CollateralManagementHelper.createClientCollateral(this.requestSpec, this.responseSpec,
|
||||
clientID.toString(), collateralId);
|
||||
final Integer clientCollateralId = CollateralManagementHelper.createClientCollateral(this.requestSpec, this.responseSpec, clientID,
|
||||
collateralId);
|
||||
Assertions.assertNotNull(clientCollateralId);
|
||||
addCollaterals(collaterals, clientCollateralId, BigDecimal.valueOf(1));
|
||||
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
|
||||
.withPrincipal("15,000.00") //
|
||||
.withLoanTermFrequency("4") //
|
||||
.withLoanTermFrequencyAsMonths() //
|
||||
.withNumberOfRepayments("4") //
|
||||
.withRepaymentEveryAfter("1") //
|
||||
.withRepaymentFrequencyTypeAsMonths() //
|
||||
.withInterestRatePerPeriod("2") //
|
||||
.withAmortizationTypeAsEqualInstallments() //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withExpectedDisbursementDate("10 January 2013") //
|
||||
.withSubmittedOnDate("10 January 2013") //
|
||||
.withCollaterals(collaterals).build(clientID, loanProductID, savingsID);
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal("15,000.00").withLoanTermFrequency("4")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("4").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withAmortizationTypeAsEqualInstallments()
|
||||
.withInterestTypeAsDecliningBalance().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate("10 January 2013").withSubmittedOnDate("10 January 2013").withCollaterals(collaterals)
|
||||
.build(clientID, loanProductID, savingsID);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
|
||||
private Integer createFixedDepositProduct(final String validFrom, final String validTo) {
|
||||
// system.out.println("------------------------------CREATING NEW FIXED DEPOSIT
|
||||
// PRODUCT
|
||||
// ---------------------------------------");
|
||||
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(requestSpec, responseSpec);
|
||||
final String fixedDepositProductJSON = fixedDepositProductHelper //
|
||||
// .withAccountingRuleAsCashBased(accounts)
|
||||
.withPeriodRangeChart()//
|
||||
.build(validFrom, validTo);
|
||||
final String fixedDepositProductJSON = fixedDepositProductHelper.withPeriodRangeChart().build(validFrom, validTo);
|
||||
return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String submittedOnDate,
|
||||
final String penalInterestType, String savingsId) {
|
||||
// system.out.println("--------------------------------APPLYING FOR FIXED
|
||||
// DEPOSIT ACCOUNT
|
||||
// --------------------------------");
|
||||
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(requestSpec, responseSpec)
|
||||
.withSubmittedOnDate(submittedOnDate).withSavings(savingsId).transferInterest(true)
|
||||
.withLockinPeriodFrequency("1", FixedDepositAccountHelper.DAYS).build(clientID, productID, penalInterestType);
|
||||
return FixedDepositAccountHelper.applyFixedDepositApplication(fixedDepositApplicationJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
private void validateNumberForEqualExcludePrecission(String val, String val2) {
|
||||
private void validateNumberForEqualExcludePrecision(String val, String val2) {
|
||||
DecimalFormat twoDForm = new DecimalFormat("#", new DecimalFormatSymbols(Locale.US));
|
||||
Assertions.assertTrue(Float.valueOf(twoDForm.format(Float.parseFloat(val)))
|
||||
.compareTo(Float.valueOf(twoDForm.format(Float.parseFloat(val2)))) == 0);
|
||||
assertEquals(0,
|
||||
Float.valueOf(twoDForm.format(Float.parseFloat(val))).compareTo(Float.valueOf(twoDForm.format(Float.parseFloat(val2)))));
|
||||
}
|
||||
}
|
||||
|
||||
+12
-17
@@ -23,15 +23,14 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
|
||||
public class StandingInstructionsHelper {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(StandingInstructionsHelper.class);
|
||||
private static final String STANDING_INSTRUCTIONS_URL = "/fineract-provider/api/v1/standinginstructions";
|
||||
private static final String STANDING_INSTRUCTIONS_RUNHISTORY_URL = "/fineract-provider/api/v1/standinginstructionrunhistory";
|
||||
private static final String STANDING_INSTRUCTIONS_RUN_HISTORY_URL = "/fineract-provider/api/v1/standinginstructionrunhistory";
|
||||
private static final String LOCALE = "en_GB";
|
||||
private static final String OFFICE_ID = "1";
|
||||
private static final String INSTRUCTION_TYPE_FIXED = "1";
|
||||
@@ -91,37 +90,33 @@ public class StandingInstructionsHelper {
|
||||
map.put("recurrenceFrequency", RECURRENCE_FREQUENCY_WEEKS);
|
||||
map.put("recurrenceOnMonthDay", monthDay);
|
||||
String savingsApplicationJSON = new Gson().toJson(map);
|
||||
LOG.info("{}", savingsApplicationJSON);
|
||||
log.info("{}", savingsApplicationJSON);
|
||||
return savingsApplicationJSON;
|
||||
}
|
||||
|
||||
public Integer createStandingInstruction(final String clientId, final String fromAccountId, final String toAccountId,
|
||||
final String fromAccountType, final String toAccountType, final String validFrom, final String validTo, final String monthDay) {
|
||||
LOG.info("-------------------------------- CREATE STANDING INSTRUCTIONS --------------------------------");
|
||||
final String standingInstructionAsJSON = new StandingInstructionsHelper(this.requestSpec, this.responseSpec) //
|
||||
.build(clientId.toString(), fromAccountId.toString(), toAccountId.toString(), fromAccountType, toAccountType, validFrom,
|
||||
validTo, monthDay);
|
||||
log.info("-------------------------------- CREATE STANDING INSTRUCTIONS --------------------------------");
|
||||
final String standingInstructionAsJSON = new StandingInstructionsHelper(this.requestSpec, this.responseSpec).build(clientId,
|
||||
fromAccountId, toAccountId, fromAccountType, toAccountType, validFrom, validTo, monthDay);
|
||||
return Utils.performServerPost(this.requestSpec, this.responseSpec, STANDING_INSTRUCTIONS_URL + "?" + Utils.TENANT_IDENTIFIER,
|
||||
standingInstructionAsJSON, "resourceId");
|
||||
}
|
||||
|
||||
public HashMap getStandingInstructionById(final String standingInstructionId) {
|
||||
|
||||
LOG.info("----------------------------- RETRIEVING STANDING INSTRUCTION BY ID---------------------------");
|
||||
log.info("----------------------------- RETRIEVING STANDING INSTRUCTION BY ID---------------------------");
|
||||
final String GET_STANDING_INSTRUCTION_BY_ID_URL = STANDING_INSTRUCTIONS_URL + "/" + standingInstructionId + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_STANDING_INSTRUCTION_BY_ID_URL, "");
|
||||
return response;
|
||||
return Utils.performServerGet(this.requestSpec, this.responseSpec, GET_STANDING_INSTRUCTION_BY_ID_URL, "");
|
||||
}
|
||||
|
||||
public List<HashMap> getStandingInstructionHistory(Integer fromSavingsId, Integer fromAccountType, Integer fromClientId,
|
||||
Integer transferType) {
|
||||
final String STANDING_INSTRUCTIONS_HISTORY_URL = STANDING_INSTRUCTIONS_RUNHISTORY_URL + "?" + Utils.TENANT_IDENTIFIER
|
||||
final String STANDING_INSTRUCTIONS_HISTORY_URL = STANDING_INSTRUCTIONS_RUN_HISTORY_URL + "?" + Utils.TENANT_IDENTIFIER
|
||||
+ "&fromSavingsId=" + fromSavingsId + "&fromAccountType=" + fromAccountType + "&clientId=" + fromClientId + "&transferType="
|
||||
+ transferType;
|
||||
LOG.info("STANDING_INSTRUCTIONS_HISTORY_URL= {}", STANDING_INSTRUCTIONS_HISTORY_URL);
|
||||
final List<HashMap> response = (List<HashMap>) Utils.performServerGet(this.requestSpec, this.responseSpec,
|
||||
STANDING_INSTRUCTIONS_HISTORY_URL, "pageItems");
|
||||
return response;
|
||||
log.info("STANDING_INSTRUCTIONS_HISTORY_URL= {}", STANDING_INSTRUCTIONS_HISTORY_URL);
|
||||
return Utils.performServerGet(this.requestSpec, this.responseSpec, STANDING_INSTRUCTIONS_HISTORY_URL, "pageItems");
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -257,7 +257,7 @@ public final class Utils {
|
||||
for (int i = 0; i < len; i++) {
|
||||
sb.append(sourceSetString.charAt(random.nextInt(lengthOfSource)));
|
||||
}
|
||||
return prefix + sb.toString();
|
||||
return prefix + sb;
|
||||
}
|
||||
|
||||
public static String randomStringGenerator(final String prefix, final int len) {
|
||||
@@ -272,11 +272,11 @@ public final class Utils {
|
||||
"DMI_RANDOM_USED_ONLY_ONCE" }, justification = "False positive for random object created and used only once")
|
||||
public static Long randomNumberGenerator(final int expectedLength) {
|
||||
final String source = "1234567890";
|
||||
final int lengthofSource = source.length();
|
||||
final int lengthOfSource = source.length();
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder(expectedLength);
|
||||
for (int i = 0; i < expectedLength; i++) {
|
||||
stringBuilder.append(source.charAt(random.nextInt(lengthofSource)));
|
||||
stringBuilder.append(source.charAt(random.nextInt(lengthOfSource)));
|
||||
}
|
||||
return Long.parseLong(stringBuilder.toString());
|
||||
}
|
||||
|
||||
+34
-35
@@ -36,19 +36,18 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Slf4j
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class LoanTransactionHelper {
|
||||
|
||||
private final RequestSpecification requestSpec;
|
||||
private final ResponseSpecification responseSpec;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LoanTransactionHelper.class);
|
||||
|
||||
private static final String CREATE_LOAN_PRODUCT_URL = "/fineract-provider/api/v1/loanproducts?" + Utils.TENANT_IDENTIFIER;
|
||||
private static final String APPLY_LOAN_URL = "/fineract-provider/api/v1/loans?" + Utils.TENANT_IDENTIFIER;
|
||||
@@ -200,8 +199,8 @@ public class LoanTransactionHelper {
|
||||
public HashMap approveLoan(final String approvalDate, final Integer loanID) {
|
||||
String loanApprovalCommand = createLoanOperationURL(APPROVE_LOAN_COMMAND, loanID);
|
||||
String loanApprovalRequest = getApproveLoanAsJSON(approvalDate);
|
||||
LOG.info("Loan approval command: {} ", loanApprovalCommand);
|
||||
LOG.info("Loan approval request: {} ", loanApprovalRequest);
|
||||
log.info("Loan approval command: {} ", loanApprovalCommand);
|
||||
log.info("Loan approval request: {} ", loanApprovalRequest);
|
||||
return performLoanTransaction(loanApprovalCommand, loanApprovalRequest);
|
||||
}
|
||||
|
||||
@@ -254,7 +253,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
map.put("postDatedChecks", postDatedChecks);
|
||||
LOG.info("Loan Application disburse request : {} ", map);
|
||||
log.info("Loan Application disburse request : {} ", map);
|
||||
return new Gson().toJson(map);
|
||||
}
|
||||
|
||||
@@ -281,16 +280,16 @@ public class LoanTransactionHelper {
|
||||
|
||||
public HashMap undoDisbursal(final Integer loanID) {
|
||||
final String undoDisburseJson = "{'note' : 'UNDO DISBURSAL'}";
|
||||
LOG.info("IN DISBURSE LOAN");
|
||||
log.info("IN DISBURSE LOAN");
|
||||
final String url = createLoanOperationURL(UNDO_DISBURSE_LOAN_COMMAND, loanID);
|
||||
LOG.info("IN DISBURSE LOAN URL : {} ", url);
|
||||
log.info("IN DISBURSE LOAN URL : {} ", url);
|
||||
return performLoanTransaction(createLoanOperationURL(UNDO_DISBURSE_LOAN_COMMAND, loanID), undoDisburseJson);
|
||||
}
|
||||
|
||||
public Float undoLastDisbursal(final Integer loanID) {
|
||||
final String undoLastDisburseJson = "{'note' : 'UNDO LAST DISBURSAL'}";
|
||||
final String url = createLoanOperationURL(UNDO_LAST_DISBURSE_LOAN_COMMAND, loanID);
|
||||
LOG.info("IN UNDO LAST DISBURSE LOAN URL : {} ", url);
|
||||
log.info("IN UNDO LAST DISBURSE LOAN URL : {} ", url);
|
||||
return performUndoLastLoanDisbursementTransaction(createLoanOperationURL(UNDO_LAST_DISBURSE_LOAN_COMMAND, loanID),
|
||||
undoLastDisburseJson);
|
||||
}
|
||||
@@ -305,24 +304,24 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public HashMap disburseGlimAccount(final String date, final Integer glimID) {
|
||||
LOG.info("--------------------------------- GLIM DISBURSEMENT APPLICATION -------------------------------");
|
||||
log.info("--------------------------------- GLIM DISBURSEMENT APPLICATION -------------------------------");
|
||||
return performLoanTransaction(createGlimAccountURL(DISBURSE_LOAN_COMMAND, glimID), getDisbursementAsJSON(date));
|
||||
}
|
||||
|
||||
public HashMap undoDisburseGlimAccount(final Integer glimID) {
|
||||
LOG.info("--------------------------------- UNDO DISBURSAL GLIM APPLICATION -------------------------------");
|
||||
log.info("--------------------------------- UNDO DISBURSAL GLIM APPLICATION -------------------------------");
|
||||
final String undoBodyJson = "{'note':'UNDO DISBURSAL'}";
|
||||
return performLoanTransaction(createGlimAccountURL(UNDO_DISBURSE_LOAN_COMMAND, glimID), undoBodyJson);
|
||||
}
|
||||
|
||||
public HashMap undoApprovalGlimAccount(final Integer glimID) {
|
||||
LOG.info("--------------------------------- UNDO APPROVAL GLIM APPLICATION -------------------------------");
|
||||
log.info("--------------------------------- UNDO APPROVAL GLIM APPLICATION -------------------------------");
|
||||
final String undoBodyJson = "{'note':'UNDO APPROVAL'}";
|
||||
return performLoanTransaction(createGlimAccountURL(UNDO_APPROVAL_LOAN_COMMAND, glimID), undoBodyJson);
|
||||
}
|
||||
|
||||
public HashMap rejectGlimAccount(final String date, final Integer glimID) {
|
||||
LOG.info("--------------------------------- REJECT GLIM APPLICATION -------------------------------");
|
||||
log.info("--------------------------------- REJECT GLIM APPLICATION -------------------------------");
|
||||
return performLoanTransaction(createGlimAccountURL(REJECT_LOAN_COMMAND, glimID), getRejectAsJSON(date));
|
||||
}
|
||||
|
||||
@@ -381,14 +380,14 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public Integer addChargesForLoan(final Integer loanId, final String request) {
|
||||
LOG.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
|
||||
final String ADD_CHARGES_URL = LOAN_ACCOUNT_URL + "/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, ADD_CHARGES_URL, request, "");
|
||||
return (Integer) response.get("resourceId");
|
||||
}
|
||||
|
||||
public Integer addChargesForLoan(final Integer loanId, final String request, final ResponseSpecification responseSpecParam) {
|
||||
LOG.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
|
||||
final String ADD_CHARGES_URL = LOAN_ACCOUNT_URL + "/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerPost(requestSpec, responseSpecParam, ADD_CHARGES_URL, request, "");
|
||||
return (Integer) response.get("resourceId");
|
||||
@@ -401,7 +400,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public Integer updateChargesForLoan(final Integer loanId, final Integer loanchargeId, final String request) {
|
||||
LOG.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
|
||||
final String UPDATE_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerPut(requestSpec, responseSpec, UPDATE_CHARGES_URL, request, "");
|
||||
@@ -409,7 +408,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public Integer deleteChargesForLoan(final Integer loanId, final Integer loanchargeId) {
|
||||
LOG.info("--------------------------------- DELETE CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- DELETE CHARGES FOR LOAN --------------------------------");
|
||||
final String DELETE_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerDelete(requestSpec, responseSpec, DELETE_CHARGES_URL, "");
|
||||
@@ -417,7 +416,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public Integer waiveChargesForLoan(final Integer loanId, final Integer loanchargeId, final String json) {
|
||||
LOG.info("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
|
||||
final String CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=waive&"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
|
||||
@@ -425,7 +424,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public Integer undoWaiveChargesForLoan(final Integer loanId, final Integer transactionId, final String body) {
|
||||
LOG.info("--------------------------------- UNDO WAIVE CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- UNDO WAIVE CHARGES FOR LOAN --------------------------------");
|
||||
final String TRANSAC_URL = "/fineract-provider/api/v1/loans/" + loanId + "/transactions/" + transactionId + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerPut(requestSpec, responseSpec, TRANSAC_URL, body, "");
|
||||
@@ -433,7 +432,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public Integer payChargesForLoan(final Integer loanId, final Integer loanchargeId, final String json) {
|
||||
LOG.info("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
|
||||
log.info("--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------");
|
||||
final String CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=pay&"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, "");
|
||||
@@ -478,7 +477,7 @@ public class LoanTransactionHelper {
|
||||
if (transactionAmount != null) {
|
||||
map.put("transactionAmount", transactionAmount);
|
||||
}
|
||||
LOG.info("Loan Application disburse request : {} ", map);
|
||||
log.info("Loan Application disburse request : {} ", map);
|
||||
return new Gson().toJson(map);
|
||||
}
|
||||
|
||||
@@ -493,7 +492,7 @@ public class LoanTransactionHelper {
|
||||
if (transactionAmount != null) {
|
||||
map.put("transactionAmount", transactionAmount);
|
||||
}
|
||||
LOG.info("Loan Application disburse request : {} ", map);
|
||||
log.info("Loan Application disburse request : {} ", map);
|
||||
return new Gson().toJson(map);
|
||||
}
|
||||
|
||||
@@ -586,7 +585,7 @@ public class LoanTransactionHelper {
|
||||
map.put("transactionDate", transactionDate);
|
||||
map.put("note", "Foreclosure Made!!!");
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -631,7 +630,7 @@ public class LoanTransactionHelper {
|
||||
map.put("dueDate", dueDate);
|
||||
map.put("chargeId", chargeId);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -646,7 +645,7 @@ public class LoanTransactionHelper {
|
||||
map.put("amount", amount);
|
||||
map.put("chargeId", chargeId);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -657,7 +656,7 @@ public class LoanTransactionHelper {
|
||||
map.put("amount", amount);
|
||||
map.put("chargeId", chargeId);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -667,7 +666,7 @@ public class LoanTransactionHelper {
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("amount", amount);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -680,7 +679,7 @@ public class LoanTransactionHelper {
|
||||
map.put("installmentNumber", installmentNumber);
|
||||
}
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -689,7 +688,7 @@ public class LoanTransactionHelper {
|
||||
map.put("locale", "en_GB");
|
||||
map.put("installmentNumber", installmentNumber);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -775,7 +774,7 @@ public class LoanTransactionHelper {
|
||||
map.put("transactionDate", date);
|
||||
map.put("transactionAmount", transactionAmount);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -791,7 +790,7 @@ public class LoanTransactionHelper {
|
||||
}
|
||||
|
||||
public void verifyRepaymentScheduleEntryFor(final int repaymentNumber, final float expectedPrincipalOutstanding, final Integer loanID) {
|
||||
LOG.info("---------------------------GETTING LOAN REPAYMENT SCHEDULE--------------------------------");
|
||||
log.info("---------------------------GETTING LOAN REPAYMENT SCHEDULE--------------------------------");
|
||||
final ArrayList<HashMap> repaymentPeriods = getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
|
||||
assertEquals(expectedPrincipalOutstanding, repaymentPeriods.get(repaymentNumber).get("principalLoanBalanceOutstanding"),
|
||||
"Mismatch in Principal Loan Balance Outstanding ");
|
||||
@@ -912,7 +911,7 @@ public class LoanTransactionHelper {
|
||||
map.put("updatedExpectedDisbursementDate", updatedExpectedDisbursementDate);
|
||||
map.put("updatedPrincipal", updatedPrincipal);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -925,7 +924,7 @@ public class LoanTransactionHelper {
|
||||
map.put("expectedDisbursementDate", expectedDisbursementDate);
|
||||
map.put("disbursementData", disbursementData);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -973,7 +972,7 @@ public class LoanTransactionHelper {
|
||||
public static HashMap<String, Object> getLoanAuditFields(final RequestSpecification requestSpec,
|
||||
final ResponseSpecification responseSpec, final Integer loanId, final String jsonReturn) {
|
||||
final String GET_LOAN_URL = "/fineract-provider/api/v1/internal/loan/" + loanId + "/audit?" + Utils.TENANT_IDENTIFIER;
|
||||
LOG.info("---------------------------------GET A LOAN ENTITY AUDIT FIELDS---------------------------------------------");
|
||||
log.info("---------------------------------GET A LOAN ENTITY AUDIT FIELDS---------------------------------------------");
|
||||
return Utils.performServerGet(requestSpec, responseSpec, GET_LOAN_URL, jsonReturn);
|
||||
}
|
||||
|
||||
@@ -981,7 +980,7 @@ public class LoanTransactionHelper {
|
||||
final ResponseSpecification responseSpec, final Integer loanId, final Integer transactionId, final String jsonReturn) {
|
||||
final String GET_LOAN_TRANSACTION_URL = "/fineract-provider/api/v1/internal/loan/" + loanId + "/transaction/" + transactionId
|
||||
+ "/audit?" + Utils.TENANT_IDENTIFIER;
|
||||
LOG.info(
|
||||
log.info(
|
||||
"---------------------------------GET A LOAN TRANSACTION ENTITY AUDIT FIELDS---------------------------------------------");
|
||||
return Utils.performServerGet(requestSpec, responseSpec, GET_LOAN_TRANSACTION_URL, jsonReturn);
|
||||
}
|
||||
|
||||
+12
-13
@@ -29,15 +29,14 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.report.ReportData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@Slf4j
|
||||
public class CampaignsHelper {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CampaignsHelper.class);
|
||||
private final RequestSpecification requestSpec;
|
||||
private final ResponseSpecification responseSpec;
|
||||
|
||||
@@ -53,7 +52,7 @@ public class CampaignsHelper {
|
||||
}
|
||||
|
||||
public Integer createCampaign(String reportName, Integer triggerType) {
|
||||
LOG.info("---------------------------------CREATING A CAMPAIGN---------------------------------------------");
|
||||
log.info("---------------------------------CREATING A CAMPAIGN---------------------------------------------");
|
||||
final String CREATE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "?" + Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerPost(requestSpec, responseSpec, CREATE_SMS_CAMPAIGNS_URL, getCreateCampaignJSON(reportName, triggerType),
|
||||
"resourceId");
|
||||
@@ -61,7 +60,7 @@ public class CampaignsHelper {
|
||||
|
||||
public void verifyCampaignCreatedOnServer(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final Integer generatedCampaignId) {
|
||||
LOG.info("------------------------------CHECK CAMPAIGN DETAILS------------------------------------\n");
|
||||
log.info("------------------------------CHECK CAMPAIGN DETAILS------------------------------------\n");
|
||||
final String RETRIEVE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?" + Utils.TENANT_IDENTIFIER;
|
||||
final Integer responseCampaignId = Utils.performServerGet(requestSpec, responseSpec, RETRIEVE_SMS_CAMPAIGNS_URL, "id");
|
||||
assertEquals(generatedCampaignId, responseCampaignId, "ERROR IN CREATING THE CAMPAIGN");
|
||||
@@ -69,7 +68,7 @@ public class CampaignsHelper {
|
||||
|
||||
public Integer updateCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final Integer generatedCampaignId, String reportName, Integer triggerType) {
|
||||
LOG.info("------------------------------UPDATE CAMPAIGN DETAILS------------------------------------\n");
|
||||
log.info("------------------------------UPDATE CAMPAIGN DETAILS------------------------------------\n");
|
||||
final String UPDATE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?" + Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerPut(requestSpec, responseSpec, UPDATE_SMS_CAMPAIGNS_URL, getUpdateCampaignJSON(reportName, triggerType),
|
||||
"resourceId");
|
||||
@@ -77,14 +76,14 @@ public class CampaignsHelper {
|
||||
|
||||
public Integer deleteCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final Integer generatedCampaignId) {
|
||||
LOG.info("------------------------------DELETE CAMPAIGN DETAILS------------------------------------\n");
|
||||
log.info("------------------------------DELETE CAMPAIGN DETAILS------------------------------------\n");
|
||||
final String DELETE_SMS_CAMPAIGNS_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?" + Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerDelete(requestSpec, responseSpec, DELETE_SMS_CAMPAIGNS_URL, "resourceId");
|
||||
}
|
||||
|
||||
public Integer performActionsOnCampaign(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final Integer generatedCampaignId, String command) {
|
||||
LOG.info("------------------------------PERFORM ACTION ON CAMPAIGN DETAILS------------------------------------\n");
|
||||
log.info("------------------------------PERFORM ACTION ON CAMPAIGN DETAILS------------------------------------\n");
|
||||
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command + "&"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
String actionDate = Utils.getLocalDateOfTenant().format(DateTimeFormatter.ofPattern(DATE_FORMAT));
|
||||
@@ -94,7 +93,7 @@ public class CampaignsHelper {
|
||||
|
||||
public Object performActionsOnCampaignWithFailure(final Integer generatedCampaignId, String command, String actionDate,
|
||||
String responseJsonAttribute) {
|
||||
LOG.info("--------------------------PERFORM ACTION ON CAMPAIGN DETAILS WITH FAILURE-------------------------------\n");
|
||||
log.info("--------------------------PERFORM ACTION ON CAMPAIGN DETAILS WITH FAILURE-------------------------------\n");
|
||||
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command + "&"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
return Utils.performServerPost(this.requestSpec, this.responseSpec, SMS_CAMPAIGNS_ACTION_URL,
|
||||
@@ -125,7 +124,7 @@ public class CampaignsHelper {
|
||||
paramValueMap.put("reportName", reportName);
|
||||
map.put("paramValue", paramValueMap);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ public class CampaignsHelper {
|
||||
paramValueMap.put("reportName", reportName);
|
||||
map.put("paramValue", paramValueMap);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -162,7 +161,7 @@ public class CampaignsHelper {
|
||||
map.put("locale", "en");
|
||||
map.put("dateFormat", DATE_FORMAT);
|
||||
String json = new Gson().toJson(map);
|
||||
LOG.info("{}", json);
|
||||
log.info("{}", json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ public class CampaignsHelper {
|
||||
}
|
||||
|
||||
private List<ReportData> getReports(String jsonAttributeToGetBack) {
|
||||
LOG.info("--------------------------------- GET REPORTS OPTIONS -------------------------------");
|
||||
log.info("--------------------------------- GET REPORTS OPTIONS -------------------------------");
|
||||
Assert.notNull(jsonAttributeToGetBack, "jsonAttributeToGetBack may not be null");
|
||||
final String templateUrl = SMS_CAMPAIGNS_URL + "/template?" + Utils.TENANT_IDENTIFIER;
|
||||
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(templateUrl).andReturn()
|
||||
|
||||
Reference in New Issue
Block a user