Accrue.Emails.PaymentSucceeded (accrue v0.3.0)

Copy Markdown View Source

Reference email template for the payment_succeeded receipt email.

mjml_eex integration (CORRECTED pattern — RESEARCH.md Pitfall #3)

This module uses the idiomatic use MjmlEEx, mjml_template: pattern, NOT the broken use Phoenix.Swoosh, formats: %{"mjml" => :html_body} shape that CONTEXT.md D-22 originally sketched. MjmlEEx's __using__/1 compiles the MJML template at build time (via the Rustler NIF backend) and generates a render/1 function that returns rendered HTML.

The :mjml_template option is resolved relative to the calling module's source file — so the template lives at priv/accrue/templates/emails/payment_succeeded.mjml.eex and is referenced here with a relative path from lib/accrue/emails/.

Assigns

  • :customer_name — string, shown in the greeting
  • :amount — pre-formatted string (e.g., "$10.00"); formatting happens at render-call time via Accrue.Money.to_string/1
  • :invoice_number — string
  • :receipt_url — absolute URL to the hosted receipt

Summary

Functions

Returns the raw MJML template. Useful for debugging rendering issues.

Safely render the MJML template using Phoenix.HTML

Plain-text body rendered from the sibling .text.eex template.

Subject line for the receipt email.

Functions

debug_mjml_template()

Returns the raw MJML template. Useful for debugging rendering issues.

render(assigns)

Safely render the MJML template using Phoenix.HTML

render_text(assigns)

@spec render_text(map()) :: String.t()

Plain-text body rendered from the sibling .text.eex template.

subject(assigns)

@spec subject(map()) :: String.t()

Subject line for the receipt email.