Revert "FINERACT-2378: Failing integration test: org.apache.fineract.integrat…" (#5064)
This reverts commit 3b58f6af22.
This commit is contained in:
+6
@@ -47,9 +47,14 @@ public class CompoundInterestHelper {
|
|||||||
// total interest earned in previous periods but not yet recognised
|
// total interest earned in previous periods but not yet recognised
|
||||||
BigDecimal compoundedInterest = BigDecimal.ZERO;
|
BigDecimal compoundedInterest = BigDecimal.ZERO;
|
||||||
BigDecimal unCompoundedInterest = BigDecimal.ZERO;
|
BigDecimal unCompoundedInterest = BigDecimal.ZERO;
|
||||||
|
LocalDate endDay = DateUtils.getBusinessLocalDate();
|
||||||
final CompoundInterestValues compoundInterestValues = new CompoundInterestValues(compoundedInterest, unCompoundedInterest);
|
final CompoundInterestValues compoundInterestValues = new CompoundInterestValues(compoundedInterest, unCompoundedInterest);
|
||||||
for (final PostingPeriod postingPeriod : allPeriods) {
|
for (final PostingPeriod postingPeriod : allPeriods) {
|
||||||
|
|
||||||
|
if (postingPeriod.dateOfPostingTransaction().getMonth() != endDay.getMonth()) {
|
||||||
|
compoundInterestValues.setCompoundedInterest(interestEarned.getAmount());
|
||||||
|
}
|
||||||
|
|
||||||
final BigDecimal interestEarnedThisPeriod = postingPeriod.calculateInterest(compoundInterestValues);
|
final BigDecimal interestEarnedThisPeriod = postingPeriod.calculateInterest(compoundInterestValues);
|
||||||
|
|
||||||
final Money moneyToBePostedForPeriod = Money.of(currency, interestEarnedThisPeriod);
|
final Money moneyToBePostedForPeriod = Money.of(currency, interestEarnedThisPeriod);
|
||||||
@@ -63,6 +68,7 @@ public class CompoundInterestHelper {
|
|||||||
|| (lockUntil != null && !DateUtils.isAfter(postingPeriod.dateOfPostingTransaction(), lockUntil)))) {
|
|| (lockUntil != null && !DateUtils.isAfter(postingPeriod.dateOfPostingTransaction(), lockUntil)))) {
|
||||||
compoundInterestValues.setCompoundedInterest(BigDecimal.ZERO);
|
compoundInterestValues.setCompoundedInterest(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
|
endDay = postingPeriod.dateOfPostingTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
return interestEarned;
|
return interestEarned;
|
||||||
|
|||||||
+21
-11
@@ -52,10 +52,12 @@ import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
|||||||
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
|
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@Disabled("Disabled till FINERACT-2378 fixed")
|
||||||
public class SavingsInterestPostingTest {
|
public class SavingsInterestPostingTest {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(SavingsInterestPostingTest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(SavingsInterestPostingTest.class);
|
||||||
@@ -88,6 +90,11 @@ public class SavingsInterestPostingTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testPostInterestWithOverdraftProduct() {
|
public void testPostInterestWithOverdraftProduct() {
|
||||||
try {
|
try {
|
||||||
|
final LocalDate startDate = LocalDate.of(LocalDate.now(Utils.getZoneIdOfTenant()).getYear(), 2, 1);
|
||||||
|
// Simulate time passing - update business date to February
|
||||||
|
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
||||||
|
new PutGlobalConfigurationsRequest().enabled(true));
|
||||||
|
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, startDate);
|
||||||
final String amount = "10000";
|
final String amount = "10000";
|
||||||
|
|
||||||
final Account assetAccount = accountHelper.createAssetAccount();
|
final Account assetAccount = accountHelper.createAssetAccount();
|
||||||
@@ -103,7 +110,7 @@ public class SavingsInterestPostingTest {
|
|||||||
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
|
|
||||||
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
||||||
final LocalDate startDate = LocalDate.of(2025, 2, 1);
|
|
||||||
final String startDateString = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
final String startDateString = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
||||||
|
|
||||||
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
||||||
@@ -113,7 +120,7 @@ public class SavingsInterestPostingTest {
|
|||||||
savingsAccountHelper.depositToSavingsAccount(accountId, amount, startDateString, CommonConstants.RESPONSE_RESOURCE_ID);
|
savingsAccountHelper.depositToSavingsAccount(accountId, amount, startDateString, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
|
|
||||||
// Simulate time passing - update business date to March
|
// Simulate time passing - update business date to March
|
||||||
LocalDate marchDate = LocalDate.of(2025, 3, 2);
|
LocalDate marchDate = LocalDate.of(startDate.getYear(), 3, 1);
|
||||||
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
||||||
|
|
||||||
runAccrualsThenPost();
|
runAccrualsThenPost();
|
||||||
@@ -122,7 +129,9 @@ public class SavingsInterestPostingTest {
|
|||||||
BigDecimal expected = calcInterestPosting(productHelper, amount, days);
|
BigDecimal expected = calcInterestPosting(productHelper, amount, days);
|
||||||
|
|
||||||
List<HashMap> txs = getInterestTransactions(accountId);
|
List<HashMap> txs = getInterestTransactions(accountId);
|
||||||
Assertions.assertEquals(expected, BigDecimal.valueOf(((Double) txs.get(0).get("amount"))), "ERROR in expected");
|
for (HashMap tx : txs) {
|
||||||
|
Assertions.assertEquals(expected, BigDecimal.valueOf(((Double) tx.get("amount"))));
|
||||||
|
}
|
||||||
|
|
||||||
long interestCount = countInterestOnDate(accountId, marchDate);
|
long interestCount = countInterestOnDate(accountId, marchDate);
|
||||||
long overdraftCount = countOverdraftOnDate(accountId, marchDate);
|
long overdraftCount = countOverdraftOnDate(accountId, marchDate);
|
||||||
@@ -154,7 +163,7 @@ public class SavingsInterestPostingTest {
|
|||||||
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
|
|
||||||
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
||||||
final LocalDate startDate = LocalDate.of(2025, 2, 1);
|
final LocalDate startDate = LocalDate.of(LocalDate.now(Utils.getZoneIdOfTenant()).getYear(), 2, 1);
|
||||||
final String startDateString = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
final String startDateString = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
||||||
|
|
||||||
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
||||||
@@ -166,7 +175,7 @@ public class SavingsInterestPostingTest {
|
|||||||
// Simulate time passing - update business date to March
|
// Simulate time passing - update business date to March
|
||||||
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
||||||
new PutGlobalConfigurationsRequest().enabled(true));
|
new PutGlobalConfigurationsRequest().enabled(true));
|
||||||
LocalDate marchDate = LocalDate.of(2025, 3, 1);
|
LocalDate marchDate = LocalDate.of(startDate.getYear(), 3, 1);
|
||||||
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
||||||
|
|
||||||
runAccrualsThenPost();
|
runAccrualsThenPost();
|
||||||
@@ -211,7 +220,7 @@ public class SavingsInterestPostingTest {
|
|||||||
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
|
|
||||||
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
||||||
final LocalDate startDate = LocalDate.of(2025, 2, 1);
|
final LocalDate startDate = LocalDate.of(LocalDate.now(Utils.getZoneIdOfTenant()).getYear(), 2, 1);
|
||||||
final String startStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
final String startStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
||||||
|
|
||||||
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
||||||
@@ -220,14 +229,14 @@ public class SavingsInterestPostingTest {
|
|||||||
savingsAccountHelper.activateSavings(accountId, startStr);
|
savingsAccountHelper.activateSavings(accountId, startStr);
|
||||||
savingsAccountHelper.depositToSavingsAccount(accountId, amountDeposit, startStr, CommonConstants.RESPONSE_RESOURCE_ID);
|
savingsAccountHelper.depositToSavingsAccount(accountId, amountDeposit, startStr, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
|
|
||||||
final LocalDate withdrawalDate = LocalDate.of(2025, 2, 16);
|
final LocalDate withdrawalDate = LocalDate.of(startDate.getYear(), 2, 16);
|
||||||
final String withdrawalStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(withdrawalDate);
|
final String withdrawalStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(withdrawalDate);
|
||||||
savingsAccountHelper.withdrawalFromSavingsAccount(accountId, amountWithdrawal, withdrawalStr,
|
savingsAccountHelper.withdrawalFromSavingsAccount(accountId, amountWithdrawal, withdrawalStr,
|
||||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
|
|
||||||
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
||||||
new PutGlobalConfigurationsRequest().enabled(true));
|
new PutGlobalConfigurationsRequest().enabled(true));
|
||||||
LocalDate marchDate = LocalDate.of(2025, 3, 1);
|
LocalDate marchDate = LocalDate.of(startDate.getYear(), 3, 1);
|
||||||
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
||||||
|
|
||||||
runAccrualsThenPost();
|
runAccrualsThenPost();
|
||||||
@@ -281,7 +290,7 @@ public class SavingsInterestPostingTest {
|
|||||||
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
interestReceivableAccount.getAccountID().toString(), assetAccount, incomeAccount, expenseAccount, liabilityAccount);
|
||||||
|
|
||||||
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, "01 January 2025");
|
||||||
final LocalDate startDate = LocalDate.of(2025, 2, 1);
|
final LocalDate startDate = LocalDate.of(LocalDate.now(Utils.getZoneIdOfTenant()).getYear(), 2, 1);
|
||||||
final String startStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
final String startStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(startDate);
|
||||||
|
|
||||||
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
final Integer accountId = savingsAccountHelper.applyForSavingsApplicationOnDate(clientId, productId,
|
||||||
@@ -290,13 +299,13 @@ public class SavingsInterestPostingTest {
|
|||||||
savingsAccountHelper.activateSavings(accountId, startStr);
|
savingsAccountHelper.activateSavings(accountId, startStr);
|
||||||
savingsAccountHelper.withdrawalFromSavingsAccount(accountId, amountWithdrawal, startStr, CommonConstants.RESPONSE_RESOURCE_ID);
|
savingsAccountHelper.withdrawalFromSavingsAccount(accountId, amountWithdrawal, startStr, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
|
|
||||||
final LocalDate depositDate = LocalDate.of(2025, 2, 16);
|
final LocalDate depositDate = LocalDate.of(startDate.getYear(), 2, 16);
|
||||||
final String depositStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(depositDate);
|
final String depositStr = DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.US).format(depositDate);
|
||||||
savingsAccountHelper.depositToSavingsAccount(accountId, amountDeposit, depositStr, CommonConstants.RESPONSE_RESOURCE_ID);
|
savingsAccountHelper.depositToSavingsAccount(accountId, amountDeposit, depositStr, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||||
|
|
||||||
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE,
|
||||||
new PutGlobalConfigurationsRequest().enabled(true));
|
new PutGlobalConfigurationsRequest().enabled(true));
|
||||||
LocalDate marchDate = LocalDate.of(2025, 3, 1);
|
LocalDate marchDate = LocalDate.of(startDate.getYear(), 3, 1);
|
||||||
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, marchDate);
|
||||||
|
|
||||||
runAccrualsThenPost();
|
runAccrualsThenPost();
|
||||||
@@ -347,6 +356,7 @@ public class SavingsInterestPostingTest {
|
|||||||
|
|
||||||
public Integer createSavingsProductWithAccrualAccountingWithOutOverdraftAllowed(final String interestPayableAccount,
|
public Integer createSavingsProductWithAccrualAccountingWithOutOverdraftAllowed(final String interestPayableAccount,
|
||||||
final String savingsControlAccount, final String interestReceivableAccount, final Account... accounts) {
|
final String savingsControlAccount, final String interestReceivableAccount, final Account... accounts) {
|
||||||
|
|
||||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT WITHOUT OVERDRAFT ---------------------------------------");
|
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT WITHOUT OVERDRAFT ---------------------------------------");
|
||||||
this.productHelper = new SavingsProductHelper().withOverDraftRate("100000", "21")
|
this.productHelper = new SavingsProductHelper().withOverDraftRate("100000", "21")
|
||||||
.withAccountInterestReceivables(interestReceivableAccount).withSavingsControlAccountId(savingsControlAccount)
|
.withAccountInterestReceivables(interestReceivableAccount).withSavingsControlAccountId(savingsControlAccount)
|
||||||
|
|||||||
+2
@@ -91,6 +91,7 @@ import org.junit.jupiter.api.AfterEach;
|
|||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.MethodOrderer.MethodName;
|
import org.junit.jupiter.api.MethodOrderer.MethodName;
|
||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -1265,6 +1266,7 @@ public class SchedulerJobsTestResults extends IntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Disabled("Disabled due to FINERACT-2378")
|
||||||
public void testInterestTransferForSavings() throws InterruptedException {
|
public void testInterestTransferForSavings() throws InterruptedException {
|
||||||
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
this.savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec);
|
||||||
FixedDepositAccountHelper fixedDepositAccountHelper = new FixedDepositAccountHelper(requestSpec, responseSpec);
|
FixedDepositAccountHelper fixedDepositAccountHelper = new FixedDepositAccountHelper(requestSpec, responseSpec);
|
||||||
|
|||||||
Reference in New Issue
Block a user