File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,21 @@ export function extractDocumentFields(result) {
45
45
} ;
46
46
} ;
47
47
48
+ const getDocumentNumber = ( documentType ) => {
49
+ const primaryField = documentType === "P" ? "passportNumber" : "documentNumber" ;
50
+ const primaryNumber = fieldWithStatus ( primaryField ) ;
51
+ const longNumber = fieldWithStatus ( "longDocumentNumber" ) ;
52
+
53
+ return primaryNumber ?. text ? primaryNumber : longNumber ;
54
+ } ;
55
+
48
56
const documentType = result . getFieldValue ( "documentCode" ) ;
49
- const documentNumberField = documentType === "P" ? "passportNumber" : "documentNumber" ;
50
57
51
58
return {
52
59
Surname : fieldWithStatus ( "primaryIdentifier" ) ,
53
60
"Given Name" : fieldWithStatus ( "secondaryIdentifier" ) ,
54
61
Nationality : fieldWithStatus ( "nationality" ) ,
55
- "Document Number" : fieldWithStatus ( documentNumberField ) ,
62
+ "Document Number" : getDocumentNumber ( documentType ) ,
56
63
"Issuing State" : fieldWithStatus ( "issuingState" ) ,
57
64
Sex : fieldWithStatus ( "sex" ) ,
58
65
"Date of Birth (YYYY-MM-DD)" : parseDate ( "birthYear" , "birthMonth" , "birthDay" ) ,
You can’t perform that action at this time.
0 commit comments