Class: Spree::StoreCreditEvent Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

NON_EXPOSED_ACTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[Spree::StoreCredit::ELIGIBLE_ACTION, Spree::StoreCredit::AUTHORIZE_ACTION]

Instance Method Summary (collapse)

Methods inherited from Base

display_includes, #initialize_preference_defaults, page, preference

Methods included from Preferences::Preferable

#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

- (Boolean) action_requires_reason?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


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

def action_requires_reason?
  [Spree::StoreCredit::ADJUSTMENT_ACTION, Spree::StoreCredit::INVALIDATE_ACTION].include?(action)
end

- (Boolean) authorization_action?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


25
26
27
# File 'app/models/spree/store_credit_event.rb', line 25

def authorization_action?
  action == Spree::StoreCredit::AUTHORIZE_ACTION
end

- (Boolean) capture_action?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


21
22
23
# File 'app/models/spree/store_credit_event.rb', line 21

def capture_action?
  action == Spree::StoreCredit::CAPTURE_ACTION
end

- (Object) display_action

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
48
# File 'app/models/spree/store_credit_event.rb', line 45

def display_action
  return if NON_EXPOSED_ACTIONS.include?(action)
  Spree.t("store_credit.display_action.#{action}")
end

- (Object) display_amount

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
# File 'app/models/spree/store_credit_event.rb', line 33

def display_amount
  Spree::Money.new(amount, { currency: currency })
end

- (Object) display_event_date

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'app/models/spree/store_credit_event.rb', line 41

def display_event_date
  I18n.l(created_at.to_date, format: :long)
end

- (Object) display_user_total_amount

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'app/models/spree/store_credit_event.rb', line 37

def display_user_total_amount
  Spree::Money.new(user_total_amount, { currency: currency })
end

- (Object) order

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



50
51
52
# File 'app/models/spree/store_credit_event.rb', line 50

def order
  Spree::Payment.find_by_response_code(authorization_code).try(:order)
end