Class: Spree::Promotion::Rules::Country

Inherits:
Spree::PromotionRule show all
Defined in:
app/models/spree/promotion/rules/country.rb

Instance Method Summary collapse

Methods inherited from Spree::PromotionRule

#actionable?, #eligibility_errors, for, #human_description, #human_name, #key

Instance Method Details

#applicable?(promotable) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/spree/promotion/rules/country.rb', line 9

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

#eligible?(order, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'app/models/spree/promotion/rules/country.rb', line 13

def eligible?(order, options = {})
  if preferred_country_iso.present?
    validate_eligibility_by_country_iso(order)
  else
    validate_eligibility_by_country_id(order, options)
  end
end