date-website

Billing Development Notes

Models

Flow (billing/handlers.py)

  1. events.views.EventDetailView.form_valid() calls billing.handlers.handle_event_billing() when the event_billing experimental feature is enabled.
  2. handle_event_billing fetches the billing configuration for the event (parent fallback) and resolves the integration provider.
  3. For invoice integration:
    • Generates a random invoice number (generate_invoice_number) and a checksum-protected reference number.
    • Computes the amount via get_selection_price()—either a fixed float or matched to a registration answer by name.
    • Creates the EventInvoice row (with retry recursion on failure).
    • Sends an invoice email using billing/util.send_event_invoice().
    • If the price resolves to 0, it sends a free-event confirmation email instead.

Utility Functions

Admin

Extending