Class: PaymentMethod
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PaymentMethod
show all
- Defined in:
- app/models/payment_method.rb
Defined Under Namespace
Classes: Check
Constant Summary
collapse
- DISPLAY =
[:both, :front_end, :back_end]
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.active? ⇒ Boolean
24
25
26
|
# File 'app/models/payment_method.rb', line 24
def self.active?
self.count(:conditions => {:type => self.to_s, :environment => Rails.env, :active => true}) > 0
end
|
.available(display_on = 'both') ⇒ Object
20
21
22
|
# File 'app/models/payment_method.rb', line 20
def self.available(display_on='both')
PaymentMethod.all.select { |p| p.active && (p.display_on == display_on.to_s || p.display_on.blank?) && (p.environment == Rails.env || p.environment.blank?) }
end
|
.current ⇒ Object
28
29
30
|
# File 'app/models/payment_method.rb', line 28
def self.current
PaymentMethod.find(:first, :conditions => {:active => true, :environment => Rails.env})
end
|
.find_with_destroyed(*args) ⇒ Object
40
41
42
|
# File 'app/models/payment_method.rb', line 40
def self.find_with_destroyed *args
self.with_exclusive_scope { find(*args) }
end
|
.providers ⇒ Object
5
6
7
|
# File 'app/models/payment_method.rb', line 5
def self.providers
Rails.application.config.spree.payment_methods
end
|
Instance Method Details
#destroy ⇒ Object
36
37
38
|
# File 'app/models/payment_method.rb', line 36
def destroy
self.update_attribute(:deleted_at, Time.now.utc)
end
|
#method_type ⇒ Object
32
33
34
|
# File 'app/models/payment_method.rb', line 32
def method_type
type.demodulize.downcase
end
|
#payment_profiles_supported? ⇒ Boolean
44
45
46
|
# File 'app/models/payment_method.rb', line 44
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
16
17
18
|
# File 'app/models/payment_method.rb', line 16
def payment_source_class
raise "You must implement payment_source_class method for this gateway."
end
|
#provider_class ⇒ Object
9
10
11
|
# File 'app/models/payment_method.rb', line 9
def provider_class
raise "You must implement provider_class method for this gateway."
end
|
#source_required? ⇒ Boolean
48
49
50
|
# File 'app/models/payment_method.rb', line 48
def source_required?
true
end
|