Class: Spree::StoreCreditEvent

Inherits:
Base
  • Object
show all
Extended by:
DisplayMoney
Defined in:
app/models/spree/store_credit_event.rb

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Methods inherited from Base

belongs_to_required_by_default, for_store, has_many_inversing, json_api_columns, json_api_permitted_attributes, json_api_type, page, spree_base_scopes, spree_base_uniqueness_scope

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #deprecated_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_deprecated, #preference_type, #set_preference

Instance Method Details

#display_actionObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/spree/store_credit_event.rb', line 16

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

#orderObject



29
30
31
# File 'app/models/spree/store_credit_event.rb', line 29

def order
  store.payments.find_by(response_code: authorization_code).try(:order)
end