Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public final class GlobalConfigurationConstants {
public static final String ALLOWED_LOAN_STATUSES_OF_DELAYED_SETTLEMENT_FOR_EXTERNAL_ASSET_TRANSFER = "allowed-loan-statuses-of-delayed-settlement-for-external-asset-transfer";
public static final String MAX_LOGIN_RETRY_ATTEMPTS = "max-login-retry-attempts";
public static final String ENABLE_ORIGINATOR_CREATION_DURING_LOAN_APPLICATION = "enable-originator-creation-during-loan-application";
public static final String ENABLE_INSTANT_DELINQUENCY_CALCULATION = "enable-instant-delinquency-calculation";
public static final String PASSWORD_REUSE_CHECK_HISTORY_COUNT = "password-reuse-check-history-count";
public static final String FORCE_WITHDRAWAL_ON_SAVINGS_ACCOUNT = "allow-force-withdrawal-on-savings-account";
public static final String FORCE_WITHDRAWAL_ON_SAVINGS_ACCOUNT_LIMIT = "force-withdrawal-on-savings-account-limit";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,10 @@ private void createWorkingCapitalLoanAccount(final List<String> loanData) {

@SuppressWarnings("unchecked")
private void trackLoanIdIfEnabled(final Long loanId) {
final List<Long> trackedIds = testContext().get(TestContextKey.WC_LOAN_IDS);
if (trackedIds != null) {
trackedIds.add(loanId);
if (testContext().get(TestContextKey.WC_LOAN_IDS) == null) {
testContext().set(TestContextKey.WC_LOAN_IDS, new ArrayList<>());
}
((List<Long>) testContext().get(TestContextKey.WC_LOAN_IDS)).add(loanId);
}

private void modifyWorkingCapitalLoanAccount(final List<String> loanData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.UUID;
Expand All @@ -38,13 +39,16 @@
import org.apache.fineract.client.models.DeleteWorkingCapitalLoanProductsProductIdResponse;
import org.apache.fineract.client.models.GetConfigurableAttributes;
import org.apache.fineract.client.models.GetPaymentAllocation;
import org.apache.fineract.client.models.GetWorkingCapitalLoanDelinquencyRangeScheduleTagHistoryResponse;
import org.apache.fineract.client.models.GetWorkingCapitalLoanProductsProductIdResponse;
import org.apache.fineract.client.models.GetWorkingCapitalLoanProductsResponse;
import org.apache.fineract.client.models.GetWorkingCapitalLoanProductsTemplateResponse;
import org.apache.fineract.client.models.InternalWorkingCapitalLoanPaymentRequest;
import org.apache.fineract.client.models.PostAllowAttributeOverrides;
import org.apache.fineract.client.models.PostWorkingCapitalLoanProductsRequest;
import org.apache.fineract.client.models.PostWorkingCapitalLoanProductsRequest.AccountingRuleEnum;
import org.apache.fineract.client.models.PostWorkingCapitalLoanProductsResponse;
import org.apache.fineract.client.models.PostWorkingCapitalLoansResponse;
import org.apache.fineract.client.models.PutWorkingCapitalLoanProductsProductIdRequest;
import org.apache.fineract.client.models.PutWorkingCapitalLoanProductsProductIdResponse;
import org.apache.fineract.client.models.StringEnumOptionData;
Expand All @@ -59,6 +63,7 @@
import org.apache.fineract.test.stepdef.AbstractStepDef;
import org.apache.fineract.test.support.TestContextKey;
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Assertions;

@Slf4j
@RequiredArgsConstructor
Expand Down Expand Up @@ -719,6 +724,53 @@ private void assertGLAccountMappingId(final Map<String, ?> mappings, final Strin
assertions.assertAll();
}

private Long getWorkingCapitalLoanResourceId() {
PostWorkingCapitalLoansResponse response = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
return response.getResourceId();
}

@When("Admin makes Internal Payment {string} on {string}")
public void internalPayWCLoan(String amount, String transactionDate) {
Long resourceId = getWorkingCapitalLoanResourceId();
fineractFeignClient.workingCapitalLoans().payment(resourceId, new InternalWorkingCapitalLoanPaymentRequest()
.amount(BigDecimal.valueOf(Double.parseDouble(amount))).transactionDate(LocalDate.parse(transactionDate)));
}

@Then("Delinquency Tag History for Working Capital loan has lines:")
public void checkDelinquencyHistory(final DataTable table) {
Long resourceId = getWorkingCapitalLoanResourceId();
List<GetWorkingCapitalLoanDelinquencyRangeScheduleTagHistoryResponse> actualLines = ok(
() -> fineractFeignClient.workingCapitalLoans().getDelinquencyRangeScheduleTagHistoryById(resourceId));

// Sort by addedOnDate (descending), then by periodNumber (descending)
actualLines.sort((a, b) -> {
int dateCompare = b.getAddedOnDate().compareTo(a.getAddedOnDate());
if (dateCompare != 0) {
return dateCompare;
}
return b.getPeriodNumber().compareTo(a.getPeriodNumber());
});

log.debug("Sorted Loan Delinquency History: {}", actualLines);
List<List<String>> rows = table.asLists();
Assertions.assertEquals(rows.size() - 1, actualLines.size());
for (int i = 0; i < rows.size() - 1; i++) {
GetWorkingCapitalLoanDelinquencyRangeScheduleTagHistoryResponse actual = actualLines.get(i);
Assertions.assertNotNull(actual);
List<String> expected = rows.get(i + 1);
Assertions.assertEquals(expected.get(0), actual.getPeriodNumber() != null ? actual.getPeriodNumber().toString() : null);
Assertions.assertEquals(expected.get(1), actual.getAddedOnDate() != null ? actual.getAddedOnDate().toString() : null);
Assertions.assertEquals(expected.get(2), actual.getLiftedOnDate() != null ? actual.getLiftedOnDate().toString() : null);

Assertions.assertNotNull(actual.getDelinquencyRange());
Assertions.assertEquals(expected.get(3), actual.getDelinquencyRange().getClassification());
Assertions.assertEquals(expected.get(4), actual.getDelinquencyRange().getMinimumAgeDays() == null ? null
: actual.getDelinquencyRange().getMinimumAgeDays().toString());
Assertions.assertEquals(expected.get(5), actual.getDelinquencyRange().getMaximumAgeDays() == null ? null
: actual.getDelinquencyRange().getMaximumAgeDays().toString());
}
}

public PostWorkingCapitalLoanProductsResponse createWorkingCapitalLoanProduct(
PostWorkingCapitalLoanProductsRequest workingCapitalProductRequest) {
String workingCapitalProductName = workingCapitalProductRequest.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class WcpCobBusinessStepInitializerStep implements FineractGlobalInitiali
public void initialize() throws Exception {
try {
JobBusinessStepConfigData response = workFlowJobHelper.getConfiguredWorkflowSteps(WCP_COB_JOB_NAME);
log.info("WCP COB configured business steps: {}", response.getBusinessSteps());
log.debug("WCP COB configured business steps: {}", response.getBusinessSteps());
} catch (CallFailedRuntimeException e) {
log.warn("WCP COB business steps retrieval failed (expected if WCP COB not deployed): {}", e.getMessage());
log.debug("Full stack trace:", e);
Expand Down
Loading
Loading