Class: Spree::Fee
- Inherits:
-
Object
- Object
- Spree::Fee
- Includes:
- TypedAdjustmentLine
- Defined in:
- app/models/spree/fee.rb
Overview
An extensible charge (surcharge, handling, gift wrap, COD, payment fee). May target a line item or fulfillment, or be order-level (both adjustable FKs nil). Fees are taxable — the tax provider writes TaxLine rows against them. Ad-hoc credits are manual Discounts, never negative fees (amount is enforced non-negative by validation + DB CHECK).
Constant Summary collapse
- KINDS =
Extensions may append their own kinds — the list is validated, not frozen.
dutyrows are written by a duties provider's adjuster and snapshot the classification they were calculated from inmetadata— never re-derive a duty from the live catalog.exchangeis what a customer owes when an exchange's replacement costs more, put on the order for the merchant to collect. %w[surcharge handling gift_wrap cod payment duty exchange]
Instance Method Summary collapse
-
#adjustable ⇒ Spree::LineItem, ...
Nil for order-level fees.
- #order_level? ⇒ Boolean
Methods included from TypedAdjustmentLine
Instance Method Details
#adjustable ⇒ Spree::LineItem, ...
Returns nil for order-level fees.
34 35 36 |
# File 'app/models/spree/fee.rb', line 34 def adjustable line_item || fulfillment end |
#order_level? ⇒ Boolean
38 39 40 |
# File 'app/models/spree/fee.rb', line 38 def order_level? line_item_id.nil? && fulfillment_id.nil? end |