mirror of
https://github.com/covidpass-org/covidpass.git
synced 2025-02-16 19:50:42 +01:00
Revert and improve pass fields
This commit is contained in:
parent
17a09e1e21
commit
d280be51ac
@ -25,7 +25,7 @@ function Page(props: PageProps): JSX.Element {
|
||||
|
||||
<footer>
|
||||
<nav className="nav flex pt-4 flex-row space-x-4 justify-center text-md font-bold flex-wrap">
|
||||
<a href="https://www.paypal.com/paypalme/msextro" className="hover:underline">{t('common:donate')}</a>
|
||||
<a href="https://ko-fi.com/marvinsxtr" className="hover:underline">{t('common:donate')}</a>
|
||||
<a href="https://github.com/marvinsxtr/covidpass" className="hover:underline">{t('common:gitHub')}</a>
|
||||
<Link href="/privacy"><a className="hover:underline">{t('common:privacyPolicy')}</a></Link>
|
||||
<Link href="/imprint"><a className="hover:underline">{t('common:imprint')}</a></Link>
|
||||
|
104
src/payload.ts
104
src/payload.ts
@ -63,12 +63,16 @@ export class Payload {
|
||||
throw new Error('certificateData');
|
||||
}
|
||||
|
||||
// Get name information
|
||||
// Get name and date of birth information
|
||||
const nameInformation = covidCertificate['nam'];
|
||||
const dateOfBirth = covidCertificate['dob'];
|
||||
|
||||
if (nameInformation == undefined) {
|
||||
throw new Error('nameMissing');
|
||||
}
|
||||
if (dateOfBirth == undefined) {
|
||||
throw new Error('dobMissing');
|
||||
}
|
||||
|
||||
const firstName = nameInformation['gn'];
|
||||
const lastName = nameInformation['fn'];
|
||||
@ -106,10 +110,17 @@ export class Payload {
|
||||
throw new Error('certificateType')
|
||||
}
|
||||
|
||||
// Get identifier and issuer
|
||||
// Get country, identifier and issuer
|
||||
const countryCode = properties['co'];
|
||||
const uvci = properties['ci'];
|
||||
const certificateIssuer = properties['is'];
|
||||
|
||||
if (!(countryCode in valueSets.countryCodes)) {
|
||||
throw new Error('invalidCountryCode');
|
||||
}
|
||||
|
||||
const country = valueSets.countryCodes[countryCode].display;
|
||||
|
||||
const generic: PassDictionary = {
|
||||
headerFields: [
|
||||
{
|
||||
@ -151,19 +162,10 @@ export class Payload {
|
||||
this.img2x = dark ? Constants.img2xWhite : Constants.img2xBlack
|
||||
this.dark = dark;
|
||||
|
||||
this.generic = Payload.fillPassData(this.certificateType, generic, properties, valueSets);
|
||||
this.generic = Payload.fillPassData(this.certificateType, generic, properties, valueSets, country, dateOfBirth);
|
||||
}
|
||||
|
||||
static fillPassData(type: CertificateType, data: PassDictionary, properties: Object, valueSets: ValueSets): PassDictionary {
|
||||
// Get country name
|
||||
const countryCode = properties['co'];
|
||||
|
||||
if (!(countryCode in valueSets.countryCodes)) {
|
||||
throw new Error('invalidCountryCode');
|
||||
}
|
||||
|
||||
const country = valueSets.countryCodes[countryCode].display;
|
||||
|
||||
static fillPassData(type: CertificateType, data: PassDictionary, properties: Object, valueSets: ValueSets, country: string, dateOfBirth: string): PassDictionary {
|
||||
switch (type) {
|
||||
case CertificateType.Vaccine:
|
||||
const dose = `${properties['dn']}/${properties['sd']}`;
|
||||
@ -201,13 +203,18 @@ export class Payload {
|
||||
value: vaccineName
|
||||
},
|
||||
{
|
||||
key: "cov",
|
||||
label: "Country of Vaccination",
|
||||
value: country,
|
||||
key: "dob",
|
||||
label: "Date of Birth",
|
||||
value: dateOfBirth,
|
||||
textAlignment: TextAlignment.right
|
||||
}
|
||||
]);
|
||||
data.backFields.push(...[
|
||||
{
|
||||
key: "cov",
|
||||
label: "Country of Vaccination",
|
||||
value: country
|
||||
},
|
||||
{
|
||||
key: "manufacturer",
|
||||
label: "Manufacturer",
|
||||
@ -216,7 +223,7 @@ export class Payload {
|
||||
{
|
||||
key: "disclaimer",
|
||||
label: "Disclaimer",
|
||||
value: "This certificate is only valid in combination with the ID card of the certificate holder and expires one year + 14 days after the last dose. The validity of this certificate was not checked by CovidPass."
|
||||
value: "This certificate is not a travel document. It is only valid in combination with the ID card of the certificate holder and may expire one year + 14 days after the last dose. The validity of this certificate was not checked by CovidPass."
|
||||
}
|
||||
]);
|
||||
break;
|
||||
@ -253,15 +260,15 @@ export class Payload {
|
||||
}
|
||||
]);
|
||||
data.auxiliaryFields.push(...[
|
||||
{
|
||||
key: "test",
|
||||
label: "Test Type",
|
||||
value: testType
|
||||
},
|
||||
{
|
||||
key: "time",
|
||||
label: "Time of Test",
|
||||
value: testTime,
|
||||
value: testTime
|
||||
},
|
||||
{
|
||||
key: "dob",
|
||||
label: "Date of Birth",
|
||||
value: dateOfBirth,
|
||||
textAlignment: TextAlignment.right
|
||||
},
|
||||
]);
|
||||
@ -276,11 +283,18 @@ export class Payload {
|
||||
label: "Testing Centre",
|
||||
value: testingCentre
|
||||
});
|
||||
data.backFields.push({
|
||||
key: "disclaimer",
|
||||
label: "Disclaimer",
|
||||
value: "This certificate is only valid in combination with the ID card of the certificate holder and may expire 24h after the test. The validity of this certificate was not checked by CovidPass."
|
||||
});
|
||||
data.backFields.push(...[
|
||||
{
|
||||
key: "test",
|
||||
label: "Test Type",
|
||||
value: testType
|
||||
},
|
||||
{
|
||||
key: "disclaimer",
|
||||
label: "Disclaimer",
|
||||
value: "This certificate is not a travel document. It is only valid in combination with the ID card of the certificate holder and may expire 24h after the test. The validity of this certificate was not checked by CovidPass."
|
||||
}
|
||||
]);
|
||||
break;
|
||||
case CertificateType.Recovery:
|
||||
const firstPositiveTestDate = properties['fr'];
|
||||
@ -289,12 +303,12 @@ export class Payload {
|
||||
|
||||
data.secondaryFields.push(...[
|
||||
{
|
||||
key: "from",
|
||||
label: "Valid From",
|
||||
value: validFrom,
|
||||
key: "until",
|
||||
label: "Valid Until",
|
||||
value: validUntil,
|
||||
},
|
||||
{
|
||||
key: "dov",
|
||||
key: "dot",
|
||||
label: "Date of positive Test",
|
||||
value: firstPositiveTestDate,
|
||||
textAlignment: TextAlignment.right
|
||||
@ -302,22 +316,30 @@ export class Payload {
|
||||
]);
|
||||
data.auxiliaryFields.push(...[
|
||||
{
|
||||
key: "until",
|
||||
label: "Valid Until",
|
||||
value: validUntil,
|
||||
key: "from",
|
||||
label: "Valid From",
|
||||
value: validFrom,
|
||||
},
|
||||
{
|
||||
key: "cov",
|
||||
key: "dob",
|
||||
label: "Date of Birth",
|
||||
value: dateOfBirth,
|
||||
textAlignment: TextAlignment.right
|
||||
}
|
||||
]);
|
||||
data.backFields.push(...[
|
||||
{
|
||||
key: "cot",
|
||||
label: "Country of Test",
|
||||
value: country,
|
||||
textAlignment: TextAlignment.right
|
||||
},
|
||||
{
|
||||
key: "disclaimer",
|
||||
label: "Disclaimer",
|
||||
value: "This certificate is not a travel document. It is only valid in combination with the ID card of the certificate holder. The validity of this certificate was not checked by CovidPass."
|
||||
}
|
||||
]);
|
||||
data.backFields.push({
|
||||
key: "disclaimer",
|
||||
label: "Disclaimer",
|
||||
value: "This certificate is only valid in combination with the ID card of the certificate holder. The validity of this certificate was not checked by CovidPass."
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new Error('certificateType');
|
||||
|
Loading…
x
Reference in New Issue
Block a user