Sha256: 3853b30a6ecb5b9a5c4072b0af11be12cb2a824cc358eb41bb21dd4210dfc6bb
Contents?: true
Size: 408 Bytes
Versions: 10
Compression:
Stored size: 408 Bytes
Contents
# A rule to limit a promotion to a specific user. class Promotion::Rules::ItemTotal < PromotionRule preference :amount, :decimal, :default => 100.00 preference :operator, :string, :default => '>' OPERATORS = ['gt', 'gte'] def eligible?(order, options = {}) item_total = order.line_items.map(&:amount).sum item_total.send(preferred_operator == 'gte' ? :>= : :>, preferred_amount) end end
Version data entries
10 entries across 10 versions & 1 rubygems