paytrace 0.1.15 → 0.1.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 251992bb528837bcd89638254f1cc8173fc319e7
4
- data.tar.gz: fa64e72359cbe019d637e88c0fb4d056da706b1d
3
+ metadata.gz: 7c24369bccca3d21f97f62554d1d04382bb300dc
4
+ data.tar.gz: 87a67ae201eaec2984fecf87669f39ce94243f98
5
5
  SHA512:
6
- metadata.gz: ef17056bab255daa9f06e97ea80b528d95fc2af7ac3a4094cfcb4cdf2019c48d70b197f0f1cad93cfcd38f6b343b785c8387750b796bc41b500fec423efa25b6
7
- data.tar.gz: 53ea32dd344813193352b44622eaf602a156c5b895d0360c46994942f2eb7004313f3dfba26338a1314b159f8c1379eac8e9e99e0f407b57e56c87ec754b6628
6
+ metadata.gz: 522c094a24fc50f1806f2de2ad09535f0039f91f5d72a59d04e034c97202631d0100655a1bdf7d432eff4ac0e609ecd8c36d5ae0e005b564b1335bcc7ff03381
7
+ data.tar.gz: 9ce05c2a29b8283364361e7b0dffa6f901af27249a645f415824d9b752562a83648452afdfd3ef5ad36d4c5d87b2da45ba1966fa1238c19a3dbc3ae8294b66b5
@@ -92,6 +92,7 @@ module PayTrace
92
92
  CALCULATE_SHIPPING_COST_RESPONSE = "SHIPPINGRECORD"
93
93
  LEVEL_3_VISA_METHOD = "Level3Visa"
94
94
  LEVEL_3_MC_METHOD = "Level3MCRD"
95
+ SETTLE_TRANSACTION_METHOD = "SettleTranx"
95
96
 
96
97
  def set_shipping_same_as_billing()
97
98
  @shipping_address = @billing_address
@@ -231,6 +232,14 @@ module PayTrace
231
232
  end
232
233
  end
233
234
 
235
+ def self.settle_transaction(params = {})
236
+ request = PayTrace::API::Request.new
237
+ request.set_param(:method, SETTLE_TRANSACTION_METHOD)
238
+ request.set_params([:recur_id, :customer_id], params)
239
+ gateway = PayTrace::API::Gateway.new
240
+ gateway.send_request(request)
241
+ end
242
+
234
243
  private
235
244
  def add_transaction_info(request)
236
245
  request.set_param(:transaction_type, type)
@@ -1,3 +1,3 @@
1
1
  module PayTrace
2
- VERSION = "0.1.15"
2
+ VERSION = "0.1.16"
3
3
  end
@@ -1,6 +1,10 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '../../test_helper.rb')
2
2
 
3
3
  describe PayTrace::Transaction do
4
+ def base_url
5
+ "UN~#{PayTrace.configuration.user_name}|PSWD~#{PayTrace.configuration.password}|TERMS~Y|"
6
+ end
7
+
4
8
  it "exports transaction(s)" do
5
9
  PayTrace::API::Gateway.debug = true
6
10
  PayTrace::API::Gateway.next_response = "TRANSACTIONRECORD~TRANXID=1143"
@@ -42,6 +46,29 @@ describe PayTrace::Transaction do
42
46
  result[0]['SHIPPINGCOMPANY'].must_equal "USPS"
43
47
  end
44
48
 
49
+
50
+ it "can settle a transaction by recurrence ID" do
51
+ PayTrace::API::Gateway.debug = true
52
+ PayTrace::API::Gateway.next_response = "SHIPPINGRECORD~SHIPPINGCOMPANY=USPS+SHIPPINGMETHOD=STANDARD POST+SHIPPINGRATE=12.72|"
53
+ params = {
54
+ # UN, PSWD, TERMS, METHOD, RECURID
55
+ recur_id: 12345
56
+ }
57
+ result = PayTrace::Transaction.settle_transaction(params)
58
+ PayTrace::API::Gateway.last_request.must_equal base_url + "METHOD~SettleTranx|RECURID~12345|"
59
+ end
60
+
61
+ it "can settle a transaction by customer ID" do
62
+ PayTrace::API::Gateway.debug = true
63
+ PayTrace::API::Gateway.next_response = "SHIPPINGRECORD~SHIPPINGCOMPANY=USPS+SHIPPINGMETHOD=STANDARD POST+SHIPPINGRATE=12.72|"
64
+ params = {
65
+ # UN, PSWD, TERMS, METHOD, RECURID
66
+ customer_id: 12346
67
+ }
68
+ result = PayTrace::Transaction.settle_transaction(params)
69
+ PayTrace::API::Gateway.last_request.must_equal base_url + "METHOD~SettleTranx|CUSTID~12346|"
70
+ end
71
+
45
72
  describe "create sales transactions" do
46
73
  before do
47
74
  @response = mock()
@@ -0,0 +1,18 @@
1
+ $:<< "./lib" # uncomment this to run against a Git clone instead of an installed gem
2
+
3
+ require "paytrace"
4
+ require "paytrace/debug"
5
+
6
+ PayTrace::Debug.configure_test
7
+
8
+ # settle a transaction via a recurrence ID
9
+ PayTrace::Debug.trace do
10
+ params = { recur_id: "1143" } # you must replace this with a valid recurrence ID!
11
+ PayTrace::Transaction.settle_transaction(params)
12
+ end
13
+
14
+ # settle a transaction via a customer ID
15
+ PayTrace::Debug.trace do
16
+ params = { customer_id: "1143" } # you must replace this with a valid customer ID!
17
+ PayTrace::Transaction.settle_transaction(params)
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paytrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Redfern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-23 00:00:00.000000000 Z
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -148,6 +148,7 @@ files:
148
148
  - test/scripts/run_export_transactions.rb
149
149
  - test/scripts/run_level3_data.rb
150
150
  - test/scripts/run_recur_payments_integration.rb
151
+ - test/scripts/run_settle_transaction.rb
151
152
  - test/scripts/smiley_face.png
152
153
  - test/test_helper.rb
153
154
  - vagrant-bootstrap.sh
@@ -171,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  version: '0'
172
173
  requirements: []
173
174
  rubyforge_project:
174
- rubygems_version: 2.2.2
175
+ rubygems_version: 2.2.0
175
176
  signing_key:
176
177
  specification_version: 4
177
178
  summary: Integration providing access to the transaction processing API for PayTrace
@@ -198,5 +199,6 @@ test_files:
198
199
  - test/scripts/run_export_transactions.rb
199
200
  - test/scripts/run_level3_data.rb
200
201
  - test/scripts/run_recur_payments_integration.rb
202
+ - test/scripts/run_settle_transaction.rb
201
203
  - test/scripts/smiley_face.png
202
204
  - test/test_helper.rb