KYC management: stage-wise notices, pagination, RD base chart
This commit is contained in:
@@ -18,6 +18,7 @@ import { map, catchError } from 'rxjs/operators';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
import { dataUrlToFile } from 'app/shared/utils/data-url.util';
|
||||
import { ClientIdentityLookupResult } from './models/client-identity.model';
|
||||
|
||||
/**
|
||||
* Clients service.
|
||||
@@ -742,9 +743,14 @@ export class ClientsService {
|
||||
sortDirection: string = '',
|
||||
activeOnly: boolean = false,
|
||||
legalFormType: string = '',
|
||||
silent: boolean = false
|
||||
silent: boolean = false,
|
||||
officeId: number | null = null
|
||||
) {
|
||||
const innerRequest: any = { text };
|
||||
// Branch filter (Head Office list). The server still limits results to the caller's office hierarchy.
|
||||
if (officeId != null) {
|
||||
innerRequest.officeId = officeId;
|
||||
}
|
||||
if (activeOnly) {
|
||||
innerRequest.activeOnly = true;
|
||||
}
|
||||
@@ -868,6 +874,39 @@ export class ClientsService {
|
||||
return this.http.post(`/clients/${clientId}/kyc`, kycData);
|
||||
}
|
||||
|
||||
/**
|
||||
* "Is this person already a customer of the bank?" — across every branch, by PAN, Aadhaar fingerprint or GSTIN.
|
||||
* Any ONE of them matching means the same customer. `contactConflicts` reports a phone/email already used by another
|
||||
* client, which is never the same customer. Only the Aadhaar's SHA-256 is sent, never the number.
|
||||
*/
|
||||
/**
|
||||
* Introduces a customer of another branch to the caller's branch, so the branch can see them and open an account
|
||||
* for them there. The customer stays at the home branch. Safe to repeat.
|
||||
*/
|
||||
linkClientToMyBranch(
|
||||
clientId: number
|
||||
): Observable<{ clientId: number; linked: boolean; officeId: number; officeName: string }> {
|
||||
return this.http.post<{ clientId: number; linked: boolean; officeId: number; officeName: string }>(
|
||||
'/clientidentity/link',
|
||||
{
|
||||
clientId
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
lookupClientIdentity(identity: {
|
||||
panNumber?: string | null;
|
||||
aadhaarHash?: string | null;
|
||||
gstinNumber?: string | null;
|
||||
mobileNo?: string | null;
|
||||
emailAddress?: string | null;
|
||||
excludeClientId?: number | null;
|
||||
}): Observable<ClientIdentityLookupResult> {
|
||||
return this.http.post<ClientIdentityLookupResult>('/clientidentity/lookup', identity, {
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Screen a client name against the UN Security Council consolidated sanctions list.
|
||||
* @param name The name to screen
|
||||
@@ -1073,9 +1112,146 @@ export class ClientsService {
|
||||
*/
|
||||
saveKycContactLog(
|
||||
clientId: string | number,
|
||||
data: { channel: string; notes: string; officerName?: string }
|
||||
data: { channel: string; notes: string; officerName?: string; noticeType?: string },
|
||||
silent = false
|
||||
): Observable<any> {
|
||||
return this.http.post(`/kyc/exceptions/${clientId}/contact-log`, data);
|
||||
return this.http.post(
|
||||
`/kyc/exceptions/${clientId}/contact-log`,
|
||||
data,
|
||||
silent ? { context: new HttpContext().set(SILENT_HTTP_ERROR, true) } : {}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The subject and text a customer would receive for the stage they are at today.
|
||||
* `type` is KYC or DORMANCY; the body comes back empty when they are at no such stage.
|
||||
*/
|
||||
previewKycNotice(clientId: string | number, type: string): Observable<{ subject?: string; body?: string }> {
|
||||
return this.http.get<{ subject?: string; body?: string }>(
|
||||
`/kyc/exceptions/${clientId}/contact-log/preview?type=${type}`,
|
||||
{
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/** Queues notices to be sent in the background by the queue job. */
|
||||
enqueueKycNotices(body: {
|
||||
items: { clientId: number; noticeType: string; channel: string; accountNo?: string; stageLabel?: string }[];
|
||||
notes?: string;
|
||||
officerName?: string;
|
||||
sendAt?: string;
|
||||
}): Observable<{ queued: number; skipped: number; unreachable: number }> {
|
||||
return this.http.post<{ queued: number; skipped: number; unreachable: number }>('/kyc/notice-queue', body);
|
||||
}
|
||||
|
||||
/** Queued notices, newest first; status narrows to PENDING, SENT, FAILED or CANCELLED. */
|
||||
getKycNoticeQueue(status = ''): Observable<any[]> {
|
||||
return this.http.get<any[]>(`/kyc/notice-queue${status ? `?status=${status}` : ''}`, {
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
actOnKycNotice(id: number, command: 'cancel' | 'retry'): Observable<any> {
|
||||
return this.http.post(`/kyc/notice-queue/${id}?command=${command}`, {});
|
||||
}
|
||||
|
||||
/** What each of these customers has been sent so far: the latest notice, how many, and which channels are done. */
|
||||
getKycContactSummary(clientIds: number[]): Observable<
|
||||
{
|
||||
clientId: number;
|
||||
count: number;
|
||||
lastAt: string;
|
||||
lastChannel: string;
|
||||
lastStatus: string;
|
||||
doneChannels: string[];
|
||||
balance?: number;
|
||||
hasMobile?: boolean;
|
||||
hasEmail?: boolean;
|
||||
mobileMasked?: string | null;
|
||||
emailMasked?: string | null;
|
||||
}[]
|
||||
> {
|
||||
return this.http.get<
|
||||
{
|
||||
clientId: number;
|
||||
count: number;
|
||||
lastAt: string;
|
||||
lastChannel: string;
|
||||
lastStatus: string;
|
||||
doneChannels: string[];
|
||||
hasMobile?: boolean;
|
||||
hasEmail?: boolean;
|
||||
mobileMasked?: string | null;
|
||||
emailMasked?: string | null;
|
||||
}[]
|
||||
>('/kyc/contact-audit/clients', {
|
||||
params: new HttpParams().set('ids', clientIds.join(',')),
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
/** Notices per customer (counts, outcomes, the latest), most recently contacted first, a page at a time. */
|
||||
getKycContactAuditCustomers(
|
||||
filter: {
|
||||
from?: string;
|
||||
to?: string;
|
||||
channel?: string;
|
||||
status?: string;
|
||||
search?: string;
|
||||
real?: boolean;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
} = {}
|
||||
): Observable<{ total: number; rows: any[] }> {
|
||||
return this.http.get<{ total: number; rows: any[] }>('/kyc/contact-audit/customers', {
|
||||
params: this.auditParams(filter),
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
/** Notices per day (customers, notices, outcomes), newest day first. */
|
||||
getKycContactAuditDays(
|
||||
filter: { from?: string; to?: string; channel?: string; status?: string; search?: string; real?: boolean } = {}
|
||||
): Observable<any[]> {
|
||||
return this.http.get<any[]>('/kyc/contact-audit/days', {
|
||||
params: this.auditParams(filter),
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
/** Customer notices on record, newest first, a page at a time. */
|
||||
getKycContactAudit(
|
||||
filter: {
|
||||
from?: string;
|
||||
to?: string;
|
||||
channel?: string;
|
||||
status?: string;
|
||||
search?: string;
|
||||
real?: boolean;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
} = {}
|
||||
): Observable<{ total: number; rows: any[] }> {
|
||||
return this.http.get<{ total: number; rows: any[] }>('/kyc/contact-audit', {
|
||||
params: this.auditParams(filter),
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
private auditParams(filter: Record<string, string | number | boolean | undefined>): HttpParams {
|
||||
let params = new HttpParams();
|
||||
Object.entries(filter).forEach(
|
||||
([
|
||||
k,
|
||||
v
|
||||
]) => {
|
||||
if (v !== undefined && v !== null && v !== '') {
|
||||
params = params.set(k, String(v));
|
||||
}
|
||||
}
|
||||
);
|
||||
return params;
|
||||
}
|
||||
|
||||
getKycContactLog(clientId: string | number): Observable<any[]> {
|
||||
@@ -1092,6 +1268,14 @@ export class ClientsService {
|
||||
return this.http.get<any[]>('/kyc/exceptions/lapsed');
|
||||
}
|
||||
|
||||
/** Clients whose re-KYC falls due within the next `days` days (default 30), soonest first. */
|
||||
getExpiringKyc(days = 30): Observable<any[]> {
|
||||
// The caller reports a failure in its own banner, so the global popup is suppressed.
|
||||
return this.http.get<any[]>(`/kyc/exceptions/expiring?days=${days}`, {
|
||||
context: new HttpContext().set(SILENT_HTTP_ERROR, true)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Savings accounts the dormancy job has marked.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user