activemerchant 1.85.0 → 1.86.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.
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
@@ -1,23 +1,22 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class CardSaveGateway < IridiumGateway
4
- #CardSave lets you handle failovers on payments by providing 3 gateways in case one happens to be down
5
- #URLS = ['https://gw1.cardsaveonlinepayments.com:4430/','https://gw2.cardsaveonlinepayments.com:4430/','https://gw3.cardsaveonlinepayments.com:4430/']
6
-
4
+ # CardSave lets you handle failovers on payments by providing 3 gateways in case one happens to be down
5
+ # URLS = ['https://gw1.cardsaveonlinepayments.com:4430/','https://gw2.cardsaveonlinepayments.com:4430/','https://gw3.cardsaveonlinepayments.com:4430/']
6
+
7
7
  self.money_format = :cents
8
8
  self.default_currency = 'GBP'
9
9
  self.supported_cardtypes = [ :visa, :maestro, :master, :american_express, :jcb ]
10
10
  self.supported_countries = [ 'GB' ]
11
11
  self.homepage_url = 'http://www.cardsave.net/'
12
12
  self.display_name = 'CardSave'
13
-
13
+
14
14
  def initialize(options={})
15
15
  super
16
16
  @test_url = 'https://gw1.cardsaveonlinepayments.com:4430/'
17
17
  @live_url = 'https://gw1.cardsaveonlinepayments.com:4430/'
18
18
  end
19
-
19
+
20
20
  end
21
21
  end
22
22
  end
23
-
@@ -99,10 +99,10 @@ module ActiveMerchant #:nodoc:
99
99
  end
100
100
 
101
101
  def scrub(transcript)
102
- transcript
103
- .gsub(%r{(authentication\.[^=]+=)[^&]+}, '\1[FILTERED]')
104
- .gsub(%r{(card\.number=)\d+}, '\1[FILTERED]')
105
- .gsub(%r{(cvv=)\d{3,4}}, '\1[FILTERED]\2')
102
+ transcript.
103
+ gsub(%r{(authentication\.[^=]+=)[^&]+}, '\1[FILTERED]').
104
+ gsub(%r{(card\.number=)\d+}, '\1[FILTERED]').
105
+ gsub(%r{(cvv=)\d{3,4}}, '\1[FILTERED]\2')
106
106
  end
107
107
 
108
108
  private
@@ -60,10 +60,10 @@ module ActiveMerchant #:nodoc:
60
60
  end
61
61
 
62
62
  def scrub(transcript)
63
- transcript
64
- .gsub(%r{(password=)[^&]+}, '\1[FILTERED]')
65
- .gsub(%r{(cardno=)[^&]+}, '\1[FILTERED]')
66
- .gsub(%r{(cid=)[^&]+}, '\1[FILTERED]')
63
+ transcript.
64
+ gsub(%r{(password=)[^&]+}, '\1[FILTERED]').
65
+ gsub(%r{(cardno=)[^&]+}, '\1[FILTERED]').
66
+ gsub(%r{(cid=)[^&]+}, '\1[FILTERED]')
67
67
  end
68
68
 
69
69
  private
@@ -19,7 +19,7 @@ module ActiveMerchant #:nodoc:
19
19
  CECA_UI_LESS_LANGUAGE = 'XML'
20
20
  CECA_UI_LESS_LANGUAGE_REFUND = '1'
21
21
  CECA_UI_LESS_REFUND_PAGE = 'anulacion_xml'
22
- CECA_ACTION_REFUND = 'tpvanularparcialmente' #use partial refund's URL to avoid time frame limitations and decision logic on client side
22
+ CECA_ACTION_REFUND = 'tpvanularparcialmente' # use partial refund's URL to avoid time frame limitations and decision logic on client side
23
23
  CECA_ACTION_PURCHASE = 'tpv'
24
24
  CECA_CURRENCIES_DICTIONARY = {'EUR' => 978, 'USD' => 840, 'GBP' => 826}
25
25
 
@@ -125,13 +125,13 @@ module ActiveMerchant #:nodoc:
125
125
 
126
126
  def add_shipping_info(xml, options)
127
127
  if options[:shipping_address]
128
- xml.ship_address_ options[:shipping_address][:address1]
129
- xml.ship_address2_ options[:shipping_address][:address2]
130
- xml.ship_city_ options[:shipping_address][:city]
131
- xml.ship_state_ options[:shipping_address][:state]
132
- xml.ship_postal_ options[:shipping_address][:zip]
133
- xml.ship_country_ options[:shipping_address][:country]
134
- xml.ship_phone_ options[:shipping_address][:phone]
128
+ xml.ship_address_ options[:shipping_address][:address1]
129
+ xml.ship_address2_ options[:shipping_address][:address2]
130
+ xml.ship_city_ options[:shipping_address][:city]
131
+ xml.ship_state_ options[:shipping_address][:state]
132
+ xml.ship_postal_ options[:shipping_address][:zip]
133
+ xml.ship_country_ options[:shipping_address][:country]
134
+ xml.ship_phone_ options[:shipping_address][:phone]
135
135
  end
136
136
  end
137
137
 
@@ -144,7 +144,7 @@ module ActiveMerchant #:nodoc:
144
144
  end
145
145
 
146
146
  def add_other_fields(xml, options)
147
- xml.bill_email_ options[:email]
147
+ xml.bill_email_ options[:email]
148
148
  xml.bill_customerip_ options[:ip]
149
149
  xml.merchantcustomerid_ options[:customer]
150
150
  xml.descriptor_name options[:descriptor_name]
@@ -20,4 +20,3 @@ module ActiveMerchant
20
20
  end
21
21
  end
22
22
  end
23
-
@@ -14,14 +14,14 @@ module ActiveMerchant #:nodoc:
14
14
 
15
15
  self.homepage_url = 'https://www.creditcall.com'
16
16
  self.display_name = 'Creditcall'
17
-
17
+
18
18
  CVV_CODE = {
19
19
  'matched' => 'M',
20
20
  'notmatched' => 'N',
21
21
  'notchecked' => 'P',
22
22
  'partialmatch' => 'N'
23
23
  }
24
-
24
+
25
25
  AVS_CODE = {
26
26
  'matched;matched' => 'D',
27
27
  'matched;notchecked' =>'B',
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
  end
54
54
 
55
55
  merged_params = multi_response.responses.map(&:params).reduce({}, :merge)
56
-
56
+
57
57
  Response.new(
58
58
  multi_response.primary_response.success?,
59
59
  multi_response.primary_response.message,
@@ -185,7 +185,7 @@ module ActiveMerchant #:nodoc:
185
185
  add_email(post, options)
186
186
  add_echo(post, options)
187
187
  add_transaction_type(post, options)
188
-
188
+
189
189
  commit(:credit, post)
190
190
  end
191
191
 
@@ -242,7 +242,7 @@ module ActiveMerchant #:nodoc:
242
242
  end
243
243
 
244
244
  def message_from(response)
245
- response['errorDescription'] || (response['terminalDisp'].strip if response['terminalDisp'])
245
+ response['errorDescription'] || response['terminalDisp']&.strip
246
246
  end
247
247
 
248
248
  def authorization_from(response)
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
 
49
49
  @@response_codes = {
50
50
  :r100 => 'Successful transaction',
51
- :r101 => 'Request is missing one or more required fields' ,
51
+ :r101 => 'Request is missing one or more required fields',
52
52
  :r102 => 'One or more fields contains invalid data',
53
53
  :r150 => 'General failure',
54
54
  :r151 => 'The request was received but a server time-out occurred',
@@ -432,9 +432,9 @@ module ActiveMerchant #:nodoc:
432
432
  def add_merchant_data(xml, options)
433
433
  xml.tag! 'merchantID', @options[:login]
434
434
  xml.tag! 'merchantReferenceCode', options[:order_id] || generate_unique_id
435
- xml.tag! 'clientLibrary' ,'Ruby Active Merchant'
435
+ xml.tag! 'clientLibrary','Ruby Active Merchant'
436
436
  xml.tag! 'clientLibraryVersion', VERSION
437
- xml.tag! 'clientEnvironment' , RUBY_PLATFORM
437
+ xml.tag! 'clientEnvironment', RUBY_PLATFORM
438
438
  end
439
439
 
440
440
  def add_purchase_data(xml, money = 0, include_grand_total = false, options={})
@@ -663,7 +663,7 @@ module ActiveMerchant #:nodoc:
663
663
  end
664
664
 
665
665
  def add_validate_pinless_debit_service(xml)
666
- xml.tag!'pinlessDebitValidateService', {'run' => 'true'}
666
+ xml.tag! 'pinlessDebitValidateService', {'run' => 'true'}
667
667
  end
668
668
 
669
669
  def add_threeds_services(xml, options)
@@ -677,7 +677,7 @@ module ActiveMerchant #:nodoc:
677
677
 
678
678
  def lookup_country_code(country_field)
679
679
  country_code = Country.find(country_field) rescue nil
680
- country_code.code(:alpha2) if country_code
680
+ country_code&.code(:alpha2)
681
681
  end
682
682
 
683
683
  # Where we actually build the full SOAP request using builder
@@ -200,15 +200,15 @@ module ActiveMerchant #:nodoc:
200
200
  CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber )
201
201
 
202
202
  ACTIONS = {
203
- :credit_card_authorize => CREDIT_CARD_FIELDS,
204
- :credit_card_charge => CREDIT_CARD_FIELDS,
205
- :credit_card_voice_authorize => CREDIT_CARD_FIELDS,
206
- :credit_card_capture => CREDIT_CARD_FIELDS,
207
- :credit_card_credit => CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
208
- :credit_card_refund => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
209
- :void_transaction => %w(ReferenceNumber TransactionID),
210
- :credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
211
- :system_check => %w(SystemCheck),
203
+ :credit_card_authorize => CREDIT_CARD_FIELDS,
204
+ :credit_card_charge => CREDIT_CARD_FIELDS,
205
+ :credit_card_voice_authorize => CREDIT_CARD_FIELDS,
206
+ :credit_card_capture => CREDIT_CARD_FIELDS,
207
+ :credit_card_credit => CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
208
+ :credit_card_refund => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
209
+ :void_transaction => %w(ReferenceNumber TransactionID),
210
+ :credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
211
+ :system_check => %w(SystemCheck),
212
212
  }
213
213
  end
214
214
  end
@@ -191,10 +191,8 @@ module ActiveMerchant #:nodoc:
191
191
  form[:email] = truncate(options[:email], 100) unless empty?(options[:email])
192
192
  form[:customer_code] = truncate(options[:customer], 10) unless empty?(options[:customer])
193
193
  form[:customer_number] = options[:customer_number] unless empty?(options[:customer_number])
194
- if options[:custom_fields]
195
- options[:custom_fields].each do |key, value|
196
- form[key.to_s] = value
197
- end
194
+ options[:custom_fields]&.each do |key, value|
195
+ form[key.to_s] = value
198
196
  end
199
197
  end
200
198
 
@@ -283,7 +281,7 @@ module ActiveMerchant #:nodoc:
283
281
  end
284
282
 
285
283
  def custom_field?(field_name, options)
286
- return true if options[:custom_fields] && options[:custom_fields].include?(field_name.to_sym)
284
+ return true if options[:custom_fields]&.include?(field_name.to_sym)
287
285
  field_name == :customer_number
288
286
  end
289
287
 
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
12
12
 
13
13
  self.default_currency = 'AUD'
14
14
 
15
- #accepted money format
15
+ # accepted money format
16
16
  self.money_format = :cents
17
17
 
18
18
  # The homepage URL of the gateway
@@ -222,4 +222,3 @@ module ActiveMerchant #:nodoc:
222
222
  end
223
223
  end
224
224
  end
225
-
@@ -157,4 +157,3 @@ module ActiveMerchant #:nodoc:
157
157
  end
158
158
  end
159
159
  end
160
-
@@ -20,4 +20,3 @@ module ActiveMerchant #:nodoc:
20
20
  end
21
21
  end
22
22
  end
23
-
@@ -140,4 +140,3 @@ module ActiveMerchant #:nodoc:
140
140
  end
141
141
  end
142
142
  end
143
-
@@ -119,9 +119,9 @@ module ActiveMerchant #:nodoc:
119
119
  response = {}
120
120
 
121
121
  doc = Nokogiri::XML(xml)
122
- doc.root.xpath('//RESPONSE/FIELDS/FIELD').each do |field|
122
+ doc.root&.xpath('//RESPONSE/FIELDS/FIELD')&.each do |field|
123
123
  response[field['KEY']] = field.text
124
- end unless doc.root.nil?
124
+ end
125
125
 
126
126
  response
127
127
  end
@@ -149,7 +149,7 @@ module ActiveMerchant #:nodoc:
149
149
  def message_from(response)
150
150
  # Silly inconsistent gateway. Always make capitalized (but not all caps)
151
151
  msg = (response['auth_response'] || response['response1'])
152
- msg.downcase.capitalize if msg
152
+ msg&.downcase&.capitalize
153
153
  end
154
154
 
155
155
  def error_code_from(response)
@@ -141,12 +141,12 @@ module ActiveMerchant #:nodoc:
141
141
  end
142
142
 
143
143
  def scrub(transcript)
144
- transcript
145
- .gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2')
146
- .gsub(%r((<VerificationStr2>).+(</VerificationStr2>)), '\1[FILTERED]\2')
147
- .gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2')
148
- .gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2')
149
- .gsub(%r((Card Number : ).*\d)i, '\1[FILTERED]')
144
+ transcript.
145
+ gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2').
146
+ gsub(%r((<VerificationStr2>).+(</VerificationStr2>)), '\1[FILTERED]\2').
147
+ gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2').
148
+ gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2').
149
+ gsub(%r((Card Number : ).*\d)i, '\1[FILTERED]')
150
150
  end
151
151
 
152
152
  def supports_network_tokenization?
@@ -394,7 +394,7 @@ module ActiveMerchant #:nodoc:
394
394
  credit_card.last_name,
395
395
  credit_card.month,
396
396
  credit_card.year
397
- ].map { |value| value.to_s.gsub(/;/, '') }.join(';')
397
+ ].map { |value| value.to_s.gsub(/;/, '') }.join(';')
398
398
  else
399
399
  raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
400
400
  end
@@ -112,12 +112,12 @@ module ActiveMerchant #:nodoc:
112
112
  end
113
113
 
114
114
  def scrub(transcript)
115
- transcript
116
- .gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2')
117
- .gsub(%r((<CVDCode>).+(</CVDCode>)), '\1[FILTERED]\2')
118
- .gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2')
119
- .gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2')
120
- .gsub(%r((CARD NUMBER\s+: )#+\d+), '\1[FILTERED]')
115
+ transcript.
116
+ gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2').
117
+ gsub(%r((<CVDCode>).+(</CVDCode>)), '\1[FILTERED]\2').
118
+ gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2').
119
+ gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2').
120
+ gsub(%r((CARD NUMBER\s+: )#+\d+), '\1[FILTERED]')
121
121
  end
122
122
 
123
123
  def supports_network_tokenization?
@@ -257,4 +257,3 @@ module ActiveMerchant #:nodoc:
257
257
  end
258
258
  end
259
259
  end
260
-
@@ -72,8 +72,8 @@ module ActiveMerchant #:nodoc:
72
72
  def scrub(transcript)
73
73
  transcript.
74
74
  gsub(%r((Authorization: )[^\\]*)i, '\1[FILTERED]').
75
- gsub(%r(("cardNumber\\":\\")\d+), '\1[FILTERED]').
76
- gsub(%r(("cvv\\":\\")\d+), '\1[FILTERED]')
75
+ gsub(%r(("cardNumber\\+":\\+")\d+), '\1[FILTERED]').
76
+ gsub(%r(("cvv\\+":\\+")\d+), '\1[FILTERED]')
77
77
  end
78
78
 
79
79
  private
@@ -230,11 +230,14 @@ module ActiveMerchant #:nodoc:
230
230
 
231
231
  def commit(action, post, authorization = nil)
232
232
  begin
233
- response = parse(ssl_post(url(action, authorization), post.to_json, headers(action, post, authorization)))
233
+ raw_response = ssl_post(url(action, authorization), post.to_json, headers(action, post, authorization))
234
+ response = parse(raw_response)
234
235
  rescue ResponseError => e
235
236
  if e.response.code.to_i >= 400
236
237
  response = parse(e.response.body)
237
238
  end
239
+ rescue JSON::ParserError
240
+ response = json_error(raw_response)
238
241
  end
239
242
 
240
243
  succeeded = success_from(response)
@@ -248,6 +251,14 @@ module ActiveMerchant #:nodoc:
248
251
  )
249
252
  end
250
253
 
254
+ def json_error(raw_response)
255
+ {
256
+ 'error_message' => 'Invalid response received from the Ingenico ePayments (formerly GlobalCollect) API. Please contact Ingenico ePayments if you continue to receive this message.' \
257
+ " (The raw response returned by the API was #{raw_response.inspect})",
258
+ 'status' => 'REJECTED'
259
+ }
260
+ end
261
+
251
262
  def headers(action, post, authorization = nil)
252
263
  {
253
264
  'Content-Type' => content_type,
@@ -286,8 +297,10 @@ EOS
286
297
  else
287
298
  if errors = response['errors']
288
299
  errors.first.try(:[], 'message')
289
- elsif status = response['status']
290
- 'Status: ' + status
300
+ elsif response['error_message']
301
+ response['error_message']
302
+ elsif response['status']
303
+ 'Status: ' + response['status']
291
304
  else
292
305
  'No message available'
293
306
  end
@@ -297,8 +310,10 @@ EOS
297
310
  def authorization_from(succeeded, response)
298
311
  if succeeded
299
312
  response['id'] || response['payment']['id'] || response['paymentResult']['payment']['id']
300
- else
313
+ elsif response['errorId']
301
314
  response['errorId']
315
+ else
316
+ 'GATEWAY ERROR'
302
317
  end
303
318
  end
304
319
 
@@ -274,7 +274,7 @@ module ActiveMerchant #:nodoc:
274
274
  end
275
275
 
276
276
  def test?
277
- (@options[:secret_api_key] && @options[:secret_api_key].include?('_cert_'))
277
+ @options[:secret_api_key]&.include?('_cert_')
278
278
  end
279
279
 
280
280
  ISSUER_MESSAGES = {
@@ -216,4 +216,3 @@ module ActiveMerchant #:nodoc:
216
216
  end
217
217
  end
218
218
  end
219
-
@@ -140,7 +140,7 @@ module ActiveMerchant #:nodoc:
140
140
  data = ssl_post self.live_url, post_data(action, parameters)
141
141
  response = parse(data)
142
142
 
143
- Response.new(response[:success] , response[:message], response,
143
+ Response.new(response[:success], response[:message], response,
144
144
  :authorization => response[:transaction_id],
145
145
  :avs_result => { :code => response[:avs_result] },
146
146
  :cvv_result => response[:cvv_result]
@@ -160,4 +160,3 @@ module ActiveMerchant #:nodoc:
160
160
  end
161
161
  end
162
162
  end
163
-