activemerchant 1.105.0 → 1.106.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +31 -1
  3. data/README.md +1 -1
  4. data/lib/active_merchant/billing/credit_card_methods.rb +12 -3
  5. data/lib/active_merchant/billing/gateway.rb +22 -22
  6. data/lib/active_merchant/billing/gateways/adyen.rb +17 -6
  7. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -19
  9. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +11 -11
  10. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +35 -35
  11. data/lib/active_merchant/billing/gateways/axcessms.rb +3 -3
  12. data/lib/active_merchant/billing/gateways/bambora_apac.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
  15. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  16. data/lib/active_merchant/billing/gateways/be2bill.rb +4 -4
  17. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +27 -27
  19. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/blue_pay.rb +8 -8
  21. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -2
  22. data/lib/active_merchant/billing/gateways/bogus.rb +20 -20
  23. data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/braintree_blue.rb +74 -74
  26. data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
  27. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +19 -19
  29. data/lib/active_merchant/billing/gateways/cc5.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cecabank.rb +3 -3
  31. data/lib/active_merchant/billing/gateways/cenpos.rb +3 -3
  32. data/lib/active_merchant/billing/gateways/checkout_v2.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/clearhaus.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/commercegate.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/creditcall.rb +4 -4
  37. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  38. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/cyber_source.rb +86 -72
  40. data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
  41. data/lib/active_merchant/billing/gateways/decidir.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/ebanx.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
  44. data/lib/active_merchant/billing/gateways/elavon.rb +13 -13
  45. data/lib/active_merchant/billing/gateways/epay.rb +40 -40
  46. data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
  47. data/lib/active_merchant/billing/gateways/eway.rb +3 -3
  48. data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
  49. data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
  50. data/lib/active_merchant/billing/gateways/exact.rb +11 -11
  51. data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
  52. data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
  53. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +20 -20
  54. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +19 -19
  55. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
  56. data/lib/active_merchant/billing/gateways/forte.rb +1 -1
  57. data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
  58. data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
  59. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  60. data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
  62. data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
  63. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/iridium.rb +8 -8
  65. data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
  66. data/lib/active_merchant/billing/gateways/iveri.rb +2 -2
  67. data/lib/active_merchant/billing/gateways/ixopay.rb +21 -0
  68. data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
  69. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
  70. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  71. data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
  72. data/lib/active_merchant/billing/gateways/litle.rb +2 -2
  73. data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
  74. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
  75. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  76. data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
  78. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
  79. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
  80. data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
  81. data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
  82. data/lib/active_merchant/billing/gateways/migs.rb +13 -13
  83. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/monei.rb +19 -19
  85. data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
  86. data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
  87. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  88. data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
  89. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  90. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
  91. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
  93. data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
  94. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  95. data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
  96. data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
  97. data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
  98. data/lib/active_merchant/billing/gateways/opp.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/optimal_payment.rb +9 -9
  100. data/lib/active_merchant/billing/gateways/orbital.rb +10 -10
  101. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
  102. data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
  104. data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
  105. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
  106. data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
  107. data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
  108. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  109. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
  110. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  111. data/lib/active_merchant/billing/gateways/payment_express.rb +7 -7
  112. data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
  113. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  114. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
  115. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  116. data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
  117. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  118. data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
  119. data/lib/active_merchant/billing/gateways/payway.rb +12 -12
  120. data/lib/active_merchant/billing/gateways/pin.rb +16 -16
  121. data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
  122. data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
  123. data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
  124. data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
  125. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
  127. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
  128. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
  129. data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
  130. data/lib/active_merchant/billing/gateways/realex.rb +8 -8
  131. data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
  132. data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/sage.rb +10 -10
  134. data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
  135. data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
  136. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
  137. data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
  138. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +15 -15
  139. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  140. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
  141. data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
  142. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  143. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
  144. data/lib/active_merchant/billing/gateways/stripe.rb +8 -8
  145. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +10 -3
  146. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
  147. data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
  148. data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
  149. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
  150. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
  151. data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
  152. data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
  153. data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
  154. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
  156. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  157. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
  158. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  159. data/lib/active_merchant/connection.rb +1 -1
  160. data/lib/active_merchant/network_connection_retries.rb +3 -3
  161. data/lib/active_merchant/post_data.rb +1 -1
  162. data/lib/active_merchant/version.rb +1 -1
  163. data/lib/certs/cacert.pem +75 -0
  164. data/lib/support/ssl_verify.rb +2 -2
  165. data/lib/support/ssl_version.rb +2 -2
  166. metadata +2 -3
  167. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
77
77
  def store(creditcard, options={})
78
78
  post = initialize_required_fields('')
79
79
  post[:transaction] = 'Create'
80
- post[:CardNumber] = creditcard.number
80
+ post[:CardNumber] = creditcard.number
81
81
  post[:CustomerPaymentInfoKey] = ''
82
82
  post[:token] = ''
83
83
  add_payment_method(post, creditcard)
@@ -235,8 +235,8 @@ module ActiveMerchant #:nodoc:
235
235
 
236
236
  def post_data(post)
237
237
  {
238
- :UserName => @options[:user_name],
239
- :Password => @options[:password]
238
+ UserName: @options[:user_name],
239
+ Password: @options[:password]
240
240
  }.merge(post).collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
241
241
  end
242
242
  end
@@ -287,7 +287,7 @@ module ActiveMerchant #:nodoc:
287
287
  error_code: error_code_from(response)
288
288
  )
289
289
  rescue ResponseError => e
290
- return Response.new(false, 'Unable to authenticate. Please check your credentials.', {}, :test => test?) if e.response.code == '401'
290
+ return Response.new(false, 'Unable to authenticate. Please check your credentials.', {}, test: test?) if e.response.code == '401'
291
291
 
292
292
  raise
293
293
  end
@@ -173,7 +173,7 @@ module ActiveMerchant #:nodoc:
173
173
  def capture(money, authorization, options = {})
174
174
  post = {}
175
175
  add_pair(post, :xref, authorization)
176
- add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), :required => true)
176
+ add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), required: true)
177
177
  add_remote_address(post, options)
178
178
 
179
179
  commit('CAPTURE', post)
@@ -225,7 +225,7 @@ module ActiveMerchant #:nodoc:
225
225
 
226
226
  def add_amount(post, money, options)
227
227
  currency = options[:currency] || currency(money)
228
- add_pair(post, :amount, localized_amount(money, currency), :required => true)
228
+ add_pair(post, :amount, localized_amount(money, currency), required: true)
229
229
  add_pair(post, :currencyCode, currency_code(currency))
230
230
  end
231
231
 
@@ -242,8 +242,8 @@ module ActiveMerchant #:nodoc:
242
242
  end
243
243
 
244
244
  def add_invoice(post, credit_card_or_reference, money, options)
245
- add_pair(post, :transactionUnique, options[:order_id], :required => true)
246
- add_pair(post, :orderRef, options[:description] || options[:order_id], :required => true)
245
+ add_pair(post, :transactionUnique, options[:order_id], required: true)
246
+ add_pair(post, :orderRef, options[:description] || options[:order_id], required: true)
247
247
  add_pair(post, :statementNarrative1, options[:merchant_name]) if options[:merchant_name]
248
248
  add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
249
249
  if credit_card_or_reference.respond_to?(:number)
@@ -267,14 +267,14 @@ module ActiveMerchant #:nodoc:
267
267
  end
268
268
 
269
269
  def add_reference(post, reference)
270
- add_pair(post, :xref, reference, :required => true)
270
+ add_pair(post, :xref, reference, required: true)
271
271
  end
272
272
 
273
273
  def add_credit_card(post, credit_card)
274
- add_pair(post, :customerName, credit_card.name, :required => true)
275
- add_pair(post, :cardNumber, credit_card.number, :required => true)
276
- add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), :required => true)
277
- add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), :required => true)
274
+ add_pair(post, :customerName, credit_card.name, required: true)
275
+ add_pair(post, :cardNumber, credit_card.number, required: true)
276
+ add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), required: true)
277
+ add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), required: true)
278
278
  add_pair(post, :cardCVV, credit_card.verification_value)
279
279
  end
280
280
 
@@ -309,10 +309,10 @@ module ActiveMerchant #:nodoc:
309
309
  end
310
310
 
311
311
  def commit(action, parameters)
312
- parameters.update(:countryCode => self.supported_countries[0]) unless ['CAPTURE', 'CANCEL'].include?(action)
312
+ parameters.update(countryCode: self.supported_countries[0]) unless ['CAPTURE', 'CANCEL'].include?(action)
313
313
  parameters.update(
314
- :merchantID => @options[:login],
315
- :action => action
314
+ merchantID: @options[:login],
315
+ action: action
316
316
  )
317
317
  # adds a signature to the post hash/array
318
318
  add_hmac(parameters)
@@ -323,10 +323,10 @@ module ActiveMerchant #:nodoc:
323
323
  response[:responseCode] == '0',
324
324
  response[:responseCode] == '0' ? 'APPROVED' : response[:responseMessage],
325
325
  response,
326
- :test => test?,
327
- :authorization => response[:xref],
328
- :cvv_result => CVV_CODE[response[:avscv2ResponseCode].to_s[0, 1]],
329
- :avs_result => avs_from(response)
326
+ test: test?,
327
+ authorization: response[:xref],
328
+ cvv_result: CVV_CODE[response[:avscv2ResponseCode].to_s[0, 1]],
329
+ avs_result: avs_from(response)
330
330
  )
331
331
  end
332
332
 
@@ -345,9 +345,9 @@ module ActiveMerchant #:nodoc:
345
345
  end
346
346
 
347
347
  AVSResult.new({
348
- :code => code,
349
- :postal_match => postal_match,
350
- :street_match => street_match
348
+ code: code,
349
+ postal_match: postal_match,
350
+ street_match: street_match
351
351
  })
352
352
  end
353
353
 
@@ -50,7 +50,7 @@ module ActiveMerchant #:nodoc:
50
50
  def build_sale_request(type, money, creditcard, options = {})
51
51
  requires!(options, :order_id)
52
52
 
53
- xml = Builder::XmlMarkup.new :indent => 2
53
+ xml = Builder::XmlMarkup.new indent: 2
54
54
 
55
55
  xml.tag! 'CC5Request' do
56
56
  add_login_tags(xml)
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  end
77
77
 
78
78
  def build_capture_request(money, authorization, options = {})
79
- xml = Builder::XmlMarkup.new :indent => 2
79
+ xml = Builder::XmlMarkup.new indent: 2
80
80
 
81
81
  xml.tag! 'CC5Request' do
82
82
  add_login_tags(xml)
@@ -87,7 +87,7 @@ module ActiveMerchant #:nodoc:
87
87
  end
88
88
 
89
89
  def build_void_request(authorization, options = {})
90
- xml = Builder::XmlMarkup.new :indent => 2
90
+ xml = Builder::XmlMarkup.new indent: 2
91
91
 
92
92
  xml.tag! 'CC5Request' do
93
93
  add_login_tags(xml)
@@ -97,7 +97,7 @@ module ActiveMerchant #:nodoc:
97
97
  end
98
98
 
99
99
  def build_authorization_credit_request(money, authorization, options = {})
100
- xml = Builder::XmlMarkup.new :indent => 2
100
+ xml = Builder::XmlMarkup.new indent: 2
101
101
 
102
102
  xml.tag! 'CC5Request' do
103
103
  add_login_tags(xml)
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
108
108
  end
109
109
 
110
110
  def build_creditcard_credit_request(money, creditcard, options = {})
111
- xml = Builder::XmlMarkup.new :indent => 2
111
+ xml = Builder::XmlMarkup.new indent: 2
112
112
 
113
113
  xml.tag! 'CC5Request' do
114
114
  add_login_tags(xml)
@@ -157,8 +157,8 @@ module ActiveMerchant #:nodoc:
157
157
  success,
158
158
  (success ? 'Approved' : "Declined (Reason: #{response[:proc_return_code]} - #{response[:err_msg]})"),
159
159
  response,
160
- :test => test?,
161
- :authorization => response[:order_id]
160
+ test: test?,
161
+ authorization: response[:order_id]
162
162
  )
163
163
  end
164
164
 
@@ -173,9 +173,9 @@ module ActiveMerchant #:nodoc:
173
173
  response[:success],
174
174
  message_from(response),
175
175
  response,
176
- :test => test?,
177
- :authorization => build_authorization(response),
178
- :error_code => response[:error_code]
176
+ test: test?,
177
+ authorization: build_authorization(response),
178
+ error_code: response[:error_code]
179
179
  )
180
180
  end
181
181
 
@@ -181,13 +181,13 @@ module ActiveMerchant #:nodoc:
181
181
  def headers
182
182
  {
183
183
  'Accept-Encoding' => 'identity',
184
- 'Content-Type' => 'text/xml;charset=UTF-8',
185
- 'SOAPAction' => 'http://tempuri.org/Transactional/ProcessCreditCard'
184
+ 'Content-Type' => 'text/xml;charset=UTF-8',
185
+ 'SOAPAction' => 'http://tempuri.org/Transactional/ProcessCreditCard'
186
186
  }
187
187
  end
188
188
 
189
189
  def build_request(post)
190
- xml = Builder::XmlMarkup.new :indent => 8
190
+ xml = Builder::XmlMarkup.new indent: 8
191
191
  xml.tag!('acr:MerchantId', post.delete(:MerchantId))
192
192
  xml.tag!('acr:Password', post.delete(:Password))
193
193
  xml.tag!('acr:UserId', post.delete(:UserId))
@@ -235,7 +235,7 @@ module ActiveMerchant #:nodoc:
235
235
  elsif response['error_type']
236
236
  response['error_type'] + ': ' + response['error_codes'].first
237
237
  else
238
- response['response_summary'] || response['response_code'] || 'Unable to read error message'
238
+ response['response_summary'] || response['response_code'] || response['status'] || 'Unable to read error message'
239
239
  end
240
240
  end
241
241
 
@@ -128,7 +128,7 @@ module ActiveMerchant #:nodoc:
128
128
  def add_payment(post, payment)
129
129
  card = {}
130
130
  card[:pan] = payment.number
131
- card[:expire_month] = '%02d'% payment.month
131
+ card[:expire_month] = '%02d' % payment.month
132
132
  card[:expire_year] = payment.year
133
133
 
134
134
  card[:csc] = payment.verification_value if payment.verification_value?
@@ -74,8 +74,8 @@ module ActiveMerchant #:nodoc:
74
74
  post[:customerIP] = options[:ip] || '127.0.0.1'
75
75
  post[:amount] = amount(money)
76
76
  post[:email] = options[:email] || 'unknown@example.com'
77
- post[:currencyCode]= options[:currency] || currency(money)
78
- post[:merchAcct] = options[:merchant]
77
+ post[:currencyCode] = options[:currency] || currency(money)
78
+ post[:merchAcct] = options[:merchant]
79
79
  end
80
80
 
81
81
  def add_creditcard(params, creditcard)
@@ -180,7 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
  'Accept-Language' => 'es',
181
181
  'Authorization' => 'Basic ' + Base64.encode64("#{@options[:key]}:"),
182
182
  'RaiseHtmlError' => 'false',
183
- 'Conekta-Client-User-Agent' => {'agent'=>"Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
183
+ 'Conekta-Client-User-Agent' => {'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
184
184
  'X-Conekta-Client-User-Agent' => conekta_client_user_agent(options),
185
185
  'X-Conekta-Client-User-Metadata' => options[:meta].to_json
186
186
  }
@@ -24,19 +24,19 @@ module ActiveMerchant #:nodoc:
24
24
 
25
25
  AVS_CODE = {
26
26
  'matched;matched' => 'D',
27
- 'matched;notchecked' =>'B',
27
+ 'matched;notchecked' => 'B',
28
28
  'matched;notmatched' => 'A',
29
29
  'matched;partialmatch' => 'A',
30
30
  'notchecked;matched' => 'P',
31
- 'notchecked;notchecked' =>'I',
31
+ 'notchecked;notchecked' => 'I',
32
32
  'notchecked;notmatched' => 'I',
33
33
  'notchecked;partialmatch' => 'I',
34
34
  'notmatched;matched' => 'W',
35
- 'notmatched;notchecked' =>'C',
35
+ 'notmatched;notchecked' => 'C',
36
36
  'notmatched;notmatched' => 'C',
37
37
  'notmatched;partialmatch' => 'C',
38
38
  'partialmatched;matched' => 'W',
39
- 'partialmatched;notchecked' =>'C',
39
+ 'partialmatched;notchecked' => 'C',
40
40
  'partialmatched;notmatched' => 'C',
41
41
  'partialmatched;partialmatch' => 'C'
42
42
  }
@@ -227,7 +227,7 @@ module ActiveMerchant #:nodoc:
227
227
  r.process { commit_raw(action, parameters) }
228
228
  r.process {
229
229
  split_auth = split_authorization(r.authorization)
230
- auth = (action.include?('recur')? split_auth[4] : split_auth[0])
230
+ auth = (action.include?('recur') ? split_auth[4] : split_auth[0])
231
231
  action.include?('recur') ? commit_raw('recur/ack', {ID: auth}) : commit_raw('ack', {TransactionNumber: auth})
232
232
  }
233
233
  end
@@ -231,8 +231,8 @@ module ActiveMerchant #:nodoc:
231
231
 
232
232
  def headers
233
233
  {
234
- 'Accept' => 'application/json',
235
- 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
234
+ 'Accept' => 'application/json',
235
+ 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
236
236
  }
237
237
  end
238
238
 
@@ -38,56 +38,61 @@ module ActiveMerchant #:nodoc:
38
38
  self.display_name = 'CyberSource'
39
39
 
40
40
  @@credit_card_codes = {
41
- :visa => '001',
42
- :master => '002',
43
- :american_express => '003',
44
- :discover => '004',
45
- :diners_club => '005',
46
- :jcb => '007',
47
- :dankort => '034',
48
- :maestro => '042',
49
- :elo => '054'
41
+ visa: '001',
42
+ master: '002',
43
+ american_express: '003',
44
+ discover: '004',
45
+ diners_club: '005',
46
+ jcb: '007',
47
+ dankort: '034',
48
+ maestro: '042',
49
+ elo: '054'
50
+ }
51
+
52
+ @@decision_codes = {
53
+ accept: 'ACCEPT',
54
+ review: 'REVIEW'
50
55
  }
51
56
 
52
57
  @@response_codes = {
53
- :r100 => 'Successful transaction',
54
- :r101 => 'Request is missing one or more required fields',
55
- :r102 => 'One or more fields contains invalid data',
56
- :r150 => 'General failure',
57
- :r151 => 'The request was received but a server time-out occurred',
58
- :r152 => 'The request was received, but a service timed out',
59
- :r200 => 'The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the AVS check',
60
- :r201 => 'The issuing bank has questions about the request',
61
- :r202 => 'Expired card',
62
- :r203 => 'General decline of the card',
63
- :r204 => 'Insufficient funds in the account',
64
- :r205 => 'Stolen or lost card',
65
- :r207 => 'Issuing bank unavailable',
66
- :r208 => 'Inactive card or card not authorized for card-not-present transactions',
67
- :r209 => 'American Express Card Identifiction Digits (CID) did not match',
68
- :r210 => 'The card has reached the credit limit',
69
- :r211 => 'Invalid card verification number',
70
- :r221 => "The customer matched an entry on the processor's negative file",
71
- :r230 => 'The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the card verification check',
72
- :r231 => 'Invalid account number',
73
- :r232 => 'The card type is not accepted by the payment processor',
74
- :r233 => 'General decline by the processor',
75
- :r234 => 'A problem exists with your CyberSource merchant configuration',
76
- :r235 => 'The requested amount exceeds the originally authorized amount',
77
- :r236 => 'Processor failure',
78
- :r237 => 'The authorization has already been reversed',
79
- :r238 => 'The authorization has already been captured',
80
- :r239 => 'The requested transaction amount must match the previous transaction amount',
81
- :r240 => 'The card type sent is invalid or does not correlate with the credit card number',
82
- :r241 => 'The request ID is invalid',
83
- :r242 => 'You requested a capture, but there is no corresponding, unused authorization record.',
84
- :r243 => 'The transaction has already been settled or reversed',
85
- :r244 => 'The bank account number failed the validation check',
86
- :r246 => 'The capture or credit is not voidable because the capture or credit information has already been submitted to your processor',
87
- :r247 => 'You requested a credit for a capture that was previously voided',
88
- :r250 => 'The request was received, but a time-out occurred with the payment processor',
89
- :r254 => 'Your CyberSource account is prohibited from processing stand-alone refunds',
90
- :r255 => 'Your CyberSource account is not configured to process the service in the country you specified'
58
+ r100: 'Successful transaction',
59
+ r101: 'Request is missing one or more required fields',
60
+ r102: 'One or more fields contains invalid data',
61
+ r150: 'General failure',
62
+ r151: 'The request was received but a server time-out occurred',
63
+ r152: 'The request was received, but a service timed out',
64
+ r200: 'The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the AVS check',
65
+ r201: 'The issuing bank has questions about the request',
66
+ r202: 'Expired card',
67
+ r203: 'General decline of the card',
68
+ r204: 'Insufficient funds in the account',
69
+ r205: 'Stolen or lost card',
70
+ r207: 'Issuing bank unavailable',
71
+ r208: 'Inactive card or card not authorized for card-not-present transactions',
72
+ r209: 'American Express Card Identifiction Digits (CID) did not match',
73
+ r210: 'The card has reached the credit limit',
74
+ r211: 'Invalid card verification number',
75
+ r221: "The customer matched an entry on the processor's negative file",
76
+ r230: 'The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the card verification check',
77
+ r231: 'Invalid account number',
78
+ r232: 'The card type is not accepted by the payment processor',
79
+ r233: 'General decline by the processor',
80
+ r234: 'A problem exists with your CyberSource merchant configuration',
81
+ r235: 'The requested amount exceeds the originally authorized amount',
82
+ r236: 'Processor failure',
83
+ r237: 'The authorization has already been reversed',
84
+ r238: 'The authorization has already been captured',
85
+ r239: 'The requested transaction amount must match the previous transaction amount',
86
+ r240: 'The card type sent is invalid or does not correlate with the credit card number',
87
+ r241: 'The request ID is invalid',
88
+ r242: 'You requested a capture, but there is no corresponding, unused authorization record.',
89
+ r243: 'The transaction has already been settled or reversed',
90
+ r244: 'The bank account number failed the validation check',
91
+ r246: 'The capture or credit is not voidable because the capture or credit information has already been submitted to your processor',
92
+ r247: 'You requested a credit for a capture that was previously voided',
93
+ r250: 'The request was received, but a time-out occurred with the payment processor',
94
+ r254: 'Your CyberSource account is prohibited from processing stand-alone refunds',
95
+ r255: 'Your CyberSource account is not configured to process the service in the country you specified'
91
96
  }
92
97
 
93
98
  # These are the options that can be used when creating a new CyberSource
@@ -245,18 +250,18 @@ module ActiveMerchant #:nodoc:
245
250
  # were only provided with one or two of them or even none
246
251
  def setup_address_hash(options)
247
252
  default_address = {
248
- :address1 => 'Unspecified',
249
- :city => 'Unspecified',
250
- :state => 'NC',
251
- :zip => '00000',
252
- :country => 'US'
253
+ address1: 'Unspecified',
254
+ city: 'Unspecified',
255
+ state: 'NC',
256
+ zip: '00000',
257
+ country: 'US'
253
258
  }
254
259
  options[:billing_address] = options[:billing_address] || options[:address] || default_address
255
260
  options[:shipping_address] = options[:shipping_address] || {}
256
261
  end
257
262
 
258
263
  def build_auth_request(money, creditcard_or_reference, options)
259
- xml = Builder::XmlMarkup.new :indent => 2
264
+ xml = Builder::XmlMarkup.new indent: 2
260
265
  add_payment_method_or_subscription(xml, money, creditcard_or_reference, options)
261
266
  add_threeds_2_ucaf_data(xml, creditcard_or_reference, options)
262
267
  add_decision_manager_fields(xml, options)
@@ -272,7 +277,7 @@ module ActiveMerchant #:nodoc:
272
277
  end
273
278
 
274
279
  def build_tax_calculation_request(creditcard, options)
275
- xml = Builder::XmlMarkup.new :indent => 2
280
+ xml = Builder::XmlMarkup.new indent: 2
276
281
  add_address(xml, creditcard, options[:billing_address], options, false)
277
282
  add_address(xml, creditcard, options[:shipping_address], options, true)
278
283
  add_line_item_data(xml, options)
@@ -286,7 +291,7 @@ module ActiveMerchant #:nodoc:
286
291
  order_id, request_id, request_token = authorization.split(';')
287
292
  options[:order_id] = order_id
288
293
 
289
- xml = Builder::XmlMarkup.new :indent => 2
294
+ xml = Builder::XmlMarkup.new indent: 2
290
295
  add_purchase_data(xml, money, true, options)
291
296
  add_other_tax(xml, options)
292
297
  add_mdd_fields(xml, options)
@@ -297,7 +302,7 @@ module ActiveMerchant #:nodoc:
297
302
  end
298
303
 
299
304
  def build_purchase_request(money, payment_method_or_reference, options)
300
- xml = Builder::XmlMarkup.new :indent => 2
305
+ xml = Builder::XmlMarkup.new indent: 2
301
306
  add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
302
307
  add_threeds_2_ucaf_data(xml, payment_method_or_reference, options)
303
308
  add_decision_manager_fields(xml, options)
@@ -319,12 +324,12 @@ module ActiveMerchant #:nodoc:
319
324
  order_id, request_id, request_token, action, money, currency = identification.split(';')
320
325
  options[:order_id] = order_id
321
326
 
322
- xml = Builder::XmlMarkup.new :indent => 2
327
+ xml = Builder::XmlMarkup.new indent: 2
323
328
  if action == 'capture'
324
329
  add_mdd_fields(xml, options)
325
330
  add_void_service(xml, request_id, request_token)
326
331
  else
327
- add_purchase_data(xml, money, true, options.merge(:currency => currency || default_currency))
332
+ add_purchase_data(xml, money, true, options.merge(currency: currency || default_currency))
328
333
  add_mdd_fields(xml, options)
329
334
  add_auth_reversal_service(xml, request_id, request_token)
330
335
  end
@@ -336,7 +341,7 @@ module ActiveMerchant #:nodoc:
336
341
  order_id, request_id, request_token = identification.split(';')
337
342
  options[:order_id] = order_id
338
343
 
339
- xml = Builder::XmlMarkup.new :indent => 2
344
+ xml = Builder::XmlMarkup.new indent: 2
340
345
  add_purchase_data(xml, money, true, options)
341
346
  add_credit_service(xml, request_id, request_token)
342
347
 
@@ -344,7 +349,7 @@ module ActiveMerchant #:nodoc:
344
349
  end
345
350
 
346
351
  def build_credit_request(money, creditcard_or_reference, options)
347
- xml = Builder::XmlMarkup.new :indent => 2
352
+ xml = Builder::XmlMarkup.new indent: 2
348
353
 
349
354
  add_payment_method_or_subscription(xml, money, creditcard_or_reference, options)
350
355
  add_mdd_fields(xml, options)
@@ -355,12 +360,12 @@ module ActiveMerchant #:nodoc:
355
360
  end
356
361
 
357
362
  def build_create_subscription_request(payment_method, options)
358
- default_subscription_params = {:frequency => 'on-demand', :amount => 0, :automatic_renew => false}
363
+ default_subscription_params = {frequency: 'on-demand', amount: 0, automatic_renew: false}
359
364
  options[:subscription] = default_subscription_params.update(
360
365
  options[:subscription] || {}
361
366
  )
362
367
 
363
- xml = Builder::XmlMarkup.new :indent => 2
368
+ xml = Builder::XmlMarkup.new indent: 2
364
369
  add_address(xml, payment_method, options[:billing_address], options)
365
370
  add_purchase_data(xml, options[:setup_fee] || 0, true, options)
366
371
  if card_brand(payment_method) == 'check'
@@ -385,7 +390,7 @@ module ActiveMerchant #:nodoc:
385
390
  end
386
391
 
387
392
  def build_update_subscription_request(reference, creditcard, options)
388
- xml = Builder::XmlMarkup.new :indent => 2
393
+ xml = Builder::XmlMarkup.new indent: 2
389
394
  add_address(xml, creditcard, options[:billing_address], options) unless options[:billing_address].blank?
390
395
  add_purchase_data(xml, options[:setup_fee], true, options) unless options[:setup_fee].blank?
391
396
  add_creditcard(xml, creditcard) if creditcard
@@ -397,21 +402,21 @@ module ActiveMerchant #:nodoc:
397
402
  end
398
403
 
399
404
  def build_delete_subscription_request(reference, options)
400
- xml = Builder::XmlMarkup.new :indent => 2
405
+ xml = Builder::XmlMarkup.new indent: 2
401
406
  add_subscription(xml, options, reference)
402
407
  add_subscription_delete_service(xml, options)
403
408
  xml.target!
404
409
  end
405
410
 
406
411
  def build_retrieve_subscription_request(reference, options)
407
- xml = Builder::XmlMarkup.new :indent => 2
412
+ xml = Builder::XmlMarkup.new indent: 2
408
413
  add_subscription(xml, options, reference)
409
414
  add_subscription_retrieve_service(xml, options)
410
415
  xml.target!
411
416
  end
412
417
 
413
418
  def build_validate_pinless_debit_request(creditcard, options)
414
- xml = Builder::XmlMarkup.new :indent => 2
419
+ xml = Builder::XmlMarkup.new indent: 2
415
420
  add_creditcard(xml, creditcard)
416
421
  add_validate_pinless_debit_service(xml)
417
422
  xml.target!
@@ -792,7 +797,7 @@ module ActiveMerchant #:nodoc:
792
797
  def build_request(body, options)
793
798
  xsd_version = test? ? TEST_XSD_VERSION : PRODUCTION_XSD_VERSION
794
799
 
795
- xml = Builder::XmlMarkup.new :indent => 2
800
+ xml = Builder::XmlMarkup.new indent: 2
796
801
  xml.instruct!
797
802
  xml.tag! 's:Envelope', {'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/'} do
798
803
  xml.tag! 's:Header' do
@@ -828,16 +833,17 @@ module ActiveMerchant #:nodoc:
828
833
  response = { message: e.to_s }
829
834
  end
830
835
 
831
- success = response[:decision] == 'ACCEPT'
836
+ success = success?(response)
832
837
  message = response[:message]
833
838
 
834
839
  authorization = success ? authorization_from(response, action, amount, options) : nil
835
840
 
836
841
  Response.new(success, message, response,
837
- :test => test?,
838
- :authorization => authorization,
839
- :avs_result => { :code => response[:avsCode] },
840
- :cvv_result => response[:cvCode]
842
+ test: test?,
843
+ authorization: authorization,
844
+ fraud_review: in_fraud_review?(response),
845
+ avs_result: { code: response[:avsCode] },
846
+ cvv_result: response[:cvCode]
841
847
  )
842
848
  end
843
849
 
@@ -887,6 +893,14 @@ module ActiveMerchant #:nodoc:
887
893
  [options[:order_id], response[:requestID], response[:requestToken], action, amount,
888
894
  options[:currency], response[:subscriptionID]].join(';')
889
895
  end
896
+
897
+ def in_fraud_review?(response)
898
+ response[:decision] == @@decision_codes[:review]
899
+ end
900
+
901
+ def success?(response)
902
+ response[:decision] == @@decision_codes[:accept]
903
+ end
890
904
  end
891
905
  end
892
906
  end