FINERACT-1971: Minor bug-fixes and enhancements
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AdjustTransactionByExternalIdCommandStrategy implements CommandStrategy {
|
||||
public class AdjustLoanTransactionByExternalIdCommandStrategy implements CommandStrategy {
|
||||
|
||||
/**
|
||||
* Loan transactions api resource {@link LoanTransactionsApiResource}.
|
||||
+1
-1
@@ -44,7 +44,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AdjustTransactionCommandStrategy implements CommandStrategy {
|
||||
public class AdjustLoanTransactionCommandStrategy implements CommandStrategy {
|
||||
|
||||
/**
|
||||
* Loan transactions api resource {@link LoanTransactionsApiResource}.
|
||||
+1
-1
@@ -48,7 +48,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GetTransactionByExternalIdCommandStrategy implements CommandStrategy {
|
||||
public class GetLoanTransactionByExternalIdCommandStrategy implements CommandStrategy {
|
||||
|
||||
/**
|
||||
* Loan transactions api resource {@link LoanTransactionsApiResource}.
|
||||
+1
-1
@@ -47,7 +47,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GetTransactionByIdCommandStrategy implements CommandStrategy {
|
||||
public class GetLoanTransactionByIdCommandStrategy implements CommandStrategy {
|
||||
|
||||
/**
|
||||
* Loan transactions api resource {@link LoanTransactionsApiResource}.
|
||||
+2
-5
@@ -42,6 +42,7 @@ import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.savings.DepositAccountOnClosureType;
|
||||
import org.apache.fineract.portfolio.savings.SavingsPeriodFrequencyType;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
|
||||
@@ -315,11 +316,7 @@ public class DepositAccountTermAndPreClosure extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public boolean isAfterExpectedFirstDepositDate(final LocalDate compareDate) {
|
||||
boolean isAfterExpectedFirstDepositDate = false;
|
||||
if (this.expectedFirstDepositOnDate != null) {
|
||||
isAfterExpectedFirstDepositDate = compareDate.isAfter(getExpectedFirstDepositOnDate());
|
||||
}
|
||||
return isAfterExpectedFirstDepositDate;
|
||||
return this.expectedFirstDepositOnDate != null && DateUtils.isAfter(compareDate, getExpectedFirstDepositOnDate());
|
||||
}
|
||||
|
||||
public Integer getOnAccountClosureType() {
|
||||
|
||||
-9
@@ -144,7 +144,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult activateFDAccount(final Long savingsId, final JsonCommand command) {
|
||||
|
||||
final AppUser user = this.context.authenticatedUser();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
@@ -621,7 +620,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult adjustRDTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) {
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
@@ -894,7 +892,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Override
|
||||
public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||
final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -927,7 +924,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Override
|
||||
public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||
final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
@@ -969,7 +965,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Override
|
||||
public SavingsAccountTransaction acceptSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||
final Office acceptedInOffice, final Staff fieldOfficer, final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
@@ -1125,7 +1120,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Override
|
||||
public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId,
|
||||
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
@@ -1261,7 +1255,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
.findOneWithNotFoundDetection(savingsAccountChargeId, accountId);
|
||||
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern("dd MM yyyy");
|
||||
|
||||
while (transactionDate.isAfter(savingsAccountCharge.getDueLocalDate())) {
|
||||
payCharge(savingsAccountCharge, transactionDate, savingsAccountCharge.amoutOutstanding(), fmt);
|
||||
}
|
||||
@@ -1270,7 +1263,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Transactional
|
||||
private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid,
|
||||
final DateTimeFormatter formatter) {
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
@@ -1314,7 +1306,6 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateMaturityDetails(Long depositAccountId, DepositAccountType depositAccountType) {
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||
|
||||
+16
-15
@@ -27,8 +27,8 @@ import java.util.stream.Stream;
|
||||
import org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.AdjustChargeByChargeExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.AdjustChargeCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.AdjustTransactionByExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.AdjustTransactionCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.AdjustLoanTransactionByExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.AdjustLoanTransactionCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy;
|
||||
@@ -50,8 +50,8 @@ import org.apache.fineract.batch.command.internal.GetDatatableEntryByAppTableIdC
|
||||
import org.apache.fineract.batch.command.internal.GetDatatableEntryByQueryCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetLoanByExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetLoanByIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetTransactionByExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetTransactionByIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetLoanTransactionByExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.GetLoanTransactionByIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.LoanStateTransistionsByExternalIdCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.ModifyLoanApplicationCommandStrategy;
|
||||
import org.apache.fineract.batch.command.internal.UnknownCommandStrategy;
|
||||
@@ -140,18 +140,18 @@ public class CommandStrategyProviderTest {
|
||||
mock(CreateTransactionLoanCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions?command=chargeRefund", HttpMethod.POST, "createTransactionLoanCommandStrategy",
|
||||
mock(CreateTransactionLoanCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123", HttpMethod.POST, "adjustTransactionCommandStrategy",
|
||||
mock(AdjustTransactionCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123?command=chargeback", HttpMethod.POST, "adjustTransactionCommandStrategy",
|
||||
mock(AdjustTransactionCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123", HttpMethod.POST, "adjustLoanTransactionCommandStrategy",
|
||||
mock(AdjustLoanTransactionCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123?command=chargeback", HttpMethod.POST, "adjustLoanTransactionCommandStrategy",
|
||||
mock(AdjustLoanTransactionCommandStrategy.class)),
|
||||
Arguments.of(
|
||||
"loans/external-id/8dfad438-2319-48ce-8520-10a62801e9a1/transactions/external-id/7dfad438-2319-48ce-8520-10a62801e9ab",
|
||||
HttpMethod.POST, "adjustTransactionByExternalIdCommandStrategy",
|
||||
mock(AdjustTransactionByExternalIdCommandStrategy.class)),
|
||||
HttpMethod.POST, "adjustLoanTransactionByExternalIdCommandStrategy",
|
||||
mock(AdjustLoanTransactionByExternalIdCommandStrategy.class)),
|
||||
Arguments.of(
|
||||
"loans/external-id/8dfad438-2319-48ce-8520-10a62801e9a1/transactions/external-id/7dfad438-2319-48ce-8520-10a62801e9ab?command=chargeback",
|
||||
HttpMethod.POST, "adjustTransactionByExternalIdCommandStrategy",
|
||||
mock(AdjustTransactionByExternalIdCommandStrategy.class)),
|
||||
HttpMethod.POST, "adjustLoanTransactionByExternalIdCommandStrategy",
|
||||
mock(AdjustLoanTransactionByExternalIdCommandStrategy.class)),
|
||||
Arguments.of("clients/456?command=activate", HttpMethod.POST, "activateClientCommandStrategy",
|
||||
mock(ActivateClientCommandStrategy.class)),
|
||||
Arguments.of("loans/123?command=approve", HttpMethod.POST, "approveLoanCommandStrategy",
|
||||
@@ -166,11 +166,12 @@ public class CommandStrategyProviderTest {
|
||||
mock(CreateLoanRescheduleRequestCommandStrategy.class)),
|
||||
Arguments.of("rescheduleloans/123?command=approve", HttpMethod.POST, "approveLoanRescheduleCommandStrategy",
|
||||
mock(ApproveLoanRescheduleCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123", HttpMethod.GET, "getTransactionByIdCommandStrategy",
|
||||
mock(GetTransactionByIdCommandStrategy.class)),
|
||||
Arguments.of("loans/123/transactions/123", HttpMethod.GET, "getLoanTransactionByIdCommandStrategy",
|
||||
mock(GetLoanTransactionByIdCommandStrategy.class)),
|
||||
Arguments.of(
|
||||
"loans/external-id/8dfad438-2319-48ce-8520-10a62801e9a1/transactions/external-id/7dfad438-2319-48ce-8520-10a62801e9ab?fields=id",
|
||||
HttpMethod.GET, "getTransactionByExternalIdCommandStrategy", mock(GetTransactionByExternalIdCommandStrategy.class)),
|
||||
HttpMethod.GET, "getLoanTransactionByExternalIdCommandStrategy",
|
||||
mock(GetLoanTransactionByExternalIdCommandStrategy.class)),
|
||||
Arguments.of("datatables/test_dt_table/123", HttpMethod.GET, "getDatatableEntryByAppTableIdCommandStrategy",
|
||||
mock(GetDatatableEntryByAppTableIdCommandStrategy.class)),
|
||||
Arguments.of("datatables/test_dt_table/123?genericResultSet=true", HttpMethod.GET,
|
||||
|
||||
+6
-6
@@ -38,12 +38,12 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Test class for {@link AdjustTransactionByExternalIdCommandStrategy}.
|
||||
* Test class for {@link AdjustLoanTransactionByExternalIdCommandStrategy}.
|
||||
*/
|
||||
public class AdjustTransactionByExternalIdCommandStrategyTest {
|
||||
public class AdjustLoanTransactionByExternalIdCommandStrategyTest {
|
||||
|
||||
/**
|
||||
* Test {@link AdjustTransactionByExternalIdCommandStrategy#execute} happy path scenario.
|
||||
* Test {@link AdjustLoanTransactionByExternalIdCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteWithoutCommandSuccessScenario() {
|
||||
@@ -73,7 +73,7 @@ public class AdjustTransactionByExternalIdCommandStrategyTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test {@link AdjustTransactionByExternalIdCommandStrategy#execute} happy path scenario.
|
||||
* Test {@link AdjustLoanTransactionByExternalIdCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteWithCommandSuccessScenario() {
|
||||
@@ -150,14 +150,14 @@ public class AdjustTransactionByExternalIdCommandStrategyTest {
|
||||
/**
|
||||
* The class under test.
|
||||
*/
|
||||
private final AdjustTransactionByExternalIdCommandStrategy subjectToTest;
|
||||
private final AdjustLoanTransactionByExternalIdCommandStrategy subjectToTest;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
TestContext() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
subjectToTest = new AdjustTransactionByExternalIdCommandStrategy(loanTransactionsApiResource);
|
||||
subjectToTest = new AdjustLoanTransactionByExternalIdCommandStrategy(loanTransactionsApiResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -36,12 +36,12 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Test class for {@link AdjustTransactionCommandStrategy}.
|
||||
* Test class for {@link AdjustLoanTransactionCommandStrategy}.
|
||||
*/
|
||||
public class AdjustTransactionCommandStrategyTest {
|
||||
public class AdjustLoanTransactionCommandStrategyTest {
|
||||
|
||||
/**
|
||||
* Test {@link AdjustTransactionCommandStrategy#execute} happy path scenario.
|
||||
* Test {@link AdjustLoanTransactionCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteWithoutCommandSuccessScenario() {
|
||||
@@ -71,7 +71,7 @@ public class AdjustTransactionCommandStrategyTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test {@link AdjustTransactionCommandStrategy#execute} happy path scenario.
|
||||
* Test {@link AdjustLoanTransactionCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteWithCommandSuccessScenario() {
|
||||
@@ -148,14 +148,14 @@ public class AdjustTransactionCommandStrategyTest {
|
||||
/**
|
||||
* The class under test.
|
||||
*/
|
||||
private final AdjustTransactionCommandStrategy subjectToTest;
|
||||
private final AdjustLoanTransactionCommandStrategy subjectToTest;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
TestContext() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
subjectToTest = new AdjustTransactionCommandStrategy(loanTransactionsApiResource);
|
||||
subjectToTest = new AdjustLoanTransactionCommandStrategy(loanTransactionsApiResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -40,16 +40,16 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Test class for {@link GetTransactionByExternalIdCommandStrategy}.
|
||||
* Test class for {@link GetLoanTransactionByExternalIdCommandStrategy}.
|
||||
*/
|
||||
public class GetTransactionByExternalIdCommandStrategyTest {
|
||||
public class GetLoanTransactionByExternalIdCommandStrategyTest {
|
||||
|
||||
private static Stream<Arguments> provideQueryParameters() {
|
||||
return Stream.of(Arguments.of(null, 0), Arguments.of("id,date,amount", 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test {@link GetTransactionByExternalIdCommandStrategy#execute} happy path scenario.
|
||||
* Test {@link GetLoanTransactionByExternalIdCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideQueryParameters")
|
||||
@@ -132,7 +132,7 @@ public class GetTransactionByExternalIdCommandStrategyTest {
|
||||
/**
|
||||
* The class under test.
|
||||
*/
|
||||
private final GetTransactionByExternalIdCommandStrategy subjectToTest;
|
||||
private final GetLoanTransactionByExternalIdCommandStrategy subjectToTest;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -140,7 +140,7 @@ public class GetTransactionByExternalIdCommandStrategyTest {
|
||||
|
||||
TestContext() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
subjectToTest = new GetTransactionByExternalIdCommandStrategy(loanTransactionsApiResource);
|
||||
subjectToTest = new GetLoanTransactionByExternalIdCommandStrategy(loanTransactionsApiResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -38,16 +38,16 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Test class for {@link GetTransactionByIdCommandStrategy}.
|
||||
* Test class for {@link GetLoanTransactionByIdCommandStrategy}.
|
||||
*/
|
||||
public class GetTransactionByIdCommandStrategyTest {
|
||||
public class GetLoanTransactionByIdCommandStrategyTest {
|
||||
|
||||
private static Stream<Arguments> provideQueryParameters() {
|
||||
return Stream.of(Arguments.of(null, 0), Arguments.of("id,date,amount", 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test {@link GetTransactionByIdCommandStrategy#execute} happy path scenario.
|
||||
* Test {@link GetLoanTransactionByIdCommandStrategy#execute} happy path scenario.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideQueryParameters")
|
||||
@@ -128,7 +128,7 @@ public class GetTransactionByIdCommandStrategyTest {
|
||||
/**
|
||||
* The class under test.
|
||||
*/
|
||||
private final GetTransactionByIdCommandStrategy subjectToTest;
|
||||
private final GetLoanTransactionByIdCommandStrategy subjectToTest;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -136,7 +136,7 @@ public class GetTransactionByIdCommandStrategyTest {
|
||||
|
||||
TestContext() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
subjectToTest = new GetTransactionByIdCommandStrategy(loanTransactionsApiResource);
|
||||
subjectToTest = new GetLoanTransactionByIdCommandStrategy(loanTransactionsApiResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user