activemerchant_paybox_direct_plus 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -17
- data/Gemfile.lock +39 -82
- data/README.md +106 -0
- data/Rakefile +8 -52
- data/activemerchant_paybox_direct_plus.gemspec +31 -67
- data/lib/activemerchant_paybox_direct_plus.rb +54 -160
- data/test/remote/gateways/remote_paybox_direct_plus_test.rb +77 -40
- data/test/test_helper.rb +7 -196
- metadata +79 -131
- data/README.markdown +0 -45
- data/VERSION +0 -1
- data/test/fixtures.yml +0 -4
data/test/test_helper.rb
CHANGED
@@ -1,201 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
3
4
|
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
require 'money'
|
7
|
-
require 'mocha/setup'
|
8
|
-
require 'yaml'
|
9
|
-
require 'active_merchant'
|
10
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'activemerchant_paybox_direct_plus')
|
11
|
-
|
12
|
-
require 'active_support/core_ext/integer/time'
|
13
|
-
require 'active_support/core_ext/numeric/time'
|
14
|
-
|
15
|
-
begin
|
16
|
-
require 'active_support/core_ext/time/acts_like'
|
17
|
-
rescue LoadError
|
18
|
-
end
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
19
6
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
require 'action_controller'
|
27
|
-
require "action_view/template"
|
28
|
-
begin
|
29
|
-
require 'action_dispatch/testing/test_process'
|
30
|
-
rescue LoadError
|
31
|
-
require 'action_controller/test_process'
|
32
|
-
end
|
33
|
-
require 'active_merchant/billing/integrations/action_view_helper'
|
7
|
+
require 'bundler/setup'
|
8
|
+
require 'minitest/autorun'
|
9
|
+
require 'active_merchant'
|
10
|
+
require 'activemerchant_paybox_direct_plus'
|
34
11
|
|
35
12
|
ActiveMerchant::Billing::Base.mode = :test
|
36
|
-
|
37
|
-
require 'logger'
|
38
|
-
ActiveMerchant::Billing::Gateway.logger = Logger.new(STDOUT) if ENV['DEBUG_ACTIVE_MERCHANT'] == 'true'
|
39
|
-
|
40
|
-
# Test gateways
|
41
|
-
class SimpleTestGateway < ActiveMerchant::Billing::Gateway
|
42
|
-
end
|
43
|
-
|
44
|
-
class SubclassGateway < SimpleTestGateway
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
module ActiveMerchant
|
49
|
-
module Assertions
|
50
|
-
AssertionClass = RUBY_VERSION > '1.9' ? MiniTest::Assertion : Test::Unit::AssertionFailedError
|
51
|
-
|
52
|
-
def assert_field(field, value)
|
53
|
-
clean_backtrace do
|
54
|
-
assert_equal value, @helper.fields[field]
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# Allows the testing of you to check for negative assertions:
|
59
|
-
#
|
60
|
-
# # Instead of
|
61
|
-
# assert !something_that_is_false
|
62
|
-
#
|
63
|
-
# # Do this
|
64
|
-
# assert_false something_that_should_be_false
|
65
|
-
#
|
66
|
-
# An optional +msg+ parameter is available to help you debug.
|
67
|
-
def assert_false(boolean, message = nil)
|
68
|
-
message = build_message message, '<?> is not false or nil.', boolean
|
69
|
-
|
70
|
-
clean_backtrace do
|
71
|
-
assert_block message do
|
72
|
-
not boolean
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# A handy little assertion to check for a successful response:
|
78
|
-
#
|
79
|
-
# # Instead of
|
80
|
-
# assert_success response
|
81
|
-
#
|
82
|
-
# # DRY that up with
|
83
|
-
# assert_success response
|
84
|
-
#
|
85
|
-
# A message will automatically show the inspection of the response
|
86
|
-
# object if things go afoul.
|
87
|
-
def assert_success(response)
|
88
|
-
clean_backtrace do
|
89
|
-
assert response.success?, "Response failed: #{response.inspect}"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
# The negative of +assert_success+
|
94
|
-
def assert_failure(response)
|
95
|
-
clean_backtrace do
|
96
|
-
assert_false response.success?, "Response expected to fail: #{response.inspect}"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def assert_valid(validateable)
|
101
|
-
clean_backtrace do
|
102
|
-
assert validateable.valid?, "Expected to be valid"
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def assert_not_valid(validateable)
|
107
|
-
clean_backtrace do
|
108
|
-
assert_false validateable.valid?, "Expected to not be valid"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
private
|
113
|
-
def clean_backtrace(&block)
|
114
|
-
yield
|
115
|
-
rescue AssertionClass => e
|
116
|
-
path = File.expand_path(__FILE__)
|
117
|
-
raise AssertionClass, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
module Fixtures
|
122
|
-
HOME_DIR = RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
|
123
|
-
LOCAL_CREDENTIALS = File.join(HOME_DIR.to_s, '.active_merchant/fixtures.yml') unless defined?(LOCAL_CREDENTIALS)
|
124
|
-
DEFAULT_CREDENTIALS = File.join(File.dirname(__FILE__), 'fixtures.yml') unless defined?(DEFAULT_CREDENTIALS)
|
125
|
-
|
126
|
-
private
|
127
|
-
def credit_card(number = '4242424242424242', options = {})
|
128
|
-
defaults = {
|
129
|
-
:number => number,
|
130
|
-
:month => 9,
|
131
|
-
:year => Time.now.year + 1,
|
132
|
-
:first_name => 'Longbob',
|
133
|
-
:last_name => 'Longsen',
|
134
|
-
:verification_value => '123',
|
135
|
-
:type => 'visa'
|
136
|
-
}.update(options)
|
137
|
-
|
138
|
-
Billing::CreditCard.new(defaults)
|
139
|
-
end
|
140
|
-
|
141
|
-
def check(options = {})
|
142
|
-
defaults = {
|
143
|
-
:name => 'Jim Smith',
|
144
|
-
:routing_number => '244183602',
|
145
|
-
:account_number => '15378535',
|
146
|
-
:account_holder_type => 'personal',
|
147
|
-
:account_type => 'checking',
|
148
|
-
:number => '1'
|
149
|
-
}.update(options)
|
150
|
-
|
151
|
-
Billing::Check.new(defaults)
|
152
|
-
end
|
153
|
-
|
154
|
-
def address(options = {})
|
155
|
-
{
|
156
|
-
:name => 'Jim Smith',
|
157
|
-
:address1 => '1234 My Street',
|
158
|
-
:address2 => 'Apt 1',
|
159
|
-
:company => 'Widgets Inc',
|
160
|
-
:city => 'Ottawa',
|
161
|
-
:state => 'ON',
|
162
|
-
:zip => 'K1C2N6',
|
163
|
-
:country => 'CA',
|
164
|
-
:phone => '(555)555-5555',
|
165
|
-
:fax => '(555)555-6666'
|
166
|
-
}.update(options)
|
167
|
-
end
|
168
|
-
|
169
|
-
def all_fixtures
|
170
|
-
@@fixtures ||= load_fixtures
|
171
|
-
end
|
172
|
-
|
173
|
-
def fixtures(key)
|
174
|
-
data = all_fixtures[key] || raise(StandardError, "No fixture data was found for '#{key}'")
|
175
|
-
|
176
|
-
data.dup
|
177
|
-
end
|
178
|
-
|
179
|
-
def load_fixtures
|
180
|
-
file = File.exists?(LOCAL_CREDENTIALS) ? LOCAL_CREDENTIALS : DEFAULT_CREDENTIALS
|
181
|
-
yaml_data = YAML.load(File.read(file))
|
182
|
-
symbolize_keys(yaml_data)
|
183
|
-
|
184
|
-
yaml_data
|
185
|
-
end
|
186
|
-
|
187
|
-
def symbolize_keys(hash)
|
188
|
-
return unless hash.is_a?(Hash)
|
189
|
-
|
190
|
-
hash.symbolize_keys!
|
191
|
-
hash.each{|k,v| symbolize_keys(v)}
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
Test::Unit::TestCase.class_eval do
|
197
|
-
include ActiveMerchant::Billing
|
198
|
-
include ActiveMerchant::Assertions
|
199
|
-
include ActiveMerchant::Utils
|
200
|
-
include ActiveMerchant::Fixtures
|
201
|
-
end
|
metadata
CHANGED
@@ -1,179 +1,127 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemerchant_paybox_direct_plus
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- donaldpiret
|
9
8
|
- arambert
|
10
9
|
- slainer68
|
10
|
+
- TiteiKo
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
18
17
|
name: activemerchant
|
19
|
-
requirement:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
type: :development
|
26
|
-
prerelease: false
|
27
|
-
version_requirements: *id001
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: shoulda
|
30
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
-
none: false
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: "0"
|
36
|
-
type: :development
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1'
|
23
|
+
type: :runtime
|
37
24
|
prerelease: false
|
38
|
-
version_requirements:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: minitest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
44
34
|
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
47
37
|
type: :development
|
48
38
|
prerelease: false
|
49
|
-
version_requirements:
|
50
|
-
|
51
|
-
name: jeweler
|
52
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
55
41
|
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
58
|
-
|
59
|
-
prerelease: false
|
60
|
-
version_requirements: *id004
|
61
|
-
- !ruby/object:Gem::Dependency
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
- !ruby/object:Gem::Dependency
|
62
45
|
name: simplecov
|
63
|
-
requirement:
|
64
|
-
|
65
|
-
requirements:
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
66
48
|
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
69
51
|
type: :development
|
70
52
|
prerelease: false
|
71
|
-
version_requirements:
|
72
|
-
|
73
|
-
name: money
|
74
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
|
-
requirements:
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
77
55
|
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: "0"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bundler
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '1.7'
|
91
65
|
type: :development
|
92
66
|
prerelease: false
|
93
|
-
version_requirements:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.7'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: rake
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '10'
|
102
79
|
type: :development
|
103
80
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: "3.0"
|
113
|
-
type: :development
|
114
|
-
prerelease: false
|
115
|
-
version_requirements: *id009
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
name: activemerchant
|
118
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
|
-
requirements:
|
121
|
-
- - ~>
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: "1.10"
|
124
|
-
type: :runtime
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: *id010
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '10'
|
127
86
|
description: Paybox Direct Plus ActiveMerchant Billing Gateway implementation
|
128
87
|
email: nospam@nospam.com
|
129
88
|
executables: []
|
130
|
-
|
131
89
|
extensions: []
|
132
|
-
|
133
|
-
extra_rdoc_files:
|
90
|
+
extra_rdoc_files:
|
134
91
|
- LICENSE.txt
|
135
|
-
- README.
|
136
|
-
files:
|
92
|
+
- README.md
|
93
|
+
files:
|
137
94
|
- Gemfile
|
138
95
|
- Gemfile.lock
|
139
96
|
- LICENSE.txt
|
140
|
-
- README.
|
97
|
+
- README.md
|
141
98
|
- Rakefile
|
142
|
-
- VERSION
|
143
99
|
- activemerchant_paybox_direct_plus.gemspec
|
144
100
|
- lib/activemerchant_paybox_direct_plus.rb
|
145
|
-
- test/fixtures.yml
|
146
101
|
- test/remote/gateways/remote_paybox_direct_plus_test.rb
|
147
102
|
- test/test_helper.rb
|
148
103
|
homepage: https://github.com/arambert/Paybox-Direct-Plus
|
149
|
-
licenses:
|
104
|
+
licenses:
|
150
105
|
- MIT
|
106
|
+
metadata: {}
|
151
107
|
post_install_message:
|
152
108
|
rdoc_options: []
|
153
|
-
|
154
|
-
require_paths:
|
109
|
+
require_paths:
|
155
110
|
- lib
|
156
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
-
|
158
|
-
requirements:
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
159
113
|
- - ">="
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
version: "0"
|
165
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
-
none: false
|
167
|
-
requirements:
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
168
118
|
- - ">="
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
version:
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
171
121
|
requirements: []
|
172
|
-
|
173
122
|
rubyforge_project:
|
174
|
-
rubygems_version:
|
123
|
+
rubygems_version: 2.2.1
|
175
124
|
signing_key:
|
176
|
-
specification_version:
|
125
|
+
specification_version: 4
|
177
126
|
summary: Paybox Direct Plus for ActiveMerchant
|
178
127
|
test_files: []
|
179
|
-
|