diff --git a/src/recipes/authenticity/get-authenticity-check-list/get-authenticity-check-list.recipe.ts b/src/recipes/authenticity/get-authenticity-check-list/get-authenticity-check-list.recipe.ts index 7b075e1..558cd9c 100644 --- a/src/recipes/authenticity/get-authenticity-check-list/get-authenticity-check-list.recipe.ts +++ b/src/recipes/authenticity/get-authenticity-check-list/get-authenticity-check-list.recipe.ts @@ -5,7 +5,6 @@ import { AuthenticityOCRSecurityTextCheckResult, AuthenticityPhotoIdentCheckResult, AuthenticitySecurityFeatureCheckResult, - eAuthenticity, eCheckDiagnose, eCheckResult, eLights, @@ -124,13 +123,22 @@ export const getAuthenticityCheckList = (input: ProcessResponse): RAuthenticityC } current.groups[groupIndex].checks.push(RAuthenticityTextCheck.fromPlain({ + reference: { + type: subItem.EtalonResultType, + reference: subItem.EtalonResultOCR, + result: subItem.SecurityTextResultOCR, + location: { + light: subItem.EtalonLightType, + rect: [subItem.EtalonFieldRect], + } + }, checkType: subItem.Type, checkResult: subItem.ElementResult ?? eCheckResult.WAS_NOT_DONE, type: subItem.EtalonFieldType, diagnose: subItem.ElementDiagnose ?? eCheckDiagnose.UNKNOWN, location: { light: subItem.LightType, - rect: [subItem.EtalonFieldRect], + rect: [subItem.FieldRect], } })) }) diff --git a/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/authenticity-text-check.model.ts b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/authenticity-text-check.model.ts index 4ff46f1..4e8a252 100644 --- a/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/authenticity-text-check.model.ts +++ b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/authenticity-text-check.model.ts @@ -1,6 +1,5 @@ import { IsDefined, IsEnum, IsIn, ValidateNested } from 'class-validator' import { plainToInstance, Type } from 'class-transformer' - import { AuthenticityOCRSecurityTextCheckResultTypes, eCheckDiagnose, @@ -8,14 +7,17 @@ import { eVisualFieldType, type tAuthenticityOCRSecurityTextCheckResultType, } from '@regulaforensics/document-reader-typings' + import { aAuthenticityCheck } from '../authenticity-check.abstract' -import { iRLocation, RLocation } from './children' +import { iRAuthenticityTextCheckReference, iRLocation, RAuthenticityTextCheckReference, RLocation } from './children' /** * Authenticity text check result type */ export interface iRAuthenticityTextCheck extends aAuthenticityCheck { + reference: iRAuthenticityTextCheckReference + /** * Feature type * @type {tAuthenticityOCRSecurityTextCheckResultType} @@ -51,6 +53,11 @@ export interface iRAuthenticityTextCheck extends aAuthenticityCheck { * Authenticity text check result type */ export class RAuthenticityTextCheck extends aAuthenticityCheck implements iRAuthenticityTextCheck { + @IsDefined() + @ValidateNested() + @Type(() => RAuthenticityTextCheckReference) + reference: RAuthenticityTextCheckReference + /** * Feature type * @type {tAuthenticityOCRSecurityTextCheckResultType} diff --git a/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/authenticity-text-check-reference/authenticity-text-check-reference.model.ts b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/authenticity-text-check-reference/authenticity-text-check-reference.model.ts new file mode 100644 index 0000000..a8c1ffd --- /dev/null +++ b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/authenticity-text-check-reference/authenticity-text-check-reference.model.ts @@ -0,0 +1,48 @@ +import { IsDefined, IsEnum, IsIn, IsString, ValidateNested } from 'class-validator' +import { Type } from 'class-transformer' + +import { eResultType, } from '@regulaforensics/document-reader-typings' +import { iRLocation, RLocation } from '../location' + + +export type tAuthenticityTextCheckReferenceType = eResultType.MRZ_OCR_EXTENDED | eResultType.VISUAL_OCR_EXTENDED | eResultType.BARCODES_TEXT_DATA + +export const AuthenticityTextCheckReferenceTypes: tAuthenticityTextCheckReferenceType[] = [ + eResultType.MRZ_OCR_EXTENDED, + eResultType.VISUAL_OCR_EXTENDED, + eResultType.BARCODES_TEXT_DATA, +] + +export interface iRAuthenticityTextCheckReference { + type: tAuthenticityTextCheckReferenceType + + reference: string + + result: string + + location: iRLocation +} + +export class RAuthenticityTextCheckReference implements iRAuthenticityTextCheckReference { + @IsDefined() + @IsEnum(eResultType) + @IsIn(AuthenticityTextCheckReferenceTypes) + type: tAuthenticityTextCheckReferenceType + + @IsDefined() + @IsString() + reference: string + + @IsDefined() + @IsString() + result: string + + /** + * Area location + * @type {RLocation} + */ + @IsDefined() + @ValidateNested() + @Type(() => RLocation) + location: RLocation +} diff --git a/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/authenticity-text-check-reference/index.ts b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/authenticity-text-check-reference/index.ts new file mode 100644 index 0000000..eb7b8e7 --- /dev/null +++ b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/authenticity-text-check-reference/index.ts @@ -0,0 +1 @@ +export * from './authenticity-text-check-reference.model' diff --git a/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/index.ts b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/index.ts index 6501f0a..889ac08 100644 --- a/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/index.ts +++ b/src/recipes/authenticity/get-authenticity-check-list/models/authenticity-check-groups-item/children/authenticity-check-group/children/authenticity-check/members/children/index.ts @@ -1 +1,2 @@ +export * from './authenticity-text-check-reference' export * from './location'