activemerchant 1.59.0 → 1.60.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +41 -0
- data/README.md +2 -2
- data/lib/active_merchant/billing/gateway.rb +3 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +16 -5
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +6 -4
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +19 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +6 -35
- data/lib/active_merchant/billing/gateways/cyber_source.rb +20 -8
- data/lib/active_merchant/billing/gateways/data_cash.rb +10 -304
- data/lib/active_merchant/billing/gateways/elavon.rb +40 -26
- data/lib/active_merchant/billing/gateways/global_transport.rb +1 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +144 -122
- data/lib/active_merchant/billing/gateways/openpay.rb +1 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +3 -1
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +0 -2
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -1
- data/lib/active_merchant/billing/gateways/redsys.rb +1 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +24 -7
- data/lib/active_merchant/billing/gateways/stripe.rb +21 -11
- data/lib/active_merchant/billing/gateways/tns.rb +11 -2
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +19 -28
- data/lib/active_merchant/version.rb +1 -1
- metadata +3 -3
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
@@ -512,7 +512,7 @@ module ActiveMerchant #:nodoc:
|
|
512
512
|
if (billing_address = options[:billing_address])
|
513
513
|
doc["v1"].phone do
|
514
514
|
doc["v1"].type (options[:phone_number_type] || "4")
|
515
|
-
doc["v1"].nr billing_address[:phone].gsub(/\D/, '')
|
515
|
+
doc["v1"].nr billing_address[:phone].gsub(/\D/, '') if billing_address[:phone]
|
516
516
|
end
|
517
517
|
doc["v1"].addrLn1 billing_address[:address1]
|
518
518
|
doc["v1"].addrLn2 billing_address[:address2]
|
@@ -32,8 +32,6 @@ module ActiveMerchant #:nodoc:
|
|
32
32
|
add_payment_method(params, payment_method)
|
33
33
|
add_antifraud_data(params, options)
|
34
34
|
params[:email] = options[:email] || 'unknown@email.com'
|
35
|
-
|
36
|
-
# No vaulting for now
|
37
35
|
params[:createAlias] = false
|
38
36
|
|
39
37
|
commit("authorize", params)
|
@@ -41,24 +39,20 @@ module ActiveMerchant #:nodoc:
|
|
41
39
|
|
42
40
|
def capture(authorization, options={})
|
43
41
|
params = {}
|
44
|
-
|
45
|
-
params[:purchaseNumber] = purchase_number
|
46
|
-
params[:externalTransactionId] = options[:order_id]
|
42
|
+
add_auth_order_id(params, authorization, options)
|
47
43
|
commit("deposit", params)
|
48
44
|
end
|
49
45
|
|
50
46
|
def void(authorization, options={})
|
51
47
|
params = {}
|
52
|
-
|
53
|
-
params
|
54
|
-
|
48
|
+
add_auth_order_id(params, authorization, options)
|
49
|
+
commit("void", params)
|
50
|
+
end
|
55
51
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
commit("cancelDeposit", params)
|
61
|
-
end
|
52
|
+
def refund(amount, authorization, options={})
|
53
|
+
params = {}
|
54
|
+
add_auth_order_id(params, authorization, options)
|
55
|
+
commit("cancelDeposit", params)
|
62
56
|
end
|
63
57
|
|
64
58
|
def verify(credit_card, options={})
|
@@ -93,6 +87,11 @@ module ActiveMerchant #:nodoc:
|
|
93
87
|
params[:currencyId] = CURRENCY_CODES[options[:currency] || currency(money)]
|
94
88
|
end
|
95
89
|
|
90
|
+
def add_auth_order_id(params, authorization, options)
|
91
|
+
params[:purchaseNumber] = authorization
|
92
|
+
params[:externalTransactionId] = options[:order_id]
|
93
|
+
end
|
94
|
+
|
96
95
|
def add_payment_method(params, payment_method)
|
97
96
|
params[:firstName] = payment_method.first_name
|
98
97
|
params[:lastName] = payment_method.last_name
|
@@ -134,7 +133,7 @@ module ActiveMerchant #:nodoc:
|
|
134
133
|
message_from(response),
|
135
134
|
response,
|
136
135
|
:test => test?,
|
137
|
-
:authorization => authorization_from(
|
136
|
+
:authorization => authorization_from(params),
|
138
137
|
:error_code => response["errorCode"]
|
139
138
|
)
|
140
139
|
end
|
@@ -149,26 +148,18 @@ module ActiveMerchant #:nodoc:
|
|
149
148
|
|
150
149
|
def url(action, params)
|
151
150
|
if (action == "authorize")
|
152
|
-
|
151
|
+
"#{base_url}/#{@options[:merchant_id]}"
|
153
152
|
else
|
154
|
-
|
153
|
+
"#{base_url}/#{@options[:merchant_id]}/#{action}/#{params[:purchaseNumber]}"
|
155
154
|
end
|
156
155
|
end
|
157
156
|
|
158
157
|
def method(action)
|
159
|
-
|
160
|
-
method = :post
|
161
|
-
else
|
162
|
-
method = :put
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
def split_authorization(authorization)
|
167
|
-
authorization.split("|")
|
158
|
+
(action == "authorize") ? :post : :put
|
168
159
|
end
|
169
160
|
|
170
|
-
def authorization_from(
|
171
|
-
|
161
|
+
def authorization_from(params)
|
162
|
+
params[:purchaseNumber]
|
172
163
|
end
|
173
164
|
|
174
165
|
def base_url
|
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.60.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: 2016-
|
11
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -194,7 +194,6 @@ files:
|
|
194
194
|
- lib/active_merchant/billing/gateways/cc5.rb
|
195
195
|
- lib/active_merchant/billing/gateways/cecabank.rb
|
196
196
|
- lib/active_merchant/billing/gateways/cenpos.rb
|
197
|
-
- lib/active_merchant/billing/gateways/certo_direct.rb
|
198
197
|
- lib/active_merchant/billing/gateways/checkout.rb
|
199
198
|
- lib/active_merchant/billing/gateways/checkout_v2.rb
|
200
199
|
- lib/active_merchant/billing/gateways/clearhaus.rb
|
@@ -277,6 +276,7 @@ files:
|
|
277
276
|
- lib/active_merchant/billing/gateways/orbital.rb
|
278
277
|
- lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb
|
279
278
|
- lib/active_merchant/billing/gateways/pac_net_raven.rb
|
279
|
+
- lib/active_merchant/billing/gateways/pagarme.rb
|
280
280
|
- lib/active_merchant/billing/gateways/pago_facil.rb
|
281
281
|
- lib/active_merchant/billing/gateways/pay_conex.rb
|
282
282
|
- lib/active_merchant/billing/gateways/pay_gate_xml.rb
|
@@ -1,278 +0,0 @@
|
|
1
|
-
module ActiveMerchant #:nodoc:
|
2
|
-
module Billing #:nodoc:
|
3
|
-
class CertoDirectGateway < Gateway
|
4
|
-
self.live_url = self.test_url = "https://secure.certodirect.com/gateway/process/v2"
|
5
|
-
|
6
|
-
self.supported_countries = [
|
7
|
-
"BE", "BG", "CZ", "DK", "DE", "EE", "IE", "ES", "FR",
|
8
|
-
"IT", "CY", "LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL",
|
9
|
-
"PT", "RO", "SI", "SK", "FI", "SE", "GB"
|
10
|
-
]
|
11
|
-
|
12
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
13
|
-
self.homepage_url = 'http://www.certodirect.com/'
|
14
|
-
self.display_name = 'CertoDirect'
|
15
|
-
|
16
|
-
# Creates a new CertoDirectGateway
|
17
|
-
#
|
18
|
-
# The gateway requires that a valid login and password be passed
|
19
|
-
# in the +options+ hash.
|
20
|
-
#
|
21
|
-
# ==== Options
|
22
|
-
#
|
23
|
-
# * <tt>:login</tt> -- The CertoDirect Shop ID (REQUIRED)
|
24
|
-
# * <tt>:password</tt> -- The CertoDirect Shop Password. (REQUIRED)
|
25
|
-
# * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
|
26
|
-
# Otherwise, perform transactions against the production server.
|
27
|
-
def initialize(options = {})
|
28
|
-
requires!(options, :login, :password)
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
33
|
-
#
|
34
|
-
# ==== Parameters
|
35
|
-
#
|
36
|
-
# * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
|
37
|
-
# * <tt>credit_card</tt> -- The CreditCard details for the transaction.
|
38
|
-
# * <tt>options</tt> -- A hash of optional parameters.
|
39
|
-
def purchase(money, credit_card, options = {})
|
40
|
-
requires!(options, :email, :currency, :ip, :description)
|
41
|
-
|
42
|
-
commit(build_sale_request(money, credit_card, options))
|
43
|
-
end
|
44
|
-
|
45
|
-
# Refund a transaction.
|
46
|
-
#
|
47
|
-
# This transaction indicates to the gateway that
|
48
|
-
# money should flow from the merchant to the customer.
|
49
|
-
#
|
50
|
-
# ==== Parameters
|
51
|
-
#
|
52
|
-
# * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
|
53
|
-
# * <tt>identification</tt> -- The ID of the original order against which the refund is being issued.
|
54
|
-
# * <tt>options</tt> -- A hash of parameters.
|
55
|
-
def refund(money, identification, options = {})
|
56
|
-
requires!(options, :reason)
|
57
|
-
|
58
|
-
commit(build_refund_request(money, identification, options))
|
59
|
-
end
|
60
|
-
|
61
|
-
# Performs an authorization, which reserves the funds on the customer's credit card, but does not
|
62
|
-
# charge the card.
|
63
|
-
#
|
64
|
-
# ==== Parameters
|
65
|
-
#
|
66
|
-
# * <tt>money</tt> -- The amount to be authorized as an Integer value in cents.
|
67
|
-
# * <tt>credit_card</tt> -- The CreditCard details for the transaction.
|
68
|
-
# * <tt>options</tt> -- A hash of optional parameters.
|
69
|
-
def authorize(money, credit_card, options = {})
|
70
|
-
requires!(options, :email, :currency, :ip, :description)
|
71
|
-
|
72
|
-
commit(build_authorize_request(money, credit_card, options))
|
73
|
-
end
|
74
|
-
|
75
|
-
# Captures the funds from an authorized transaction.
|
76
|
-
#
|
77
|
-
# ==== Parameters
|
78
|
-
#
|
79
|
-
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
80
|
-
# * <tt>identification</tt> -- The authorization returned from the previous authorize request.
|
81
|
-
def capture(money, identification, options = {})
|
82
|
-
commit(build_capture_request(money, identification))
|
83
|
-
end
|
84
|
-
|
85
|
-
# Void a previous transaction
|
86
|
-
#
|
87
|
-
# ==== Parameters
|
88
|
-
#
|
89
|
-
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
90
|
-
# * <tt>identification</tt> - The authorization returned from the previous authorize request.
|
91
|
-
def void(money, identification, options = {})
|
92
|
-
commit(build_void_request(money, identification))
|
93
|
-
end
|
94
|
-
|
95
|
-
# Create a recurring payment.
|
96
|
-
#
|
97
|
-
# ==== Parameters
|
98
|
-
#
|
99
|
-
# * <tt>options</tt> -- A hash of parameters.
|
100
|
-
#
|
101
|
-
# ==== Options
|
102
|
-
#
|
103
|
-
def recurring(identification, options={})
|
104
|
-
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
|
105
|
-
|
106
|
-
commit(build_recurring_request(identification, options))
|
107
|
-
end
|
108
|
-
|
109
|
-
private
|
110
|
-
|
111
|
-
def commit(request_xml)
|
112
|
-
begin
|
113
|
-
response = Hash.from_xml(ssl_post(self.live_url, request_xml, headers))
|
114
|
-
Response.new(success?(response),
|
115
|
-
message(response),
|
116
|
-
response,
|
117
|
-
:test => test?,
|
118
|
-
:authorization => authorization(response))
|
119
|
-
rescue ResponseError => e
|
120
|
-
raise e unless e.response.code == '403'
|
121
|
-
response = Hash.from_xml(e.response.body)['response']
|
122
|
-
Response.new(false, message(response), {}, :test => test?)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def build_sale_request(money, credit_card, options)
|
127
|
-
build_request_xml('Sale') do |xml|
|
128
|
-
add_order(xml, money, credit_card, options)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def build_authorize_request(money, credit_card, options)
|
133
|
-
build_request_xml('Authorize') do |xml|
|
134
|
-
add_order(xml, money, credit_card, options)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def build_refund_request(money, identification, options)
|
139
|
-
build_request_xml('Refund') do |xml|
|
140
|
-
add_reference_info(xml, money, identification, options)
|
141
|
-
xml.tag! 'reason', options[:reason]
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def build_capture_request(money, identification)
|
146
|
-
build_request_xml('Capture') do |xml|
|
147
|
-
add_reference_info(xml, money, identification, options)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def build_void_request(money, identification)
|
152
|
-
build_request_xml('Void') do |xml|
|
153
|
-
add_reference_info(xml, money, identification, options)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def build_recurring_request(identification, options)
|
158
|
-
build_request_xml('Sale') do |xml|
|
159
|
-
xml.tag! 'order' do
|
160
|
-
xml.tag!('test', 'true') if test?
|
161
|
-
xml.tag! 'initial_order_id', identification, :type => 'integer'
|
162
|
-
|
163
|
-
add_order_details(xml, options[:amount], options) if has_any_order_details_key?(options)
|
164
|
-
add_address(xml, 'billing_address', options[:billing_address]) if options[:billing_address]
|
165
|
-
add_address(xml, 'shipping_address', options[:shipping_address]) if options[:shipping_address]
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def build_request_xml(type, &block)
|
171
|
-
xml = Builder::XmlMarkup.new(:indent => 2)
|
172
|
-
xml.tag! 'transaction' do
|
173
|
-
xml.tag! 'type', type
|
174
|
-
yield(xml)
|
175
|
-
end
|
176
|
-
xml.target!
|
177
|
-
end
|
178
|
-
|
179
|
-
def add_order(xml, money, credit_card, options)
|
180
|
-
xml.tag! 'order' do
|
181
|
-
xml.tag!('test', 'true') if test?
|
182
|
-
|
183
|
-
xml.tag!('return_url', options[:return_url]) if options[:return_url]
|
184
|
-
xml.tag!('cancel_url', options[:cancel_url]) if options[:cancel_url]
|
185
|
-
|
186
|
-
xml.tag! 'payment_method_type', 'CreditCard'
|
187
|
-
xml.tag! 'payment_method' do
|
188
|
-
xml.tag! 'number', credit_card.number
|
189
|
-
xml.tag! 'exp_month', "%02i" % credit_card.month
|
190
|
-
xml.tag! 'exp_year', credit_card.year
|
191
|
-
xml.tag! 'holder', credit_card.name
|
192
|
-
xml.tag! 'verification_value', credit_card.verification_value
|
193
|
-
end
|
194
|
-
|
195
|
-
add_order_details(xml, money, options)
|
196
|
-
add_address(xml, 'billing_address', options[:billing_address]) if options[:billing_address]
|
197
|
-
add_address(xml, 'shipping_address', options[:shipping_address]) if options[:shipping_address]
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
def add_order_details(xml, money, options)
|
202
|
-
xml.tag! 'details' do
|
203
|
-
xml.tag!('amount', localized_amount(money, options[:currency]), :type => 'decimal') if money
|
204
|
-
xml.tag!('currency', options[:currency]) if options[:currency]
|
205
|
-
xml.tag!('email', options[:email]) if options[:email]
|
206
|
-
xml.tag!('ip', options[:ip]) if options[:ip]
|
207
|
-
xml.tag!('shipping', options[:shipping], :type => 'decimal') if options[:shipping]
|
208
|
-
xml.tag!('description', options[:description]) if options[:description]
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def add_reference_info(xml, money, identification, options)
|
213
|
-
xml.tag! 'order_id', identification, :type => 'integer'
|
214
|
-
xml.tag! 'amount', localized_amount(money, options[:currency]), :type => 'decimal'
|
215
|
-
end
|
216
|
-
|
217
|
-
def add_address(xml, address_type, address)
|
218
|
-
xml.tag! address_type do
|
219
|
-
xml.tag! 'address', address[:address1]
|
220
|
-
xml.tag! 'city', address[:city]
|
221
|
-
xml.tag! 'country', address[:country]
|
222
|
-
xml.tag! 'first_name', address[:first_name]
|
223
|
-
xml.tag! 'last_name', address[:last_name]
|
224
|
-
xml.tag! 'state', address[:state]
|
225
|
-
xml.tag! 'phone', address[:phone]
|
226
|
-
xml.tag! 'zip', address[:zip]
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
def has_any_order_details_key?(options)
|
231
|
-
[ :currency, :amount, :email, :ip, :shipping, :description ].any? do |key|
|
232
|
-
options.has_key?(key)
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
def success?(response)
|
237
|
-
%w(completed forwarding).include?(state(response)) and
|
238
|
-
status(response) == 'success'
|
239
|
-
end
|
240
|
-
|
241
|
-
def error?(response)
|
242
|
-
response['errors']
|
243
|
-
end
|
244
|
-
|
245
|
-
def state(response)
|
246
|
-
response["transaction"].try(:[], "state")
|
247
|
-
end
|
248
|
-
|
249
|
-
def status(response)
|
250
|
-
response['transaction'].try(:[], 'response').try(:[], 'status')
|
251
|
-
end
|
252
|
-
|
253
|
-
def authorization(response)
|
254
|
-
error?(response) ? nil : response["transaction"]["order"]['id'].to_s
|
255
|
-
end
|
256
|
-
|
257
|
-
def message(response)
|
258
|
-
return response['errors'].join('; ') if error?(response)
|
259
|
-
|
260
|
-
if state(response) == 'completed'
|
261
|
-
response["transaction"]["response"]["message"]
|
262
|
-
else
|
263
|
-
response['transaction']['message']
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
def headers
|
268
|
-
{ 'authorization' => basic_auth,
|
269
|
-
'Accept' => 'application/xml',
|
270
|
-
'Content-Type' => 'application/xml' }
|
271
|
-
end
|
272
|
-
|
273
|
-
def basic_auth
|
274
|
-
'Basic ' + ["#{@options[:login]}:#{@options[:password]}"].pack('m').delete("\r\n")
|
275
|
-
end
|
276
|
-
end
|
277
|
-
end
|
278
|
-
end
|