Class: Spree::Gateway
Direct Known Subclasses
Bogus
Defined Under Namespace
Classes: Bogus, BogusSimple
Constant Summary
PaymentMethod::DISPLAY
Class Method Summary
collapse
-
.current ⇒ Object
instantiates the selected gateway and configures with the options stored in the database.
Instance Method Summary
collapse
active?, available, #destroy, find_with_destroyed, #provider_class, providers, #source_required?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
34
35
36
37
38
39
40
|
# File 'app/models/spree/gateway.rb', line 34
def method_missing(method, *args)
if @provider.nil? || !@provider.respond_to?(method)
super
else
provider.send(method)
end
end
|
Class Method Details
.current ⇒ Object
instantiates the selected gateway and configures with the options stored in the database
15
16
17
|
# File 'app/models/spree/gateway.rb', line 15
def self.current
super
end
|
Instance Method Details
#method_type ⇒ Object
46
47
48
|
# File 'app/models/spree/gateway.rb', line 46
def method_type
'gateway'
end
|
#options ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/models/spree/gateway.rb', line 26
def options
options_hash = {}
self.preferences.each do |key,value|
options_hash[key.to_sym] = value
end
options_hash
end
|
#payment_profiles_supported? ⇒ Boolean
42
43
44
|
# File 'app/models/spree/gateway.rb', line 42
def payment_profiles_supported?
false
end
|
#payment_source_class ⇒ Object
10
11
12
|
# File 'app/models/spree/gateway.rb', line 10
def payment_source_class
Creditcard
end
|
#provider ⇒ Object
19
20
21
22
23
24
|
# File 'app/models/spree/gateway.rb', line 19
def provider
gateway_options = options
gateway_options.delete :login if gateway_options.has_key?(:login) and gateway_options[:login].nil?
ActiveMerchant::Billing::Base.gateway_mode = gateway_options[:server].to_sym
@provider ||= provider_class.new(gateway_options)
end
|