paytrace 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paytrace.rb +1 -0
- data/lib/paytrace/api/fields.rb +2 -1
- data/lib/paytrace/api/gateway.rb +7 -0
- data/lib/paytrace/transaction.rb +10 -0
- data/lib/paytrace/version.rb +1 -1
- data/test/paytrace/transaction_spec.rb +14 -6
- data/test/scripts/run_adjust_amount.rb +16 -0
- data/test/scripts/run_attach_signature.rb +2 -1
- data/test/scripts/run_calculate_shipping_costs.rb +2 -1
- data/test/scripts/run_create_customer.rb +2 -1
- data/test/scripts/run_email_request.rb +2 -1
- data/test/scripts/run_export_customers.rb +2 -1
- data/test/scripts/run_export_transactions.rb +2 -1
- data/test/scripts/run_level3_data.rb +7 -7
- data/test/scripts/run_recur_payments_integration.rb +2 -1
- data/test/scripts/run_settle_transaction.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84816713c530841342b09d6e6c0ad0ab9a3c76d9
|
4
|
+
data.tar.gz: 630093f3288af7c1a4c65d910e653e71aea91681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad0fbbb6664dbcb5823bdd805df339c3df2c8727880debe19d5ef0d4b3a3bb75081f17536f08914c2c1afba3ed10976fcb2176e890f6187df4c8a0ee40cee06
|
7
|
+
data.tar.gz: 03ae07044bfded8fa0c63a55ec23cbeaacf04f43198543093e0c2fa7a4b62f6fa4eb34d1c060ccd4e94a36e2945be345c3c8ee4588ef4770998c6315587a776a
|
data/lib/paytrace.rb
CHANGED
data/lib/paytrace/api/fields.rb
CHANGED
@@ -89,9 +89,10 @@ module PayTrace
|
|
89
89
|
id_number:"PHOTOID",
|
90
90
|
id_expiration:"IDEXP",
|
91
91
|
cc_last_4:"LAST4",
|
92
|
-
#bank accounts
|
92
|
+
#bank accounts/checks
|
93
93
|
account_number:"DDA",
|
94
94
|
routing_number:"TR",
|
95
|
+
check_type: "CHECKTYPE",
|
95
96
|
#recurring transactions
|
96
97
|
recur_id: "RECURID",
|
97
98
|
recur_frequency: "FREQUENCY",
|
data/lib/paytrace/api/gateway.rb
CHANGED
data/lib/paytrace/transaction.rb
CHANGED
@@ -93,6 +93,7 @@ module PayTrace
|
|
93
93
|
LEVEL_3_VISA_METHOD = "Level3Visa"
|
94
94
|
LEVEL_3_MC_METHOD = "Level3MCRD"
|
95
95
|
SETTLE_TRANSACTION_METHOD = "SettleTranx"
|
96
|
+
ADJUST_AMOUNT_METHOD = "AdjustAmount"
|
96
97
|
|
97
98
|
def set_shipping_same_as_billing()
|
98
99
|
@shipping_address = @billing_address
|
@@ -240,6 +241,15 @@ module PayTrace
|
|
240
241
|
gateway.send_request(request)
|
241
242
|
end
|
242
243
|
|
244
|
+
def self.adjust_amount(params = {})
|
245
|
+
request = PayTrace::API::Request.new
|
246
|
+
request.set_param(:method, ADJUST_AMOUNT_METHOD)
|
247
|
+
request.set_param(:transaction_id, params[:transaction_id])
|
248
|
+
request.set_param(:amount, params[:amount])
|
249
|
+
gateway = PayTrace::API::Gateway.new
|
250
|
+
gateway.send_request(request)
|
251
|
+
end
|
252
|
+
|
243
253
|
private
|
244
254
|
def add_transaction_info(request)
|
245
255
|
request.set_param(:transaction_type, type)
|
data/lib/paytrace/version.rb
CHANGED
@@ -5,8 +5,12 @@ describe PayTrace::Transaction do
|
|
5
5
|
"UN~#{PayTrace.configuration.user_name}|PSWD~#{PayTrace.configuration.password}|TERMS~Y|"
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
before do
|
9
9
|
PayTrace::API::Gateway.debug = true
|
10
|
+
PayTrace::API::Gateway.reset_trace()
|
11
|
+
end
|
12
|
+
|
13
|
+
it "exports transaction(s)" do
|
10
14
|
PayTrace::API::Gateway.next_response = "TRANSACTIONRECORD~TRANXID=1143"
|
11
15
|
records = PayTrace::Transaction.export({transaction_id: 1143})
|
12
16
|
records.must_be_instance_of Array
|
@@ -16,21 +20,18 @@ describe PayTrace::Transaction do
|
|
16
20
|
end
|
17
21
|
|
18
22
|
it "successfully attaches base-64 encoded signatures to transactions" do
|
19
|
-
PayTrace::API::Gateway.debug = true
|
20
23
|
PayTrace::API::Gateway.next_response = "RESPONSE~172. The signature image was successfully attached to Transaction ID 13192003.|"
|
21
24
|
result = PayTrace::Transaction.attach_signature({transaction_id: 13192003, image_data: "foo", image_type: "png"})
|
22
25
|
result.has_errors?.must_equal false
|
23
26
|
end
|
24
27
|
|
25
28
|
it "successfully attaches image files to transactions" do
|
26
|
-
PayTrace::API::Gateway.debug = true
|
27
29
|
PayTrace::API::Gateway.next_response = "RESPONSE~172. The signature image was successfully attached to Transaction ID 13192003.|"
|
28
30
|
result = PayTrace::Transaction.attach_signature({transaction_id: 13192003, image_file: __FILE__, image_type: "png"})
|
29
31
|
result.has_errors?.must_equal false
|
30
32
|
end
|
31
33
|
|
32
34
|
it "calculates shipping costs" do
|
33
|
-
PayTrace::API::Gateway.debug = true
|
34
35
|
PayTrace::API::Gateway.next_response = "SHIPPINGRECORD~SHIPPINGCOMPANY=USPS+SHIPPINGMETHOD=STANDARD POST+SHIPPINGRATE=12.72|"
|
35
36
|
params = {
|
36
37
|
#UN, PSWD, TERMS, METHOD, SOURCEZIP, SOURCESTATE, SZIP, WEIGHT, SHIPPERS, SSTATE
|
@@ -46,9 +47,17 @@ describe PayTrace::Transaction do
|
|
46
47
|
result[0]['SHIPPINGCOMPANY'].must_equal "USPS"
|
47
48
|
end
|
48
49
|
|
50
|
+
it "can adjust a transaction" do
|
51
|
+
PayTrace::API::Gateway.next_response = "SHIPPINGRECORD~SHIPPINGCOMPANY=USPS+SHIPPINGMETHOD=STANDARD POST+SHIPPINGRATE=12.72|"
|
52
|
+
params = {
|
53
|
+
transaction_id: 1234,
|
54
|
+
amount: 9.87
|
55
|
+
}
|
56
|
+
result = PayTrace::Transaction.adjust_amount(params)
|
57
|
+
PayTrace::API::Gateway.last_request.must_equal base_url + "METHOD~AdjustAmount|TRANXID~1234|AMOUNT~9.87|"
|
58
|
+
end
|
49
59
|
|
50
60
|
it "can settle a transaction by recurrence ID" do
|
51
|
-
PayTrace::API::Gateway.debug = true
|
52
61
|
PayTrace::API::Gateway.next_response = "SHIPPINGRECORD~SHIPPINGCOMPANY=USPS+SHIPPINGMETHOD=STANDARD POST+SHIPPINGRATE=12.72|"
|
53
62
|
params = {
|
54
63
|
# UN, PSWD, TERMS, METHOD, RECURID
|
@@ -59,7 +68,6 @@ describe PayTrace::Transaction do
|
|
59
68
|
end
|
60
69
|
|
61
70
|
it "can settle a transaction by customer ID" do
|
62
|
-
PayTrace::API::Gateway.debug = true
|
63
71
|
PayTrace::API::Gateway.next_response = "SHIPPINGRECORD~SHIPPINGCOMPANY=USPS+SHIPPINGMETHOD=STANDARD POST+SHIPPINGRATE=12.72|"
|
64
72
|
params = {
|
65
73
|
# UN, PSWD, TERMS, METHOD, RECURID
|
@@ -0,0 +1,16 @@
|
|
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
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
8
|
+
|
9
|
+
PayTrace::Debug.trace do
|
10
|
+
params = {
|
11
|
+
# this must be a valid transaction ID for the credentials supplied
|
12
|
+
transaction_id: 1131,
|
13
|
+
amount: 4.01
|
14
|
+
}
|
15
|
+
PayTrace::Transaction::adjust_amount(params)
|
16
|
+
end
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
# see: http://help.paytrace.com/api-email-receipt for details
|
9
10
|
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
PayTrace::Debug.trace do
|
9
10
|
params = {
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
# this should be a valid credit card number (it can be a "sandbox" number, however)
|
9
10
|
cc = PayTrace::CreditCard.new({
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
PayTrace::Debug.trace do
|
9
10
|
e = PayTrace::EmailReceiptRequest.new({email: "support@paytrace.com", check_id: "62" })
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
# this should dump out a wall of text...
|
9
10
|
PayTrace::Debug.trace { puts PayTrace::Customer.export() }
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
PayTrace::API::Gateway.debug = true
|
9
10
|
|
@@ -3,11 +3,13 @@ $:<< "./lib" # uncomment this to run against a Git clone instead of an installed
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
9
|
+
# This is testing the Level 3 data addition for Visa transactions
|
8
10
|
PayTrace::Debug.trace do
|
9
11
|
params = {
|
10
|
-
transaction_id: "
|
12
|
+
transaction_id: "1448",
|
11
13
|
invoice: "12346",
|
12
14
|
customer_reference_id: "1234578",
|
13
15
|
tax_amount: 31.76,
|
@@ -54,19 +56,17 @@ PayTrace::Debug.trace do
|
|
54
56
|
PayTrace::Transaction.add_level_three_visa(params)
|
55
57
|
end
|
56
58
|
|
57
|
-
#
|
58
|
-
# [REQUEST] UN~demo123|PSWD~demo123|TERMS~Y|METHOD~Level3MCRD|TRANXID~1399|INVOICE~12347|CUSTREF~1234579|TAX~31.78|NTAX~0.01|FREIGHT~7.98|DUTY~6.51|SOURCEZIP~94948|SZIP~98134|SCOUNTRY~US|ADDTAX~4.54|ADDTAXIND~Y|LINEITEM~PRODUCTID=E123126+DESCRIPTION=Wadgets and wudgets+QUANTITY=21+MEASURE=food+MERCHANTTAXID=13699468+UNITCOST=3.98+ADDTAXRATELI=0.45+ADDTAXINDLI=Y+ADDTAXLI=3.82+DISCOUNTIND=Y+AMOUNTLI=6+NETGROSSIND=Y+DCIND=D+DISCOUNTLI=1.86+DISCOUNTRATE=0.10|
|
59
|
+
# This is testing the Level 3 data addition for Mastercard transactions
|
59
60
|
|
60
|
-
PayTrace::Debug.configure_test("NEWapiuser", "test456")
|
61
61
|
PayTrace::Debug.trace do
|
62
62
|
params = {
|
63
|
-
transaction_id: "
|
63
|
+
transaction_id: "1448",
|
64
64
|
invoice: "12347",
|
65
65
|
customer_reference_id: "1234579",
|
66
66
|
tax_amount: 31.78,
|
67
67
|
national_tax: 0.01,
|
68
68
|
freight: 7.98,
|
69
|
-
duty: 6.51,
|
69
|
+
# duty: 6.51,
|
70
70
|
source_zip: "94948",
|
71
71
|
shipping_postal_code: "98134",
|
72
72
|
shipping_country: "US",
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
# this should be a valid credit card number (it can be a "sandbox" number, however)
|
9
10
|
cc = PayTrace::CreditCard.new({
|
@@ -3,7 +3,8 @@ $:<< "./lib" # uncomment this to run against a Git clone instead of an installed
|
|
3
3
|
require "paytrace"
|
4
4
|
require "paytrace/debug"
|
5
5
|
|
6
|
-
|
6
|
+
# change this as needed to reflect the username, password, and test host you're testing against
|
7
|
+
PayTrace::Debug.configure_test("demo123", "demo123", "stage.paytrace.com")
|
7
8
|
|
8
9
|
# settle a transaction via a recurrence ID
|
9
10
|
PayTrace::Debug.trace do
|
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.
|
4
|
+
version: 0.1.17
|
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-
|
11
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- test/paytrace/level3_data_spec.rb
|
140
140
|
- test/paytrace/recurring_transaction_spec.rb
|
141
141
|
- test/paytrace/transaction_spec.rb
|
142
|
+
- test/scripts/run_adjust_amount.rb
|
142
143
|
- test/scripts/run_attach_signature.rb
|
143
144
|
- test/scripts/run_calculate_shipping_costs.rb
|
144
145
|
- test/scripts/run_change_password.rb
|
@@ -190,6 +191,7 @@ test_files:
|
|
190
191
|
- test/paytrace/level3_data_spec.rb
|
191
192
|
- test/paytrace/recurring_transaction_spec.rb
|
192
193
|
- test/paytrace/transaction_spec.rb
|
194
|
+
- test/scripts/run_adjust_amount.rb
|
193
195
|
- test/scripts/run_attach_signature.rb
|
194
196
|
- test/scripts/run_calculate_shipping_costs.rb
|
195
197
|
- test/scripts/run_change_password.rb
|