Class: SolidusSubscriptions::Promotion::Rules::SubscriptionInstallmentOrder

Inherits:
Spree::PromotionRule
  • Object
show all
Defined in:
app/models/solidus_subscriptions/promotion/rules/subscription_installment_order.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)


14
15
16
# File 'app/models/solidus_subscriptions/promotion/rules/subscription_installment_order.rb', line 14

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)


25
26
27
# File 'app/models/solidus_subscriptions/promotion/rules/subscription_installment_order.rb', line 25

def eligible?(order, _options = {})
  order.subscription_order?
end