Skip to content

Commit

Permalink
Merge pull request #15 from 2060-io/feat/add-mrz-type-messages
Browse files Browse the repository at this point in the history
feat: add mrz type messages
  • Loading branch information
lotharking authored Oct 3, 2024
2 parents 63d65f3 + 6457547 commit 5dc9cd1
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

Client tools for building Quarkus java DIDcomm Verifiable Credential powered conversational service (Chatbots) with [2060.io Service Agent](https://github.com/2060-io/2060-service-agent/blob/main/doc/service-agent-api.md)

## How to use
On dev mode use the command `mvn clean install -Dgpg.skip` to run the project

## Releases

| Version | Release Date | Type of Change | Description |
|---------|--------------|---------------------|-----------------------------------------------------------------------------|
| 2.0.9 | 2024-10-DD | Patch | - add profile message parameters |
| 2.0.10 | 2024-10-02 | Patch | - add mrz message parameters |
| 2.0.9 | 2024-10-01 | Patch | - add profile message parameters |
| 2.0.8 | 2024-09-27 | Patch | - add call's command |


Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.2060</groupId>
<artifactId>service-agent-java-client</artifactId>
<version>2.0.9</version>
<version>2.0.10</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
83 changes: 83 additions & 0 deletions src/main/java/io/twentysixty/sa/client/enums/Mrz.java
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import io.twentysixty.sa.client.model.message.calls.CallEndRequestMessage;
import io.twentysixty.sa.client.model.message.calls.CallOfferRequestMessage;
import io.twentysixty.sa.client.model.message.calls.CallRejectRequestMessage;
import io.twentysixty.sa.client.model.message.mrtd.MrzDataRequestMessage;
import io.twentysixty.sa.client.model.message.mrtd.MrzDataSubmitMessage;
import io.twentysixty.sa.client.util.InstantDeserializer;
import io.twentysixty.sa.client.util.InstantSerializer;

Expand Down Expand Up @@ -45,7 +47,9 @@
@Type(value = CallAcceptRequestMessage.class, name ="call-accept"),
@Type(value = CallEndRequestMessage.class, name ="call-end"),
@Type(value = CallOfferRequestMessage.class, name ="call-offer"),
@Type(value = CallRejectRequestMessage.class, name ="call-reject")
@Type(value = CallRejectRequestMessage.class, name ="call-reject"),
@Type(value = MrzDataRequestMessage.class, name ="mrz-data-request"),
@Type(value = MrzDataSubmitMessage.class, name ="mrz-data-submit")
})
public abstract class BaseMessage implements Serializable {

Expand Down
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;
}
}
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;
}
}
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;

}

0 comments on commit 5dc9cd1

Please sign in to comment.