Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FrejaEidClient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.verisec.frejaeid</groupId>
<artifactId>FrejaEidClient</artifactId>
<version>2.31.0-SNAPSHOT</version>
<version>2.32.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>FrejaEidClient</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,109 @@

import java.util.Objects;

public class DocumentInfoWithPdf extends DocumentInfo {
/**
* PDF file as a Base64-encoded String
*/
public class DocumentInfoWithPdf {
private final SsnUserInfo ssn;
private final BasicUserInfo basicUserInfo;
private final String dateOfBirth;
private final String gender;
private final DocumentType type;
private final Country country;
private final String serialNumber;
private final String expirationDate;
private final String pdf;
private final String documentPhoto;
private final String nfcIdPhoto;

@JsonCreator
public DocumentInfoWithPdf(@JsonProperty("type") DocumentType type,
@JsonProperty("serialNumber") String serialNumber,
@JsonProperty("country") Country country,
@JsonProperty("expirationDate") String expirationDate,
@JsonProperty("pdf") String pdf) {
super(type, serialNumber, country, expirationDate);
public DocumentInfoWithPdf(
@JsonProperty("ssn") SsnUserInfo ssn,
@JsonProperty("basicUserInfo") BasicUserInfo basicUserInfo,
@JsonProperty("dateOfBirth") String dateOfBirth,
@JsonProperty("gender") String gender,
@JsonProperty("type") DocumentType type,
@JsonProperty("serialNumber") String serialNumber,
@JsonProperty("country") Country country,
@JsonProperty("expirationDate") String expirationDate,
@JsonProperty("pdf") String pdf,
@JsonProperty("documentPhoto") String documentPhoto,
@JsonProperty("nfcIdPhoto") String nfcIdPhoto) {
this.ssn = ssn;
this.basicUserInfo = basicUserInfo;
this.dateOfBirth = dateOfBirth;
this.gender = gender;
this.type = type;
this.serialNumber = serialNumber;
this.country = country;
this.expirationDate = expirationDate;
this.pdf = pdf;
this.documentPhoto = documentPhoto;
this.nfcIdPhoto = nfcIdPhoto;
}

public SsnUserInfo getSsn() {
return ssn;
}

public BasicUserInfo getBasicUserInfo() {
return basicUserInfo;
}

public String getDateOfBirth() {
return dateOfBirth;
}

public String getGender() {
return gender;
}

public DocumentType getType() {
return type;
}

public Country getCountry() {
return country;
}

public String getSerialNumber() {
return serialNumber;
}

public String getExpirationDate() {
return expirationDate;
}

public String getPdf() {
return pdf;
}

public String getDocumentPhoto() {
return documentPhoto;
}

public String getNfcIdPhoto() {
return nfcIdPhoto;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
DocumentInfoWithPdf that = (DocumentInfoWithPdf) o;
return Objects.equals(pdf, that.pdf);
return Objects.equals(ssn, that.ssn) &&
Objects.equals(basicUserInfo, that.basicUserInfo) &&
Objects.equals(dateOfBirth, that.dateOfBirth) &&
Objects.equals(gender, that.gender) &&
type == that.type &&
country == that.country &&
Objects.equals(serialNumber, that.serialNumber) &&
Objects.equals(expirationDate, that.expirationDate) &&
Objects.equals(pdf, that.pdf) &&
Objects.equals(documentPhoto, that.documentPhoto) &&
Objects.equals(nfcIdPhoto, that.nfcIdPhoto);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), pdf);
}

@Override
public String toString() {
return "DocumentInfo{" +
"documentType=" + super.getType() +
", serialNumber='" + super.getSerialNumber() + '\'' +
", country=" + super.getCountry() +
", expirationDate='" + super.getExpirationDate() + '\'' +
", pdf=" + pdf +
'}';
return Objects.hash(ssn, basicUserInfo, dateOfBirth, gender,
type, country, serialNumber, expirationDate, pdf, documentPhoto, nfcIdPhoto);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ public class AuthenticationClientGetResultTest {
private static final String PHOTO = "https://image-hashId/test";
private static final DocumentInfo DOCUMENT_INFO =
new DocumentInfo(DocumentType.PASSPORT, "123456789", Country.SWEDEN, "2050-01-01");
private static final DocumentInfoWithPdf DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(DocumentType.PASSPORT, "123456789", Country.SWEDEN, "2050-01-01", "Base64Pdf");
private static final DocumentInfoWithPdf CHILDREN_DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(DocumentType.PASSPORT, "987654321", Country.SWEDEN, "20240-01-01", "Base64Pdf");
private static final String DOCUMENT_PHOTO = "Base64EncodedDocPhoto";
private static final CovidCertificates COVID_CERTIFICATES =
new CovidCertificates(new Vaccines("covidCertificate"), null, null, true);
Expand All @@ -76,6 +72,13 @@ public class AuthenticationClientGetResultTest {
private AuthenticationClientApi authenticationClient;
private static final String GENDER = "MALE";
private static final String NFC_ID_PHOTO = "Base64EncodedNfcIdPhoto";
private static final String PDF = "Base64Pdf";
private static final DocumentInfoWithPdf DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(SSN, BASIC_USER_INFO, DATE_OF_BIRTH, GENDER, DocumentType.PASSPORT, "123456789",
Country.SWEDEN, "2050-01-01", PDF, DOCUMENT_PHOTO, NFC_ID_PHOTO);
private static final DocumentInfoWithPdf CHILDREN_DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(SSN, BASIC_USER_INFO, DATE_OF_BIRTH, GENDER, DocumentType.PASSPORT, "987654321",
Country.SWEDEN, "2024-01-01", PDF, DOCUMENT_PHOTO, NFC_ID_PHOTO);

@BeforeClass
public static void initTestData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class SignClientGetResultTest {
private static final String SIGN_REFERENCE = "123456789123456789";
private static final String SIGN_DETAILS = "This is sign transaction";
private static final String RELYING_PARTY_USER_ID = "relyingPartyUserId";
private static final SsnUserInfo SSN = SsnUserInfo.create(Country.SWEDEN, "199207295578");
private static final BasicUserInfo BASIC_USER_INFO = new BasicUserInfo("John", "Fante");
private static final String EMAIL_ADDRESS = "test@frejaeid.com";
private static final String PHONE_NUMBER = "+46123456789";
private static final String ORGANISATION_ID = "orgId";
Expand All @@ -54,21 +56,26 @@ public class SignClientGetResultTest {
AddressType.RESIDENTIAL, AddressSourceType.GOVERNMENT_REGISTRY));
private static final List<Email> ALL_EMAIL_ADDRESSES = Arrays.asList(new Email(EMAIL_ADDRESS));
private static final List<PhoneNumberInfo> ALL_PHONE_NUMBERS = Arrays.asList(new PhoneNumberInfo(PHONE_NUMBER));
private static final String DATE_OF_BIRTH = "1987-10-18";
private static final Integer AGE = 35;
private static final String PHOTO = "Base64EncodedAvatarPhoto";
private static final DocumentInfo DOCUMENT_INFO =
new DocumentInfo(DocumentType.PASSPORT, "123456789", Country.SWEDEN, "2050-01-01");
private static final DocumentInfoWithPdf DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(DocumentType.PASSPORT, "123456789", Country.SWEDEN, "2050-01-01", "Base64Pdf");
private static final DocumentInfoWithPdf CHILDREN_DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(DocumentType.PASSPORT, "987654321", Country.SWEDEN, "20240-01-01", "Base64Pdf");
private static final String DOCUMENT_PHOTO = "Base64EncodedDocPhoto";
protected static final CovidCertificates COVID_CERTIFICATES =
new CovidCertificates(new Vaccines("covidCertificate"), null, null, true);
private static final NetworkInfo NETWORK_INFO = new NetworkInfo("123.45.6.7");
private static final String FREJA_COOKIE = "frejaCookie";
private static final String GENDER = "MALE";
private static final String NFC_ID_PHOTO = "Base64EncodedNfcIdPhoto";
private static final String PDF = "Base64Pdf";
private static final DocumentInfoWithPdf DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(SSN, BASIC_USER_INFO, DATE_OF_BIRTH, GENDER, DocumentType.PASSPORT, "123456789",
Country.SWEDEN, "2050-01-01", PDF, DOCUMENT_PHOTO, NFC_ID_PHOTO);
private static final DocumentInfoWithPdf CHILDREN_DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(SSN, BASIC_USER_INFO, DATE_OF_BIRTH, GENDER, DocumentType.PASSPORT, "987654321",
Country.SWEDEN, "2024-01-01", PDF, DOCUMENT_PHOTO, NFC_ID_PHOTO);

private static RequestedAttributes REQUESTED_ATTRIBUTES;
private SignClientApi signClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public abstract class CommonHttpTest {
private static final String PHOTO = "Base64EncodedAvatarPhoto";
private static final DocumentInfo DOCUMENT_INFO =
new DocumentInfo(DocumentType.PASSPORT, "123456789", Country.SWEDEN, "2050-01-01");
private static final DocumentInfoWithPdf DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(DocumentType.PASSPORT, "123456789", Country.SWEDEN, "2050-01-01", "Base64Pdf");
private static final DocumentInfoWithPdf CHILDREN_DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(DocumentType.PASSPORT, "987654321", Country.SWEDEN, "20240-01-01", "Base64Pdf");
private static final CovidCertificates COVID_CERTIFICATES =
new CovidCertificates(new Vaccines("covidCertificate"), null, null, true);
private static final String DOCUMENT_PHOTO = "Base64EncodedDocPhoto";
Expand All @@ -69,6 +65,13 @@ public abstract class CommonHttpTest {
private static final String UNIQUE_IDENTIFIER = "1234-567890-1234";
private static final String GENDER = "MALE";
private static final String NFC_ID_PHOTO = "Base64EncodedNfcIdPhoto";
private static final String PDF = "Base64Pdf";
private static final DocumentInfoWithPdf DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(SSN_USER_INFO, BASIC_USER_INFO, DATE_OF_BIRTH, GENDER, DocumentType.PASSPORT, "123456789",
Country.SWEDEN, "2050-01-01", PDF, DOCUMENT_PHOTO, NFC_ID_PHOTO);
private static final DocumentInfoWithPdf CHILDREN_DOCUMENT_WITH_PDF =
new DocumentInfoWithPdf(SSN_USER_INFO, BASIC_USER_INFO, DATE_OF_BIRTH, GENDER, DocumentType.PASSPORT, "987654321",
Country.SWEDEN, "2024-01-01", PDF, DOCUMENT_PHOTO, NFC_ID_PHOTO);
protected static final RequestedAttributes REQUESTED_ATTRIBUTES =
new RequestedAttributes(BASIC_USER_INFO, CUSTOM_IDENTIFIER, SSN_USER_INFO, null, DATE_OF_BIRTH,
RELYING_PARTY_USER_ID, EMAIL_ADDRESS, ORGANISATION_ID, ADDRESSES,
Expand Down