Class: Spree::NullPromotionHandler

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/null_promotion_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ NullPromotionHandler

Returns a new instance of NullPromotionHandler.



7
8
9
10
# File 'app/models/spree/null_promotion_handler.rb', line 7

def initialize(order)
  @order = order
  @coupon_code = order.coupon_code&.downcase
end

Instance Attribute Details

#coupon_codeObject (readonly)

Returns the value of attribute coupon_code.



5
6
7
# File 'app/models/spree/null_promotion_handler.rb', line 5

def coupon_code
  @coupon_code
end

#orderObject (readonly)

Returns the value of attribute order.



5
6
7
# File 'app/models/spree/null_promotion_handler.rb', line 5

def order
  @order
end

Instance Method Details

#activateObject



12
13
14
# File 'app/models/spree/null_promotion_handler.rb', line 12

def activate
  @order
end

#applyObject



16
17
18
# File 'app/models/spree/null_promotion_handler.rb', line 16

def apply
  self
end

#can_apply?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/models/spree/null_promotion_handler.rb', line 20

def can_apply?
  true
end

#errorObject



24
25
26
# File 'app/models/spree/null_promotion_handler.rb', line 24

def error
  nil
end

#statusObject



40
41
42
# File 'app/models/spree/null_promotion_handler.rb', line 40

def status
  I18n.t(:coupon_code_applied, scope: [:spree, :null_promotion_handler])
end

#status_codeObject



36
37
38
# File 'app/models/spree/null_promotion_handler.rb', line 36

def status_code
  :coupon_code_applied
end

#successObject



28
29
30
# File 'app/models/spree/null_promotion_handler.rb', line 28

def success
  true
end

#successful?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/spree/null_promotion_handler.rb', line 32

def successful?
  true
end