flower
/

review · segments

Complete Map of the Order Expiration Email System

claude 67 events 1 segments usps-label-broker-fs-storage

segment 1 of 1

Map the order expiration email system

Done

The assistant systematically searched the codebase for all order-expiration email components: Blade templates (orders-expiring, order-expired, orders-pending-deletion), scheduled artisan commands (ProcessExpiringOrderEmails, ProcessExpiringOrders), queue jobs (CustomerAlertExpiringOrders, CustomerProcessExpiringOrders), the CustomerEmail job with methods ordersExpiring, orderExpired, and pendingOrderDeletion, the EmailTemplate model and service, the email_templates migration and seeder, and NotificationType records. It found no separate 'old orders' or '10 days before' email; only a single 7-day warning and an expired notice are active. The pending-deletion template and method exist but are not triggered.

outcome

A complete map of the order expiration email system: three Blade templates, two scheduled commands, one queue job, a CustomerEmail job with three email methods, an EmailTemplateService with DB override logic, and no evidence of a separate 'old orders' or '10 days before' email.

next steps

  • Update the email copy in the three Blade templates: orders-expiring.blade.php, order-expired.blade.php, and orders-pending-deletion.blade.php.
  • Check the production database for active EmailTemplateVersion records that may override the Blade templates for 'orders-expiring' and 'order-expired'.
  • Consider adding a separate 'old orders' email if needed (no such logic currently exists).
  • Verify whether the 'orders-pending-deletion' email should be re-enabled, and if so, add a scheduled command or queue push to trigger it.

key decisions

  • The template slugs used are 'orders-expiring', 'order-expired', and 'orders-pending-deletion'.
  • No 10-day-before-expiration email or separate 'old orders' email exists in the codebase. Only the 7-day warning (orders-expiring) is active.
  • The EmailTemplateService.getEmailSubject() provides dynamic subject lines, falling back to hardcoded strings if no active DB version exists.
  • NotificationType records are linked via slug but the email sending itself bypasses NotificationType; the CustomerEmail job directly sends Mail::send with the Blade view.
  • The 'Pending Deletion' email (orders-pending-deletion) has a working Blade template and a method in CustomerEmail, but no code that calls it (no queue push or command trigger found).

open questions

  • Are there any active EmailTemplateVersion records in the production DB that override the Blade templates?
  • What are the actual max-order-age and deletion thresholds used in production? (The templates reference $order->determineDaysBeforeDeletion() but that logic wasn't inspected.)
  • Is there a cron entry for tdr:processExpiringOrderEmails running? (The Transcript didn't show crontab.)
  • The DatabaseSeeder only calls OrdersTableSeeder; how did NotificationType records for 'orders-expiring' and 'order-expired' get created? Possibly via a migration not inspected or a manual seed.

3 weeks ago 3 weeks ago