diff --git a/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/AmlMatch.tsx b/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/AmlMatch.tsx index 365adb5907..af1224150c 100644 --- a/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/AmlMatch.tsx +++ b/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/AmlMatch.tsx @@ -11,17 +11,19 @@ interface IAmlMatchProps { sanctions: THit['sanctions']; adverseMedia: THit['adverseMedia']; fitnessProbity: THit['fitnessProbity']; + other: THit['other']; }; } export const AmlMatch = ({ match }: IAmlMatchProps) => { const orderedTypes = useMemo( () => [ - { key: 'pep', accessor: 'person', header: 'PEP' }, - { key: 'warnings', accessor: 'warning', header: 'Warnings' }, - { key: 'sanctions', accessor: 'sanction', header: 'Sanctions' }, - { key: 'adverseMedia', accessor: 'entry', header: 'Adverse Media' }, - { key: 'fitnessProbity', accessor: 'entry', header: 'Fitness Probity' }, + { key: 'pep', header: 'PEP' }, + { key: 'warnings', header: 'Warnings' }, + { key: 'sanctions', header: 'Sanctions' }, + { key: 'adverseMedia', header: 'Adverse Media' }, + { key: 'fitnessProbity', header: 'Fitness Probity' }, + { key: 'other', header: 'Other' }, ], [], ); @@ -39,10 +41,10 @@ export const AmlMatch = ({ match }: IAmlMatchProps) => {
{type.header} - {item[type.accessor]} + {item.sourceName} - {item.source && ( + {item.sourceUrl && ( { })} target={'_blank'} rel={'noopener noreferrer'} - href={item.source} + href={item.sourceUrl} > Link diff --git a/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx b/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx index 451d3b9ac6..837c394a5b 100644 --- a/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx +++ b/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/hooks/useAmlBlock/useAmlBlock.tsx @@ -182,6 +182,12 @@ export const useAmlBlock = (data: Array) => { }, header: 'Fitness Probity', }), + columnHelper.accessor('other', { + cell: info => { + return {info.getValue().length}; + }, + header: 'Other', + }), ], }, }) diff --git a/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/utils/aml-adapter.ts b/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/utils/aml-adapter.ts index 4eed8d79cd..939acbcce4 100644 --- a/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/utils/aml-adapter.ts +++ b/apps/backoffice-v2/src/lib/blocks/components/AmlBlock/utils/aml-adapter.ts @@ -2,6 +2,7 @@ import { z } from 'zod'; const SourceInfoSchema = z .object({ + type: z.string().optional().nullable(), sourceName: z.string().optional().nullable(), sourceUrl: z.string().optional().nullable(), date: z.string().optional().nullable(), @@ -20,6 +21,7 @@ export const HitSchema = z.object({ pep: z.array(SourceInfoSchema).optional().nullable(), adverseMedia: z.array(SourceInfoSchema).optional().nullable(), fitnessProbity: z.array(SourceInfoSchema).optional().nullable(), + other: z.array(SourceInfoSchema).optional().nullable(), }); export type THit = z.infer; @@ -31,6 +33,14 @@ export const AmlSchema = z.object({ export type TAml = z.infer; +const getEntryFromSource = (sourceInfo: z.infer) => { + return { + date: sourceInfo?.date, + sourceName: [sourceInfo?.sourceName, sourceInfo?.type].filter(Boolean).join(' - '), + sourceUrl: sourceInfo?.sourceUrl, + }; +}; + export const amlAdapter = (aml: TAml) => { const { hits, createdAt } = aml; @@ -51,42 +61,20 @@ export const amlAdapter = (aml: TAml) => { pep, adverseMedia, fitnessProbity, + other, }) => ({ matchedName, dateOfBirth, countries: countries?.join(', ') ?? '', matchTypes: matchTypes?.join(', ') ?? '', aka: aka?.join(', ') ?? '', - sanctions: - sanctions?.filter(Boolean).map(sanction => ({ - sanction: sanction?.sourceName, - date: sanction?.date, - source: sanction?.sourceUrl, - })) ?? [], - warnings: - warnings?.filter(Boolean).map(warning => ({ - warning: warning?.sourceName, - date: warning?.date, - source: warning?.sourceUrl, - })) ?? [], - pep: - pep?.filter(Boolean).map(pepItem => ({ - person: pepItem?.sourceName, - date: pepItem?.date, - source: pepItem?.sourceUrl, - })) ?? [], - adverseMedia: - adverseMedia?.filter(Boolean).map(adverseMediaItem => ({ - entry: adverseMediaItem?.sourceName, - date: adverseMediaItem?.date, - source: adverseMediaItem?.sourceUrl, - })) ?? [], + sanctions: sanctions?.filter(Boolean).map(item => getEntryFromSource(item)) ?? [], + warnings: warnings?.filter(Boolean).map(item => getEntryFromSource(item)) ?? [], + pep: pep?.filter(Boolean).map(item => getEntryFromSource(item)) ?? [], + adverseMedia: adverseMedia?.filter(Boolean).map(item => getEntryFromSource(item)) ?? [], fitnessProbity: - fitnessProbity?.filter(Boolean).map(fitnessProbityItem => ({ - entry: fitnessProbityItem?.sourceName, - date: fitnessProbityItem?.date, - source: fitnessProbityItem?.sourceUrl, - })) ?? [], + fitnessProbity?.filter(Boolean).map(item => getEntryFromSource(item)) ?? [], + other: other?.filter(Boolean).map(item => getEntryFromSource(item)) ?? [], }), ) ?? [], }; diff --git a/services/workflows-service/prisma/data-migrations b/services/workflows-service/prisma/data-migrations index 08f7c7b800..12d06b41a2 160000 --- a/services/workflows-service/prisma/data-migrations +++ b/services/workflows-service/prisma/data-migrations @@ -1 +1 @@ -Subproject commit 08f7c7b800b359ced60b243b67441036e9499ffa +Subproject commit 12d06b41a229f959320ccaec5eccd789c66264e6 diff --git a/services/workflows-service/scripts/generate-end-user.ts b/services/workflows-service/scripts/generate-end-user.ts index 3fe1685a44..08be05165e 100644 --- a/services/workflows-service/scripts/generate-end-user.ts +++ b/services/workflows-service/scripts/generate-end-user.ts @@ -243,6 +243,13 @@ export const generateEndUser = ({ sourceUrl: faker.internet.url(), }, ], + other: [ + { + date: faker.date.recent(2).toISOString(), + sourceName: faker.company.name(), + sourceUrl: faker.internet.url(), + }, + ], matchTypes: ['PEP'], } satisfies z.infer[number]), ), diff --git a/services/workflows-service/src/end-user/end-user.schema.ts b/services/workflows-service/src/end-user/end-user.schema.ts index c43fe30b03..19b30335f6 100644 --- a/services/workflows-service/src/end-user/end-user.schema.ts +++ b/services/workflows-service/src/end-user/end-user.schema.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; const ActiveMonitoringSchema = z.object({ type: z.literal('aml'), - vendor: z.enum(['veriff', 'test']), + vendor: z.enum(['veriff', 'test', 'dow-jones']), monitoredUntil: z.string().datetime(), sessionId: z.string(), }); @@ -10,13 +10,14 @@ const ActiveMonitoringSchema = z.object({ export const EndUserActiveMonitoringsSchema = z.array(ActiveMonitoringSchema); const SourceSchema = z.object({ + type: z.string().nullable().optional(), sourceName: z.string().nullable().optional(), sourceUrl: z.string().url().nullable().optional(), date: z.string().nullable().optional(), }); const AmlHitSchema = z.object({ - vendor: z.enum(['veriff', 'test']), + vendor: z.enum(['veriff', 'test', 'dow-jones']), matchedName: z.string(), countries: z.array(z.string()), matchTypes: z.array(z.string()), @@ -25,6 +26,7 @@ const AmlHitSchema = z.object({ fitnessProbity: z.array(SourceSchema), pep: z.array(SourceSchema), adverseMedia: z.array(SourceSchema), + other: z.array(SourceSchema).optional(), }); export const EndUserAmlHitsSchema = z.array(AmlHitSchema);