From df5ff2d4fcb6214277e1165f8d1f5d0d75cac979 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Tue, 10 Feb 2026 02:24:10 +0100 Subject: [PATCH] feat: export IdentDoc images from latest completed Ident step Only export IdentDoc images that belong to the newest completed identification step, filtering by kycStep.transactionId in the blob filename. This prevents exporting blurry/failed images from earlier identification attempts. --- src/config/config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config/config.ts b/src/config/config.ts index 7e0e9edf69..29314d1214 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -311,9 +311,15 @@ export class Configuration { fileTypes: [ContentType.PDF], }, { - name: (file: KycFileBlob) => `IdentDoc_${file.name.split('/').pop()?.split('.')[0] ?? 'unknown'}`, + name: (file: KycFileBlob) => file.name.split('/').pop()?.split('.')[0] ?? 'IdentDoc', prefixes: (userData: UserData) => [`user/${userData.id}/Identification`], fileTypes: [ContentType.PNG, ContentType.JPEG, ContentType.JPG], + filter: (file: KycFileBlob, userData: UserData) => { + const latestIdent = userData.kycSteps + .filter((s) => s.name === KycStepName.IDENT && s.isCompleted && s.transactionId) + .sort((a, b) => b.id - a.id)[0]; + return latestIdent ? file.name.includes(latestIdent.transactionId) : false; + }, selectAll: true, handleFileNotFound: () => true, },