Class: Spree::CommissionLine

Inherits:
Object
  • Object
show all
Extended by:
DisplayMoney
Includes:
Metadata
Defined in:
app/models/spree/commission_line.rb

Overview

What one sale earned the marketplace, frozen at placement.

Deliberately not a Spree::Fee. A fee is buyer-facing and rolls into the order total; a commission is a platform↔seller settlement the customer never sees, so it lives off the order and never touches its totals. It merely follows the same typed-line design — concrete FKs, no polymorphic source, no state machine.

Every field is a snapshot: the rate that applied, what it charged, and the VAT charged on top of it. Editing the Spree::CommissionRate afterwards changes nothing here, and neither does deleting it.

tax_amount is the EU piece and the reason this model exists rather than a single amount column: the marketplace's commission is its own taxable B2B supply to the seller, separate from the consumer's item sale, so the two VATs are computed independently and never mix.

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Methods included from Metadata

#private_metadata, #private_metadata=

Instance Method Details

#subject ⇒ Spree::LineItem, ...

What this row was charged against.



75
76
77
# File 'app/models/spree/commission_line.rb', line 75

def subject
  line_item || fulfillment
end