Class: Spree::StoreCreditEvent
- Inherits:
-
Base
- Object
- ActiveRecord::Base
- Base
- Spree::StoreCreditEvent
show all
- Includes:
- SoftDeletable
- Defined in:
- app/models/spree/store_credit_event.rb
Constant Summary
collapse
- NON_EXPOSED_ACTIONS =
[Spree::StoreCredit::ELIGIBLE_ACTION, Spree::StoreCredit::AUTHORIZE_ACTION]
Instance Method Summary
collapse
Methods inherited from Base
display_includes
#generate_permalink, #save_permalink
Instance Method Details
#action_requires_reason? ⇒ Boolean
#authorization_action? ⇒ Boolean
#capture_action? ⇒ Boolean
#display_action ⇒ Object
51
52
53
54
|
# File 'app/models/spree/store_credit_event.rb', line 51
def display_action
return if NON_EXPOSED_ACTIONS.include?(action)
I18n.t("spree.store_credit.display_action.#{action}")
end
|
#display_amount ⇒ Object
35
36
37
|
# File 'app/models/spree/store_credit_event.rb', line 35
def display_amount
Spree::Money.new(amount, { currency: currency })
end
|
#display_event_date ⇒ Object
47
48
49
|
# File 'app/models/spree/store_credit_event.rb', line 47
def display_event_date
I18n.l(created_at.to_date, format: :long)
end
|
#display_remaining_amount ⇒ Object
43
44
45
|
# File 'app/models/spree/store_credit_event.rb', line 43
def display_remaining_amount
Spree::Money.new(amount_remaining, { currency: currency })
end
|
#display_user_total_amount ⇒ Object
39
40
41
|
# File 'app/models/spree/store_credit_event.rb', line 39
def display_user_total_amount
Spree::Money.new(user_total_amount, { currency: currency })
end
|
#order ⇒ Object
56
57
58
|
# File 'app/models/spree/store_credit_event.rb', line 56
def order
Spree::Payment.find_by(response_code: authorization_code).try(:order)
end
|