Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Release 2.2.0-rc1 merge develop to master (#87)
Browse files Browse the repository at this point in the history
* updated version to 2.1 (#77)

Co-authored-by: Nicola Keller <[email protected]>

* VACCINECER-1122: sampleDateTime now only checks if it is not later than the same day

* Release/version 2.1 (#82)

* updated version to 2.1

* VACCINECER-1122 (#79)

* updated version to 2.1 (#77)

Co-authored-by: Nicola Keller <[email protected]>

* VACCINECER-1122: sampleDateTime now only checks if it is not later than the same day

Co-authored-by: Nicola Keller <[email protected]>

* VACCINECER-1194: updated test value set json to version 1.0.7

Co-authored-by: Nicola Keller <[email protected]>

* VACCINECER-1184 generate pdf from qr code

* VACCINECER-1184 generate pdf from qr code

* VACCINECER-1184 add unit tests

* VACCINECER-1184 add controller unit tests

* VACCINECER-1184 add unit tests

* VACCINECER-1119: ignore bom if in the csv file encoding (#86)

Co-authored-by: Nicola Keller <[email protected]>

* VACCINECER-1184 add get all test valueSets in ValueSetsService

Co-authored-by: NicolaKellerTIM <[email protected]>
Co-authored-by: Nicola Keller <[email protected]>
Co-authored-by: Georgios Papadopoulos <[email protected]>
  • Loading branch information
4 people authored Jul 19, 2021
1 parent 2ae9e9f commit 29f6205
Show file tree
Hide file tree
Showing 50 changed files with 2,562 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public static TestCertificatePdf toTestCertificatePdf(
) {
CovidCertificateDiseaseOrAgentTargeted diseaseOrAgentTargeted = CovidCertificateDiseaseOrAgentTargeted.getStandardInstance();
return new TestCertificatePdf(
testCertificateCreateDto.getPersonData(),
testCertificateCreateDto.getPersonData().getName().getFamilyName(),
testCertificateCreateDto.getPersonData().getName().getGivenName(),
testCertificateCreateDto.getPersonData().getDateOfBirth(),
testCertificateCreateDto.getLanguage(),
diseaseOrAgentTargeted.getCode(),
diseaseOrAgentTargeted.getSystem(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public static VaccinationCertificatePdf toVaccinationCertificatePdf(
) {
CovidCertificateDiseaseOrAgentTargeted diseaseOrAgentTargeted = CovidCertificateDiseaseOrAgentTargeted.getStandardInstance();
return new VaccinationCertificatePdf(
vaccinationCertificateCreateDto.getPersonData(),
vaccinationCertificateCreateDto.getPersonData().getName().getFamilyName(),
vaccinationCertificateCreateDto.getPersonData().getName().getGivenName(),
vaccinationCertificateCreateDto.getPersonData().getDateOfBirth(),
vaccinationCertificateCreateDto.getLanguage(),
diseaseOrAgentTargeted.getCode(),
diseaseOrAgentTargeted.getSystem(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ch.admin.bag.covidcertificate.api.mapper;

import ch.admin.bag.covidcertificate.api.response.ValueSetsResponseDto;
import ch.admin.bag.covidcertificate.api.valueset.ValueSetsDto;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ValueSetsResponseDtoMapper {
public static ValueSetsResponseDto create(ValueSetsDto valueSetsDto){
return new ValueSetsResponseDto(
valueSetsDto.getCountryCodes(),
valueSetsDto.getVaccinationSets(),
valueSetsDto.getChAcceptedTestValueSets()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ch.admin.bag.covidcertificate.api.mapper.pdfgeneration;

import ch.admin.bag.covidcertificate.api.request.pdfgeneration.RecoveryCertificatePdfGenerateRequestDto;
import ch.admin.bag.covidcertificate.service.domain.CovidCertificateDiseaseOrAgentTargeted;
import ch.admin.bag.covidcertificate.service.domain.RecoveryCertificatePdf;
import ch.admin.bag.covidcertificate.util.DateHelper;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import static ch.admin.bag.covidcertificate.api.Constants.ISSUER;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class RecoveryCertificatePdfGenerateRequestDtoMapper {

public static RecoveryCertificatePdf toRecoveryCertificatePdf(
RecoveryCertificatePdfGenerateRequestDto recoveryCertificateCreateDto,
String countryOfTest,
String countryOfTestEn
) {
var diseaseOrAgentTargeted = CovidCertificateDiseaseOrAgentTargeted.getStandardInstance();
return new RecoveryCertificatePdf(
recoveryCertificateCreateDto.getDecodedCert().getPersonData().getName().getFamilyName(),
recoveryCertificateCreateDto.getDecodedCert().getPersonData().getName().getGivenName(),
recoveryCertificateCreateDto.getDecodedCert().getPersonData().getDateOfBirth(),
recoveryCertificateCreateDto.getLanguage(),
diseaseOrAgentTargeted.getCode(),
diseaseOrAgentTargeted.getSystem(),
recoveryCertificateCreateDto.getDecodedCert().getRecoveryInfo().get(0).getDateOfFirstPositiveTestResult(),
countryOfTest,
countryOfTestEn,
ISSUER,
DateHelper.calculateValidFrom(recoveryCertificateCreateDto.getDecodedCert().getRecoveryInfo().get(0).getDateOfFirstPositiveTestResult()),
DateHelper.calculateValidUntil(recoveryCertificateCreateDto.getDecodedCert().getRecoveryInfo().get(0).getDateOfFirstPositiveTestResult()),
recoveryCertificateCreateDto.getDecodedCert().getRecoveryInfo().get(0).getIdentifier());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package ch.admin.bag.covidcertificate.api.mapper.pdfgeneration;

import ch.admin.bag.covidcertificate.api.request.pdfgeneration.TestCertificatePdfGenerateRequestDto;
import ch.admin.bag.covidcertificate.api.valueset.NegativeTestResult;
import ch.admin.bag.covidcertificate.api.valueset.TestValueSet;
import ch.admin.bag.covidcertificate.service.domain.CovidCertificateDiseaseOrAgentTargeted;
import ch.admin.bag.covidcertificate.service.domain.TestCertificatePdf;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import static ch.admin.bag.covidcertificate.api.Constants.ISSUER;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class TestCertificatePdfGenerateRequestDtoMapper {

public static TestCertificatePdf toTestCertificatePdf(
TestCertificatePdfGenerateRequestDto testCertificateCreateDto,
TestValueSet testValueSet,
String memberStateOfTest,
String memberStateOfTestEn
) {
var diseaseOrAgentTargeted = CovidCertificateDiseaseOrAgentTargeted.getStandardInstance();
return new TestCertificatePdf(
testCertificateCreateDto.getDecodedCert().getPersonData().getName().getFamilyName(),
testCertificateCreateDto.getDecodedCert().getPersonData().getName().getGivenName(),
testCertificateCreateDto.getDecodedCert().getPersonData().getDateOfBirth(),
testCertificateCreateDto.getLanguage(),
diseaseOrAgentTargeted.getCode(),
diseaseOrAgentTargeted.getSystem(),
testValueSet.getType(),
testValueSet.getName(),
testValueSet.getManufacturer(),
testCertificateCreateDto.getDecodedCert().getTestInfo().get(0).getSampleDateTime(),
NegativeTestResult.DISPLAY,
testCertificateCreateDto.getDecodedCert().getTestInfo().get(0).getTestingCentreOrFacility(),
memberStateOfTest,
memberStateOfTestEn,
ISSUER,
testCertificateCreateDto.getDecodedCert().getTestInfo().get(0).getIdentifier());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package ch.admin.bag.covidcertificate.api.mapper.pdfgeneration;

import ch.admin.bag.covidcertificate.api.request.pdfgeneration.VaccinationCertificatePdfGenerateRequestDto;
import ch.admin.bag.covidcertificate.api.valueset.VaccinationValueSet;
import ch.admin.bag.covidcertificate.service.domain.CovidCertificateDiseaseOrAgentTargeted;
import ch.admin.bag.covidcertificate.service.domain.VaccinationCertificatePdf;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import static ch.admin.bag.covidcertificate.api.Constants.ISSUER;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class VaccinationCertificatePdfGenerateRequestDtoMapper {

public static VaccinationCertificatePdf toVaccinationCertificatePdf(
VaccinationCertificatePdfGenerateRequestDto vaccinationCertificateCreateDto,
VaccinationValueSet vaccinationValueSet,
String countryOfVaccinationDisplay,
String countryOfVaccinationDisplayEn
) {
var diseaseOrAgentTargeted = CovidCertificateDiseaseOrAgentTargeted.getStandardInstance();
return new VaccinationCertificatePdf(
vaccinationCertificateCreateDto.getDecodedCert().getPersonData().getName().getFamilyName(),
vaccinationCertificateCreateDto.getDecodedCert().getPersonData().getName().getGivenName(),
vaccinationCertificateCreateDto.getDecodedCert().getPersonData().getDateOfBirth(),
vaccinationCertificateCreateDto.getLanguage(),
diseaseOrAgentTargeted.getCode(),
diseaseOrAgentTargeted.getSystem(),
vaccinationValueSet.getProphylaxis(),
vaccinationValueSet.getMedicinalProduct(),
vaccinationValueSet.getAuthHolder(),
vaccinationCertificateCreateDto.getDecodedCert().getVaccinationInfo().get(0).getNumberOfDoses(),
vaccinationCertificateCreateDto.getDecodedCert().getVaccinationInfo().get(0).getTotalNumberOfDoses(),
vaccinationCertificateCreateDto.getDecodedCert().getVaccinationInfo().get(0).getVaccinationDate(),
countryOfVaccinationDisplay,
countryOfVaccinationDisplayEn,
ISSUER,
vaccinationCertificateCreateDto.getDecodedCert().getVaccinationInfo().get(0).getIdentifier());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import static ch.admin.bag.covidcertificate.api.Constants.DEFAULT_DISEASE_OR_AGENT_SYSTEM;
import static ch.admin.bag.covidcertificate.api.Constants.DEFAULT_DISEASE_OR_AGENT_TARGETED;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class CertificatePdfGenerateDiseaseOrAgentTargetedDto {
@JsonProperty("code")
private String code;
@JsonProperty("system")
private String system;

public static CertificatePdfGenerateDiseaseOrAgentTargetedDto getStandardInstance() {
return new CertificatePdfGenerateDiseaseOrAgentTargetedDto(
DEFAULT_DISEASE_OR_AGENT_TARGETED,
DEFAULT_DISEASE_OR_AGENT_SYSTEM
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class CertificatePdfGenerateMetadataDto {
@JsonProperty("is")
private String issuer;
@JsonProperty("ci")
private String identifier;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.time.LocalDate;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class CertificatePdfGeneratePersonDto {
@JsonProperty("nam")
private CertificatePdfGeneratePersonNameDto name;
@JsonProperty("dob")
private LocalDate dateOfBirth;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class CertificatePdfGeneratePersonNameDto {
@JsonProperty("fn")
private String familyName;
@JsonProperty("fnt")
private String familyNameStandardised;
@JsonProperty("gn")
private String givenName;
@JsonProperty("gnt")
private String givenNameStandardised;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.time.LocalDate;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class RecoveryCertificateHcertDecodedDataDto {
@JsonProperty("tg")
private String diseaseOrAgentTargeted;
@JsonProperty("fr")
private LocalDate dateOfFirstPositiveTestResult;
@JsonProperty("co")
private String countryOfTest;
@JsonProperty("df")
private LocalDate validFrom;
@JsonProperty("du")
private LocalDate validUntil;
@JsonProperty("is")
private String issuer;
@JsonProperty("ci")
private String identifier;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.*;

import java.util.List;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class RecoveryCertificateHcertDecodedDto {
@JsonProperty("ver")
private String version;
@JsonUnwrapped
private CertificatePdfGeneratePersonDto personData;
@JsonProperty("r")
private List<RecoveryCertificateHcertDecodedDataDto> recoveryInfo;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.time.LocalDate;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class RecoveryCertificatePdfGenerateMetadataDto extends CertificatePdfGenerateMetadataDto {
@JsonProperty("df")
private LocalDate validFrom;
@JsonProperty("du")
private LocalDate validUntil;

public RecoveryCertificatePdfGenerateMetadataDto(String issuer, String identifier, LocalDate validFrom, LocalDate validUntil) {
super(issuer, identifier);
this.validFrom = validFrom;
this.validUntil = validUntil;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.*;

import java.util.List;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class RecoveryCertificatePdfGenerateRequestDto {
@JsonProperty("issuedAt")
private Long issuedAt;
@JsonProperty("language")
private String language;
@JsonProperty("hcert")
private String hcert;
@JsonProperty("decodedCert")
private RecoveryCertificateHcertDecodedDto decodedCert;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

import java.time.ZonedDateTime;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class TestCertificateHcertDecodedDataDto {
@JsonProperty("tg")
private String diseaseOrAgentTargeted;
@JsonProperty("tt")
private String typeOfTest;
@JsonProperty("nm")
private String testName;
@JsonProperty("ma")
private String testManufacturer;
@JsonProperty("sc")
private ZonedDateTime sampleDateTime;
@JsonProperty("tr")
private String result;
@JsonProperty("tc")
private String testingCentreOrFacility;
@JsonProperty("co")
private String memberStateOfTest;
@JsonProperty("is")
private String issuer;
@JsonProperty("ci")
private String identifier;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ch.admin.bag.covidcertificate.api.request.pdfgeneration;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.*;

import java.util.List;

@Getter
@ToString
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class TestCertificateHcertDecodedDto {
@JsonProperty("ver")
private String version;
@JsonUnwrapped
private CertificatePdfGeneratePersonDto personData;
@JsonProperty("t")
private List<TestCertificateHcertDecodedDataDto> testInfo;
}
Loading

0 comments on commit 29f6205

Please sign in to comment.