Sha256: ca6b3da83fe988ce1fb2002201dc6eb8db12e14e03f2bffa7972e91b6c687d36

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

module SolidusSubscriptions
  class SubscriptionOrderPromotionRule < Spree::PromotionRule
    # Promotion can be applied to an entire order. Will only be true
    # for Spree::Order
    #
    # @param promotable [Object] Any object which could have this
    #   promotion rule applied to it.
    #
    # @return [Boolean]
    def applicable?(promotable)
      promotable.is_a? Spree::Order
    end

    # An order is eligible if it fulfills a subscription Installment. Will only
    # return true if the order fulfills one or more Installments
    #
    # @param order [Spree::Order] The order which could have this rule applied
    #   to it.
    #
    # @return [Boolean]
    def eligible?(order, **_options)
      order.subscription_order?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_subscriptions-alpha-0.0.4 app/models/solidus_subscriptions/subscription_order_promotion_rule.rb