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

Commit

Permalink
Merge pull request #27 from admin-ch/feature/vaccination-tourist
Browse files Browse the repository at this point in the history
Use separate endpoint to create PDFs for tourist vaccination certificates (suffix "_T")
  • Loading branch information
UBaggeler authored Nov 24, 2021
2 parents e04da4d + 3c72efe commit a63c443
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ch.admin.bag.covidcertificate.backend.transformation.model;

public interface VaccinationCertificateTypes {
public static String VACCINATION_CERTIFICATE_TYPE_TOURIST_SUFFIX = "_T";
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ch.admin.bag.covidcertificate.backend.transformation.ws.client;

import ch.admin.bag.covidcertificate.backend.transformation.model.TestTypes;
import ch.admin.bag.covidcertificate.backend.transformation.model.VaccinationCertificateTypes;
import ch.admin.bag.covidcertificate.backend.transformation.model.pdf.BitPdfPayload;
import ch.admin.bag.covidcertificate.backend.transformation.model.pdf.DecodedCert;
import ch.admin.bag.covidcertificate.backend.transformation.model.pdf.DecodedRCert;
Expand Down Expand Up @@ -35,7 +36,15 @@ public PdfResponse getPdf(BitPdfPayload payload) throws JsonProcessingException
} else if (decodedCert instanceof DecodedRCert) {
endpoint = pdfConfig.getRecoveryEndpoint();
} else if (decodedCert instanceof DecodedVCert) {
endpoint = pdfConfig.getVaccinationEndpoint();
if (((DecodedVCert) decodedCert)
.getV()
.get(0)
.getMp()
.endsWith(VaccinationCertificateTypes.VACCINATION_CERTIFICATE_TYPE_TOURIST_SUFFIX)) {
endpoint = pdfConfig.getVaccinationTouristEndpoint();
} else {
endpoint = pdfConfig.getVaccinationEndpoint();
}
} else {
throw new RuntimeException(
"unexpected class received: " + decodedCert.getClass().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class PdfConfig {
private String vaccinationEndpoint;
private String antibodyEndpoint;

private String vaccinationTouristEndpoint;

public List<String> getChIssuers() {
return chIssuers;
}
Expand Down Expand Up @@ -50,4 +52,11 @@ public String getAntibodyEndpoint() {
public void setAntibodyEndpoint(String antibodyEndpoint) {
this.antibodyEndpoint = antibodyEndpoint;
}

public String getVaccinationTouristEndpoint() { return vaccinationTouristEndpoint; }

public void setVaccinationTouristEndpoint(String vaccinationTouristEndpoint) {
this.vaccinationTouristEndpoint = vaccinationTouristEndpoint;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ verification.check.endpoint=/v1/verify
transform.pdf.test-endpoint=http://localhost:8082/app/transform/v1/test
transform.pdf.recovery-endpoint=http://localhost:8082/app/transform/v1/recovery
transform.pdf.vaccination-endpoint=http://localhost:8082/app/transform/v1/vaccination
transform.pdf.vaccination-tourist-endpoint=http://localhost:8082/app/transform/v1/vaccination-tourist
transform.pdf.antibody-endpoint=http://localhost:8082/app/transform/v1/antibody

transform.pdf.chIssuers[0]=CH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ verification.check.endpoint=/v1/verify
transform.pdf.test-endpoint=/app/transform/v1/test
transform.pdf.recovery-endpoint=/app/transform/v1/recovery
transform.pdf.vaccination-endpoint=/app/transform/v1/vaccination
transform.pdf.vaccination-tourist-endpoint=/app/transform/v1/vaccination-tourist
transform.pdf.antibody-endpoint=/app/transform/v1/antibody

transform.pdf.chIssuers[0]=CH
transform.pdf.chIssuers[1]=CH BAG
Expand Down

0 comments on commit a63c443

Please sign in to comment.