Class: Payzilla::Gateways::Gateway
- Inherits:
-
Object
- Object
- Payzilla::Gateways::Gateway
- Defined in:
- lib/payzilla/gateways.rb
Direct Known Subclasses
Akado, Beeline, Cyberplat, Dummy, Gorod, Mailru, Matrix, Megafon, Mts, Osmp, Rapida, Skylink, Webmoney, Yamoney, Yota
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#revision_page_size ⇒ Object
Returns the value of attribute revision_page_size.
Class Method Summary collapse
-
.available_attachments ⇒ Array
Show registered attachments.
-
.available_settings ⇒ Array
Show registered settings.
-
.available_switches ⇒ Array
Show registered switches.
-
.can_list_providers ⇒ Object
Set that Gateway can set providers.
-
.can_list_providers? ⇒ Boolean
Check if gateway can list providers.
-
.register_attachments(list) ⇒ Object
Register some attachments.
-
.register_settings(list) ⇒ Object
Register some settings.
-
.register_switches(list) ⇒ Object
Register some switches.
- .require_payment_fields(list) ⇒ Object
- .required_payment_fields ⇒ Object
-
.requires_revision ⇒ Object
Require gateway revision.
-
.requires_revision? ⇒ Boolean
Check if gateway requires revision.
Instance Method Summary collapse
-
#can_list_providers? ⇒ Boolean
Check if gateway can list providers.
-
#initialize(config, log = nil) ⇒ Gateway
constructor
Creates gateway instance.
-
#requires_revision? ⇒ Boolean
Check if gateway requires revision.
-
#revise(revision) ⇒ String
Send revision to carrier.
Constructor Details
#initialize(config, log = nil) ⇒ Gateway
Creates gateway instance
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/payzilla/gateways.rb', line 14 def initialize(config, log=nil) @config = config if defined?(Rails) && Rails.root.join('log/gateways').directory? log ||= Rails.root.join("log/gateways/#{@config.keyword}.log") end if !log.respond_to?(:info) @logger = Logger.new log.to_s, 2 @logger.level = Logger::DEBUG @logger.level = @config.debug_level if @config.respond_to?(:debug_level) @logger.formatter = Logger::Formatter.new end @revision_page_size = 5000 end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/payzilla/gateways.rb', line 6 def config @config end |
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/payzilla/gateways.rb', line 7 def logger @logger end |
#revision_page_size ⇒ Object
Returns the value of attribute revision_page_size.
8 9 10 |
# File 'lib/payzilla/gateways.rb', line 8 def revision_page_size @revision_page_size end |
Class Method Details
.available_attachments ⇒ Array
Show registered attachments
70 71 72 |
# File 'lib/payzilla/gateways.rb', line 70 def self. @available_attachments || [] end |
.available_settings ⇒ Array
Show registered settings
63 64 65 |
# File 'lib/payzilla/gateways.rb', line 63 def self.available_settings @available_settings || [] end |
.available_switches ⇒ Array
Show registered switches
77 78 79 |
# File 'lib/payzilla/gateways.rb', line 77 def self.available_switches @available_switches || [] end |
.can_list_providers ⇒ Object
Set that Gateway can set providers
111 112 113 |
# File 'lib/payzilla/gateways.rb', line 111 def self.can_list_providers @can_list_providers = true end |
.can_list_providers? ⇒ Boolean
Check if gateway can list providers
106 107 108 |
# File 'lib/payzilla/gateways.rb', line 106 def self.can_list_providers? @can_list_providers == true end |
.register_attachments(list) ⇒ Object
Register some attachments
41 42 43 |
# File 'lib/payzilla/gateways.rb', line 41 def self.(list) @available_attachments = list end |
.register_settings(list) ⇒ Object
Register some settings
34 35 36 |
# File 'lib/payzilla/gateways.rb', line 34 def self.register_settings(list) @available_settings = list end |
.register_switches(list) ⇒ Object
Register some switches
48 49 50 |
# File 'lib/payzilla/gateways.rb', line 48 def self.register_switches(list) @available_switches = list end |
.require_payment_fields(list) ⇒ Object
52 53 54 |
# File 'lib/payzilla/gateways.rb', line 52 def self.require_payment_fields(list) @required_payment_fields = list end |
.required_payment_fields ⇒ Object
56 57 58 |
# File 'lib/payzilla/gateways.rb', line 56 def self.required_payment_fields @required_payment_fields || [] end |
.requires_revision ⇒ Object
Require gateway revision
96 97 98 |
# File 'lib/payzilla/gateways.rb', line 96 def self.requires_revision @requires_revision = true end |
.requires_revision? ⇒ Boolean
Check if gateway requires revision
91 92 93 |
# File 'lib/payzilla/gateways.rb', line 91 def self.requires_revision? @requires_revision == true end |
Instance Method Details
#can_list_providers? ⇒ Boolean
Check if gateway can list providers
101 102 103 |
# File 'lib/payzilla/gateways.rb', line 101 def can_list_providers? self.class.can_list_providers? end |
#requires_revision? ⇒ Boolean
Check if gateway requires revision
84 85 86 |
# File 'lib/payzilla/gateways.rb', line 84 def requires_revision? self.class.requires_revision? end |
#revise(revision) ⇒ String
Send revision to carrier
119 120 121 |
# File 'lib/payzilla/gateways.rb', line 119 def revise(revision) send_revision revision, generate_revision(revision)[1] end |