Step 2: Configure the QR code content
The template for the QR code generation is provided here under vaccination-context. The QR code structure must match the vaccination-context. Any updates made in the QR code content must reflect in the vaccination-context.js file.
a. Open the file main.js.
b. Go to the function transformW3 and add the fields according to your requirement. This function will read the data received from the certificate generation API call and convert it into QR code Json format.
function transformW3(cert, certificateId) {
const certificateType = R.pathOr('', ['meta', 'certificateType'], cert);
const recipientIdentifier = R.pathOr('', ['recipient', 'identity'], cert);
const preEnrollmentCode = R.pathOr('', ['preEnrollmentCode'], cert);
const recipientName = R.pathOr('', ['recipient', 'name'], cert);
const recipientGender = R.pathOr('', ['recipient', 'gender'], cert);
const recipientNationality = R.pathOr('', ['recipient', 'nationality'], cert);
const recipientParentName = R.pathOr('', ['recipient', 'parentName'], cert);
c. Add the newly-added field to the data variable
let data = {
namespace, recipientIdentifier, preEnrollmentCode, recipientName, recipientGender, recipientDob, recipientAge, recipientNationality, recipientParentName, recipientAddressLine1, recipientAddressLine2, recipientAddressDistrict, recipientAddressCity, recipientAddressRegion, recipientAddressCountry, recipientAddressPostalCode,
issuer, issuanceDate, evidenceId, InfoUrl, feedbackUrl,
certificateId, batch, vaccine, icd11Code, prophylaxis, manufacturer, vaccinationDate, effectiveStart, effectiveUntil, dose, totalDoses,
facilityName, facilityAddressLine1, facilityAddressLine2, facilityAddressDistrict, facilityAddressCity, facilityAddressRegion, facilityAddressCountry, facilityAddressPostalCode
Certain constant values are also listed in the main.js. If you want to update any of the constant values such as “certificate controller,” please refer to the DockerFile.
All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.
Export as PDF
Copy link
Edit on GitHub