gateway_signup 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gateway_signup.gemspec +14 -0
- data/.gitignore +18 -0
- data/Gemfile +1 -0
- data/LICENSE +20 -0
- data/README.md +2 -0
- data/lib/gateway_signup/config_engine.rb +18 -0
- data/lib/gateway_signup/engines/sqlite.rb +89 -0
- data/lib/gateway_signup/engines/yaml.rb +27 -0
- data/lib/gateway_signup/registry.rb +27 -0
- data/lib/gateway_signup.rb +4 -0
- data/spec/support/gateways.yml +149 -0
- data/spec/support/gw.yml +8 -0
- metadata +75 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'gateway_signup'
|
3
|
+
s.version = '0.1.0'
|
4
|
+
s.date = '2014-01-28'
|
5
|
+
s.summary = "Spreedly Gateway Registration Field Lookup"
|
6
|
+
s.description = "Small library for reading a config and returning the fields required to register a specific gateway with Spreedly"
|
7
|
+
s.authors = ["Glen Holcomb"]
|
8
|
+
s.email = 'dev@atpay.com'
|
9
|
+
s.files = `git ls-files`.split($/)
|
10
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
11
|
+
s.homepage = "https://github.com/atpay/gateway_signup"
|
12
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
13
|
+
s.add_runtime_dependency 'sqlite3'
|
14
|
+
end
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem 'sqlite3'
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 @Pay
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module GatewaySignup
|
2
|
+
class ConfigEngine
|
3
|
+
class << self
|
4
|
+
def source(type, options)
|
5
|
+
case type
|
6
|
+
when :yaml
|
7
|
+
require File.dirname(File.absolute_path __FILE__) + '/engines/yaml'
|
8
|
+
Engines::Yaml.new(options)
|
9
|
+
when :sqlite
|
10
|
+
require File.dirname(File.absolute_path __FILE__) + '/engines/sqlite'
|
11
|
+
Engines::Sqlite.new(options)
|
12
|
+
else
|
13
|
+
raise "Bad Source Type: #{type}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module GatewaySignup
|
2
|
+
module Engines
|
3
|
+
require 'sqlite3'
|
4
|
+
|
5
|
+
class Sqlite
|
6
|
+
def initialize(args)
|
7
|
+
@db = Sqlite3::Database.new args[:db]
|
8
|
+
end
|
9
|
+
|
10
|
+
def setup_db(force)
|
11
|
+
force ? force_create : soft_create
|
12
|
+
end
|
13
|
+
|
14
|
+
def gateways
|
15
|
+
results = []
|
16
|
+
|
17
|
+
@db.execute("select * from gateways") do |row|
|
18
|
+
results << row[:name]
|
19
|
+
end
|
20
|
+
|
21
|
+
results
|
22
|
+
end
|
23
|
+
|
24
|
+
def details(gateway)
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def fields_for(gateway)
|
29
|
+
id = @db.execute "select id from gateways where name = ?", gateway
|
30
|
+
|
31
|
+
@db.execute <<-SQL
|
32
|
+
select * from fields
|
33
|
+
left outer join gateways_fields
|
34
|
+
on gateways_fields.field_id = fields.id
|
35
|
+
where gateways_fields.gateway_id = ?;
|
36
|
+
SQL
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def force_create
|
43
|
+
drop_tables
|
44
|
+
|
45
|
+
create_gateway_table
|
46
|
+
create_field_table
|
47
|
+
create_gateway_field_table
|
48
|
+
end
|
49
|
+
|
50
|
+
def soft_create
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_gateway_table
|
55
|
+
@db.ecexute <<-SQL
|
56
|
+
create table if not exists gateways (
|
57
|
+
id integer_primary_key,
|
58
|
+
name varchar(255),
|
59
|
+
country varchar(255),
|
60
|
+
display_name varchar(255)
|
61
|
+
);
|
62
|
+
SQL
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_field_table
|
66
|
+
@db.execute <<-SQL
|
67
|
+
create table if not exists fields (
|
68
|
+
id integer_primary_key,
|
69
|
+
type varchar(255),
|
70
|
+
val varchar(255)
|
71
|
+
);
|
72
|
+
SQL
|
73
|
+
end
|
74
|
+
|
75
|
+
def create_gateway_field_table
|
76
|
+
@db.execute <<-SQL
|
77
|
+
create table if not exists gateways_fields (
|
78
|
+
gateway_id int,
|
79
|
+
field_id int
|
80
|
+
);
|
81
|
+
SQL
|
82
|
+
end
|
83
|
+
|
84
|
+
def drop_tables
|
85
|
+
@db.execute
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GatewaySignup
|
2
|
+
module Engines
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class Yaml
|
6
|
+
def initialize(file)
|
7
|
+
@gw_data = YAML.load_file file
|
8
|
+
end
|
9
|
+
|
10
|
+
def fields_for(gateway)
|
11
|
+
@gw_data[gateway.to_sym][:fields]
|
12
|
+
end
|
13
|
+
|
14
|
+
def gateways
|
15
|
+
@gw_data.keys
|
16
|
+
end
|
17
|
+
|
18
|
+
def details(gateway)
|
19
|
+
@gw_data[gateway.to_sym]
|
20
|
+
end
|
21
|
+
|
22
|
+
def for_country(country)
|
23
|
+
gateways.select { |gw| @gw_data[gw][:countries].include? country }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GatewaySignup
|
2
|
+
class Registry
|
3
|
+
def initialize(args)
|
4
|
+
@config = ConfigEngine.source args[:format], args[:location]
|
5
|
+
end
|
6
|
+
|
7
|
+
def setup_sqlite(force)
|
8
|
+
@config.setup_db force
|
9
|
+
end
|
10
|
+
|
11
|
+
def gateways
|
12
|
+
@config.gateways
|
13
|
+
end
|
14
|
+
|
15
|
+
def fields_for(gateway)
|
16
|
+
@config.fields_for gateway
|
17
|
+
end
|
18
|
+
|
19
|
+
def details(gateway)
|
20
|
+
@config.details gateway
|
21
|
+
end
|
22
|
+
|
23
|
+
def for_country(country)
|
24
|
+
@config.for_country country
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
:authorize_net:
|
2
|
+
:display_name: Authorize.Net
|
3
|
+
:country: US
|
4
|
+
:fields:
|
5
|
+
|
6
|
+
:balanced:
|
7
|
+
:display_name: Balanced
|
8
|
+
:country: US
|
9
|
+
:fields:
|
10
|
+
|
11
|
+
:bean_stream:
|
12
|
+
:display_name: BeanStream
|
13
|
+
:country: US
|
14
|
+
:fields:
|
15
|
+
|
16
|
+
:blue_pay:
|
17
|
+
:display_name: BluePay
|
18
|
+
:country: US
|
19
|
+
:fields:
|
20
|
+
|
21
|
+
:brain_tree:
|
22
|
+
:display_name: BrainTree
|
23
|
+
:country: US
|
24
|
+
:fields:
|
25
|
+
|
26
|
+
:cyber_source:
|
27
|
+
:display_name: CyberSource
|
28
|
+
:country: US
|
29
|
+
:fields:
|
30
|
+
|
31
|
+
:dwolla:
|
32
|
+
:display_name: Dwolla
|
33
|
+
:country: US
|
34
|
+
:fields:
|
35
|
+
|
36
|
+
:elavon:
|
37
|
+
:display_name: Elavon
|
38
|
+
:country: US
|
39
|
+
:fields:
|
40
|
+
|
41
|
+
:first_data_e4:
|
42
|
+
:display_name: First Data e4
|
43
|
+
:country: US
|
44
|
+
:fields:
|
45
|
+
|
46
|
+
:first_data_global_gateway:
|
47
|
+
:display_name: First Data Global Gateway
|
48
|
+
:country: US
|
49
|
+
:fields:
|
50
|
+
|
51
|
+
:jet_pay:
|
52
|
+
:display_name: JetPay
|
53
|
+
:country: US
|
54
|
+
:fields:
|
55
|
+
|
56
|
+
:litle:
|
57
|
+
:display_name: Litle
|
58
|
+
:country: US
|
59
|
+
:fields:
|
60
|
+
|
61
|
+
:merchant_e_solutions:
|
62
|
+
:display_name: Merchant e-Solutions
|
63
|
+
:country: US
|
64
|
+
:fields:
|
65
|
+
|
66
|
+
:mercury:
|
67
|
+
:display_name: Mercury
|
68
|
+
:country: US
|
69
|
+
:fields:
|
70
|
+
|
71
|
+
:net_billing:
|
72
|
+
:display_name: NETbilling
|
73
|
+
:country: US
|
74
|
+
:fields:
|
75
|
+
|
76
|
+
:nmi:
|
77
|
+
:display_name: NMI
|
78
|
+
:country: US
|
79
|
+
:fields:
|
80
|
+
|
81
|
+
:paymentech_orbital_gateway:
|
82
|
+
:display_name: Paymentech Orbital Gateway
|
83
|
+
:country: US
|
84
|
+
:fields:
|
85
|
+
|
86
|
+
:payflow_pro:
|
87
|
+
:display_name: Payflow Pro
|
88
|
+
:country: US
|
89
|
+
:fields:
|
90
|
+
|
91
|
+
:payment_express:
|
92
|
+
:display_name: Payment Express
|
93
|
+
:country: US
|
94
|
+
:fields:
|
95
|
+
|
96
|
+
:pay_pal:
|
97
|
+
:display_name: PayPal
|
98
|
+
:country: US
|
99
|
+
:fields:
|
100
|
+
|
101
|
+
:quick_books_merchant_services:
|
102
|
+
:display_name: QuickBooks Merchant Services
|
103
|
+
:country: US
|
104
|
+
:fields:
|
105
|
+
|
106
|
+
:quantum:
|
107
|
+
:display_name: Quantum
|
108
|
+
:country: US
|
109
|
+
:fields:
|
110
|
+
|
111
|
+
:sage_payment_solutions:
|
112
|
+
:display_name: Sage Payment Solutions
|
113
|
+
:country: US
|
114
|
+
:fields:
|
115
|
+
|
116
|
+
:secure_net:
|
117
|
+
:display_name: SecureNet
|
118
|
+
:country: US
|
119
|
+
:fields:
|
120
|
+
|
121
|
+
:stripe:
|
122
|
+
:display_name: Stripe
|
123
|
+
:country: US
|
124
|
+
:fields:
|
125
|
+
|
126
|
+
:spreedly_test:
|
127
|
+
:display_name: Spreedly Test
|
128
|
+
:country: US
|
129
|
+
:fields:
|
130
|
+
|
131
|
+
:trans_first:
|
132
|
+
:display_name: TransFirst
|
133
|
+
:country: US
|
134
|
+
:fields:
|
135
|
+
|
136
|
+
:trust_commerce:
|
137
|
+
:display_name: TrustCommerce
|
138
|
+
:country: US
|
139
|
+
:fields:
|
140
|
+
|
141
|
+
:usa_epay:
|
142
|
+
:display_name: USA ePay
|
143
|
+
:country: US
|
144
|
+
:fields:
|
145
|
+
|
146
|
+
:world_pay:
|
147
|
+
:display_name: WorldPay
|
148
|
+
:country: US
|
149
|
+
:fields:
|
data/spec/support/gw.yml
ADDED
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gateway_signup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Glen Holcomb
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sqlite3
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Small library for reading a config and returning the fields required
|
31
|
+
to register a specific gateway with Spreedly
|
32
|
+
email: dev@atpay.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- .gateway_signup.gemspec
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE
|
41
|
+
- README.md
|
42
|
+
- lib/gateway_signup.rb
|
43
|
+
- lib/gateway_signup/config_engine.rb
|
44
|
+
- lib/gateway_signup/engines/sqlite.rb
|
45
|
+
- lib/gateway_signup/engines/yaml.rb
|
46
|
+
- lib/gateway_signup/registry.rb
|
47
|
+
- spec/support/gateways.yml
|
48
|
+
- spec/support/gw.yml
|
49
|
+
homepage: https://github.com/atpay/gateway_signup
|
50
|
+
licenses: []
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 1.8.23
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: Spreedly Gateway Registration Field Lookup
|
73
|
+
test_files:
|
74
|
+
- spec/support/gateways.yml
|
75
|
+
- spec/support/gw.yml
|