Studio admins requested the ability to view and edit the "Payment due" email. That notice — sent by the daily billing scan — was previously fixed wording baked into PaymentDueMailer. This adds a Studio Settings → Payment Due Email screen where the template can be viewed, edited, and previewed against sample values.
What changed
PaymentDueEmailTemplate — stores subject/body/item-line as new us_payment_due_email_* options, each falling back to the built-in default when blank. Renders via {token} substitution. Body tokens: {student_name}, {items}, {total_due}, {credit}, {etransfer}, {reference}; item-line tokens: {label}, {due_date}, {currency}, {amount}.
PaymentDueMailer — now takes a PaymentDueEmailTemplate (defaulted, so existing wiring is unchanged), builds a token map from the same consolidated items/credit/e-transfer/reference data, and renders the stored template. The default template reproduces the previous wording exactly.
PaymentEmailController — the view/edit/save/reset admin page, gated on manage_billing with a nonce, including a server-rendered sample preview.
PaymentEmailPreviewEndpoint — POST /wp-json/us-scheduler/v1/payment-email/preview (manage_billing) + payment-email-admin.js drive a debounced live preview of unsaved edits; degrades to the server-rendered preview when JS is off.
Submenu registered under Studio Settings; endpoint wired in RestRegistrar.
Bumped to 1.6.0 with a CHANGELOG entry.
Compatibility
New options default gracefully to the built-in wording, so existing sites need no migration and send the identical notice until an admin edits it.
Verification
phpunit: 1027 tests, 2971 assertions — OK (new suites for the template, controller, and endpoint; mailer test updated)
phpstan (level 10): no errors
phpcs: clean
no-debug check: clean
## Summary
Studio admins requested the ability to view and edit the "Payment due" email. That notice — sent by the daily billing scan — was previously fixed wording baked into `PaymentDueMailer`. This adds a **Studio Settings → Payment Due Email** screen where the template can be viewed, edited, and previewed against sample values.
## What changed
- **`PaymentDueEmailTemplate`** — stores subject/body/item-line as new `us_payment_due_email_*` options, each falling back to the built-in default when blank. Renders via `{token}` substitution. Body tokens: `{student_name}`, `{items}`, `{total_due}`, `{credit}`, `{etransfer}`, `{reference}`; item-line tokens: `{label}`, `{due_date}`, `{currency}`, `{amount}`.
- **`PaymentDueMailer`** — now takes a `PaymentDueEmailTemplate` (defaulted, so existing wiring is unchanged), builds a token map from the same consolidated items/credit/e-transfer/reference data, and renders the stored template. The default template reproduces the previous wording exactly.
- **`PaymentEmailController`** — the view/edit/save/reset admin page, gated on `manage_billing` with a nonce, including a server-rendered sample preview.
- **`PaymentEmailPreviewEndpoint`** — `POST /wp-json/us-scheduler/v1/payment-email/preview` (`manage_billing`) + `payment-email-admin.js` drive a debounced live preview of unsaved edits; degrades to the server-rendered preview when JS is off.
- Submenu registered under Studio Settings; endpoint wired in `RestRegistrar`.
- Bumped to **1.6.0** with a CHANGELOG entry.
## Compatibility
New options default gracefully to the built-in wording, so existing sites need **no migration** and send the identical notice until an admin edits it.
## Verification
- `phpunit`: 1027 tests, 2971 assertions — OK (new suites for the template, controller, and endpoint; mailer test updated)
- `phpstan` (level 10): no errors
- `phpcs`: clean
- no-debug check: clean
The "Payment due" notice the daily billing scan sends was fixed wording
baked into PaymentDueMailer. Studio admins can now view, edit and preview
its subject and body under Studio Settings -> Payment Due Email.
- PaymentDueEmailTemplate stores subject/body/item-line as us_payment_due_email_*
options, each falling back to the built-in default when blank, and renders
via {token} substitution.
- PaymentDueMailer now builds a token map from the same consolidated
items/credit/e-transfer/reference data and renders the stored template; the
default template reproduces the previous wording exactly.
- PaymentEmailController serves the view/edit/save/reset admin page
(manage_billing, nonce-checked) with a server-rendered sample preview.
- PaymentEmailPreviewEndpoint (POST us-scheduler/v1/payment-email/preview,
manage_billing) + payment-email-admin.js drive a live preview of unsaved edits.
- Submenu wired under Studio Settings; endpoint wired in RestRegistrar.
- Bump to 1.6.0 and add CHANGELOG entry. New options default gracefully, so
existing sites need no migration and send the identical notice until edited.
Co-authored-by: anthropic/claude-opus-4-8
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Studio admins requested the ability to view and edit the "Payment due" email. That notice — sent by the daily billing scan — was previously fixed wording baked into
PaymentDueMailer. This adds a Studio Settings → Payment Due Email screen where the template can be viewed, edited, and previewed against sample values.What changed
PaymentDueEmailTemplate— stores subject/body/item-line as newus_payment_due_email_*options, each falling back to the built-in default when blank. Renders via{token}substitution. Body tokens:{student_name},{items},{total_due},{credit},{etransfer},{reference}; item-line tokens:{label},{due_date},{currency},{amount}.PaymentDueMailer— now takes aPaymentDueEmailTemplate(defaulted, so existing wiring is unchanged), builds a token map from the same consolidated items/credit/e-transfer/reference data, and renders the stored template. The default template reproduces the previous wording exactly.PaymentEmailController— the view/edit/save/reset admin page, gated onmanage_billingwith a nonce, including a server-rendered sample preview.PaymentEmailPreviewEndpoint—POST /wp-json/us-scheduler/v1/payment-email/preview(manage_billing) +payment-email-admin.jsdrive a debounced live preview of unsaved edits; degrades to the server-rendered preview when JS is off.RestRegistrar.Compatibility
New options default gracefully to the built-in wording, so existing sites need no migration and send the identical notice until an admin edits it.
Verification
phpunit: 1027 tests, 2971 assertions — OK (new suites for the template, controller, and endpoint; mailer test updated)phpstan(level 10): no errorsphpcs: cleanThe "Payment due" notice the daily billing scan sends was fixed wording baked into PaymentDueMailer. Studio admins can now view, edit and preview its subject and body under Studio Settings -> Payment Due Email. - PaymentDueEmailTemplate stores subject/body/item-line as us_payment_due_email_* options, each falling back to the built-in default when blank, and renders via {token} substitution. - PaymentDueMailer now builds a token map from the same consolidated items/credit/e-transfer/reference data and renders the stored template; the default template reproduces the previous wording exactly. - PaymentEmailController serves the view/edit/save/reset admin page (manage_billing, nonce-checked) with a server-rendered sample preview. - PaymentEmailPreviewEndpoint (POST us-scheduler/v1/payment-email/preview, manage_billing) + payment-email-admin.js drive a live preview of unsaved edits. - Submenu wired under Studio Settings; endpoint wired in RestRegistrar. - Bump to 1.6.0 and add CHANGELOG entry. New options default gracefully, so existing sites need no migration and send the identical notice until edited. Co-authored-by: anthropic/claude-opus-4-8