paytrace 0.1.17 → 0.1.18

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: 84816713c530841342b09d6e6c0ad0ab9a3c76d9
4
- data.tar.gz: 630093f3288af7c1a4c65d910e653e71aea91681
3
+ metadata.gz: 9b8c933ace0d385e68fb1fa6763ef764d969160c
4
+ data.tar.gz: 2c0f4df1ebd158e3d95e0dcfb4b178583a426f05
5
5
  SHA512:
6
- metadata.gz: 6ad0fbbb6664dbcb5823bdd805df339c3df2c8727880debe19d5ef0d4b3a3bb75081f17536f08914c2c1afba3ed10976fcb2176e890f6187df4c8a0ee40cee06
7
- data.tar.gz: 03ae07044bfded8fa0c63a55ec23cbeaacf04f43198543093e0c2fa7a4b62f6fa4eb34d1c060ccd4e94a36e2945be345c3c8ee4588ef4770998c6315587a776a
6
+ metadata.gz: 4757b23b7fa51b37b985c3aee2a8cf33602bf1a52eb600ece91849be7f8751a1510ea1b0717176cf6e868851c1bd74e85b3578a89e017a4c4b319a2fbeff19ec
7
+ data.tar.gz: 2765509db5fa83ead7620de56e9160825d74452c9e396955412517af4cb155f385f2495ae3e982a375b84a7ec2bc8de8e6fea25c276a4a0eb2ed972f35dc5c75
@@ -0,0 +1,29 @@
1
+ module PayTrace
2
+ class CheckTransaction
3
+ PROCESS_SALE_METHOD = "ProcessCheck"
4
+
5
+ def self.process_sale(params = {})
6
+ request = PayTrace::API::Request.new
7
+ request.set_param(:method, PROCESS_SALE_METHOD)
8
+ request.set_params([
9
+ :check_type,
10
+ :amount, :customer_id, :account_number, :routing_number,
11
+ :billing_name, :billing_address, :billing_address2, :billing_city, :billing_state, :billing_postal_code, :billing_country,
12
+ :shipping_name, :shipping_address, :shipping_address2, :shipping_city, :shipping_region, :shipping_state, :shipping_postal_code, :shipping_country,
13
+ :email, :invoice, :description, :tax_amount, :customer_reference_id
14
+ ], params)
15
+
16
+ if params[:discretionary_data]
17
+ params[:discretionary_data].keys.each do |k|
18
+ request.set_discretionary(k, params[:discretionary_data][k])
19
+ end
20
+ end
21
+
22
+ gateway = PayTrace::API::Gateway.new
23
+ response = gateway.send_request(request)
24
+ unless response.has_errors?
25
+ response.values
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
1
  module PayTrace
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
3
3
  end
@@ -0,0 +1,43 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '../../test_helper.rb')
2
+
3
+ describe PayTrace::CheckTransaction do
4
+ def base_url(method)
5
+ "UN~#{PayTrace.configuration.user_name}|PSWD~#{PayTrace.configuration.password}|TERMS~Y|METHOD~#{method}|"
6
+ end
7
+
8
+ before do
9
+ PayTrace::API::Gateway.debug = true
10
+ PayTrace::API::Gateway.reset_trace()
11
+ end
12
+
13
+ # UN, PSWD, TERMS, METHOD, CHECKTYPE, AMOUNT, DDA, TR
14
+ it "should process a check payment via routing number/account number" do
15
+ PayTrace::API::Gateway.next_response = "RESULT~Ok"
16
+ params = {
17
+ check_type: 'foo',
18
+ amount: 17.29,
19
+ account_number: 1234567,
20
+ routing_number: 1234568
21
+ }
22
+ result = PayTrace::CheckTransaction.process_sale(params)
23
+ PayTrace::API::Gateway.last_request.must_equal base_url(PayTrace::CheckTransaction::PROCESS_SALE_METHOD) +
24
+ "CHECKTYPE~foo|AMOUNT~17.29|DDA~1234567|TR~1234568|"
25
+ end
26
+
27
+ # UN, PSWD, TERMS, METHOD, CHECKTYPE, AMOUNT, CUSTID
28
+ it "should process a check payment via customer id" do
29
+ PayTrace::API::Gateway.next_response = "RESULT~Ok"
30
+ params = {
31
+ check_type: 'bar',
32
+ amount: 17.28,
33
+ customer_id: 'MMouse'
34
+ }
35
+ result = PayTrace::CheckTransaction.process_sale(params)
36
+ PayTrace::API::Gateway.last_request.must_equal base_url(PayTrace::CheckTransaction::PROCESS_SALE_METHOD) +
37
+ "CHECKTYPE~bar|AMOUNT~17.28|CUSTID~MMouse|"
38
+ end
39
+
40
+ it "accepts billing and shipping information"
41
+ it "accepts email, invoice, description, tax amount, and customer reference id"
42
+ it "accepts discretionary data"
43
+ end
@@ -1,4 +1,4 @@
1
- $:<< "./lib" # uncomment this to run against a Git clone instead of an installed gem
1
+ # $:<< "./lib" # uncomment this to run against a Git clone instead of an installed gem
2
2
 
3
3
  require "paytrace"
4
4
  require "paytrace/debug"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paytrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Redfern
@@ -116,6 +116,7 @@ files:
116
116
  - lib/paytrace/api/gateway.rb
117
117
  - lib/paytrace/api/request.rb
118
118
  - lib/paytrace/api/response.rb
119
+ - lib/paytrace/check_transaction.rb
119
120
  - lib/paytrace/configuration.rb
120
121
  - lib/paytrace/credit_card.rb
121
122
  - lib/paytrace/customer.rb
@@ -131,6 +132,7 @@ files:
131
132
  - test/paytrace/api/gateway_spec.rb
132
133
  - test/paytrace/api/request_spec.rb
133
134
  - test/paytrace/api/response_spec.rb
135
+ - test/paytrace/check_transactions_spec.rb
134
136
  - test/paytrace/configuration_spec.rb
135
137
  - test/paytrace/credit_card_spec.rb
136
138
  - test/paytrace/customer_spec.rb
@@ -183,6 +185,7 @@ test_files:
183
185
  - test/paytrace/api/gateway_spec.rb
184
186
  - test/paytrace/api/request_spec.rb
185
187
  - test/paytrace/api/response_spec.rb
188
+ - test/paytrace/check_transactions_spec.rb
186
189
  - test/paytrace/configuration_spec.rb
187
190
  - test/paytrace/credit_card_spec.rb
188
191
  - test/paytrace/customer_spec.rb