activemerchant-paymentech-orbital 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +18 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/activemerchant-paymentech-orbital.gemspec +79 -0
- data/lib/active_merchant/billing/paymentech_orbital.rb +113 -0
- data/lib/active_merchant/billing/paymentech_orbital/request.rb +67 -0
- data/lib/active_merchant/billing/paymentech_orbital/request/end_of_day.rb +22 -0
- data/lib/active_merchant/billing/paymentech_orbital/request/new_order.rb +121 -0
- data/lib/active_merchant/billing/paymentech_orbital/request/profile_management.rb +82 -0
- data/lib/active_merchant/billing/paymentech_orbital/request/void.rb +39 -0
- data/lib/active_merchant/billing/paymentech_orbital/response.rb +100 -0
- data/lib/activemerchant-paymentech-orbital.rb +9 -0
- data/test/activemerchant-paymentech-orbital_test.rb +7 -0
- data/test/factories.rb +170 -0
- data/test/mocks/active_merchant/billing/gateway.rb +9 -0
- data/test/options.rb +85 -0
- data/test/payment_orbital/gateway_test.rb +131 -0
- data/test/payment_orbital/request/end_of_day_test.rb +30 -0
- data/test/payment_orbital/request/new_order_test.rb +40 -0
- data/test/payment_orbital/request/profile_management_test.rb +47 -0
- data/test/payment_orbital/request/void_test.rb +28 -0
- data/test/payment_orbital/request_test.rb +28 -0
- data/test/test_helper.rb +22 -0
- metadata +100 -0
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class GatewayTest < Test::Unit::TestCase
|
4
|
+
context "Initializing" do
|
5
|
+
[ :login, :password, :merchant_id, :bin, :terminal_id ].each do |attr|
|
6
|
+
should "require #{attr}" do
|
7
|
+
assert_raises(ArgumentError) do
|
8
|
+
gateway(:"#{attr}" => nil)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
should "add currency_exponent to options" do
|
14
|
+
assert_not_nil gateway.options[:currency_exponent]
|
15
|
+
end
|
16
|
+
|
17
|
+
should "add currency_code to options" do
|
18
|
+
assert_not_nil gateway.options[:currency_code]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "Authorizing" do
|
23
|
+
setup do
|
24
|
+
@gateway = gateway
|
25
|
+
@credit_card = Factory(:credit_card)
|
26
|
+
@gateway.authorize(0, @credit_card)
|
27
|
+
end
|
28
|
+
|
29
|
+
should "assign instance variable request" do
|
30
|
+
assert_not_nil @gateway.request
|
31
|
+
end
|
32
|
+
|
33
|
+
should "instance variable request should be Request::NewOrder" do
|
34
|
+
assert @gateway.request.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Request::NewOrder)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "Purchasing" do
|
39
|
+
setup do
|
40
|
+
@gateway = gateway
|
41
|
+
@credit_card = Factory(:credit_card)
|
42
|
+
@gateway.purchase(100, @credit_card)
|
43
|
+
end
|
44
|
+
|
45
|
+
should "assign instance variable request" do
|
46
|
+
assert_not_nil @gateway.request
|
47
|
+
end
|
48
|
+
|
49
|
+
should "instance variable request should be Request::NewOrder" do
|
50
|
+
assert @gateway.request.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Request::NewOrder)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "Refunding" do
|
55
|
+
setup do
|
56
|
+
@gateway = gateway
|
57
|
+
@credit_card = Factory(:credit_card)
|
58
|
+
@gateway.refund(100, @credit_card)
|
59
|
+
end
|
60
|
+
|
61
|
+
should "assign instance variable request" do
|
62
|
+
assert_not_nil @gateway.request
|
63
|
+
end
|
64
|
+
|
65
|
+
should "instance variable request should be Request::NewOrder" do
|
66
|
+
assert @gateway.request.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Request::NewOrder)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "Interacting with a saved profile" do
|
71
|
+
setup do
|
72
|
+
@gateway = gateway
|
73
|
+
@gateway.profile(:read, nil)
|
74
|
+
end
|
75
|
+
|
76
|
+
should "assign instance variable request" do
|
77
|
+
assert_not_nil @gateway.request
|
78
|
+
end
|
79
|
+
|
80
|
+
should "instance variable request should be Request::ProfileManagement" do
|
81
|
+
assert @gateway.request.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Request::ProfileManagement)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "Voiding" do
|
86
|
+
setup do
|
87
|
+
@gateway = gateway
|
88
|
+
@gateway.void("1", "1", 100)
|
89
|
+
end
|
90
|
+
|
91
|
+
should "assign instance variable request" do
|
92
|
+
assert_not_nil @gateway.request
|
93
|
+
end
|
94
|
+
|
95
|
+
should "instance variable request should be Request::Void" do
|
96
|
+
assert @gateway.request.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Request::Void)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "Sending an end of day request" do
|
101
|
+
setup do
|
102
|
+
@gateway = gateway
|
103
|
+
@gateway.end_of_day
|
104
|
+
end
|
105
|
+
|
106
|
+
should "assign instance variable request" do
|
107
|
+
assert_not_nil @gateway.request
|
108
|
+
end
|
109
|
+
|
110
|
+
should "instance variable request should be Request::ProfileManagement" do
|
111
|
+
assert @gateway.request.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Request::EndOfDay)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "Committing" do
|
116
|
+
setup do
|
117
|
+
@gateway = gateway
|
118
|
+
@request = new_order_request
|
119
|
+
@gateway.instance_variable_set("@request", @request)
|
120
|
+
@gateway.send(:commit, "sale", @request)
|
121
|
+
end
|
122
|
+
|
123
|
+
should "assign instance variable response" do
|
124
|
+
assert_not_nil @gateway.response
|
125
|
+
end
|
126
|
+
|
127
|
+
should "assign an instance of Response::Base as response instance variable" do
|
128
|
+
assert @gateway.response.is_a?(ActiveMerchant::Billing::PaymentechOrbital::Response)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class EndOfDayTest < Test::Unit::TestCase
|
4
|
+
context "Initializing" do
|
5
|
+
setup do
|
6
|
+
@request = end_of_day_request
|
7
|
+
end
|
8
|
+
|
9
|
+
[ :options ].each do |attr|
|
10
|
+
should "set @#{attr} instance variable" do
|
11
|
+
assert_not_nil @request.send(attr)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "A base request" do
|
17
|
+
setup do
|
18
|
+
@request = end_of_day_request
|
19
|
+
end
|
20
|
+
|
21
|
+
should "delegate to options" do
|
22
|
+
assert_delegates_to_ostruct(@request, @request.options, *[
|
23
|
+
:login, :password, :merchant_id,
|
24
|
+
:bin, :terminal_id, :currency_code,
|
25
|
+
:currency_exponent, :customer_ref_num,
|
26
|
+
:order_id
|
27
|
+
])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NewOrderTest < Test::Unit::TestCase
|
4
|
+
context "Initializing" do
|
5
|
+
setup do
|
6
|
+
@request = new_order_request
|
7
|
+
end
|
8
|
+
|
9
|
+
[ :message_type, :money, :credit_card, :options ].each do |attr|
|
10
|
+
should "set @#{attr} instance variable" do
|
11
|
+
assert_not_nil @request.send(attr)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "A base request" do
|
17
|
+
setup do
|
18
|
+
@request = new_order_request
|
19
|
+
end
|
20
|
+
|
21
|
+
should "delegate to options" do
|
22
|
+
assert_delegates_to_ostruct(@request, @request.options, *[
|
23
|
+
:login, :password, :merchant_id, :bin, :terminal_id, :currency_code,
|
24
|
+
:currency_exponent, :customer_ref_num, :order_id,
|
25
|
+
:industry_type, :mb_type, :recurring_start_date,
|
26
|
+
:recurring_end_date, :recurring_end_date_flag,
|
27
|
+
:recurring_max_billings, :recurring_frequency,
|
28
|
+
:deferred_bill_date, :soft_descriptors
|
29
|
+
])
|
30
|
+
end
|
31
|
+
|
32
|
+
should "be recurring if industry_type is RC" do
|
33
|
+
assert new_order_request(:industry_type => "RC").recurring?
|
34
|
+
end
|
35
|
+
|
36
|
+
should "not be recurring if industry_type is RC" do
|
37
|
+
assert !new_order_request(:industry_type => "EC").recurring?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ProfileManagementTest < Test::Unit::TestCase
|
4
|
+
context "Initializing" do
|
5
|
+
setup do
|
6
|
+
@request = profile_management_request
|
7
|
+
end
|
8
|
+
|
9
|
+
[ :action, :credit_card, :options ].each do |attr|
|
10
|
+
should "set @#{attr} instance variable" do
|
11
|
+
assert_not_nil @request.send(attr)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "A base request" do
|
17
|
+
setup do
|
18
|
+
@request = profile_management_request
|
19
|
+
end
|
20
|
+
|
21
|
+
should "delegate to options" do
|
22
|
+
assert_delegates_to_ostruct(@request, @request.options, *[
|
23
|
+
:login, :password, :merchant_id,
|
24
|
+
:bin, :terminal_id, :currency_code,
|
25
|
+
:currency_exponent, :customer_ref_num,
|
26
|
+
:order_id
|
27
|
+
])
|
28
|
+
end
|
29
|
+
|
30
|
+
should "return a different customer profile action based its action instance variable" do
|
31
|
+
assert_equal "C", profile_management_request(:create).send(:customer_profile_action)
|
32
|
+
assert_equal "R", profile_management_request(:retrieve).send(:customer_profile_action)
|
33
|
+
assert_equal "U", profile_management_request(:update).send(:customer_profile_action)
|
34
|
+
assert_equal "D", profile_management_request(:delete).send(:customer_profile_action)
|
35
|
+
end
|
36
|
+
|
37
|
+
should "be writing? when action is create or update" do
|
38
|
+
assert profile_management_request(:create).send(:writing?)
|
39
|
+
assert profile_management_request(:update).send(:writing?)
|
40
|
+
end
|
41
|
+
|
42
|
+
should "not be writing? when action is retrieve or delete" do
|
43
|
+
assert !profile_management_request(:retrieve).send(:writing?)
|
44
|
+
assert !profile_management_request(:delete).send(:writing?)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class VoidTest < Test::Unit::TestCase
|
4
|
+
context "Initializing" do
|
5
|
+
setup do
|
6
|
+
@request = void_request
|
7
|
+
end
|
8
|
+
|
9
|
+
[ :tx_ref_num, :tx_ref_idx, :money, :options ].each do |attr|
|
10
|
+
should "set @#{attr} instance variable" do
|
11
|
+
assert_not_nil @request.send(attr)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "A base request" do
|
17
|
+
setup do
|
18
|
+
@request = void_request
|
19
|
+
end
|
20
|
+
|
21
|
+
should "delegate to options" do
|
22
|
+
assert_delegates_to_ostruct(@request, @request.options, *[
|
23
|
+
:login, :password, :merchant_id, :bin, :terminal_id, :currency_code,
|
24
|
+
:currency_exponent, :customer_ref_num, :order_id
|
25
|
+
])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RequestTest < Test::Unit::TestCase
|
4
|
+
context "Initializing" do
|
5
|
+
setup do
|
6
|
+
@request = ActiveMerchant::Billing::PaymentechOrbital::Request::Base.new(
|
7
|
+
Options(:request_options)
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
should "set @options instance variable" do
|
12
|
+
assert_not_nil @request.options
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "A base request" do
|
17
|
+
setup do
|
18
|
+
@request = base_request
|
19
|
+
end
|
20
|
+
|
21
|
+
should "delegate to options" do
|
22
|
+
assert_delegates_to_ostruct(@request, @request.options, *[
|
23
|
+
:login, :password, :merchant_id, :bin, :terminal_id, :currency_code,
|
24
|
+
:currency_exponent, :customer_ref_num, :order_id
|
25
|
+
])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'activemerchant-paymentech-orbital'
|
4
|
+
require 'options'
|
5
|
+
require 'mocks/active_merchant/billing/gateway'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'shoulda'
|
8
|
+
require 'factory_girl'
|
9
|
+
require 'rr'
|
10
|
+
|
11
|
+
ActiveMerchant::Billing::Base.mode = :test
|
12
|
+
|
13
|
+
class Test::Unit::TestCase
|
14
|
+
include RR::Adapters::TestUnit
|
15
|
+
|
16
|
+
def assert_delegates_to_ostruct(delegator, delegatee, *methods)
|
17
|
+
methods.each do |method|
|
18
|
+
mock(delegatee).method_missing(method)
|
19
|
+
delegator.send(:"#{method}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activemerchant-paymentech-orbital
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Corrigan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-03 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activemerchant
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.4.2
|
24
|
+
version:
|
25
|
+
description: A gem to provide a ruby interface for Chase Paymentech Orbital payment gateway.
|
26
|
+
email: john@mintdigital.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- activemerchant-paymentech-orbital.gemspec
|
42
|
+
- lib/active_merchant/billing/paymentech_orbital.rb
|
43
|
+
- lib/active_merchant/billing/paymentech_orbital/request.rb
|
44
|
+
- lib/active_merchant/billing/paymentech_orbital/request/end_of_day.rb
|
45
|
+
- lib/active_merchant/billing/paymentech_orbital/request/new_order.rb
|
46
|
+
- lib/active_merchant/billing/paymentech_orbital/request/profile_management.rb
|
47
|
+
- lib/active_merchant/billing/paymentech_orbital/request/void.rb
|
48
|
+
- lib/active_merchant/billing/paymentech_orbital/response.rb
|
49
|
+
- lib/activemerchant-paymentech-orbital.rb
|
50
|
+
- test/activemerchant-paymentech-orbital_test.rb
|
51
|
+
- test/factories.rb
|
52
|
+
- test/mocks/active_merchant/billing/gateway.rb
|
53
|
+
- test/options.rb
|
54
|
+
- test/payment_orbital/gateway_test.rb
|
55
|
+
- test/payment_orbital/request/end_of_day_test.rb
|
56
|
+
- test/payment_orbital/request/new_order_test.rb
|
57
|
+
- test/payment_orbital/request/profile_management_test.rb
|
58
|
+
- test/payment_orbital/request/void_test.rb
|
59
|
+
- test/payment_orbital/request_test.rb
|
60
|
+
- test/test_helper.rb
|
61
|
+
has_rdoc: true
|
62
|
+
homepage: http://github.com/johnideal/activemerchant-paymentech-orbital
|
63
|
+
licenses: []
|
64
|
+
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options:
|
67
|
+
- --charset=UTF-8
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.3.5
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: A gem to provide a ruby interface for Chase Paymentech Orbital payment gateway.
|
89
|
+
test_files:
|
90
|
+
- test/activemerchant-paymentech-orbital_test.rb
|
91
|
+
- test/factories.rb
|
92
|
+
- test/mocks/active_merchant/billing/gateway.rb
|
93
|
+
- test/options.rb
|
94
|
+
- test/payment_orbital/gateway_test.rb
|
95
|
+
- test/payment_orbital/request/end_of_day_test.rb
|
96
|
+
- test/payment_orbital/request/new_order_test.rb
|
97
|
+
- test/payment_orbital/request/profile_management_test.rb
|
98
|
+
- test/payment_orbital/request/void_test.rb
|
99
|
+
- test/payment_orbital/request_test.rb
|
100
|
+
- test/test_helper.rb
|