Class: Spree::NullPromotionHandler
- Inherits:
-
Object
- Object
- Spree::NullPromotionHandler
- Defined in:
- app/models/spree/null_promotion_handler.rb
Instance Attribute Summary collapse
-
#coupon_code ⇒ Object
readonly
Returns the value of attribute coupon_code.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #activate ⇒ Object
- #apply ⇒ Object
- #can_apply? ⇒ Boolean
- #error ⇒ Object
-
#initialize(order) ⇒ NullPromotionHandler
constructor
A new instance of NullPromotionHandler.
- #status ⇒ Object
- #status_code ⇒ Object
- #success ⇒ Object
- #successful? ⇒ Boolean
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_code ⇒ Object (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 |
#order ⇒ Object (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
#activate ⇒ Object
12 13 14 |
# File 'app/models/spree/null_promotion_handler.rb', line 12 def activate @order end |
#apply ⇒ Object
16 17 18 |
# File 'app/models/spree/null_promotion_handler.rb', line 16 def apply self end |
#can_apply? ⇒ Boolean
20 21 22 |
# File 'app/models/spree/null_promotion_handler.rb', line 20 def can_apply? true end |
#error ⇒ Object
24 25 26 |
# File 'app/models/spree/null_promotion_handler.rb', line 24 def error nil end |
#status ⇒ Object
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_code ⇒ Object
36 37 38 |
# File 'app/models/spree/null_promotion_handler.rb', line 36 def status_code :coupon_code_applied end |
#success ⇒ Object
28 29 30 |
# File 'app/models/spree/null_promotion_handler.rb', line 28 def success true end |
#successful? ⇒ Boolean
32 33 34 |
# File 'app/models/spree/null_promotion_handler.rb', line 32 def successful? true end |