generateMrvB

fun generateMrvB(documentType: String, issuingState: String, documentNumber: String, primaryIdentifier: String, secondaryIdentifier: String, nationality: String, dateOfBirth: LocalDate, sex: Sex, dateOfExpiry: LocalDate, optionalData: String, transliteration: TransliterationProfile? = null): GenerationResult

Encodes an MRV-B (Type-B visa) MRZ from field values.

Joins the identifiers with <<, or uses only the primary if the secondary is empty, and replaces spaces with <. The name field holds up to 31 characters. Pads short fields with < and computes every check digit. An MRV-B has no composite check digit.

Return

GenerationResult.Success with the MRZ lines, or GenerationResult.Failure with MrzGenerationNumericInNameField, MrzGenerationUnsupportedCharacters, or MrzGenerationFieldOverflow. The result metadata holds the transliteration details when the profile processed a non-empty identifier.

Parameters

documentType

the document type code, up to 2 characters.

issuingState

the issuing state code, up to 3 characters.

documentNumber

the document number, up to 9 characters.

primaryIdentifier

the primary identifier (surname). Must not contain digits.

secondaryIdentifier

the secondary identifier (given names). Must not contain digits.

nationality

the nationality code, up to 3 characters.

dateOfBirth

the date of birth. Only the last two digits of the year are written.

sex

the sex. Sex.UNSPECIFIED is written as <.

dateOfExpiry

the date of expiry. Only the last two digits of the year are written.

optionalData

the optional data, up to 8 characters.

transliteration

the profile that maps both identifiers to the MRZ alphabet, or null to use them as given. Defaults to null.