- Registration confirmations attach an invoice PDF (itemized breakdown, early-bird discount, balance due, Yoco pay-now link/QR) whenever a balance is outstanding; payment/donation confirmations attach a payment receipt PDF. Sent as an email attachment and, over WhatsApp, as the PDF itself with the existing message as its caption. - Users can also (re)send either document on demand: an "Invoice" button on the registration detail popup, and a "Receipt" button next to each payment there and on the Payment history page, each opening an Email/WhatsApp choice popup, via two new endpoints restricted to the registration/payment's own owner. - Fix: editing an event option's early-bird tiers deleted and recreated every tier for that option with brand-new ids, silently severing the appliedTierId link on all historical purchases (losing early-bird attribution and undercounting stock-limit usage) even for tiers the admin didn't touch. Tiers are now upserted by id. - Update the "My Events" help content and the API docs index for the new endpoints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
39 lines
1.6 KiB
JavaScript
39 lines
1.6 KiB
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const {
|
|
createRegistration,
|
|
getRegistrations,
|
|
getUserRegistrations,
|
|
getRegistrationById,
|
|
updateRegistrationStatus,
|
|
cancelRegistration,
|
|
getRegistrationsByEvent,
|
|
createManualRegistration,
|
|
updateRegistrationOptions,
|
|
submitFormResponses, replaceFormResponses,
|
|
getFormDraft, saveFormDraft,
|
|
sendInvoice,
|
|
} = require('../controllers/registrationController');
|
|
const { protect, supervisor, staff, optionalAuth } = require('../middleware/authMiddleware');
|
|
|
|
// Registration - auth optional when event doesn't require it
|
|
router.post('/', optionalAuth, createRegistration);
|
|
router.get('/myregistrations', protect, getUserRegistrations);
|
|
router.put('/:id/options', protect, updateRegistrationOptions);
|
|
router.delete('/:id', protect, cancelRegistration);
|
|
router.post('/:id/send-invoice', protect, sendInvoice);
|
|
|
|
// Registration detail + forms — optionalAuth so guests can access with just the registrationId
|
|
router.get('/:id', optionalAuth, getRegistrationById);
|
|
router.get('/:id/forms/draft', optionalAuth, getFormDraft);
|
|
router.put('/:id/forms/draft', optionalAuth, saveFormDraft);
|
|
router.post('/:id/forms/responses', optionalAuth, submitFormResponses);
|
|
router.put('/:id/forms/responses', protect, supervisor, replaceFormResponses);
|
|
|
|
// Admin/Staff routes
|
|
router.get('/', protect, staff, getRegistrations);
|
|
router.put('/:id', protect, staff, updateRegistrationStatus);
|
|
router.get('/event/:eventId', protect, staff, getRegistrationsByEvent);
|
|
router.post('/manual', protect, supervisor, createManualRegistration);
|
|
|
|
module.exports = router; |