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 +4 -4
- data/lib/paytrace/check_transaction.rb +29 -0
- data/lib/paytrace/version.rb +1 -1
- data/test/paytrace/check_transactions_spec.rb +43 -0
- data/test/scripts/run_adjust_amount.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b8c933ace0d385e68fb1fa6763ef764d969160c
|
4
|
+
data.tar.gz: 2c0f4df1ebd158e3d95e0dcfb4b178583a426f05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/paytrace/version.rb
CHANGED
@@ -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
|
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.
|
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
|