Sha256: 3ec615239e171caa96d6d75a76091967719262f1e3ff3e0882d4cba8c20bfb1f

Contents?: true

Size: 444 Bytes

Versions: 26

Compression:

Stored size: 444 Bytes

Contents

module Spree
  class OrderPromotion < Spree::Base
    belongs_to :order, class_name: 'Spree::Order'
    belongs_to :promotion, class_name: 'Spree::Promotion'

    delegate :name, :description, :code, :public_metadata, to: :promotion
    delegate :currency, to: :order

    extend Spree::DisplayMoney
    money_methods :amount

    def amount
      order.all_adjustments.promotion.where(source: promotion.actions).sum(:amount)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/spree/order_promotion.rb
spree_core-4.10.0 app/models/spree/order_promotion.rb
spree_core-4.9.0 app/models/spree/order_promotion.rb
spree_core-4.8.3 app/models/spree/order_promotion.rb
spree_core-4.8.2 app/models/spree/order_promotion.rb
spree_core-4.7.3 app/models/spree/order_promotion.rb
spree_core-4.6.6 app/models/spree/order_promotion.rb
spree_core-4.5.5 app/models/spree/order_promotion.rb
spree_core-4.4.1 app/models/spree/order_promotion.rb
spree_core-4.5.4 app/models/spree/order_promotion.rb
spree_core-4.6.5 app/models/spree/order_promotion.rb
spree_core-4.7.2 app/models/spree/order_promotion.rb
spree_core-4.7.1 app/models/spree/order_promotion.rb
spree_core-4.6.4 app/models/spree/order_promotion.rb
spree_core-4.7.0 app/models/spree/order_promotion.rb
spree_core-4.6.3 app/models/spree/order_promotion.rb
spree_core-4.6.2 app/models/spree/order_promotion.rb
spree_core-4.6.1 app/models/spree/order_promotion.rb
spree_core-4.6.0 app/models/spree/order_promotion.rb
spree_core-4.5.3 app/models/spree/order_promotion.rb