Render a customer notification where the booking was made, not where the workflow is advanced
Renders a customer notification where the booking was made, not where the workflow happens to be advanced.
The problem
OrderNotifier::notifyMilestone() runs wherever the workflow is advanced: an operator's back office, or cron with no request at all. Everything downstream reads ambient state, so a confirmation carried the wrong context three ways:
- Links.
CancelLinkBuilder,TicketLinkBuilderand the check-in QR build['absolute' => TRUE]URLs, whose host comes fromrouter.request_context. - Configuration. Per-domain overrides key on the negotiated domain, so the site name, the site mail and the ticket settings were the validating surface's.
- The ticket.
yoyaku_ticket_orchestraenriches the same notification event, so the attached PDF carried the same wrong links and branding.
The change
One wrap. Orchestra now records where each run was started and offers orchestra.notification_context; the notifier dispatches the whole customer notification in that place:
$this->notificationContext->inOrigin($instance->getOrigin(), function () { … });The link builders are untouched, and the ticket enricher runs inside the same dispatch, so the PDF, its QR and its branding follow without knowing anything about it.
Operator notifications are deliberately not wrapped here: a task waiting in the back office must keep linking to the back office. Orchestra calls that place the workspace and handles it on its own side.
Why nothing is stored on the transaction
An earlier revision of this branch put an origin field on yoyaku_transaction with its own resolver and switcher seams and a yoyaku_domain submodule. That was the wrong home: the process instance is what gets advanced elsewhere, and Orchestra needs the same fact for its own notifications, so the fact would have been stored and captured twice. Deriving it from the tenant was also rejected: one tenant legitimately serves several domains.
Requires the Orchestra side (orchestra.notification_context and the instance origin).
Tests
OrderNotifierOriginTest, using Orchestra's test context module: the customer notification is dispatched in the run's origin and asks for nowhere else; a run with no recorded origin still notifies exactly as before.