activemerchant 1.100.0 → 1.101.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/lib/active_merchant/billing/check.rb +2 -6
- data/lib/active_merchant/billing/credit_card.rb +1 -3
- data/lib/active_merchant/billing/gateway.rb +4 -7
- data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -9
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +1 -3
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +4 -12
- data/lib/active_merchant/billing/gateways/axcessms.rb +1 -3
- data/lib/active_merchant/billing/gateways/balanced.rb +12 -11
- data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -6
- data/lib/active_merchant/billing/gateways/blue_snap.rb +1 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +7 -21
- data/lib/active_merchant/billing/gateways/cecabank.rb +1 -3
- data/lib/active_merchant/billing/gateways/checkout.rb +1 -3
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +9 -12
- data/lib/active_merchant/billing/gateways/credorax.rb +1 -1
- data/lib/active_merchant/billing/gateways/culqi.rb +6 -5
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +1 -3
- data/lib/active_merchant/billing/gateways/decidir.rb +1 -3
- data/lib/active_merchant/billing/gateways/ebanx.rb +1 -3
- data/lib/active_merchant/billing/gateways/elavon.rb +2 -6
- data/lib/active_merchant/billing/gateways/element.rb +1 -3
- data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -5
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +7 -6
- data/lib/active_merchant/billing/gateways/forte.rb +2 -6
- data/lib/active_merchant/billing/gateways/garanti.rb +1 -3
- data/lib/active_merchant/billing/gateways/global_collect.rb +1 -3
- data/lib/active_merchant/billing/gateways/hdfc.rb +1 -3
- data/lib/active_merchant/billing/gateways/hps.rb +6 -5
- data/lib/active_merchant/billing/gateways/inspire.rb +2 -6
- data/lib/active_merchant/billing/gateways/instapay.rb +1 -3
- data/lib/active_merchant/billing/gateways/iridium.rb +1 -3
- data/lib/active_merchant/billing/gateways/iveri.rb +7 -8
- data/lib/active_merchant/billing/gateways/jetpay.rb +3 -9
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +2 -6
- data/lib/active_merchant/billing/gateways/kushki.rb +7 -8
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +6 -5
- data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -3
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -3
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +1 -3
- data/lib/active_merchant/billing/gateways/mercury.rb +2 -6
- data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -12
- data/lib/active_merchant/billing/gateways/migs.rb +1 -3
- data/lib/active_merchant/billing/gateways/moneris.rb +1 -3
- data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -3
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +24 -9
- data/lib/active_merchant/billing/gateways/netbilling.rb +1 -3
- data/lib/active_merchant/billing/gateways/network_merchants.rb +1 -3
- data/lib/active_merchant/billing/gateways/opp.rb +12 -13
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -3
- data/lib/active_merchant/billing/gateways/orbital.rb +8 -11
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -3
- data/lib/active_merchant/billing/gateways/pagarme.rb +4 -12
- data/lib/active_merchant/billing/gateways/pago_facil.rb +1 -3
- data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -3
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -3
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +6 -5
- data/lib/active_merchant/billing/gateways/payflow.rb +2 -6
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +1 -3
- data/lib/active_merchant/billing/gateways/paymill.rb +1 -3
- data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/quickbooks.rb +104 -31
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +2 -6
- data/lib/active_merchant/billing/gateways/realex.rb +1 -3
- data/lib/active_merchant/billing/gateways/redsys.rb +17 -27
- data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -3
- data/lib/active_merchant/billing/gateways/sage_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/secure_net.rb +2 -6
- data/lib/active_merchant/billing/gateways/secure_pay.rb +4 -12
- data/lib/active_merchant/billing/gateways/smart_ps.rb +2 -6
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +2 -6
- data/lib/active_merchant/billing/gateways/stripe.rb +3 -9
- data/lib/active_merchant/billing/gateways/telr.rb +2 -6
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +6 -5
- data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -3
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -3
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +4 -12
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -9
- data/lib/active_merchant/billing/gateways/viaklix.rb +2 -6
- data/lib/active_merchant/billing/gateways/wepay.rb +2 -6
- data/lib/active_merchant/billing/gateways/wirecard.rb +2 -6
- data/lib/active_merchant/billing/gateways/worldpay.rb +5 -15
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +2 -6
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/ssl_verify.rb +1 -3
- metadata +2 -2
@@ -187,13 +187,9 @@ module ActiveMerchant
|
|
187
187
|
def add_invoice(post, options)
|
188
188
|
add_order_id(post, options)
|
189
189
|
|
190
|
-
if options[:billing_address]
|
191
|
-
post[:invoice_address] = map_address(options[:billing_address])
|
192
|
-
end
|
190
|
+
post[:invoice_address] = map_address(options[:billing_address]) if options[:billing_address]
|
193
191
|
|
194
|
-
if options[:shipping_address]
|
195
|
-
post[:shipping_address] = map_address(options[:shipping_address])
|
196
|
-
end
|
192
|
+
post[:shipping_address] = map_address(options[:shipping_address]) if options[:shipping_address]
|
197
193
|
|
198
194
|
[:metadata, :branding_id, :variables].each do |field|
|
199
195
|
post[field] = options[field] if options[field]
|
@@ -256,9 +256,7 @@ module ActiveMerchant
|
|
256
256
|
|
257
257
|
def add_merchant_details(xml, options)
|
258
258
|
xml.tag! 'merchantid', @options[:login]
|
259
|
-
if options[:account] || @options[:account]
|
260
|
-
xml.tag! 'account', (options[:account] || @options[:account])
|
261
|
-
end
|
259
|
+
xml.tag! 'account', (options[:account] || @options[:account]) if options[:account] || @options[:account]
|
262
260
|
end
|
263
261
|
|
264
262
|
def add_transaction_identifiers(xml, authorization, options)
|
@@ -320,9 +320,7 @@ module ActiveMerchant #:nodoc:
|
|
320
320
|
end
|
321
321
|
|
322
322
|
def add_threeds(data, options)
|
323
|
-
if options[:execute_threed] == true
|
324
|
-
data[:threeds] = {threeDSInfo: 'CardData'}
|
325
|
-
end
|
323
|
+
data[:threeds] = {threeDSInfo: 'CardData'} if options[:execute_threed] == true
|
326
324
|
end
|
327
325
|
|
328
326
|
def determine_3ds_action(threeds_hash)
|
@@ -446,13 +444,9 @@ module ActiveMerchant #:nodoc:
|
|
446
444
|
|
447
445
|
# Set moto flag only if explicitly requested via moto field
|
448
446
|
# Requires account configuration to be able to use
|
449
|
-
if options.dig(:moto) && options.dig(:metadata, :manual_entry)
|
450
|
-
xml.DS_MERCHANT_DIRECTPAYMENT 'moto'
|
451
|
-
end
|
447
|
+
xml.DS_MERCHANT_DIRECTPAYMENT 'moto' if options.dig(:moto) && options.dig(:metadata, :manual_entry)
|
452
448
|
|
453
|
-
if data[:threeds]
|
454
|
-
xml.DS_MERCHANT_EMV3DS data[:threeds].to_json
|
455
|
-
end
|
449
|
+
xml.DS_MERCHANT_EMV3DS data[:threeds].to_json if data[:threeds]
|
456
450
|
end
|
457
451
|
end
|
458
452
|
|
@@ -464,18 +458,7 @@ module ActiveMerchant #:nodoc:
|
|
464
458
|
xml = Nokogiri::XML(data)
|
465
459
|
code = xml.xpath('//RETORNOXML/CODIGO').text
|
466
460
|
|
467
|
-
if
|
468
|
-
vxml = Nokogiri::XML(data).remove_namespaces!.xpath("//Envelope/Body/#{action}Response/#{action}Return").inner_text
|
469
|
-
xml = Nokogiri::XML(vxml)
|
470
|
-
node = (action == 'iniciaPeticion' ? 'INFOTARJETA' : 'OPERACION')
|
471
|
-
op = xml.xpath("//RETORNOXML/#{node}")
|
472
|
-
op.children.each do |element|
|
473
|
-
params[element.name.downcase.to_sym] = element.text
|
474
|
-
end
|
475
|
-
message = response_text_3ds(xml, params)
|
476
|
-
options[:authorization] = build_authorization(params)
|
477
|
-
success = params.size > 0 && is_success_response?(params[:ds_response])
|
478
|
-
elsif code == '0'
|
461
|
+
if code == '0' && xml.xpath('//RETORNOXML/OPERACION').present?
|
479
462
|
op = xml.xpath('//RETORNOXML/OPERACION')
|
480
463
|
op.children.each do |element|
|
481
464
|
params[element.name.downcase.to_sym] = element.text
|
@@ -487,6 +470,17 @@ module ActiveMerchant #:nodoc:
|
|
487
470
|
else
|
488
471
|
message = 'Response failed validation check'
|
489
472
|
end
|
473
|
+
elsif ['iniciaPeticion', 'trataPeticion'].include?(action)
|
474
|
+
vxml = Nokogiri::XML(data).remove_namespaces!.xpath("//Envelope/Body/#{action}Response/#{action}Return").inner_text
|
475
|
+
xml = Nokogiri::XML(vxml)
|
476
|
+
node = (action == 'iniciaPeticion' ? 'INFOTARJETA' : 'OPERACION')
|
477
|
+
op = xml.xpath("//RETORNOXML/#{node}")
|
478
|
+
op.children.each do |element|
|
479
|
+
params[element.name.downcase.to_sym] = element.text
|
480
|
+
end
|
481
|
+
message = response_text_3ds(xml, params)
|
482
|
+
options[:authorization] = build_authorization(params)
|
483
|
+
success = params.size > 0 && is_success_response?(params[:ds_response])
|
490
484
|
else
|
491
485
|
# Some kind of programmer error with the request!
|
492
486
|
message = "#{code} ERROR"
|
@@ -599,13 +593,9 @@ module ActiveMerchant #:nodoc:
|
|
599
593
|
xml_signed_fields = data[:ds_amount] + data[:ds_order] + data[:ds_merchantcode] +
|
600
594
|
data[:ds_currency] + data[:ds_response]
|
601
595
|
|
602
|
-
if data[:ds_cardnumber]
|
603
|
-
xml_signed_fields += data[:ds_cardnumber]
|
604
|
-
end
|
596
|
+
xml_signed_fields += data[:ds_cardnumber] if data[:ds_cardnumber]
|
605
597
|
|
606
|
-
if data[:ds_emv3ds]
|
607
|
-
xml_signed_fields += data[:ds_emv3ds]
|
608
|
-
end
|
598
|
+
xml_signed_fields += data[:ds_emv3ds] if data[:ds_emv3ds]
|
609
599
|
|
610
600
|
xml_signed_fields + data[:ds_transactiontype] + data[:ds_securepayment]
|
611
601
|
end
|
@@ -245,9 +245,7 @@ module ActiveMerchant #:nodoc:
|
|
245
245
|
end
|
246
246
|
|
247
247
|
def error_code_from(response)
|
248
|
-
unless success_from(response)
|
249
|
-
response[:ex_err_code] || response[:err_code]
|
250
|
-
end
|
248
|
+
response[:ex_err_code] || response[:err_code] unless success_from(response)
|
251
249
|
end
|
252
250
|
|
253
251
|
def underscore(camel_cased_word)
|
@@ -403,9 +403,7 @@ module ActiveMerchant #:nodoc:
|
|
403
403
|
:VPSProtocol => @options.fetch(:protocol_version, '3.00')
|
404
404
|
)
|
405
405
|
|
406
|
-
|
407
|
-
parameters.update(:ReferrerID => application_id)
|
408
|
-
end
|
406
|
+
parameters.update(:ReferrerID => application_id) if application_id && (application_id != Gateway.application_id)
|
409
407
|
|
410
408
|
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
411
409
|
end
|
@@ -136,13 +136,9 @@ module ActiveMerchant #:nodoc:
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def add_customer_data(xml, options)
|
139
|
-
if options.has_key? :customer
|
140
|
-
xml.tag! 'CUSTOMERID', options[:customer]
|
141
|
-
end
|
139
|
+
xml.tag! 'CUSTOMERID', options[:customer] if options.has_key? :customer
|
142
140
|
|
143
|
-
if options.has_key? :ip
|
144
|
-
xml.tag! 'CUSTOMERIP', options[:ip]
|
145
|
-
end
|
141
|
+
xml.tag! 'CUSTOMERIP', options[:ip] if options.has_key? :ip
|
146
142
|
end
|
147
143
|
|
148
144
|
def add_address(xml, creditcard, options)
|
@@ -137,17 +137,11 @@ module ActiveMerchant #:nodoc:
|
|
137
137
|
post[:cust_id] = options[:customer] if Float(options[:customer]) rescue nil
|
138
138
|
end
|
139
139
|
|
140
|
-
if options.has_key? :ip
|
141
|
-
post[:customer_ip] = options[:ip]
|
142
|
-
end
|
140
|
+
post[:customer_ip] = options[:ip] if options.has_key? :ip
|
143
141
|
|
144
|
-
if options.has_key? :cardholder_authentication_value
|
145
|
-
post[:cardholder_authentication_value] = options[:cardholder_authentication_value]
|
146
|
-
end
|
142
|
+
post[:cardholder_authentication_value] = options[:cardholder_authentication_value] if options.has_key? :cardholder_authentication_value
|
147
143
|
|
148
|
-
if options.has_key? :authentication_indicator
|
149
|
-
post[:authentication_indicator] = options[:authentication_indicator]
|
150
|
-
end
|
144
|
+
post[:authentication_indicator] = options[:authentication_indicator] if options.has_key? :authentication_indicator
|
151
145
|
end
|
152
146
|
|
153
147
|
# x_duplicate_window won't be sent by default, because sending it changes the response.
|
@@ -184,9 +178,7 @@ module ActiveMerchant #:nodoc:
|
|
184
178
|
def message_from(results)
|
185
179
|
if results[:response_code] == DECLINED
|
186
180
|
return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
|
187
|
-
if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
188
|
-
return AVSResult.messages[results[:avs_result_code]]
|
189
|
-
end
|
181
|
+
return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
190
182
|
end
|
191
183
|
|
192
184
|
(results[:response_reason_text] ? results[:response_reason_text].chomp('.') : '')
|
@@ -129,13 +129,9 @@ module ActiveMerchant #:nodoc:
|
|
129
129
|
private
|
130
130
|
|
131
131
|
def add_customer_data(post, options)
|
132
|
-
if options.has_key? :email
|
133
|
-
post[:email] = options[:email]
|
134
|
-
end
|
132
|
+
post[:email] = options[:email] if options.has_key? :email
|
135
133
|
|
136
|
-
if options.has_key? :ip
|
137
|
-
post[:ipaddress] = options[:ip]
|
138
|
-
end
|
134
|
+
post[:ipaddress] = options[:ip] if options.has_key? :ip
|
139
135
|
end
|
140
136
|
|
141
137
|
def add_address(post, address, prefix='')
|
@@ -173,12 +173,8 @@ module ActiveMerchant #:nodoc:
|
|
173
173
|
doc.ip(options[:ip]) if options[:ip]
|
174
174
|
doc.description(options[:description]) if options[:description]
|
175
175
|
|
176
|
-
if options[:merchant_name_descriptor]
|
177
|
-
|
178
|
-
end
|
179
|
-
if options[:merchant_location_descriptor]
|
180
|
-
doc.merchant_location_descriptor(options[:merchant_location_descriptor])
|
181
|
-
end
|
176
|
+
doc.merchant_name_descriptor(options[:merchant_name_descriptor]) if options[:merchant_name_descriptor]
|
177
|
+
doc.merchant_location_descriptor(options[:merchant_location_descriptor]) if options[:merchant_location_descriptor]
|
182
178
|
end
|
183
179
|
|
184
180
|
def add_payment_method(doc, payment_method, options)
|
@@ -215,13 +215,9 @@ module ActiveMerchant #:nodoc:
|
|
215
215
|
# The /cards endpoint does not update other customer parameters.
|
216
216
|
r.process { commit(:post, "customers/#{CGI.escape(options[:customer])}/cards", params, options) }
|
217
217
|
|
218
|
-
if options[:set_default] and r.success? and !r.params['id'].blank?
|
219
|
-
post[:default_card] = r.params['id']
|
220
|
-
end
|
218
|
+
post[:default_card] = r.params['id'] if options[:set_default] and r.success? and !r.params['id'].blank?
|
221
219
|
|
222
|
-
if post.count > 0
|
223
|
-
r.process { update_customer(options[:customer], post) }
|
224
|
-
end
|
220
|
+
r.process { update_customer(options[:customer], post) } if post.count > 0
|
225
221
|
end
|
226
222
|
else
|
227
223
|
commit(:post, 'customers', post.merge(params), options)
|
@@ -410,9 +406,7 @@ module ActiveMerchant #:nodoc:
|
|
410
406
|
copy_when_present(level_three, [:shipping_amount], options)
|
411
407
|
copy_when_present(level_three, [:line_items], options)
|
412
408
|
|
413
|
-
unless level_three.empty?
|
414
|
-
post[:level3] = level_three
|
415
|
-
end
|
409
|
+
post[:level3] = level_three unless level_three.empty?
|
416
410
|
end
|
417
411
|
|
418
412
|
def add_expand_parameters(post, options)
|
@@ -146,9 +146,7 @@ module ActiveMerchant #:nodoc:
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def add_ref(doc, action, payment_method)
|
149
|
-
if ['capture', 'refund', 'void'].include?(action) || payment_method.is_a?(String)
|
150
|
-
doc.ref(split_authorization(payment_method)[0])
|
151
|
-
end
|
149
|
+
doc.ref(split_authorization(payment_method)[0]) if ['capture', 'refund', 'void'].include?(action) || payment_method.is_a?(String)
|
152
150
|
end
|
153
151
|
|
154
152
|
def add_authentication(doc)
|
@@ -251,9 +249,7 @@ module ActiveMerchant #:nodoc:
|
|
251
249
|
end
|
252
250
|
|
253
251
|
def error_code_from(succeeded, response)
|
254
|
-
unless succeeded
|
255
|
-
response[:code]
|
256
|
-
end
|
252
|
+
response[:code] unless succeeded
|
257
253
|
end
|
258
254
|
|
259
255
|
def cvv_result(parsed)
|
@@ -333,11 +333,12 @@ module ActiveMerchant #:nodoc:
|
|
333
333
|
def commit(action, request)
|
334
334
|
request = add_transaction_code_to_request(request, action)
|
335
335
|
|
336
|
-
raw_response =
|
337
|
-
|
338
|
-
|
339
|
-
e
|
340
|
-
|
336
|
+
raw_response =
|
337
|
+
begin
|
338
|
+
ssl_post(url, request, headers)
|
339
|
+
rescue ActiveMerchant::ResponseError => e
|
340
|
+
e.response.body
|
341
|
+
end
|
341
342
|
|
342
343
|
response = parse(raw_response)
|
343
344
|
|
@@ -68,9 +68,7 @@ module ActiveMerchant #:nodoc:
|
|
68
68
|
|
69
69
|
def capture(amount, authorization, options={})
|
70
70
|
identifier, original_amount = split_authorization(authorization)
|
71
|
-
if amount && (amount != original_amount)
|
72
|
-
raise ArgumentError.new("Partial capture is not supported, and #{amount.inspect} != #{original_amount.inspect}")
|
73
|
-
end
|
71
|
+
raise ArgumentError.new("Partial capture is not supported, and #{amount.inspect} != #{original_amount.inspect}") if amount && (amount != original_amount)
|
74
72
|
|
75
73
|
post = PostData.new
|
76
74
|
add_credentials(post)
|
@@ -416,9 +416,7 @@ module ActiveMerchant #:nodoc:
|
|
416
416
|
# symbol keys. Before sending our input to TCLink, we convert all our keys to strings and dump the symbol keys.
|
417
417
|
# We also remove any pairs with nil values, as these confuse TCLink.
|
418
418
|
parameters.keys.reverse_each do |key|
|
419
|
-
if parameters[key]
|
420
|
-
parameters[key.to_s] = parameters[key]
|
421
|
-
end
|
419
|
+
parameters[key.to_s] = parameters[key] if parameters[key]
|
422
420
|
parameters.delete(key)
|
423
421
|
end
|
424
422
|
end
|
@@ -1345,9 +1345,7 @@ module ActiveMerchant #:nodoc:
|
|
1345
1345
|
when payment_method[:method].kind_of?(ActiveMerchant::Billing::Check)
|
1346
1346
|
build_tag soap, :string, 'Account', payment_method[:method].account_number
|
1347
1347
|
build_tag soap, :string, 'Routing', payment_method[:method].routing_number
|
1348
|
-
unless payment_method[:method].account_type.nil?
|
1349
|
-
build_tag soap, :string, 'AccountType', payment_method[:method].account_type.capitalize
|
1350
|
-
end
|
1348
|
+
build_tag soap, :string, 'AccountType', payment_method[:method].account_type.capitalize unless payment_method[:method].account_type.nil?
|
1351
1349
|
build_tag soap, :string, 'DriversLicense', options[:drivers_license]
|
1352
1350
|
build_tag soap, :string, 'DriversLicenseState', options[:drivers_license_state]
|
1353
1351
|
build_tag soap, :string, 'RecordType', options[:record_type]
|
@@ -1434,9 +1432,7 @@ module ActiveMerchant #:nodoc:
|
|
1434
1432
|
def build_card_expiration(options)
|
1435
1433
|
month = options[:payment_method].month
|
1436
1434
|
year = options[:payment_method].year
|
1437
|
-
unless month.nil? || year.nil?
|
1438
|
-
"#{"%02d" % month}#{year.to_s[-2..-1]}"
|
1439
|
-
end
|
1435
|
+
"#{"%02d" % month}#{year.to_s[-2..-1]}" unless month.nil? || year.nil?
|
1440
1436
|
end
|
1441
1437
|
|
1442
1438
|
def build_check_data(soap, options)
|
@@ -1476,9 +1472,7 @@ module ActiveMerchant #:nodoc:
|
|
1476
1472
|
|
1477
1473
|
def build_billing_address(soap, options)
|
1478
1474
|
if options[:billing_address]
|
1479
|
-
if options[:billing_address][:name]
|
1480
|
-
options[:billing_address][:first_name], options[:billing_address][:last_name] = split_names(options[:billing_address][:name])
|
1481
|
-
end
|
1475
|
+
options[:billing_address][:first_name], options[:billing_address][:last_name] = split_names(options[:billing_address][:name]) if options[:billing_address][:name]
|
1482
1476
|
soap.BillingAddress 'xsi:type' => 'ns1:Address' do
|
1483
1477
|
ADDRESS_OPTIONS.each do |k, v|
|
1484
1478
|
build_tag soap, v[0], v[1], options[:billing_address][k]
|
@@ -1489,9 +1483,7 @@ module ActiveMerchant #:nodoc:
|
|
1489
1483
|
|
1490
1484
|
def build_shipping_address(soap, options)
|
1491
1485
|
if options[:shipping_address]
|
1492
|
-
if options[:shipping_address][:name]
|
1493
|
-
options[:shipping_address][:first_name], options[:shipping_address][:last_name] = split_names(options[:shipping_address][:name])
|
1494
|
-
end
|
1486
|
+
options[:shipping_address][:first_name], options[:shipping_address][:last_name] = split_names(options[:shipping_address][:name]) if options[:shipping_address][:name]
|
1495
1487
|
soap.ShippingAddress 'xsi:type' => 'ns1:Address' do
|
1496
1488
|
ADDRESS_OPTIONS.each do |k, v|
|
1497
1489
|
build_tag soap, v[0], v[1], options[:shipping_address][k]
|
@@ -153,13 +153,9 @@ module ActiveMerchant #:nodoc:
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
if options.has_key? :customer
|
157
|
-
post[:custid] = options[:customer]
|
158
|
-
end
|
156
|
+
post[:custid] = options[:customer] if options.has_key? :customer
|
159
157
|
|
160
|
-
if options.has_key? :ip
|
161
|
-
post[:ip] = options[:ip]
|
162
|
-
end
|
158
|
+
post[:ip] = options[:ip] if options.has_key? :ip
|
163
159
|
end
|
164
160
|
|
165
161
|
def add_address(post, payment, options)
|
@@ -252,9 +248,7 @@ module ActiveMerchant #:nodoc:
|
|
252
248
|
next
|
253
249
|
end
|
254
250
|
|
255
|
-
if key == :bill_amount
|
256
|
-
value = amount(value)
|
257
|
-
end
|
251
|
+
value = amount(value) if key == :bill_amount
|
258
252
|
|
259
253
|
post[key.to_s.delete('_')] = value
|
260
254
|
end
|
@@ -49,9 +49,7 @@ module ActiveMerchant #:nodoc:
|
|
49
49
|
# Make a credit to a card (Void can only be done from the virtual terminal)
|
50
50
|
# Viaklix does not support credits by reference. You must pass in the credit card
|
51
51
|
def credit(money, creditcard, options = {})
|
52
|
-
if creditcard.is_a?(String)
|
53
|
-
raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card'
|
54
|
-
end
|
52
|
+
raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card' if creditcard.is_a?(String)
|
55
53
|
|
56
54
|
form = {}
|
57
55
|
add_invoice(form, options)
|
@@ -109,9 +107,7 @@ module ActiveMerchant #:nodoc:
|
|
109
107
|
form[:card_number] = creditcard.number
|
110
108
|
form[:exp_date] = expdate(creditcard)
|
111
109
|
|
112
|
-
if creditcard.verification_value?
|
113
|
-
add_verification_value(form, creditcard)
|
114
|
-
end
|
110
|
+
add_verification_value(form, creditcard) if creditcard.verification_value?
|
115
111
|
|
116
112
|
form[:first_name] = creditcard.first_name.to_s.slice(0, 20)
|
117
113
|
form[:last_name] = creditcard.last_name.to_s.slice(0, 30)
|
@@ -48,9 +48,7 @@ module ActiveMerchant #:nodoc:
|
|
48
48
|
|
49
49
|
post = {}
|
50
50
|
post[:checkout_id] = checkout_id
|
51
|
-
|
52
|
-
post[:amount] = amount(money)
|
53
|
-
end
|
51
|
+
post[:amount] = amount(money) if money && (original_amount != amount(money))
|
54
52
|
commit('/checkout/capture', post, options)
|
55
53
|
end
|
56
54
|
|
@@ -66,9 +64,7 @@ module ActiveMerchant #:nodoc:
|
|
66
64
|
|
67
65
|
post = {}
|
68
66
|
post[:checkout_id] = checkout_id
|
69
|
-
|
70
|
-
post[:amount] = amount(money)
|
71
|
-
end
|
67
|
+
post[:amount] = amount(money) if money && (original_amount != amount(money))
|
72
68
|
post[:refund_reason] = (options[:description] || 'Refund')
|
73
69
|
post[:payer_email_message] = options[:payer_email_message] if options[:payer_email_message]
|
74
70
|
post[:payee_email_message] = options[:payee_email_message] if options[:payee_email_message]
|
@@ -290,9 +290,7 @@ module ActiveMerchant #:nodoc:
|
|
290
290
|
xml.tag! 'City', address[:city]
|
291
291
|
xml.tag! 'ZipCode', address[:zip]
|
292
292
|
|
293
|
-
if address[:state] =~ /[A-Za-z]{2}/ && address[:country] =~ /^(us|ca)$/i
|
294
|
-
xml.tag! 'State', address[:state].upcase
|
295
|
-
end
|
293
|
+
xml.tag! 'State', address[:state].upcase if address[:state] =~ /[A-Za-z]{2}/ && address[:country] =~ /^(us|ca)$/i
|
296
294
|
|
297
295
|
xml.tag! 'Country', address[:country]
|
298
296
|
xml.tag! 'Phone', address[:phone] if address[:phone] =~ VALID_PHONE_FORMAT
|
@@ -331,9 +329,7 @@ module ActiveMerchant #:nodoc:
|
|
331
329
|
status = nil
|
332
330
|
|
333
331
|
root.elements.to_a.each do |node|
|
334
|
-
if node.name =~ /FNC_CC_/
|
335
|
-
status = REXML::XPath.first(node, 'CC_TRANSACTION/PROCESSING_STATUS')
|
336
|
-
end
|
332
|
+
status = REXML::XPath.first(node, 'CC_TRANSACTION/PROCESSING_STATUS') if node.name =~ /FNC_CC_/
|
337
333
|
end
|
338
334
|
|
339
335
|
message = ''
|
@@ -203,12 +203,8 @@ module ActiveMerchant #:nodoc:
|
|
203
203
|
end
|
204
204
|
add_payment_method(xml, money, payment_method, options)
|
205
205
|
add_shopper(xml, options)
|
206
|
-
if options[:hcg_additional_data]
|
207
|
-
|
208
|
-
end
|
209
|
-
if options[:instalments]
|
210
|
-
add_instalments_data(xml, options)
|
211
|
-
end
|
206
|
+
add_hcg_additional_data(xml, options) if options[:hcg_additional_data]
|
207
|
+
add_instalments_data(xml, options) if options[:instalments]
|
212
208
|
add_moto_flag(xml, options) if options.dig(:metadata, :manual_entry)
|
213
209
|
add_additional_3ds_data(xml, options) if options[:execute_threed] && options[:three_ds_version] && options[:three_ds_version] =~ /^2/
|
214
210
|
add_3ds_exemption(xml, options) if options[:exemption_type]
|
@@ -278,9 +274,7 @@ module ActiveMerchant #:nodoc:
|
|
278
274
|
'exponent' => currency_exponent(currency)
|
279
275
|
}
|
280
276
|
|
281
|
-
if options[:debit_credit_indicator]
|
282
|
-
amount_hash['debitCreditIndicator'] = options[:debit_credit_indicator]
|
283
|
-
end
|
277
|
+
amount_hash['debitCreditIndicator'] = options[:debit_credit_indicator] if options[:debit_credit_indicator]
|
284
278
|
|
285
279
|
xml.tag! 'amount', amount_hash
|
286
280
|
end
|
@@ -572,15 +566,11 @@ module ActiveMerchant #:nodoc:
|
|
572
566
|
end
|
573
567
|
|
574
568
|
def error_code_from(success, raw)
|
575
|
-
unless success == 'SUCCESS'
|
576
|
-
raw[:iso8583_return_code_code] || raw[:error_code] || nil
|
577
|
-
end
|
569
|
+
raw[:iso8583_return_code_code] || raw[:error_code] || nil unless success == 'SUCCESS'
|
578
570
|
end
|
579
571
|
|
580
572
|
def required_status_message(raw, success_criteria)
|
581
|
-
if
|
582
|
-
"A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(" or ")} is required."
|
583
|
-
end
|
573
|
+
"A transaction status of #{success_criteria.collect { |c| "'#{c}'" }.join(" or ")} is required." if !success_criteria.include?(raw[:last_event])
|
584
574
|
end
|
585
575
|
|
586
576
|
def authorization_from(action, raw, options)
|