tns_payments 0.0.1
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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +10 -0
- data/lib/tns_payments/connection.rb +120 -0
- data/lib/tns_payments/credit_card.rb +8 -0
- data/lib/tns_payments/response.rb +22 -0
- data/lib/tns_payments/version.rb +3 -0
- data/lib/tns_payments.rb +10 -0
- data/test/helper.rb +4 -0
- data/test/unit/conntection_test.rb +224 -0
- data/test/unit/response_test.rb +4 -0
- data/tns_payments.gemspec +23 -0
- metadata +121 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'json'
|
3
|
+
require 'rest-client'
|
4
|
+
|
5
|
+
module TNSPayments
|
6
|
+
class Connection
|
7
|
+
CREDIT_CARD_TOKEN_FORMAT = /^9/ # /\d{16}/
|
8
|
+
|
9
|
+
attr_writer :session_token
|
10
|
+
|
11
|
+
def available?
|
12
|
+
request(:get, '/information', :authorization => false).success?
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize options
|
16
|
+
@api_key = options[:api_key]
|
17
|
+
@merchant_id = options[:merchant_id]
|
18
|
+
end
|
19
|
+
|
20
|
+
def payment_form_url
|
21
|
+
"https://secure.ap.tnspayments.com/form/#{session_token}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def purchase amount, token, options = {}
|
25
|
+
if token =~ CREDIT_CARD_TOKEN_FORMAT
|
26
|
+
purchase_with_credit_card_token amount, token, options
|
27
|
+
else
|
28
|
+
purchase_with_session_token amount, token, options
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def refund amount, options = {}
|
33
|
+
order_id = create_order_id options[:order_id]
|
34
|
+
transaction_id = options[:transaction_id]
|
35
|
+
params = {
|
36
|
+
'apiOperation' => 'REFUND',
|
37
|
+
'order' => {'reference' => options[:order_reference]},
|
38
|
+
'transaction' => {'amount' => amount.to_s, 'currency' => 'AUD', 'reference' => transaction_id.to_s}
|
39
|
+
}
|
40
|
+
|
41
|
+
request :put, "/merchant/#{@merchant_id}/order/#{order_id}/transaction/#{transaction_id}", params
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_credit_card_token
|
45
|
+
request :post, "/merchant/#{@merchant_id}/token"
|
46
|
+
end
|
47
|
+
|
48
|
+
def delete_credit_card_token token
|
49
|
+
request :delete, "/merchant/#{@merchant_id}/token/#{token}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def session_token?
|
53
|
+
!@session_token.nil?
|
54
|
+
end
|
55
|
+
|
56
|
+
def session_token reload = false
|
57
|
+
if @session_token.nil? or reload
|
58
|
+
response = request :post, "/merchant/#{@merchant_id}/session"
|
59
|
+
@session_token = response.success?? response.response['session'] : nil
|
60
|
+
end
|
61
|
+
@session_token
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def api_url
|
67
|
+
'https://secure.ap.tnspayments.com/api/rest/version/4'
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_order_id id
|
71
|
+
10000000000 + id.to_i
|
72
|
+
end
|
73
|
+
|
74
|
+
def encode_credentials
|
75
|
+
credentials = ['', @api_key].join(':')
|
76
|
+
'Basic ' << Base64.encode64(credentials)
|
77
|
+
end
|
78
|
+
|
79
|
+
def purchase_with_credit_card_token amount, token, options = {}
|
80
|
+
order_id = create_order_id options[:order_id]
|
81
|
+
transaction_id = options[:transaction_id]
|
82
|
+
params = {
|
83
|
+
'apiOperation' => 'PAY',
|
84
|
+
'order' => {'reference' => options[:order_reference]},
|
85
|
+
'cardDetails' => {'cardToken' => token},
|
86
|
+
'transaction' => {'amount' => amount.to_s, 'currency' => 'AUD', 'reference' => transaction_id.to_s}
|
87
|
+
}
|
88
|
+
|
89
|
+
request :put, "/merchant/#{@merchant_id}/order/#{order_id}/transaction/#{transaction_id}", params
|
90
|
+
end
|
91
|
+
|
92
|
+
def purchase_with_session_token amount, token, options = {}
|
93
|
+
order_id = create_order_id options[:order_id]
|
94
|
+
transaction_id = options[:transaction_id]
|
95
|
+
params = {
|
96
|
+
'apiOperation' => 'PAY',
|
97
|
+
'order' => {'reference' => options[:order_reference]},
|
98
|
+
'cardDetails' => {'session' => token},
|
99
|
+
'transaction' => {'amount' => amount.to_s, 'currency' => 'AUD', 'reference' => transaction_id.to_s}
|
100
|
+
}
|
101
|
+
|
102
|
+
request :put, "/merchant/#{@merchant_id}/order/#{order_id}/transaction/#{transaction_id}", params
|
103
|
+
end
|
104
|
+
|
105
|
+
def request method, path, options = {}
|
106
|
+
authorization = options.fetch(:authorization) { true }
|
107
|
+
url = api_url << path
|
108
|
+
auth_headers = {:Authorization => encode_credentials}
|
109
|
+
headers = {:content_type => 'Application/json;charset=UTF-8', :accept => '*/*'}
|
110
|
+
headers.merge! auth_headers if authorization
|
111
|
+
|
112
|
+
args = [headers]
|
113
|
+
args.unshift(options.to_json) unless [:delete, :get, :head].include? method
|
114
|
+
|
115
|
+
Response.new JSON.parse(RestClient.send(method, url, *args))
|
116
|
+
rescue RestClient::Exception => e
|
117
|
+
Response.new 'result' => e.message.upcase, 'response' => e.response
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module TNSPayments
|
2
|
+
class CreditCard
|
3
|
+
FORM_RESPONSE_MAPPING = {:gatewayCardExpiryDateYear => :year, :gatewayCardExpiryDateMonth => :month, :gatewayCardNumber => :number, :gatewayCardSecurityCode => :verification_value}.freeze
|
4
|
+
|
5
|
+
def initialize args = {}
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module TNSPayments
|
2
|
+
class Response
|
3
|
+
extend Forwardable
|
4
|
+
|
5
|
+
attr_reader :response
|
6
|
+
|
7
|
+
def_delegators :credit_card, :card_type
|
8
|
+
|
9
|
+
def initialize body
|
10
|
+
@response = body
|
11
|
+
@result = @response['result'] || @response['status']
|
12
|
+
end
|
13
|
+
|
14
|
+
def credit_card
|
15
|
+
@credit_card ||= Tns::CreditCard.new @response['card']
|
16
|
+
end
|
17
|
+
|
18
|
+
def success?
|
19
|
+
%w[SUCCESS OPERATING].include? @result
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/tns_payments.rb
ADDED
data/test/helper.rb
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'webmock/minitest'
|
3
|
+
|
4
|
+
class TNSPayments::ConnectionTest < MiniTest::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@api_key = '123api456'
|
7
|
+
@merchant_id = 'MERCHANT'
|
8
|
+
@gateway = Connection.new :api_key => @api_key, :merchant_id => @merchant_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_available_is_true_when_tns_gateway_is_operating
|
12
|
+
stub_availability_request.
|
13
|
+
to_return(:status => 200, :body => '{"status":"OPERATING"}', :headers => {})
|
14
|
+
assert @gateway.available?
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_available_is_false_when_tns_gateway_is_not_operating
|
18
|
+
stub_availability_request.
|
19
|
+
to_return(:status => 200, :body => '{"status":"EPIC_FAIL"}', :headers => {})
|
20
|
+
refute @gateway.available?
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_purchase_with_session_token_makes_a_successful_purchase
|
24
|
+
stub_successful_session_token_purchase_request :amount => 100, :token => 'SESSIONTOKEN', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
25
|
+
response = @gateway.purchase 100, 'SESSIONTOKEN', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
26
|
+
assert response.success?
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_purchase_with_session_token_makes_an_unsuccessful_purchase
|
30
|
+
stub_unsuccessful_session_token_purchase_request :amount => 100, :token => 'SESSIONTOKEN', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
31
|
+
response = @gateway.purchase 100, 'SESSIONTOKEN', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
32
|
+
refute response.success?
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_purchase_with_session_token_can_deal_with_timeout_errors
|
36
|
+
stub_session_token_purchase_request(:amount => 100, :token => 'SESSIONTOKEN', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123').
|
37
|
+
to_timeout
|
38
|
+
response = @gateway.purchase 100, 'SESSIONTOKEN', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
39
|
+
refute response.success?
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_purchase_with_credit_card_token_makes_a_successful_purchase
|
43
|
+
stub_successful_credit_card_token_purchase_request(:amount => 100, :token => '9111111111111111', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123')
|
44
|
+
assert @gateway.purchase(100, '9111111111111111', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123').success?
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_purchase_with_credit_card_token_makes_an_unsuccessful_purchase
|
48
|
+
stub_unsuccessful_credit_card_token_purchase_request :amount => 100, :token => '9111111111111111', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
49
|
+
response = @gateway.purchase 100, '9111111111111111', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
50
|
+
refute response.success?
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_purchase_with_credit_card_token_can_deal_with_timeout_errors
|
54
|
+
stub_credit_card_token_purchase_request(:amount => 100, :token => '9111111111111111', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123').
|
55
|
+
to_timeout
|
56
|
+
response = @gateway.purchase 100, '9111111111111111', :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
57
|
+
refute response.success?
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_refund_makes_successful_refund
|
61
|
+
stub_successful_refund_request :amount => 100, :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
62
|
+
response = @gateway.refund 100, :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
63
|
+
assert response.success?
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_refund_makes_unsuccessful_refund
|
67
|
+
stub_unsuccessful_refund_request :amount => 100, :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
68
|
+
response = @gateway.refund 100, :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
69
|
+
refute response.success?
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_refund_can_deal_with_timeout_errors
|
73
|
+
stub_refund_request(:amount => 100, :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123').
|
74
|
+
to_timeout
|
75
|
+
response = @gateway.refund 100, :order_id => 1, :transaction_id => 1, :order_reference => 'AUD123'
|
76
|
+
refute response.success?
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_create_credit_card_token_successfully_stores_creditcard
|
80
|
+
stub_successful_create_credit_card_token_request
|
81
|
+
assert @gateway.create_credit_card_token.success?
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_create_credit_card_token_returns_valid_card_token_when_successful
|
85
|
+
stub_successful_create_credit_card_token_request
|
86
|
+
token = @gateway.create_credit_card_token.response['cardToken']
|
87
|
+
assert_equal 16, token.size
|
88
|
+
assert_match Connection::CREDIT_CARD_TOKEN_FORMAT, token
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_create_credit_card_token_unsuccessfully_attempts_to_store_credit_card
|
92
|
+
stub_unsuccessful_create_credit_card_token_request
|
93
|
+
refute @gateway.create_credit_card_token.success?
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_delete_credit_card_token_successfully_deletes_a_stored_credit_card_token
|
97
|
+
stub_successful_delete_credit_card_token_request
|
98
|
+
assert @gateway.delete_credit_card_token('9123456781234567').success?
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_delete_credit_card_token_unsuccessfully_attempts_to_delete_a_stored_credit_card
|
102
|
+
stub_unsuccessful_delete_credit_card_token_request
|
103
|
+
refute @gateway.delete_credit_card_token('9123456781234567').success?
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
def stub_availability_request
|
109
|
+
stub_request(:get, "https://secure.ap.tnspayments.com/api/rest/version/4/information").
|
110
|
+
with(:headers => {'Accept'=>'*/*', 'Content-Type'=>'Application/json;charset=UTF-8'})
|
111
|
+
end
|
112
|
+
|
113
|
+
def stub_successful_refund_request options = {}
|
114
|
+
stub_refund_request(options).
|
115
|
+
to_return :status => 200, :headers => {}, :body => <<-EOS
|
116
|
+
{"merchant":"#{@merchant_id}","order":{"id":#{@gateway.send(:create_order_id, options[:order_id])},"totalAuthorizedAmount":0.00,"totalCapturedAmount":0.00,"totalRefundedAmount":0.00},
|
117
|
+
"response":{"acquirerCode":"00","gatewayCode":"APPROVED"},"result":"SUCCESS","transaction":{"acquirer":{"id":"STGEORGE"},
|
118
|
+
"amount":#{options[:amount]},"authorizationCode":"000582","batch":20110707,"currency":"AUD","id":"#{options[:transaction_id]}",
|
119
|
+
"receipt":"110707000582","source":"INTERNET","terminal":"08845778","type":"REFUND"}}
|
120
|
+
EOS
|
121
|
+
end
|
122
|
+
|
123
|
+
def stub_unsuccessful_refund_request options = {}
|
124
|
+
stub_refund_request(options).
|
125
|
+
to_return(:status => 200, :body => '{"result":"FAILURE"}', :headers => {})
|
126
|
+
end
|
127
|
+
|
128
|
+
def stub_successful_credit_card_token_purchase_request options = {}
|
129
|
+
stub_credit_card_token_purchase_request(options).
|
130
|
+
to_return(:status => 200, :body => %[{"card":{"expiry":{"month":"5","year":"13"},"number":"xxxxxxxxxxxxxxxx","scheme":"MASTERCARD"},"merchant":"","order":{"id":"#{@gateway.send(:create_order_id, options[:order_id])}","totalAuthorizedAmount":0.00,"totalCapturedAmount":0.00,"totalRefundedAmount":0.00},"response":{"acquirerCode":"00","gatewayCode":"APPROVED"},"result":"SUCCESS","transaction":{"acquirer":{"id":"STGEORGE"},"amount":"#{options[:amount]}","authorizationCode":"000576","batch":20110707,"currency":"AUD","frequency":"SINGLE","id":"72637779534c67696c54b26f220dc4d3","receipt":"110707000576","source":"INTERNET","terminal":"08845778","type":"PAYMENT"}}], :headers => {})
|
131
|
+
end
|
132
|
+
|
133
|
+
def stub_unsuccessful_credit_card_token_purchase_request options = {}
|
134
|
+
stub_credit_card_token_purchase_request(options).
|
135
|
+
to_return(:status => 200, :body => '{"result":"FAILURE"}', :headers => {})
|
136
|
+
end
|
137
|
+
|
138
|
+
def stub_successful_session_token_purchase_request options = {}
|
139
|
+
stub_session_token_purchase_request(options).
|
140
|
+
to_return(:status => 200, :body => %[{"card":{"expiry":{"month":"5","year":"13"},"number":"xxxxxxxxxxxxxxxx","scheme":"MASTERCARD"},"merchant":"","order":{"id":"#{@gateway.send(:create_order_id, options[:order_id])}","totalAuthorizedAmount":0.00,"totalCapturedAmount":0.00,"totalRefundedAmount":0.00},"response":{"acquirerCode":"00","gatewayCode":"APPROVED"},"result":"SUCCESS","transaction":{"acquirer":{"id":"STGEORGE"},"amount":"#{options[:amount]}","authorizationCode":"000576","batch":20110707,"currency":"AUD","frequency":"SINGLE","id":"72637779534c67696c54b26f220dc4d3","receipt":"110707000576","source":"INTERNET","terminal":"08845778","type":"PAYMENT"}}], :headers => {})
|
141
|
+
end
|
142
|
+
|
143
|
+
def stub_unsuccessful_session_token_purchase_request options = {}
|
144
|
+
stub_session_token_purchase_request(options).
|
145
|
+
to_return(:status => 200, :body => '{"result":"FAILURE"}', :headers => {})
|
146
|
+
end
|
147
|
+
|
148
|
+
def stub_successful_create_credit_card_token_request
|
149
|
+
stub_create_credit_card_token_request.
|
150
|
+
to_return(:status => 200, :body => %{{"result":"SUCCESS", "response":{"gatewayCode":"BASIC_VERIFICATION_SUCCESSFUL"}, "card":{"number":"xxxxxxxxxxxxxxxx", "scheme":"MASTERCARD", "expiry":{"month":"5", "year":"13"}}, "cardToken":"9102370788509763"}}, :headers => {})
|
151
|
+
end
|
152
|
+
|
153
|
+
def stub_unsuccessful_create_credit_card_token_request
|
154
|
+
stub_create_credit_card_token_request.
|
155
|
+
to_return(:status => 200, :body => '{"result":"FAILURE"}', :headers => {})
|
156
|
+
end
|
157
|
+
|
158
|
+
def stub_successful_delete_credit_card_token_request
|
159
|
+
stub_delete_credit_card_token_request.
|
160
|
+
to_return(:status => 200, :body => '{"result":"SUCCESS"}', :headers => {})
|
161
|
+
end
|
162
|
+
|
163
|
+
def stub_unsuccessful_delete_credit_card_token_request
|
164
|
+
stub_delete_credit_card_token_request.
|
165
|
+
to_return(:status => 200, :body => '{"result":"FAILURE"}', :headers => {})
|
166
|
+
end
|
167
|
+
|
168
|
+
def stub_session_token_purchase_request options = {}
|
169
|
+
stub_request(:put, /https:\/\/:#{@api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@merchant_id}\/order\/#{@gateway.send(:create_order_id, options[:order_id])}\/transaction\/#{options[:transaction_id]}/).
|
170
|
+
with :body => JSON.generate({
|
171
|
+
'apiOperation' => 'PAY',
|
172
|
+
'order' => {'reference' => options[:order_reference].to_s},
|
173
|
+
'cardDetails' => {'session' => options[:token].to_s},
|
174
|
+
'transaction' => {'amount' => options[:amount].to_s, 'currency' => 'AUD', 'reference' => options[:transaction_id].to_s}
|
175
|
+
}),
|
176
|
+
:headers => {
|
177
|
+
'Accept' => '*/*',
|
178
|
+
'Accept-Encoding' => 'gzip, deflate',
|
179
|
+
'Content-Length' => '158',
|
180
|
+
'Content-Type' => 'Application/json;charset=UTF-8'
|
181
|
+
}
|
182
|
+
end
|
183
|
+
|
184
|
+
def stub_credit_card_token_purchase_request options = {}
|
185
|
+
stub_request(:put, /https:\/\/:#{@api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@merchant_id}\/order\/#{@gateway.send(:create_order_id, options[:order_id])}\/transaction\/#{options[:transaction_id]}/).
|
186
|
+
with :body => JSON.generate({
|
187
|
+
'apiOperation' => 'PAY',
|
188
|
+
'order' => {'reference' => options[:order_reference].to_s},
|
189
|
+
'cardDetails' => {'cardToken' => options[:token].to_s},
|
190
|
+
'transaction' => {'amount' => options[:amount].to_s, 'currency' => 'AUD', 'reference' => options[:transaction_id].to_s}
|
191
|
+
}),
|
192
|
+
:headers => {
|
193
|
+
'Accept' => '*/*',
|
194
|
+
'Accept-Encoding' => 'gzip, deflate',
|
195
|
+
'Content-Length' => '164',
|
196
|
+
'Content-Type' => 'Application/json;charset=UTF-8'
|
197
|
+
}
|
198
|
+
end
|
199
|
+
|
200
|
+
def stub_refund_request options = {}
|
201
|
+
stub_request(:put, /https:\/\/:#{@api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@merchant_id}\/order\/#{@gateway.send(:create_order_id, options[:order_id])}\/transaction\/#{options[:transaction_id]}/).
|
202
|
+
with :body => JSON.generate({
|
203
|
+
'apiOperation' => 'REFUND',
|
204
|
+
'order' => {'reference' => options[:order_reference].to_s},
|
205
|
+
'transaction' => {'amount' => options[:amount].to_s, 'currency' => 'AUD', 'reference' => options[:transaction_id].to_s}
|
206
|
+
}),
|
207
|
+
:headers => {
|
208
|
+
'Accept' => '*/*',
|
209
|
+
'Accept-Encoding' => 'gzip, deflate',
|
210
|
+
'Content-Length' => '120',
|
211
|
+
'Content-Type' => 'Application/json;charset=UTF-8'
|
212
|
+
}
|
213
|
+
end
|
214
|
+
|
215
|
+
def stub_create_credit_card_token_request
|
216
|
+
stub_request(:post, /https:\/\/:#{@api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@merchant_id}\/token/).
|
217
|
+
with(:headers => {'Accept'=>'*/*', 'Content-Type'=>'Application/json;charset=UTF-8'}, :body => {})
|
218
|
+
end
|
219
|
+
|
220
|
+
def stub_delete_credit_card_token_request
|
221
|
+
stub_request(:delete, /https:\/\/:#{@api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@merchant_id}\/token\/\d{16}/).
|
222
|
+
with(:headers => {'Accept'=>'*/*', 'Content-Type'=>'Application/json;charset=UTF-8'}, :body => {})
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "tns_payments/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "tns_payments"
|
7
|
+
s.version = TNSPayments::VERSION
|
8
|
+
s.authors = ["Tim Cooper"]
|
9
|
+
s.email = ["coop@latrobest.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Integration with TNS Payments Gateway}
|
12
|
+
s.description = %q{Integration with TNS Payments Gateway}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.add_runtime_dependency 'json'
|
19
|
+
s.add_runtime_dependency 'rest-client'
|
20
|
+
s.add_development_dependency 'minitest'
|
21
|
+
s.add_development_dependency 'rake'
|
22
|
+
s.add_development_dependency 'webmock'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tns_payments
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tim Cooper
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: &70141552320780 !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: *70141552320780
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rest-client
|
27
|
+
requirement: &70141552319900 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70141552319900
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
requirement: &70141552335720 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70141552335720
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70141552335100 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70141552335100
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: webmock
|
60
|
+
requirement: &70141552333420 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70141552333420
|
69
|
+
description: Integration with TNS Payments Gateway
|
70
|
+
email:
|
71
|
+
- coop@latrobest.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- Rakefile
|
79
|
+
- lib/tns_payments.rb
|
80
|
+
- lib/tns_payments/connection.rb
|
81
|
+
- lib/tns_payments/credit_card.rb
|
82
|
+
- lib/tns_payments/response.rb
|
83
|
+
- lib/tns_payments/version.rb
|
84
|
+
- test/helper.rb
|
85
|
+
- test/unit/conntection_test.rb
|
86
|
+
- test/unit/response_test.rb
|
87
|
+
- tns_payments.gemspec
|
88
|
+
homepage: ''
|
89
|
+
licenses: []
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
hash: -1671981607314652405
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
hash: -1671981607314652405
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 1.8.10
|
115
|
+
signing_key:
|
116
|
+
specification_version: 3
|
117
|
+
summary: Integration with TNS Payments Gateway
|
118
|
+
test_files:
|
119
|
+
- test/helper.rb
|
120
|
+
- test/unit/conntection_test.rb
|
121
|
+
- test/unit/response_test.rb
|