feat: implement DIP/MNRL lookups and enhance Sanctions screening workflows
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-4) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-5) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (main, build-core) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (main, cucumber) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (progressive-loan, build-progressive-loan) (push) Canceled after 0s
Fineract Docker Builds / build (false, docker-compose-postgresql.yml, postgresql) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-5) (push) Canceled after 0s
Fineract Docker Builds / build (true, docker-compose.yml, mariadb) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 1 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-4) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-5) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-4) (push) Canceled after 0s
Fineract Documentation build / build (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 10 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 2 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 3 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 4 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 5 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 6 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 7 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 8 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 9 of 10) (push) Canceled after 0s
Fineract Liquibase Only mode - PostgreSQL / test (push) Canceled after 0s
Fineract Messaging Smoke Tests / Smoke Test with ActiveMQ (push) Canceled after 0s
Fineract Messaging Smoke Tests / Smoke Test with Kafka (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-4) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-5) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (main, build-core) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (main, cucumber) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (progressive-loan, build-progressive-loan) (push) Canceled after 0s
Fineract Docker Builds / build (false, docker-compose-postgresql.yml, postgresql) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-5) (push) Canceled after 0s
Fineract Docker Builds / build (true, docker-compose.yml, mariadb) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 1 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-4) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-5) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-4) (push) Canceled after 0s
Fineract Documentation build / build (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 10 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 2 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 3 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 4 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 5 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 6 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 7 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 8 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 9 of 10) (push) Canceled after 0s
Fineract Liquibase Only mode - PostgreSQL / test (push) Canceled after 0s
Fineract Messaging Smoke Tests / Smoke Test with ActiveMQ (push) Canceled after 0s
Fineract Messaging Smoke Tests / Smoke Test with Kafka (push) Canceled after 0s
- Implement DIP/MNRL lookup logs table, filtering, and detail review under reports. - Integrate DIP verification gating on client creation, allowing officers to record PROCEEDED/REJECTED decisions with reasons. - Upgrade Sanctions verification dialog to support comparing Name, DOB, and Nationality particulars. - Add Sanctions disposition recording (FALSE_POSITIVE / CONFIRMED_MATCH) awaiting Principal Officer approval. - Add sanctions-alert-review-dialog for reviewers to assess and escalate/clear flagged names. - Enforce strict screening reset logic on client name changes, preventing bypass of existing blocks. - Update routes and shell menu navigation to include DIP/MNRL Lookups and Sanctions Logs.
This commit is contained in:
+1
@@ -191,6 +191,7 @@ public class ClientApiConstants {
|
||||
public static final String constitutionIdParamName = "constitutionId";
|
||||
public static final String mainBusinessLineIdParamName = "mainBusinessLineId";
|
||||
public static final String authorizedSignatoryParamName = "authorizedSignatory";
|
||||
public static final String authorizedSignatoryClientIdsParamName = "authorizedSignatoryClientIds";
|
||||
public static final String additionalInfoParamName = "additionalInfo";
|
||||
public static final String dateOfRegistrationParamName = "dateOfRegistration";
|
||||
|
||||
|
||||
+14
@@ -34,6 +34,8 @@ public class ClientNonPersonData implements Serializable {
|
||||
private final CodeValueData mainBusinessLine;
|
||||
private final String remarks;
|
||||
private final String authorizedSignatory;
|
||||
/** Client ids behind {@link #authorizedSignatory}, comma separated and in the same order. */
|
||||
private final String authorizedSignatoryClientIds;
|
||||
private final String additionalInfo;
|
||||
private final LocalDate dateOfRegistration;
|
||||
|
||||
@@ -62,13 +64,24 @@ public class ClientNonPersonData implements Serializable {
|
||||
this.constitution = null;
|
||||
this.mainBusinessLine = null;
|
||||
this.authorizedSignatory = null;
|
||||
this.authorizedSignatoryClientIds = null;
|
||||
this.additionalInfo = null;
|
||||
this.dateOfRegistration = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kept for the list/search mappers, whose SQL does not select the signatory client ids.
|
||||
*/
|
||||
public ClientNonPersonData(CodeValueData constitution, String incorpNo, LocalDate incorpValidityTillDate,
|
||||
CodeValueData mainBusinessLine, String remarks, String authorizedSignatory, String additionalInfo,
|
||||
LocalDate dateOfRegistration) {
|
||||
this(constitution, incorpNo, incorpValidityTillDate, mainBusinessLine, remarks, authorizedSignatory, additionalInfo,
|
||||
dateOfRegistration, null);
|
||||
}
|
||||
|
||||
public ClientNonPersonData(CodeValueData constitution, String incorpNo, LocalDate incorpValidityTillDate,
|
||||
CodeValueData mainBusinessLine, String remarks, String authorizedSignatory, String additionalInfo,
|
||||
LocalDate dateOfRegistration, String authorizedSignatoryClientIds) {
|
||||
|
||||
this.constitution = constitution;
|
||||
this.incorpNumber = incorpNo;
|
||||
@@ -76,6 +89,7 @@ public class ClientNonPersonData implements Serializable {
|
||||
this.mainBusinessLine = mainBusinessLine;
|
||||
this.remarks = remarks;
|
||||
this.authorizedSignatory = authorizedSignatory;
|
||||
this.authorizedSignatoryClientIds = authorizedSignatoryClientIds;
|
||||
this.additionalInfo = additionalInfo;
|
||||
this.dateOfRegistration = dateOfRegistration;
|
||||
}
|
||||
|
||||
@@ -294,6 +294,17 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
@Column(name = "alternate_dip_timestamp")
|
||||
private String alternateDipTimestamp;
|
||||
|
||||
/**
|
||||
* The DIP/MNRL status the number actually returned — CLEAN, SUSPECTED, DISCONNECTED or
|
||||
* SERVICE_UNAVAILABLE. dipVerified alone cannot tell "checked and clean" apart from "the DoT
|
||||
* service was down", which previously stored both as verified.
|
||||
*/
|
||||
@Column(name = "dip_status", length = 40)
|
||||
private String dipStatus;
|
||||
|
||||
@Column(name = "alternate_dip_status", length = 40)
|
||||
private String alternateDipStatus;
|
||||
|
||||
@Column(name = "name_verified")
|
||||
private Boolean nameVerified;
|
||||
|
||||
|
||||
+52
@@ -25,11 +25,15 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.Transient;
|
||||
import jakarta.persistence.UniqueConstraint;
|
||||
import java.time.LocalDate;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
|
||||
@@ -61,6 +65,14 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
@JoinColumn(name = "client_id", nullable = false)
|
||||
private Client client;
|
||||
|
||||
/**
|
||||
* Scratch record of what the in-flight {@link #update} replaced, read back via
|
||||
* {@link #getFieldsOverwrittenByLastUpdate()}. Never persisted and never read outside the
|
||||
* transaction that called update(), which clears it first.
|
||||
*/
|
||||
@Transient
|
||||
private final transient Set<String> fieldsOverwrittenByLastUpdate = new LinkedHashSet<>();
|
||||
|
||||
/** 100 = PENDING, 200 = IN_PROGRESS, 300 = VERIFIED, 400 = REJECTED, 500 = EXPIRED */
|
||||
@Column(name = "kyc_status", nullable = false)
|
||||
private Integer kycStatus;
|
||||
@@ -440,11 +452,13 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
final Map<String, Object> actualChanges = new LinkedHashMap<>();
|
||||
this.fieldsOverwrittenByLastUpdate.clear();
|
||||
|
||||
final String panNumberParam = "panNumber";
|
||||
if (command.isChangeInStringParameterNamed(panNumberParam, this.panNumber)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(panNumberParam);
|
||||
actualChanges.put(panNumberParam, newValue);
|
||||
recordOverwrite(panNumberParam, this.panNumber);
|
||||
this.panNumber = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
@@ -452,6 +466,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
if (command.isChangeInStringParameterNamed(aadhaarParam, this.aadhaarNumberMasked)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(aadhaarParam);
|
||||
actualChanges.put(aadhaarParam, newValue);
|
||||
recordOverwrite(aadhaarParam, this.aadhaarNumberMasked);
|
||||
this.aadhaarNumberMasked = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
@@ -459,6 +474,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
if (command.isChangeInStringParameterNamed(gstinParam, this.gstinNumber)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(gstinParam);
|
||||
actualChanges.put(gstinParam, newValue);
|
||||
recordOverwrite(gstinParam, this.gstinNumber);
|
||||
this.gstinNumber = StringUtils.defaultIfEmpty(newValue, null);
|
||||
}
|
||||
|
||||
@@ -466,9 +482,12 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
if (command.isChangeInIntegerParameterNamed(riskParam, this.riskCategory)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(riskParam);
|
||||
actualChanges.put(riskParam, newValue);
|
||||
recordOverwrite(riskParam, this.riskCategory);
|
||||
this.riskCategory = newValue;
|
||||
}
|
||||
|
||||
// remarks is the audit justification itself, so a change to it is deliberately not recorded
|
||||
// as an overwrite — requiring remarks in order to write remarks would be circular.
|
||||
final String remarksParam = "remarks";
|
||||
if (command.isChangeInStringParameterNamed(remarksParam, this.remarks)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(remarksParam);
|
||||
@@ -551,6 +570,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
if (command.isChangeInStringParameterNamed(param, current)) {
|
||||
final String newValue = command.stringValueOfParameterNamed(param);
|
||||
changes.put(param, newValue);
|
||||
recordOverwrite(param, current);
|
||||
setter.accept(StringUtils.defaultIfEmpty(newValue, null));
|
||||
}
|
||||
}
|
||||
@@ -560,6 +580,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
if (command.isChangeInLocalDateParameterNamed(param, current)) {
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(param);
|
||||
changes.put(param, newValue);
|
||||
recordOverwrite(param, current);
|
||||
setter.accept(newValue);
|
||||
}
|
||||
}
|
||||
@@ -570,6 +591,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
final Boolean newValue = command.booleanObjectValueOfParameterNamed(param);
|
||||
if ((newValue == null && current != null) || (newValue != null && !newValue.equals(current))) {
|
||||
changes.put(param, newValue);
|
||||
recordOverwrite(param, current);
|
||||
setter.accept(newValue);
|
||||
}
|
||||
}
|
||||
@@ -580,10 +602,40 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
if (command.isChangeInBigDecimalParameterNamed(param, current)) {
|
||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(param);
|
||||
changes.put(param, newValue);
|
||||
recordOverwrite(param, current);
|
||||
setter.accept(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes that {@code param} replaced a value the record already held. A field going from empty to
|
||||
* populated is the record being completed rather than altered, so it is deliberately not
|
||||
* recorded — see {@link #getFieldsOverwrittenByLastUpdate()}.
|
||||
*/
|
||||
private void recordOverwrite(final String param, final Object currentValue) {
|
||||
final boolean wasPopulated = currentValue instanceof String text
|
||||
? StringUtils.isNotBlank(text)
|
||||
: currentValue != null;
|
||||
if (wasPopulated) {
|
||||
this.fieldsOverwrittenByLastUpdate.add(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters whose already-populated value the most recent {@link #update} replaced.
|
||||
*
|
||||
* <p>Distinguishes altering a record from finishing one: a non-individual KYC auto-verifies as
|
||||
* soon as PAN and GSTIN pass, which happens part-way through the create wizard, and the officer
|
||||
* still has to save the KYC document details afterwards. Those fields are empty at that point,
|
||||
* so filling them in leaves this set empty and no audit justification is demanded — while
|
||||
* changing a document number that was already on the verified record does populate it.
|
||||
*
|
||||
* <p>Reset at the start of every {@link #update} and never persisted: it describes one call.
|
||||
*/
|
||||
public Set<String> getFieldsOverwrittenByLastUpdate() {
|
||||
return Collections.unmodifiableSet(this.fieldsOverwrittenByLastUpdate);
|
||||
}
|
||||
|
||||
/** Called when documents are submitted and 3rd-party verification is initiated. */
|
||||
public void markInProgress() {
|
||||
this.kycStatus = ClientKycStatus.IN_PROGRESS.getValue();
|
||||
|
||||
+46
@@ -65,6 +65,29 @@ public class MobileLookupLog extends AbstractAuditableWithUTCDateTimeCustom<Long
|
||||
@Column(name = "looked_up_on", nullable = false)
|
||||
private OffsetDateTime lookedUpOn;
|
||||
|
||||
// ── Officer decision on a non-clean result ────────────────────────────────
|
||||
// A DIP hit is a fraud-risk signal rather than a legal bar, so onboarding may continue — but
|
||||
// the officer has to say why in writing, and that reasoning is kept with the lookup.
|
||||
|
||||
/** PROCEEDED | REJECTED. Null while no decision is required or none has been taken. */
|
||||
@Column(name = "override_decision", length = 20)
|
||||
private String overrideDecision;
|
||||
|
||||
@Column(name = "override_reason")
|
||||
private String overrideReason;
|
||||
|
||||
@Column(name = "decided_by")
|
||||
private Long decidedBy;
|
||||
|
||||
@Column(name = "decided_on")
|
||||
private OffsetDateTime decidedOn;
|
||||
|
||||
public static final String STATUS_CLEAN = "CLEAN";
|
||||
public static final String STATUS_ERROR = "ERROR";
|
||||
public static final String STATUS_SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE";
|
||||
public static final String DECISION_PROCEEDED = "PROCEEDED";
|
||||
public static final String DECISION_REJECTED = "REJECTED";
|
||||
|
||||
protected MobileLookupLog() {}
|
||||
|
||||
public MobileLookupLog(final String mobileNumber, final String lookupStatus,
|
||||
@@ -81,4 +104,27 @@ public class MobileLookupLog extends AbstractAuditableWithUTCDateTimeCustom<Long
|
||||
this.clientId = clientId;
|
||||
this.lookedUpOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||
}
|
||||
|
||||
public void recordDecision(final String decision, final String reason, final Long userId) {
|
||||
this.overrideDecision = decision;
|
||||
this.overrideReason = reason;
|
||||
this.decidedBy = userId;
|
||||
this.decidedOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||
}
|
||||
|
||||
/** True when the lookup produced something the officer must consciously decide about. */
|
||||
public boolean requiresDecision() {
|
||||
return this.suspected || this.disconnected;
|
||||
}
|
||||
|
||||
/**
|
||||
* A number may be used only when it came back clean, or when an officer explicitly chose to
|
||||
* proceed. An unreachable DoT service is NOT a pass — it means nothing was checked.
|
||||
*/
|
||||
public boolean isUsable() {
|
||||
if (STATUS_CLEAN.equals(this.lookupStatus)) {
|
||||
return true;
|
||||
}
|
||||
return DECISION_PROCEEDED.equals(this.overrideDecision);
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -19,6 +19,8 @@
|
||||
package org.apache.fineract.portfolio.mobilelookup.domain;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
@@ -35,4 +37,29 @@ public interface MobileLookupLogRepository extends JpaRepository<MobileLookupLog
|
||||
|
||||
@Query("SELECT l FROM MobileLookupLog l WHERE l.lookupStatus = :status ORDER BY l.lookedUpOn DESC")
|
||||
List<MobileLookupLog> findByLookupStatus(@Param("status") String status);
|
||||
|
||||
/** Non-clean lookups still waiting for an officer's decision — the DIP review queue. */
|
||||
@Query("SELECT l FROM MobileLookupLog l WHERE (l.suspected = true OR l.disconnected = true) "
|
||||
+ "AND l.overrideDecision IS NULL ORDER BY l.lookedUpOn DESC")
|
||||
List<MobileLookupLog> findPendingDecisions();
|
||||
|
||||
/**
|
||||
* Most recent lookup for a number, used by the server-side gate to confirm the browser's
|
||||
* claim that a number was verified.
|
||||
*
|
||||
* <p>
|
||||
* Paged rather than a JPQL {@code LIMIT}, which EclipseLink does not accept — the caller
|
||||
* takes the first row.
|
||||
* </p>
|
||||
*/
|
||||
@Query("SELECT l FROM MobileLookupLog l WHERE l.mobileNumber = :mobileNumber ORDER BY l.lookedUpOn DESC")
|
||||
List<MobileLookupLog> findLatestByMobileNumber(@Param("mobileNumber") String mobileNumber, Pageable pageable);
|
||||
|
||||
/**
|
||||
* Earlier rejections of the same number, on any client. A number turned away once is a
|
||||
* standing signal: without this the next officer screens it fresh and sees no history.
|
||||
*/
|
||||
@Query("SELECT l FROM MobileLookupLog l WHERE l.mobileNumber = :mobileNumber "
|
||||
+ "AND l.overrideDecision = 'REJECTED' ORDER BY l.decidedOn DESC")
|
||||
List<MobileLookupLog> findRejections(@Param("mobileNumber") String mobileNumber, Pageable pageable);
|
||||
}
|
||||
|
||||
+98
@@ -61,6 +61,47 @@ public class SanctionsScreeningLog extends AbstractAuditableWithUTCDateTimeCusto
|
||||
@Column(name = "screened_on", nullable = false)
|
||||
private OffsetDateTime screenedOn;
|
||||
|
||||
// ── Alert disposition ─────────────────────────────────────────────────────
|
||||
// A FLAGGED screening opens a case. It stays PENDING_REVIEW until an officer either
|
||||
// documents it as a different person (FALSE_POSITIVE, effective only once the Principal
|
||||
// Officer approves) or confirms it (CONFIRMED_MATCH, which freezes and gets reported).
|
||||
|
||||
@Column(name = "disposition", length = 30)
|
||||
private String disposition;
|
||||
|
||||
@Column(name = "disposition_reason")
|
||||
private String dispositionReason;
|
||||
|
||||
@Column(name = "reviewed_by")
|
||||
private Long reviewedBy;
|
||||
|
||||
@Column(name = "reviewed_on")
|
||||
private OffsetDateTime reviewedOn;
|
||||
|
||||
@Column(name = "approved_by")
|
||||
private Long approvedBy;
|
||||
|
||||
@Column(name = "approved_on")
|
||||
private OffsetDateTime approvedOn;
|
||||
|
||||
@Column(name = "fiu_str_reference", length = 100)
|
||||
private String fiuStrReference;
|
||||
|
||||
@Column(name = "nodal_officer_informed_on")
|
||||
private OffsetDateTime nodalOfficerInformedOn;
|
||||
|
||||
@Column(name = "frozen_account_ids", length = 1000)
|
||||
private String frozenAccountIds;
|
||||
|
||||
@Column(name = "frozen_on")
|
||||
private OffsetDateTime frozenOn;
|
||||
|
||||
public static final String RESULT_FLAGGED = "FLAGGED";
|
||||
public static final String RESULT_CLEAR = "CLEAR";
|
||||
public static final String DISPOSITION_PENDING = "PENDING_REVIEW";
|
||||
public static final String DISPOSITION_FALSE_POSITIVE = "FALSE_POSITIVE";
|
||||
public static final String DISPOSITION_CONFIRMED = "CONFIRMED_MATCH";
|
||||
|
||||
protected SanctionsScreeningLog() {}
|
||||
|
||||
public SanctionsScreeningLog(final String screenedName, final String screeningResult,
|
||||
@@ -75,8 +116,55 @@ public class SanctionsScreeningLog extends AbstractAuditableWithUTCDateTimeCusto
|
||||
this.clientId = clientId;
|
||||
this.ipAddress = ipAddress;
|
||||
this.screenedOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||
// A hit opens a case; a clear screening has no case to close.
|
||||
this.disposition = RESULT_FLAGGED.equals(screeningResult) ? DISPOSITION_PENDING : null;
|
||||
}
|
||||
|
||||
// ── Alert lifecycle ───────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Records the officer's assessment of the hit. Deliberately does NOT clear the block: a
|
||||
* false positive only takes effect once {@link #approve(Long)} is called by the Principal
|
||||
* Officer, so the person who raised it cannot wave their own match through.
|
||||
*/
|
||||
public void recordDisposition(final String newDisposition, final String reason, final Long userId) {
|
||||
this.disposition = newDisposition;
|
||||
this.dispositionReason = reason;
|
||||
this.reviewedBy = userId;
|
||||
this.reviewedOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||
// Re-opening a previously approved alert must drop the old approval with it.
|
||||
this.approvedBy = null;
|
||||
this.approvedOn = null;
|
||||
}
|
||||
|
||||
public void approve(final Long approverId) {
|
||||
this.approvedBy = approverId;
|
||||
this.approvedOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||
}
|
||||
|
||||
/** Records the FIU-IND STR reference and the date the nodal officer was informed. */
|
||||
public void recordReporting(final String strReference, final OffsetDateTime nodalOfficerInformedOn) {
|
||||
if (strReference != null) {
|
||||
this.fiuStrReference = strReference;
|
||||
}
|
||||
if (nodalOfficerInformedOn != null) {
|
||||
this.nodalOfficerInformedOn = nodalOfficerInformedOn;
|
||||
}
|
||||
}
|
||||
|
||||
public void recordFreeze(final String accountIds) {
|
||||
this.frozenAccountIds = accountIds;
|
||||
this.frozenOn = DateUtils.getOffsetDateTimeOfTenant();
|
||||
}
|
||||
|
||||
public boolean isFlagged() { return RESULT_FLAGGED.equals(this.screeningResult); }
|
||||
|
||||
public boolean isApprovedFalsePositive() {
|
||||
return DISPOSITION_FALSE_POSITIVE.equals(this.disposition) && this.approvedBy != null;
|
||||
}
|
||||
|
||||
public boolean isConfirmedMatch() { return DISPOSITION_CONFIRMED.equals(this.disposition); }
|
||||
|
||||
// ── Accessors ─────────────────────────────────────────────────────────────
|
||||
|
||||
public String getScreenedName() { return screenedName; }
|
||||
@@ -89,4 +177,14 @@ public class SanctionsScreeningLog extends AbstractAuditableWithUTCDateTimeCusto
|
||||
public void setClientId(Long clientId) { this.clientId = clientId; }
|
||||
public String getIpAddress() { return ipAddress; }
|
||||
public OffsetDateTime getScreenedOn() { return screenedOn; }
|
||||
public String getDisposition() { return disposition; }
|
||||
public String getDispositionReason() { return dispositionReason; }
|
||||
public Long getReviewedBy() { return reviewedBy; }
|
||||
public OffsetDateTime getReviewedOn() { return reviewedOn; }
|
||||
public Long getApprovedBy() { return approvedBy; }
|
||||
public OffsetDateTime getApprovedOn() { return approvedOn; }
|
||||
public String getFiuStrReference() { return fiuStrReference; }
|
||||
public OffsetDateTime getNodalOfficerInformedOn() { return nodalOfficerInformedOn; }
|
||||
public String getFrozenAccountIds() { return frozenAccountIds; }
|
||||
public OffsetDateTime getFrozenOn() { return frozenOn; }
|
||||
}
|
||||
|
||||
+20
@@ -39,4 +39,24 @@ public interface SanctionsScreeningLogRepository extends JpaRepository<Sanctions
|
||||
|
||||
@Query("SELECT l FROM SanctionsScreeningLog l WHERE LOWER(l.screenedName) LIKE LOWER(CONCAT('%', :name, '%')) ORDER BY l.screenedOn DESC")
|
||||
List<SanctionsScreeningLog> findByScreenedNameContaining(@Param("name") String name);
|
||||
|
||||
@Query("SELECT l FROM SanctionsScreeningLog l WHERE l.disposition = :disposition ORDER BY l.screenedOn DESC")
|
||||
List<SanctionsScreeningLog> findByDisposition(@Param("disposition") String disposition);
|
||||
|
||||
/** Every open alert — the Principal Officer's review queue. */
|
||||
@Query("SELECT l FROM SanctionsScreeningLog l WHERE l.disposition IS NOT NULL ORDER BY l.screenedOn DESC")
|
||||
List<SanctionsScreeningLog> findAllAlerts();
|
||||
|
||||
/**
|
||||
* A name is only cleared to onboard once a false positive on that exact name has been
|
||||
* approved by the Principal Officer — the maker's own assessment is not enough.
|
||||
*/
|
||||
@Query("SELECT COUNT(l) FROM SanctionsScreeningLog l WHERE LOWER(TRIM(l.screenedName)) = LOWER(TRIM(:name)) "
|
||||
+ "AND l.disposition = 'FALSE_POSITIVE' AND l.approvedBy IS NOT NULL")
|
||||
long countApprovedFalsePositives(@Param("name") String name);
|
||||
|
||||
/** Latest alert for a client, used to decide whether their accounts must stay frozen. */
|
||||
@Query("SELECT l FROM SanctionsScreeningLog l WHERE l.clientId = :clientId AND l.screeningResult = 'FLAGGED' "
|
||||
+ "ORDER BY l.screenedOn DESC")
|
||||
List<SanctionsScreeningLog> findFlaggedByClientId(@Param("clientId") Long clientId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user