activemerchant 1.55.0 → 1.56.0
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/CHANGELOG +22 -0
- data/CONTRIBUTORS +4 -0
- data/README.md +1 -0
- data/lib/active_merchant.rb +0 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +5 -0
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +56 -29
- data/lib/active_merchant/billing/gateways/card_stream.rb +2 -1
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +4 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +3 -1
- data/lib/active_merchant/billing/gateways/elavon.rb +6 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +1 -1
- data/lib/active_merchant/billing/gateways/garanti.rb +4 -2
- data/lib/active_merchant/billing/gateways/jetpay.rb +3 -2
- data/lib/active_merchant/billing/gateways/mercury.rb +10 -1
- data/lib/active_merchant/billing/gateways/micropayment.rb +20 -6
- data/lib/active_merchant/billing/gateways/omise.rb +5 -4
- data/lib/active_merchant/billing/gateways/redsys.rb +107 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +17 -3
- data/lib/active_merchant/billing/gateways/trans_first.rb +107 -18
- data/lib/active_merchant/version.rb +1 -1
- metadata +6 -5
@@ -1,7 +1,8 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class TransFirstGateway < Gateway
|
4
|
-
self.
|
4
|
+
self.test_url = 'https://ws.cert.transfirst.com'
|
5
|
+
self.live_url = 'https://webservices.primerchants.com'
|
5
6
|
|
6
7
|
self.supported_countries = ['US']
|
7
8
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
@@ -12,25 +13,59 @@ module ActiveMerchant #:nodoc:
|
|
12
13
|
|
13
14
|
DECLINED = 'The transaction was declined'
|
14
15
|
|
16
|
+
ACTIONS = {
|
17
|
+
purchase: "CCSale",
|
18
|
+
purchase_echeck: "ACHDebit",
|
19
|
+
refund: "CreditCardAutoRefundorVoid",
|
20
|
+
refund_echeck: "ACHVoidTransaction",
|
21
|
+
void: "CreditCardAutoRefundorVoid",
|
22
|
+
}
|
23
|
+
|
24
|
+
ENDPOINTS = {
|
25
|
+
purchase: "creditcard.asmx",
|
26
|
+
purchase_echeck: "checkverifyws/checkverifyws.asmx",
|
27
|
+
refund: "creditcard.asmx",
|
28
|
+
refund_echeck: "checkverifyws/checkverifyws.asmx",
|
29
|
+
void: "creditcard.asmx"
|
30
|
+
}
|
31
|
+
|
15
32
|
def initialize(options = {})
|
16
33
|
requires!(options, :login, :password)
|
17
34
|
super
|
18
35
|
end
|
19
36
|
|
20
|
-
def purchase(money,
|
37
|
+
def purchase(money, payment, options = {})
|
21
38
|
post = {}
|
22
39
|
|
23
40
|
add_amount(post, money)
|
24
41
|
add_invoice(post, options)
|
25
|
-
|
42
|
+
add_payment(post, payment)
|
26
43
|
add_address(post, options)
|
27
44
|
|
28
|
-
commit(post)
|
45
|
+
commit((payment.is_a?(Check) ? :purchase_echeck : :purchase), post)
|
46
|
+
end
|
47
|
+
|
48
|
+
def refund(money, authorization, options={})
|
49
|
+
post = {}
|
50
|
+
transaction_id, payment_type = split_authorization(authorization)
|
51
|
+
add_amount(post, money)
|
52
|
+
add_invoice(post, options)
|
53
|
+
add_pair(post, :TransID, transaction_id)
|
54
|
+
commit((payment_type == "check" ? :refund_echeck : :refund), post)
|
55
|
+
end
|
56
|
+
|
57
|
+
def void(authorization, options={})
|
58
|
+
post = {}
|
59
|
+
transaction_id, _ = split_authorization(authorization)
|
60
|
+
add_pair(post, :TransID, transaction_id)
|
61
|
+
|
62
|
+
commit(:void, post)
|
29
63
|
end
|
30
64
|
|
31
65
|
private
|
66
|
+
|
32
67
|
def add_amount(post, money)
|
33
|
-
add_pair(post, :Amount, amount(money), :
|
68
|
+
add_pair(post, :Amount, amount(money), required: true)
|
34
69
|
end
|
35
70
|
|
36
71
|
def add_address(post, options)
|
@@ -43,19 +78,38 @@ module ActiveMerchant #:nodoc:
|
|
43
78
|
end
|
44
79
|
|
45
80
|
def add_invoice(post, options)
|
46
|
-
add_pair(post, :RefID, options[:order_id], :
|
47
|
-
add_pair(post, :
|
81
|
+
add_pair(post, :RefID, options[:order_id], required: true)
|
82
|
+
add_pair(post, :SECCCode, options[:invoice], required: true)
|
83
|
+
add_pair(post, :PONumber, options[:invoice], required: true)
|
48
84
|
add_pair(post, :SaleTaxAmount, amount(options[:tax] || 0))
|
49
|
-
add_pair(post, :PaymentDesc, options[:description], :
|
85
|
+
add_pair(post, :PaymentDesc, options[:description], required: true)
|
50
86
|
add_pair(post, :TaxIndicator, 0)
|
87
|
+
add_pair(post, :CompanyName, options[:company_name] || "", required: true)
|
88
|
+
end
|
89
|
+
|
90
|
+
def add_payment(post, payment)
|
91
|
+
if payment.is_a?(Check)
|
92
|
+
add_echeck(post, payment)
|
93
|
+
else
|
94
|
+
add_credit_card(post, payment)
|
95
|
+
end
|
51
96
|
end
|
52
97
|
|
53
|
-
def add_credit_card(post,
|
54
|
-
add_pair(post, :CardHolderName,
|
55
|
-
add_pair(post, :CardNumber,
|
98
|
+
def add_credit_card(post, payment)
|
99
|
+
add_pair(post, :CardHolderName, payment.name, required: true)
|
100
|
+
add_pair(post, :CardNumber, payment.number, required: true)
|
101
|
+
add_pair(post, :Expiration, expdate(payment), required: true)
|
102
|
+
add_pair(post, :CVV2, payment.verification_value)
|
103
|
+
end
|
56
104
|
|
57
|
-
|
58
|
-
add_pair(post, :
|
105
|
+
def add_echeck(post, payment)
|
106
|
+
add_pair(post, :TransRoute, payment.routing_number, required: true)
|
107
|
+
add_pair(post, :BankAccountNo, payment.account_number, required: true)
|
108
|
+
add_pair(post, :BankAccountType, payment.account_type.capitalize, required: true)
|
109
|
+
add_pair(post, :CheckType, payment.account_holder_type.capitalize, required: true)
|
110
|
+
add_pair(post, :Name, payment.name, required: true)
|
111
|
+
add_pair(post, :ProcessDate, Time.now.strftime("%m%d%y"), required: true)
|
112
|
+
add_pair(post, :Description, "", required: true)
|
59
113
|
end
|
60
114
|
|
61
115
|
def add_unused_fields(post)
|
@@ -75,7 +129,7 @@ module ActiveMerchant #:nodoc:
|
|
75
129
|
response = {}
|
76
130
|
|
77
131
|
xml = REXML::Document.new(data)
|
78
|
-
root = REXML::XPath.first(xml, "
|
132
|
+
root = REXML::XPath.first(xml, "*")
|
79
133
|
|
80
134
|
if root.nil?
|
81
135
|
response[:message] = data.to_s.strip
|
@@ -88,17 +142,43 @@ module ActiveMerchant #:nodoc:
|
|
88
142
|
response
|
89
143
|
end
|
90
144
|
|
91
|
-
def commit(params)
|
92
|
-
response = parse(
|
145
|
+
def commit(action, params)
|
146
|
+
response = parse(ssl_post(url(action), post_data(params)))
|
93
147
|
|
94
|
-
Response.new(
|
148
|
+
Response.new(
|
149
|
+
success_from(response),
|
150
|
+
message_from(response),
|
151
|
+
response,
|
95
152
|
:test => test?,
|
96
|
-
:authorization => response
|
153
|
+
:authorization => authorization_from(response),
|
97
154
|
:avs_result => { :code => response[:avs_code] },
|
98
155
|
:cvv_result => response[:cvv2_code]
|
99
156
|
)
|
100
157
|
end
|
101
158
|
|
159
|
+
def authorization_from(response)
|
160
|
+
if response[:status] == "APPROVED"
|
161
|
+
"#{response[:trans_id]}|check"
|
162
|
+
else
|
163
|
+
"#{response[:trans_id]}|creditcard"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def success_from(response)
|
168
|
+
case response[:status]
|
169
|
+
when "Authorized"
|
170
|
+
true
|
171
|
+
when "Voided"
|
172
|
+
true
|
173
|
+
when "APPROVED"
|
174
|
+
true
|
175
|
+
when "VOIDED"
|
176
|
+
true
|
177
|
+
else
|
178
|
+
false
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
102
182
|
def message_from(response)
|
103
183
|
case response[:message]
|
104
184
|
when 'Call Voice Center'
|
@@ -120,6 +200,15 @@ module ActiveMerchant #:nodoc:
|
|
120
200
|
def add_pair(post, key, value, options = {})
|
121
201
|
post[key] = value if !value.blank? || options[:required]
|
122
202
|
end
|
203
|
+
|
204
|
+
def url(action)
|
205
|
+
base_url = test? ? test_url : live_url
|
206
|
+
"#{base_url}/#{ENDPOINTS[action]}/#{ACTIONS[action]}"
|
207
|
+
end
|
208
|
+
|
209
|
+
def split_authorization(authorization)
|
210
|
+
authorization.split("|")
|
211
|
+
end
|
123
212
|
end
|
124
213
|
end
|
125
214
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.56.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 3.2.14
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 5.
|
22
|
+
version: '5.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 3.2.14
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 5.
|
32
|
+
version: '5.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: i18n
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/active_merchant/billing/gateways/cams.rb
|
189
189
|
- lib/active_merchant/billing/gateways/card_save.rb
|
190
190
|
- lib/active_merchant/billing/gateways/card_stream.rb
|
191
|
+
- lib/active_merchant/billing/gateways/cardknox.rb
|
191
192
|
- lib/active_merchant/billing/gateways/cashnet.rb
|
192
193
|
- lib/active_merchant/billing/gateways/cc5.rb
|
193
194
|
- lib/active_merchant/billing/gateways/cecabank.rb
|
@@ -381,7 +382,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
381
382
|
requirements:
|
382
383
|
- - ">="
|
383
384
|
- !ruby/object:Gem::Version
|
384
|
-
version: '
|
385
|
+
version: '2'
|
385
386
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
386
387
|
requirements:
|
387
388
|
- - ">="
|