Class: Spree::PaymentMethod
- Inherits:
-
Base
- Object
- ApplicationRecord
- Base
- Spree::PaymentMethod
show all
- Defined in:
- app/models/spree/payment_method.rb
Defined Under Namespace
Classes: Check, StoreCredit
Constant Summary
collapse
- DISPLAY =
[:both, :front_end, :back_end].freeze
Class Method Summary
collapse
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
Class Method Details
.find_with_destroyed(*args) ⇒ Object
39
40
41
|
# File 'app/models/spree/payment_method.rb', line 39
def self.find_with_destroyed(*args)
unscoped { find(*args) }
end
|
.providers ⇒ Object
20
21
22
|
# File 'app/models/spree/payment_method.rb', line 20
def self.providers
Rails.application.config.spree.payment_methods
end
|
Instance Method Details
#auto_capture? ⇒ Boolean
57
58
59
|
# File 'app/models/spree/payment_method.rb', line 57
def auto_capture?
auto_capture.nil? ? Spree::Config[:auto_capture] : auto_capture
end
|
#available_for_order?(_order) ⇒ Boolean
Custom PaymentMethod/Gateway can redefine this method to check method availability for concrete order.
75
76
77
|
# File 'app/models/spree/payment_method.rb', line 75
def available_for_order?(_order)
true
end
|
#cancel(_response) ⇒ Object
65
66
67
|
# File 'app/models/spree/payment_method.rb', line 65
def cancel(_response)
raise ::NotImplementedError, 'You must implement cancel method for this payment method.'
end
|
#method_type ⇒ Object
35
36
37
|
# File 'app/models/spree/payment_method.rb', line 35
def method_type
type.demodulize.downcase
end
|
#payment_profiles_supported? ⇒ Boolean
43
44
45
|
# File 'app/models/spree/payment_method.rb', line 43
def payment_profiles_supported?
false
end
|
#payment_source_class ⇒ Object
The class that will process payments for this payment type, used for @payment.source e.g. CreditCard in the case of a the Gateway payment type nil means the payment method doesn’t require a source e.g. check
31
32
33
|
# File 'app/models/spree/payment_method.rb', line 31
def payment_source_class
raise ::NotImplementedError, 'You must implement payment_source_class method for this gateway.'
end
|
#provider_class ⇒ Object
24
25
26
|
# File 'app/models/spree/payment_method.rb', line 24
def provider_class
raise ::NotImplementedError, 'You must implement provider_class method for this gateway.'
end
|
#reusable_sources(_order) ⇒ Object
Custom gateways should redefine this method. See Gateway implementation as an example
53
54
55
|
# File 'app/models/spree/payment_method.rb', line 53
def reusable_sources(_order)
[]
end
|
#source_required? ⇒ Boolean
47
48
49
|
# File 'app/models/spree/payment_method.rb', line 47
def source_required?
true
end
|
#supports?(_source) ⇒ Boolean
61
62
63
|
# File 'app/models/spree/payment_method.rb', line 61
def supports?(_source)
true
end
|