-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from 2060-io/feat/add-mrz-type-messages
feat: add mrz type messages
- Loading branch information
Showing
7 changed files
with
185 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package io.twentysixty.sa.client.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Getter | ||
@Setter | ||
@ToString | ||
public class Mrz { | ||
public enum Format { | ||
@JsonProperty("TD1") | ||
TD1, | ||
@JsonProperty("TD2") | ||
TD2, | ||
@JsonProperty("TD3") | ||
TD3, | ||
@JsonProperty("FRENCH_NATIONAL_ID") | ||
FRENCH_NATIONAL_ID, | ||
@JsonProperty("FRENCH_DRIVING_LICENSE") | ||
FRENCH_DRIVING_LICENSE, | ||
@JsonProperty("SWISS_DRIVING_LICENSE") | ||
SWISS_DRIVING_LICENSE; | ||
} | ||
|
||
public enum FieldName { | ||
@JsonProperty("administrativeCode") | ||
ADMINISTRATIVE_CODE, | ||
@JsonProperty("administrativeCode2") | ||
ADMINISTRATIVE_CODE2, | ||
@JsonProperty("birthDate") | ||
BIRTH_DATE, | ||
@JsonProperty("birthDateCheckDigit") | ||
BIRTH_DATE_CHECK_DIGIT, | ||
@JsonProperty("compositeCheckDigit") | ||
COMPOSITE_CHECK_DIGIT, | ||
@JsonProperty("documentNumber") | ||
DOCUMENT_NUMBER, | ||
@JsonProperty("documentNumberCheckDigit") | ||
DOCUMENT_NUMBER_CHECK_DIGIT, | ||
@JsonProperty("documentCode") | ||
DOCUMENT_CODE, | ||
@JsonProperty("expirationDate") | ||
EXPIRATION_DATE, | ||
@JsonProperty("expirationDateCheckDigit") | ||
EXPIRATION_DATE_CHECK_DIGIT, | ||
@JsonProperty("firstName") | ||
FIRST_NAME, | ||
@JsonProperty("issueDate") | ||
ISSUE_DATE, | ||
@JsonProperty("issuingState") | ||
ISSUING_STATE, | ||
@JsonProperty("languageCode") | ||
LANGUAGE_CODE, | ||
@JsonProperty("lastName") | ||
LAST_NAME, | ||
@JsonProperty("nationality") | ||
NATIONALITY, | ||
@JsonProperty("optional") | ||
OPTIONAL, | ||
@JsonProperty("optional1") | ||
OPTIONAL1, | ||
@JsonProperty("optional2") | ||
OPTIONAL2, | ||
@JsonProperty("personalNumber") | ||
PERSONAL_NUMBER, | ||
@JsonProperty("personalNumberCheckDigit") | ||
PERSONAL_NUMBER_CHECK_DIGIT, | ||
@JsonProperty("pinCode") | ||
PIN_CODE, | ||
@JsonProperty("sex") | ||
SEX, | ||
@JsonProperty("versionNumber") | ||
VERSION_NUMBER; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.twentysixty.sa.client.model.message.mrtd; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
|
||
import io.twentysixty.sa.client.enums.Mrz; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Getter | ||
@Setter | ||
@ToString | ||
public class MrzData implements Serializable { | ||
|
||
private static final long serialVersionUID = -5234275638176689315L; | ||
|
||
private Object raw; | ||
private ParsedData parsed; | ||
|
||
public String getRaw() { | ||
if (raw instanceof List) { | ||
return String.join(",", (List<String>) raw); | ||
} else if (raw instanceof String) { | ||
return (String) raw; | ||
} | ||
return null; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
public static class ParsedData { | ||
private Mrz.Format format; | ||
private Map<Mrz.FieldName, String> fields; | ||
private boolean valid; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataRequestMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.twentysixty.sa.client.model.message.mrtd; | ||
|
||
import java.util.UUID; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
|
||
import io.twentysixty.sa.client.model.message.BaseMessage; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class MrzDataRequestMessage extends BaseMessage { | ||
|
||
private static final long serialVersionUID = -2840211856886673672L; | ||
|
||
public static MrzDataRequestMessage build(UUID connectionId, UUID threadId) { | ||
MrzDataRequestMessage mrzr = new MrzDataRequestMessage(); | ||
mrzr.setConnectionId(connectionId); | ||
mrzr.setThreadId(threadId); | ||
return mrzr; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.twentysixty.sa.client.model.message.mrtd; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
|
||
import io.twentysixty.sa.client.model.message.BaseMessage; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Getter | ||
@Setter | ||
@ToString | ||
public class MrzDataSubmitMessage extends BaseMessage { | ||
|
||
private static final long serialVersionUID = -2840411856886673672L; | ||
|
||
private MrzData mrzData; | ||
|
||
} |