Sha256: c53bb62a7e94e03564ba8b6ec21ceb183652074f0003cc77e2e79dffd9e0380d

Contents?: true

Size: 766 Bytes

Versions: 5

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module SolidusPromotions
  # Simple object used to hold discount data for an item.
  #
  # This generic object will hold the amount of discount that should be applied to
  # an item.
  #
  # @attr_reader [Spree::LineItem,Spree::Shipment] the item to be discounted.
  # @attr_reader [String] label information about the discount
  # @attr_reader [ApplicationRecord] source will be used as the source for adjustments
  # @attr_reader [BigDecimal] amount the amount of discount applied to the item
  class ItemDiscount
    include ActiveModel::Model
    attr_accessor :item, :label, :source, :amount

    def ==(other)
      item == other.item && label == other.label && source == other.source && amount == other.amount
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_promotions-4.5.1 app/models/solidus_promotions/item_discount.rb
solidus_promotions-4.5.0 app/models/solidus_promotions/item_discount.rb
solidus_promotions-4.4.2 app/models/solidus_promotions/item_discount.rb
solidus_promotions-4.4.1 app/models/solidus_promotions/item_discount.rb
solidus_promotions-4.4.0 app/models/solidus_promotions/item_discount.rb