From 0a0b892b9b3653d994d00c505e2602d8fc334e92 Mon Sep 17 00:00:00 2001 From: Mikhail Privalov Date: Thu, 16 Nov 2023 22:25:38 +0300 Subject: [PATCH] Cert check (#3218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Проверка ОГРН * Проверка ОГРН reversed --- l2-frontend/src/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/l2-frontend/src/utils.ts b/l2-frontend/src/utils.ts index 7358e0a29c..a0253cf7bc 100644 --- a/l2-frontend/src/utils.ts +++ b/l2-frontend/src/utils.ts @@ -374,7 +374,13 @@ export const convertSubjectNameToTitle = (object: any, subjectName: string | nul export const subjectNameHasOGRN = (object: any, subjectName: string | null) => { const obj = object || convertSubjectNameToCertObject(subjectName); - return String(obj['ОГРН'] || '').length === 13; + let ogrn = obj['ОГРН'] || null; + + if (!ogrn) { + ogrn = Object.entries(obj).find(([, v]) => v === 'ОГРН')?.[0] || null; + } + + return String(ogrn || '').length === 13; }; export const validateEmail = (email: string) => Boolean(