Sha256: 47eab4b177b0418569ea27f0c7d00f6b27bc2ab1463ade69b4957da75f281aa1
Contents?: true
Size: 699 Bytes
Versions: 9
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true module SolidusFriendlyPromotions module PromotionHandler class Page attr_reader :order, :path def initialize(order, path) @order = order @path = path.gsub(/\A\//, "") end def activate if promotion Spree::Config.promotion_adjuster_class.new(order, dry_run_promotion: promotion).call if promotion.eligibility_results.success? order.friendly_promotions << promotion order.recalculate end end end private def promotion @promotion ||= SolidusFriendlyPromotions::Promotion.active.find_by(path: path) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems