def document_number(self, value: str, set_hash=True): sc = ("<", " ") for c in sc: if c in value: if c == value[9]: value = value.replace(c, "") else: # TODO: Raise error print("special char is not in correct position") break else: # special char not detected pass first = value[:9] second = "%s%s" % (value[9:], hash_string("%s<%s" % (first, value[9:]))) if set_hash else value[9:] self._document_number = field(first, 9, "document number") self._optional_data1 = field(second, 15, "optional data 1")
def optional_data(self, value: str): """Set optional data field (29 to 35 char position of the second line) for TD2 Optional data at the discretion of the issuing State or organization. Non mandatory field Case insensitive. """ self._optional_data = check.field(transliterate(value, self.transliteration), 7, "optional data", "<")
def optional_data1(self, value: str): """Set optional data field of the first line (16 to 30 char position of the first line) for TD1 Optional data at the discretion of the issuing State or organization. Non mandatory field Case insensitive """ self._optional_data1 = check.field(transliterate(value, self.transliteration), 15, "optional data 1", "<")
def optional_data(self, value: str): """Set optional data field for Visas of type A (MRVA) Optional data at the discretion of the issuing State or organization. Non mandatory field 29 to 44 char position of the second line. Case insensitive property """ self._optional_data = check.field(transliterate(value, self.transliteration), 16, "optional data", "<")
def country_code(self, value: str): """Set issuing state Can be used the 3-letter code (ISO 3166-1) or the country name called in English (For example, 'NLD' or 'Netherlands') Case insensitive. """ self._country_code = check.country( value) if not self.force else check.field(value, 3, "country code")
def optional_data(self, value: str): """Set optional data field (ID Number of the passport holder) Optional data at the discretion of the issuing State or organization. Non mandatory field. 29 to 42 char position of the second line. Case insensitive property """ self._optional_data = check.field( transliterate(value, self.transliteration), 14, "optional data", "<")
def nationality(self, value: str): """Set holder's nationality Can be used the 3-letter code (ISO 3166-1) or the country name called in English (For example, 'NLD' or 'Netherlands') Case insensitive """ self._nationality = check.country( value) if not self.force else check.field(value, 3, "document type")
def document_type(self, value: str): """Set document type code For TD1 and TD2, the first letter must be 'I', 'A' or 'C'. Optionally, can be used a second character. The second character shall be at discretion of issuing state. Note: 'V' shall not be used as 2nd char and 'C' shall not be used after 'A'. (TD1 and TD2) First letter of passports and other TD3 must be 'P'. Optionally, can be used a second character. The second character shall be at discretion of issuing state For visas (MRV-A and MRV-B), the first letter must be 'V'. Optionally, can be used a second character. The second character shall be at discretion of issuing state Case insensitive. """ self._document_type = check.document_type(value, self) if not self.force \ else check.field(value, 2, "document type")
def identifier(self) -> str: """Return identifier (the primary and secondary identifiers) """ return check.field(self.surname + "<<" + self.given_names, 39, "full name", "<")