PhoenixKitBookings.Pricing (PhoenixKitBookings v0.1.1)

Copy Markdown View Source

Total computation for a booking request: price × price_per units.

  • "booking" — flat price regardless of length (any time unit)
  • "hour" — minute services; fractional hours price proportionally
  • "day" / "night" — date services; units = Date.diff(ends, starts)

A price_per that doesn't fit the range shape (e.g. "hour" on a nightly service) degrades to the flat price rather than guessing. Returns nil for unpriced services — bookings then carry no total.

Summary

Functions

"120.00 EUR" or nil.

One-line price tag for a service ("45.00 EUR / hour"), nil when unpriced.

Total for the validated range, or nil when the service is unpriced.

Functions

format(total, currency)

"120.00 EUR" or nil.

tag(service)

One-line price tag for a service ("45.00 EUR / hour"), nil when unpriced.

total(service, arg2)

Total for the validated range, or nil when the service is unpriced.