Class: SolidusSubscriptions::SubscriptionOrderPromotionRule

Inherits:
Spree::PromotionRule
  • Object
show all
Defined in:
app/models/solidus_subscriptions/subscription_order_promotion_rule.rb

Instance Method Summary collapse

Instance Method Details

#applicable?(promotable) ⇒ Boolean

Promotion can be applied to an entire order. Will only be true for Spree::Order

Parameters:

  • promotable (Object)

    Any object which could have this promotion rule applied to it.

Returns:

  • (Boolean)


10
11
12
# File 'app/models/solidus_subscriptions/subscription_order_promotion_rule.rb', line 10

def applicable?(promotable)
  promotable.is_a? Spree::Order
end

#eligible?(order, **_options) ⇒ Boolean

An order is eligible if it fulfills a subscription Installment. Will only return true if the order fulfills one or more Installments

Parameters:

  • order (Spree::Order)

    The order which could have this rule applied to it.

Returns:

  • (Boolean)


21
22
23
# File 'app/models/solidus_subscriptions/subscription_order_promotion_rule.rb', line 21

def eligible?(order, **_options)
  order.subscription_order?
end