activemerchant 1.85.0 → 1.86.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +15 -3
  3. data/lib/active_merchant/billing/avs_result.rb +12 -12
  4. data/lib/active_merchant/billing/compatibility.rb +1 -2
  5. data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
  6. data/lib/active_merchant/billing/gateways/authorize_net.rb +12 -0
  7. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -2
  8. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +45 -22
  9. data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
  10. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -6
  11. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +0 -1
  12. data/lib/active_merchant/billing/gateways/blue_pay.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/braintree_blue.rb +6 -4
  14. data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/card_connect.rb +6 -6
  16. data/lib/active_merchant/billing/gateways/card_save.rb +5 -6
  17. data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -4
  18. data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
  19. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/checkout.rb +8 -8
  21. data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/creditcall.rb +3 -3
  23. data/lib/active_merchant/billing/gateways/credorax.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/cyber_source.rb +5 -5
  26. data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
  27. data/lib/active_merchant/billing/gateways/elavon.rb +3 -5
  28. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/exact.rb +0 -1
  30. data/lib/active_merchant/billing/gateways/federated_canada.rb +0 -1
  31. data/lib/active_merchant/billing/gateways/finansbank.rb +0 -1
  32. data/lib/active_merchant/billing/gateways/first_giving.rb +0 -1
  33. data/lib/active_merchant/billing/gateways/first_pay.rb +3 -3
  34. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  35. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +6 -6
  36. data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
  37. data/lib/active_merchant/billing/gateways/global_collect.rb +21 -6
  38. data/lib/active_merchant/billing/gateways/hdfc.rb +0 -1
  39. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/inspire.rb +0 -1
  41. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  42. data/lib/active_merchant/billing/gateways/itransact.rb +0 -1
  43. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
  46. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  47. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -1
  48. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  49. data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
  50. data/lib/active_merchant/billing/gateways/migs.rb +5 -5
  51. data/lib/active_merchant/billing/gateways/modern_payments.rb +0 -1
  52. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +0 -1
  53. data/lib/active_merchant/billing/gateways/money_movers.rb +0 -1
  54. data/lib/active_merchant/billing/gateways/mundipagg.rb +4 -4
  55. data/lib/active_merchant/billing/gateways/nab_transact.rb +8 -8
  56. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
  57. data/lib/active_merchant/billing/gateways/netaxept.rb +0 -1
  58. data/lib/active_merchant/billing/gateways/netbanx.rb +4 -3
  59. data/lib/active_merchant/billing/gateways/netpay.rb +0 -1
  60. data/lib/active_merchant/billing/gateways/network_merchants.rb +0 -1
  61. data/lib/active_merchant/billing/gateways/omise.rb +1 -1
  62. data/lib/active_merchant/billing/gateways/opp.rb +0 -1
  63. data/lib/active_merchant/billing/gateways/optimal_payment.rb +20 -20
  64. data/lib/active_merchant/billing/gateways/orbital.rb +1 -1
  65. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/pagarme.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -1
  70. data/lib/active_merchant/billing/gateways/payeezy.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/payex.rb +2 -3
  72. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +5 -1
  73. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
  74. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/payflow_uk.rb +0 -1
  76. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/paymentez.rb +4 -4
  78. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  79. data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
  80. data/lib/active_merchant/billing/gateways/psl_card.rb +6 -6
  81. data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -2
  82. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  83. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +7 -8
  84. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  85. data/lib/active_merchant/billing/gateways/s5.rb +1 -1
  86. data/lib/active_merchant/billing/gateways/sage_pay.rb +5 -5
  87. data/lib/active_merchant/billing/gateways/sallie_mae.rb +0 -1
  88. data/lib/active_merchant/billing/gateways/secure_pay.rb +0 -1
  89. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -1
  90. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -1
  91. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -5
  92. data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
  93. data/lib/active_merchant/billing/gateways/stripe.rb +1 -1
  94. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -8
  95. data/lib/active_merchant/billing/gateways/telr.rb +2 -2
  96. data/lib/active_merchant/billing/gateways/transax.rb +4 -5
  97. data/lib/active_merchant/billing/gateways/transnational.rb +0 -1
  98. data/lib/active_merchant/billing/gateways/trexle.rb +6 -6
  99. data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -5
  100. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -2
  103. data/lib/active_merchant/billing/gateways/world_net.rb +3 -3
  104. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +15 -15
  105. data/lib/active_merchant/connection.rb +2 -2
  106. data/lib/active_merchant/network_connection_retries.rb +1 -1
  107. data/lib/active_merchant/posts_data.rb +2 -2
  108. data/lib/active_merchant/version.rb +1 -1
  109. data/lib/activemerchant.rb +1 -1
  110. data/lib/support/gateway_support.rb +0 -1
  111. metadata +2 -2
@@ -445,4 +445,3 @@ module ActiveMerchant #:nodoc:
445
445
  end
446
446
  end
447
447
  end
448
-
@@ -395,7 +395,7 @@ module ActiveMerchant #:nodoc:
395
395
 
396
396
  def lookup_country_code(code)
397
397
  country = Country.find(code) rescue nil
398
- country && country.code(:alpha3)
398
+ country&.code(:alpha3)
399
399
  end
400
400
  end
401
401
  end
@@ -430,7 +430,7 @@ module ActiveMerchant #:nodoc:
430
430
 
431
431
  def lookup_country_code(code)
432
432
  country = Country.find(code) rescue nil
433
- country && country.code(:alpha3)
433
+ country&.code(:alpha3)
434
434
  end
435
435
  end
436
436
  end
@@ -340,7 +340,7 @@ module ActiveMerchant #:nodoc:
340
340
  :terminaltype => options[:terminaltype],
341
341
  :ip => options[:ip],
342
342
  :reference_number => options[:reference_number],
343
- :recurring => options[:recurring] || 'NO', #DO NOT USE if you are using the periodic billing option.
343
+ :recurring => options[:recurring] || 'NO', # DO NOT USE if you are using the periodic billing option.
344
344
  :tdate => options[:tdate]
345
345
  },
346
346
  :orderoptions => {
@@ -434,9 +434,9 @@ module ActiveMerchant #:nodoc:
434
434
  response = {:message => 'Global Error Receipt', :complete => false}
435
435
 
436
436
  xml = REXML::Document.new("<response>#{xml}</response>")
437
- xml.root.elements.each do |node|
437
+ xml.root&.elements&.each do |node|
438
438
  response[node.name.downcase.sub(/^r_/, '').to_sym] = normalize(node.text)
439
- end unless xml.root.nil?
439
+ end
440
440
 
441
441
  response
442
442
  end
@@ -284,7 +284,7 @@ module ActiveMerchant #:nodoc:
284
284
  doc.cardholderAuthentication do
285
285
  doc.authenticationValue(payment_method.payment_cryptogram)
286
286
  end
287
- elsif options[:order_source] && options[:order_source].start_with?('3ds')
287
+ elsif options[:order_source]&.start_with?('3ds')
288
288
  doc.cardholderAuthentication do
289
289
  doc.authenticationValue(options[:cavv]) if options[:cavv]
290
290
  doc.authenticationTransactionId(options[:xid]) if options[:xid]
@@ -186,6 +186,12 @@ module ActiveMerchant #:nodoc:
186
186
 
187
187
  def parse(body)
188
188
  JSON.parse(body)
189
+ rescue JSON::ParserError
190
+ {
191
+ 'status' => 'error',
192
+ 'status_detail' => 'json_parse_error',
193
+ 'message' => "A non-JSON response was received from Mercado Pago where one was expected. The raw response was:\n\n#{body}"
194
+ }
189
195
  end
190
196
 
191
197
  def commit(action, path, parameters)
@@ -207,7 +213,7 @@ module ActiveMerchant #:nodoc:
207
213
 
208
214
  def success_from(action, response)
209
215
  if action == 'refund'
210
- response['error'].nil?
216
+ response['status'] != 404 && response['error'].nil?
211
217
  else
212
218
  ['active', 'approved', 'authorized', 'cancelled', 'in_process'].include?(response['status'])
213
219
  end
@@ -111,4 +111,3 @@ module ActiveMerchant #:nodoc:
111
111
  end
112
112
  end
113
113
  end
114
-
@@ -212,7 +212,7 @@ module ActiveMerchant #:nodoc:
212
212
  # Track 1 and 2 have identical end sentinels (ETX) of '?'
213
213
  # Tracks may or may not have checksum (LRC) after the ETX
214
214
  # If the track has no STX or is corrupt, we send it as track 1, to let Mercury
215
- #handle with the validation error as it sees fit.
215
+ # handle with the validation error as it sees fit.
216
216
  # Track 2 requires having the STX and ETX stripped. Track 1 does not.
217
217
  # Max-length track 1s require having the STX and ETX stripped. Max is 79 bytes including LRC.
218
218
  is_track_2 = credit_card.track_data[0] == ';'
@@ -314,11 +314,11 @@ module ActiveMerchant #:nodoc:
314
314
  end
315
315
 
316
316
  def calculate_secure_hash(post, secure_hash)
317
- input = post
318
- .reject { |k| %i[SecureHash SecureHashType].include?(k) }
319
- .sort
320
- .map { |(k, v)| "vpc_#{k}=#{v}" }
321
- .join('&')
317
+ input = post.
318
+ reject { |k| %i[SecureHash SecureHashType].include?(k) }.
319
+ sort.
320
+ map { |(k, v)| "vpc_#{k}=#{v}" }.
321
+ join('&')
322
322
  OpenSSL::HMAC.hexdigest('SHA256', [secure_hash].pack('H*'), input).upcase
323
323
  end
324
324
  end
@@ -35,4 +35,3 @@ module ActiveMerchant #:nodoc:
35
35
  end
36
36
  end
37
37
  end
38
-
@@ -215,4 +215,3 @@ module ActiveMerchant #:nodoc:
215
215
  end
216
216
  end
217
217
  end
218
-
@@ -149,4 +149,3 @@ module ActiveMerchant #:nodoc:
149
149
  end
150
150
  end
151
151
  end
152
-
@@ -89,10 +89,10 @@ module ActiveMerchant #:nodoc:
89
89
  end
90
90
 
91
91
  def scrub(transcript)
92
- transcript
93
- .gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]')
94
- .gsub(%r(("cvv\\":\\")\d*), '\1[FILTERED]')
95
- .gsub(%r((card\\":{\\"number\\":\\")\d*), '\1[FILTERED]')
92
+ transcript.
93
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
94
+ gsub(%r(("cvv\\":\\")\d*), '\1[FILTERED]').
95
+ gsub(%r((card\\":{\\"number\\":\\")\d*), '\1[FILTERED]')
96
96
  end
97
97
 
98
98
  private
@@ -23,14 +23,14 @@ module ActiveMerchant #:nodoc:
23
23
  self.money_format = :cents
24
24
  self.default_currency = 'AUD'
25
25
 
26
- #Transactions currently accepted by NAB Transact XML API
26
+ # Transactions currently accepted by NAB Transact XML API
27
27
  TRANSACTIONS = {
28
- :purchase => 0, #Standard Payment
29
- :refund => 4, #Refund
30
- :void => 6, #Client Reversal (Void)
31
- :unmatched_refund => 666, #Unmatched Refund
32
- :authorization => 10, #Preauthorise
33
- :capture => 11 #Preauthorise Complete (Advice)
28
+ :purchase => 0, # Standard Payment
29
+ :refund => 4, # Refund
30
+ :void => 6, # Client Reversal (Void)
31
+ :unmatched_refund => 666, # Unmatched Refund
32
+ :authorization => 10, # Preauthorise
33
+ :capture => 11 # Preauthorise Complete (Advice)
34
34
  }
35
35
 
36
36
  PERIODIC_TYPES = {
@@ -134,7 +134,7 @@ module ActiveMerchant #:nodoc:
134
134
  xml.target!
135
135
  end
136
136
 
137
- #Generate payment request XML
137
+ # Generate payment request XML
138
138
  # - API is set to allow multiple Txn's but currently only allows one
139
139
  # - txnSource = 23 - (XML)
140
140
  def build_request(action, body)
@@ -131,7 +131,7 @@ module ActiveMerchant
131
131
  # format for a command.
132
132
  def expiry(credit_card)
133
133
  month = format(credit_card.month, :two_digits)
134
- year = format(credit_card.year , :two_digits)
134
+ year = format(credit_card.year, :two_digits)
135
135
  "#{month}/#{year}"
136
136
  end
137
137
 
@@ -178,4 +178,3 @@ module ActiveMerchant #:nodoc:
178
178
  end
179
179
  end
180
180
  end
181
-
@@ -165,9 +165,10 @@ module ActiveMerchant #:nodoc:
165
165
  return {} if address.nil?
166
166
  country = Country.find(address[:country]) if address[:country]
167
167
  mapped = {
168
- :street => address[:address1],
169
- :city => address[:city],
170
- :zip => address[:zip],
168
+ :street => address[:address1],
169
+ :city => address[:city],
170
+ :zip => address[:zip],
171
+ :state => address[:state],
171
172
  }
172
173
  mapped.merge!({:country => country.code(:alpha2).value}) unless country.blank?
173
174
 
@@ -110,7 +110,6 @@ module ActiveMerchant #:nodoc:
110
110
  add_order_id(post, order_id_from(authorization))
111
111
  add_amount(post, money, options)
112
112
 
113
- #commit('Refund', post, options)
114
113
  commit('Credit', post, options)
115
114
  end
116
115
 
@@ -239,4 +239,3 @@ module ActiveMerchant #:nodoc:
239
239
  end
240
240
  end
241
241
  end
242
-
@@ -19,7 +19,7 @@ module ActiveMerchant #:nodoc:
19
19
  self.default_currency = 'THB'
20
20
  self.money_format = :cents
21
21
 
22
- #Country supported by Omise
22
+ # Country supported by Omise
23
23
  # * Thailand
24
24
  self.supported_countries = %w( TH JP )
25
25
 
@@ -244,7 +244,6 @@ module ActiveMerchant #:nodoc:
244
244
 
245
245
  def add_payment_method(post, payment, options)
246
246
  if options[:registrationId]
247
- #post[:recurringType] = 'REPEATED'
248
247
  post[:card] = {
249
248
  cvv: payment.verification_value,
250
249
  }
@@ -99,11 +99,11 @@ module ActiveMerchant #:nodoc:
99
99
  cc_stored_data_request(money, post)
100
100
  when 'ccAuthorizeReversal'
101
101
  cc_auth_reversal_request(post)
102
- #when 'ccCancelSettle', 'ccCancelCredit', 'ccCancelPayment'
102
+ # when 'ccCancelSettle', 'ccCancelCredit', 'ccCancelPayment'
103
103
  # cc_cancel_request(money, post)
104
- #when 'ccPayment'
104
+ # when 'ccPayment'
105
105
  # cc_payment_request(money, post)
106
- #when 'ccAuthenticate'
106
+ # when 'ccAuthenticate'
107
107
  # cc_authenticate_request(money, post)
108
108
  else
109
109
  raise 'Unknown Action'
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
 
179
179
  def get_text_from_document(document, node)
180
180
  node = REXML::XPath.first(document, node)
181
- node && node.text
181
+ node&.text
182
182
  end
183
183
 
184
184
  def cc_auth_request(money, opts)
@@ -255,27 +255,27 @@ module ActiveMerchant #:nodoc:
255
255
 
256
256
  def build_merchant_account(xml)
257
257
  xml.tag! 'merchantAccount' do
258
- xml.tag! 'accountNum' , @options[:account_number]
259
- xml.tag! 'storeID' , @options[:store_id]
260
- xml.tag! 'storePwd' , @options[:password]
258
+ xml.tag! 'accountNum', @options[:account_number]
259
+ xml.tag! 'storeID', @options[:store_id]
260
+ xml.tag! 'storePwd', @options[:password]
261
261
  end
262
262
  end
263
263
 
264
264
  def build_card(xml, opts)
265
265
  xml.tag! 'card' do
266
- xml.tag! 'cardNum' , @credit_card.number
266
+ xml.tag! 'cardNum', @credit_card.number
267
267
  xml.tag! 'cardExpiry' do
268
- xml.tag! 'month' , @credit_card.month
269
- xml.tag! 'year' , @credit_card.year
268
+ xml.tag! 'month', @credit_card.month
269
+ xml.tag! 'year', @credit_card.year
270
270
  end
271
271
  if brand = card_type(@credit_card.brand)
272
- xml.tag! 'cardType' , brand
272
+ xml.tag! 'cardType', brand
273
273
  end
274
274
  if @credit_card.verification_value?
275
- xml.tag! 'cvdIndicator' , '1' # Value Provided
276
- xml.tag! 'cvd' , @credit_card.verification_value
275
+ xml.tag! 'cvdIndicator', '1' # Value Provided
276
+ xml.tag! 'cvd', @credit_card.verification_value
277
277
  else
278
- xml.tag! 'cvdIndicator' , '0'
278
+ xml.tag! 'cvdIndicator', '0'
279
279
  end
280
280
  end
281
281
  end
@@ -299,18 +299,18 @@ module ActiveMerchant #:nodoc:
299
299
  if addr[:name]
300
300
  first_name, last_name = split_names(addr[:name])
301
301
  xml.tag! 'firstName', first_name
302
- xml.tag! 'lastName' , last_name
302
+ xml.tag! 'lastName', last_name
303
303
  end
304
- xml.tag! 'street' , addr[:address1] if addr[:address1].present?
304
+ xml.tag! 'street', addr[:address1] if addr[:address1].present?
305
305
  xml.tag! 'street2', addr[:address2] if addr[:address2].present?
306
- xml.tag! 'city' , addr[:city] if addr[:city].present?
306
+ xml.tag! 'city', addr[:city] if addr[:city].present?
307
307
  if addr[:state].present?
308
308
  state_tag = %w(US CA).include?(addr[:country]) ? 'state' : 'region'
309
309
  xml.tag! state_tag, addr[:state]
310
310
  end
311
- xml.tag! 'country', addr[:country] if addr[:country].present?
312
- xml.tag! 'zip' , addr[:zip] if addr[:zip].present?
313
- xml.tag! 'phone' , addr[:phone] if addr[:phone].present?
311
+ xml.tag! 'country', addr[:country] if addr[:country].present?
312
+ xml.tag! 'zip', addr[:zip] if addr[:zip].present?
313
+ xml.tag! 'phone', addr[:phone] if addr[:phone].present?
314
314
  end
315
315
 
316
316
  def card_type(key)
@@ -396,7 +396,7 @@ module ActiveMerchant #:nodoc:
396
396
  xml.tag! :AVSphoneNum, (address[:phone] ? address[:phone].scan(/\d/).join.to_s[0..13] : nil)
397
397
  end
398
398
 
399
- xml.tag! :AVSname, ((creditcard && creditcard.name) ? creditcard.name[0..29] : nil)
399
+ xml.tag! :AVSname, (creditcard&.name ? creditcard.name[0..29] : nil)
400
400
  xml.tag! :AVScountryCode, (avs_supported ? byte_limit(format_address_field(address[:country]), 2) : '')
401
401
 
402
402
  # Needs to come after AVScountryCode
@@ -204,4 +204,3 @@ module ActiveMerchant #:nodoc:
204
204
  end
205
205
  end
206
206
  end
207
-
@@ -181,7 +181,7 @@ module ActiveMerchant #:nodoc:
181
181
  end
182
182
 
183
183
  def json_error(raw_response)
184
- msg = 'Resposta inválida retornada pela API do Pagar.me. Por favor entre em contato com suporte@pagar.me se você continuar recebendo essa mensagem.'
184
+ msg = 'Resposta inválida retornada pela API do Pagar.me. Por favor entre em contato com suporte@pagar.me se você continuar recebendo essa mensagem.'
185
185
  msg += " (A resposta retornada pela API foi #{raw_response.inspect})"
186
186
  {
187
187
  'errors' => [{
@@ -274,4 +274,4 @@ module ActiveMerchant #:nodoc:
274
274
  end
275
275
  end
276
276
  end
277
- end
277
+ end
@@ -173,7 +173,7 @@ module ActiveMerchant #:nodoc:
173
173
  def message_from(response)
174
174
  return response['response']['message'] if response['response']
175
175
 
176
- response['errors'].inject(''){ |message,error| error['message'] + '|' + message } if response['errors']
176
+ response['errors']&.inject(''){ |message,error| error['message'] + '|' + message }
177
177
  end
178
178
 
179
179
  def authorization_from(response)
@@ -109,4 +109,3 @@ module ActiveMerchant #:nodoc:
109
109
  end
110
110
  end
111
111
  end
112
-
@@ -374,7 +374,7 @@ module ActiveMerchant
374
374
  response['transaction_id'],
375
375
  response['transaction_tag'],
376
376
  params[:method],
377
- (response['amount'] && response['amount'].to_i)
377
+ response['amount']&.to_i
378
378
  ].join('|')
379
379
  end
380
380
  end
@@ -363,7 +363,7 @@ module ActiveMerchant #:nodoc:
363
363
 
364
364
  doc = Nokogiri::XML(body)
365
365
 
366
- doc.root.xpath('*').each do |node|
366
+ doc.root&.xpath('*')&.each do |node|
367
367
  if (node.elements.size == 0)
368
368
  response[node.name.downcase.to_sym] = node.text
369
369
  else
@@ -372,7 +372,7 @@ module ActiveMerchant #:nodoc:
372
372
  response[name.to_sym] = childnode.text
373
373
  end
374
374
  end
375
- end unless doc.root.nil?
375
+ end
376
376
 
377
377
  response
378
378
  end
@@ -408,4 +408,3 @@ module ActiveMerchant #:nodoc:
408
408
  end
409
409
  end
410
410
  end
411
-
@@ -22,6 +22,10 @@ module ActiveMerchant #:nodoc:
22
22
  address['country']
23
23
  end
24
24
 
25
+ def phone
26
+ @params['phone']
27
+ end
28
+
25
29
  def address
26
30
  { 'name' => @params['shiptoname'] || full_name,
27
31
  'company' => nil,
@@ -31,7 +35,7 @@ module ActiveMerchant #:nodoc:
31
35
  'state' => @params['state'],
32
36
  'country' => @params['country'],
33
37
  'zip' => @params['zip'],
34
- 'phone' => nil
38
+ 'phone' => phone,
35
39
  }
36
40
  end
37
41
  end
@@ -4,10 +4,10 @@ module ActiveMerchant #:nodoc:
4
4
  def profile_id
5
5
  @params['profile_id']
6
6
  end
7
-
7
+
8
8
  def payment_history
9
9
  @payment_history ||= @params['rp_payment_result'].collect(&:stringify_keys) rescue []
10
10
  end
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -12,4 +12,3 @@ module ActiveMerchant #:nodoc:
12
12
  end
13
13
  end
14
14
  end
15
-