Sha256: 6ec309d064dde381180fa4ea5e25c461c2fd4099ea97e9eb4087fe332befeafc
Contents?: true
Size: 643 Bytes
Versions: 5
Compression:
Stored size: 643 Bytes
Contents
Spree::Order.class_eval do attr_accessible :coupon_code attr_reader :coupon_code def coupon_code=(code) @coupon_code = code.strip.downcase rescue nil end # Tells us if there if the specified promotion is already associated with the order # regardless of whether or not its currently eligible. Useful because generally # you would only want a promotion to apply to order no more than once. def promotion_credit_exists?(promotion) !! adjustments.promotion.reload.detect { |credit| credit.originator.promotion.id == promotion.id } end def promo_total adjustments.eligible.promotion.map(&:amount).sum end end
Version data entries
5 entries across 5 versions & 2 rubygems