Class: Spree::StoreCreditEvent
- Inherits:
-
Base
- Object
- ApplicationRecord
- Base
- Spree::StoreCreditEvent
show all
- Defined in:
- app/models/spree/store_credit_event.rb
Instance Method Summary
collapse
Methods inherited from Base
belongs_to_required_by_default, page, spree_base_scopes
#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#display_action ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/models/spree/store_credit_event.rb', line 21
def display_action
case action
when Spree::StoreCredit::CAPTURE_ACTION
Spree.t('store_credit.captured')
when Spree::StoreCredit::AUTHORIZE_ACTION
Spree.t('store_credit.authorized')
when Spree::StoreCredit::ALLOCATION_ACTION
Spree.t('store_credit.allocated')
when Spree::StoreCredit::VOID_ACTION, Spree::StoreCredit::CREDIT_ACTION
Spree.t('store_credit.credit')
end
end
|
#display_amount ⇒ Object
13
14
15
|
# File 'app/models/spree/store_credit_event.rb', line 13
def display_amount
Spree::Money.new(amount, currency: currency)
end
|
#display_user_total_amount ⇒ Object
17
18
19
|
# File 'app/models/spree/store_credit_event.rb', line 17
def display_user_total_amount
Spree::Money.new(user_total_amount, currency: currency)
end
|
#order ⇒ Object
34
35
36
|
# File 'app/models/spree/store_credit_event.rb', line 34
def order
Spree::Payment.find_by(response_code: authorization_code).try(:order)
end
|