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
@@ -0,0 +1,51 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.api;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.BeanParam;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.onboarding.data.EnrollmentCaseData;
import org.apache.fineract.onboarding.data.EnrollmentCasesRequest;
import org.apache.fineract.onboarding.service.EnrollmentStatusReadPlatformService;
import org.springframework.stereotype.Component;

/** Back-office read model for source-qualified enrollment dashboard data. */
@Path("/v2/onboarding/cases")
@Component
@Tag(name = "Onboarding Cases", description = "Read enrollment status projections")
@RequiredArgsConstructor
public class OnboardingCasesApiResource {

private static final String RESOURCE_NAME_FOR_PERMISSIONS = "CLIENT";
private static final String ENROLLMENT_STATUS_RESOURCE_NAME = "ENROLLMENT_STATUS";

private final PlatformSecurityContext context;
private final EnrollmentStatusReadPlatformService readPlatformService;

@GET
@Produces(MediaType.APPLICATION_JSON)
@Operation(
summary = "List enrollment status cases",
description =
"Returns office-scoped enrollment status projections derived from Fineract client"
+ " lifecycle and savings-plugin KYC records. Unsupported stages are returned as"
+ " UNKNOWN instead of inferred.")
public Page<EnrollmentCaseData> retrieveEnrollmentCases(
@BeanParam final EnrollmentCasesRequest request) {
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
context.authenticatedUser().validateHasReadPermission(ENROLLMENT_STATUS_RESOURCE_NAME);
return readPlatformService.retrieveEnrollmentCases(request);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.data;

public record EnrollmentAgingData(Integer days, String trafficLight, String source) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.data;

import java.util.List;

public record EnrollmentCaseData(
Long clientId,
String clientName,
Long officeId,
String clientLifecycleStatus,
List<EnrollmentStageData> enrollmentStages,
KycEvidenceData kycEvidence) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.data;

public record EnrollmentCasesCriteria(String view, Long clientId, int limit, int offset) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.data;

import io.swagger.v3.oas.annotations.Parameter;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.QueryParam;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class EnrollmentCasesRequest {

@QueryParam("view")
@DefaultValue("enrollment")
@Parameter(description = "Only enrollment is currently supported")
private String view = "enrollment";

@QueryParam("clientId")
@Parameter(description = "Optional client id filter")
private Long clientId;

@QueryParam("limit")
@DefaultValue("50")
@Parameter(description = "Maximum rows to return")
private Integer limit = 50;

@QueryParam("offset")
@DefaultValue("0")
@Parameter(description = "Rows to skip")
private Integer offset = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.data;

public record EnrollmentStageData(
String name,
String status,
String startedAt,
String completedAt,
String source,
EnrollmentAgingData aging) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.data;

public record KycEvidenceData(
Long verificationId,
String sessionId,
String verificationCreatedAt,
String verificationLastModifiedAt,
String providerDecisionStatus,
String providerDecisionCreatedAt,
String derivedKycStatus,
Boolean faceMatchEvidencePresent,
String faceMatchEvidenceStatus,
Boolean faceMatchEvidenceSucceeded,
Boolean idVerificationEvidencePresent,
String idVerificationEvidenceStatus,
Boolean idVerificationEvidenceSucceeded,
Boolean amlScreeningEvidencePresent,
String amlScreeningEvidenceStatus,
Boolean amlScreeningEvidenceSucceeded) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright since 2026 Mifos Initiative
*
* <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy
* of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.apache.fineract.onboarding.service;

import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.onboarding.data.EnrollmentCaseData;
import org.apache.fineract.onboarding.data.EnrollmentCasesRequest;

public interface EnrollmentStatusReadPlatformService {

Page<EnrollmentCaseData> retrieveEnrollmentCases(EnrollmentCasesRequest request);
}
Loading