This is an example of production backend code. The backend is built using the Meteor.js framework, which is built on top of Node.js. This code is responsible for generating Gift Voucher PDFs. It is utilized on this page after a user purchases a gift voucher.
This workflow outlines the key steps involved in generating Gift Voucher PDFs for users who purchase them.
-
payments.js file:
- When a payment is made, the
sendConfirmationEmail()
function is called.
- When a payment is made, the
-
Processing Gift Payments:
- In the case of a payment type being
GIFT
, thecreateVoucherFile()
function is invoked.
- In the case of a payment type being
-
createVoucherFile() Function:
- The
createVoucherFile()
function performs several tasks:- It determines whether to create a zip file with multiple PDFs or just a single PDF.
- The function imports the
giftVoucher.html
template. - It loads the appropriate i18n file.
- It generates the PDF file.
- The
-
Email Attachment:
- The generated PDF file is made available as an email attachment, ready to be sent in the payment confirmation email.