tns_payments 0.0.6 → 0.0.7
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/CHANGELOG.md +4 -0
- data/lib/tns_payments/connection.rb +3 -2
- data/lib/tns_payments/version.rb +1 -1
- data/test/unit/conntection_test.rb +3 -3
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@ require 'base64'
|
|
3
3
|
module TNSPayments
|
4
4
|
class Connection
|
5
5
|
CREDIT_CARD_TOKEN_FORMAT = /^9\d{15}/
|
6
|
+
MINIMUM_ORDER_ID = 10000000000
|
6
7
|
|
7
8
|
attr_accessor :api_key, :host, :merchant_id
|
8
9
|
attr_writer :session_token
|
@@ -21,7 +22,7 @@ module TNSPayments
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def purchase transaction, token
|
24
|
-
order_id = transaction.order_id
|
25
|
+
order_id = MINIMUM_ORDER_ID + transaction.order_id.to_i
|
25
26
|
transaction_id = transaction.transaction_id
|
26
27
|
params = {
|
27
28
|
'apiOperation' => 'PAY',
|
@@ -34,7 +35,7 @@ module TNSPayments
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def refund transaction
|
37
|
-
order_id = transaction.order_id
|
38
|
+
order_id = MINIMUM_ORDER_ID + transaction.order_id.to_i
|
38
39
|
transaction_id = transaction.transaction_id
|
39
40
|
params = {
|
40
41
|
'apiOperation' => 'REFUND',
|
data/lib/tns_payments/version.rb
CHANGED
@@ -199,7 +199,7 @@ private
|
|
199
199
|
end
|
200
200
|
|
201
201
|
def stub_session_token_purchase_request transaction, token
|
202
|
-
stub_request(:put, /https:\/\/:#{@gateway.api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@gateway.merchant_id}\/order\/#{transaction.order_id}\/transaction\/#{transaction.transaction_id}/).
|
202
|
+
stub_request(:put, /https:\/\/:#{@gateway.api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@gateway.merchant_id}\/order\/#{TNSPayments::Connection::MINIMUM_ORDER_ID + transaction.order_id}\/transaction\/#{transaction.transaction_id}/).
|
203
203
|
with :body => JSON.generate({
|
204
204
|
'apiOperation' => 'PAY',
|
205
205
|
'order' => {'reference' => transaction.reference.to_s},
|
@@ -215,7 +215,7 @@ private
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def stub_credit_card_token_purchase_request transaction, token
|
218
|
-
stub_request(:put, /https:\/\/:#{@gateway.api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@gateway.merchant_id}\/order\/#{transaction.order_id}\/transaction\/#{transaction.transaction_id}/).
|
218
|
+
stub_request(:put, /https:\/\/:#{@gateway.api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@gateway.merchant_id}\/order\/#{TNSPayments::Connection::MINIMUM_ORDER_ID + transaction.order_id}\/transaction\/#{transaction.transaction_id}/).
|
219
219
|
with :body => JSON.generate({
|
220
220
|
'apiOperation' => 'PAY',
|
221
221
|
'order' => {'reference' => transaction.reference.to_s},
|
@@ -231,7 +231,7 @@ private
|
|
231
231
|
end
|
232
232
|
|
233
233
|
def stub_refund_request transaction
|
234
|
-
stub_request(:put, /https:\/\/:#{@gateway.api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@gateway.merchant_id}\/order\/#{transaction.order_id}\/transaction\/#{transaction.transaction_id}/).
|
234
|
+
stub_request(:put, /https:\/\/:#{@gateway.api_key}@secure\.ap\.tnspayments\.com\/api\/rest\/version\/4\/merchant\/#{@gateway.merchant_id}\/order\/#{TNSPayments::Connection::MINIMUM_ORDER_ID + transaction.order_id}\/transaction\/#{transaction.transaction_id}/).
|
235
235
|
with :body => JSON.generate({
|
236
236
|
'apiOperation' => 'REFUND',
|
237
237
|
'transaction' => {'amount' => transaction.amount.to_s, 'currency' => transaction.currency, 'reference' => transaction.transaction_id.to_s}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tns_payments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Cooper
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-03 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|