Skip to main content

Module money

Module money 

Source

Structs§

MinorUnits

Functions§

apply_rate
Apply a percent rate to a base. Shared by tax_amount and discount math.
line_total
Compute line total in minor units: qty * unit_price.
line_total_discounted
Line total after applying at most one of (rate discount, fixed discount). If both are set, rate wins — caller should enforce mutual exclusion at the CLI layer. Result is clamped at zero so a mis-sized fixed discount can’t flip the line negative.
tax_amount
Compute tax amount in minor units: base * rate / 100.