activemerchant 1.114.0 → 1.120.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +183 -0
  3. data/README.md +4 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/avs_result.rb +1 -1
  6. data/lib/active_merchant/billing/check.rb +10 -0
  7. data/lib/active_merchant/billing/compatibility.rb +3 -3
  8. data/lib/active_merchant/billing/credit_card.rb +3 -0
  9. data/lib/active_merchant/billing/credit_card_methods.rb +80 -15
  10. data/lib/active_merchant/billing/gateways/adyen.rb +44 -20
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +50 -12
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +5 -1
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  16. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  17. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  19. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  21. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  23. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  24. data/lib/active_merchant/billing/gateways/blue_snap.rb +22 -18
  25. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  27. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  28. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/braintree_blue.rb +60 -17
  30. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  31. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  32. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  36. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cashnet.rb +7 -2
  38. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  39. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/checkout_v2.rb +38 -20
  42. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  43. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  45. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/credorax.rb +39 -23
  47. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  48. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  49. data/lib/active_merchant/billing/gateways/cyber_source.rb +81 -39
  50. data/lib/active_merchant/billing/gateways/d_local.rb +12 -12
  51. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  52. data/lib/active_merchant/billing/gateways/decidir.rb +31 -10
  53. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  57. data/lib/active_merchant/billing/gateways/elavon.rb +296 -225
  58. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  59. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  60. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  61. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  62. data/lib/active_merchant/billing/gateways/eway_rapid.rb +19 -6
  63. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  64. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  65. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  66. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  67. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  69. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  70. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -8
  74. data/lib/active_merchant/billing/gateways/global_collect.rb +35 -16
  75. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  76. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  77. data/lib/active_merchant/billing/gateways/hps.rb +72 -9
  78. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  79. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  80. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  81. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  82. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  83. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  84. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  85. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  86. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  87. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  88. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  91. data/lib/active_merchant/billing/gateways/litle.rb +32 -16
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  93. data/lib/active_merchant/billing/gateways/mercado_pago.rb +9 -9
  94. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  95. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  96. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  97. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  98. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  99. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  100. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  101. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  102. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  103. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  104. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  105. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  106. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  107. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  108. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  109. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  110. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  111. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  112. data/lib/active_merchant/billing/gateways/netbanx.rb +45 -10
  113. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  114. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  115. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  116. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  117. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  118. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  120. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  121. data/lib/active_merchant/billing/gateways/orbital.rb +225 -105
  122. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  123. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  124. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  125. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  126. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  127. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  128. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  129. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  130. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  131. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  132. data/lib/active_merchant/billing/gateways/payeezy.rb +62 -20
  133. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  134. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payment_express.rb +11 -7
  136. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  137. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  138. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  139. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  140. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  141. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  143. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  144. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  145. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  146. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  147. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  148. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  149. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  152. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  153. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  154. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  157. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/qvalent.rb +31 -17
  159. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/redsys.rb +105 -9
  161. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  162. data/lib/active_merchant/billing/gateways/safe_charge.rb +51 -18
  163. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  164. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  165. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  169. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  170. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  172. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  173. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  174. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  175. data/lib/active_merchant/billing/gateways/stripe.rb +18 -18
  176. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +91 -25
  177. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  179. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  180. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  181. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  182. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  183. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  185. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  186. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  187. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  188. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  190. data/lib/active_merchant/billing/gateways/vpos.rb +172 -0
  191. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  192. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  193. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  194. data/lib/active_merchant/billing/gateways/worldpay.rb +43 -22
  195. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  196. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  197. data/lib/active_merchant/billing/response.rb +3 -2
  198. data/lib/active_merchant/country.rb +1 -1
  199. data/lib/active_merchant/network_connection_retries.rb +2 -2
  200. data/lib/active_merchant/post_data.rb +1 -1
  201. data/lib/active_merchant/posts_data.rb +1 -1
  202. data/lib/active_merchant/version.rb +1 -1
  203. data/lib/certs/cacert.pem +1582 -2431
  204. data/lib/support/ssl_verify.rb +2 -2
  205. data/lib/support/ssl_version.rb +2 -2
  206. metadata +5 -3
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  discover: 'Discover'
33
33
  }
34
34
 
35
- E4_BRANDS = BRANDS.merge({mastercard: 'Mastercard'})
35
+ E4_BRANDS = BRANDS.merge({ mastercard: 'Mastercard' })
36
36
 
37
37
  DEFAULT_ECI = '07'
38
38
 
@@ -302,7 +302,8 @@ module ActiveMerchant #:nodoc:
302
302
  first_name: params[2],
303
303
  last_name: params[3],
304
304
  month: params[4],
305
- year: params[5])
305
+ year: params[5]
306
+ )
306
307
 
307
308
  xml.tag! 'TransarmorToken', params[0]
308
309
  xml.tag! 'Expiry_Date', expdate(credit_card)
@@ -356,10 +357,9 @@ module ActiveMerchant #:nodoc:
356
357
  Response.new(successful?(response), message_from(response), response,
357
358
  test: test?,
358
359
  authorization: successful?(response) ? response_authorization(action, response, credit_card) : '',
359
- avs_result: {code: response[:avs]},
360
+ avs_result: { code: response[:avs] },
360
361
  cvv_result: response[:cvv2],
361
- error_code: standard_error_code(response)
362
- )
362
+ error_code: standard_error_code(response))
363
363
  end
364
364
 
365
365
  def successful?(response)
@@ -395,7 +395,7 @@ module ActiveMerchant #:nodoc:
395
395
  credit_card.last_name,
396
396
  credit_card.month,
397
397
  credit_card.year
398
- ].map { |value| value.to_s.gsub(/;/, '') }.join(';')
398
+ ].map { |value| value.to_s.delete(';') }.join(';')
399
399
  else
400
400
  raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
401
401
  end
@@ -439,7 +439,7 @@ module ActiveMerchant #:nodoc:
439
439
  parse_elements(response, root)
440
440
  end
441
441
 
442
- response.delete_if { |k, v| SENSITIVE_FIELDS.include?(k) }
442
+ response.delete_if { |k, _v| SENSITIVE_FIELDS.include?(k) }
443
443
  end
444
444
 
445
445
  def parse_elements(response, root)
@@ -212,8 +212,8 @@ module ActiveMerchant #:nodoc:
212
212
  xml.tag! 'Expiry_Date', expdate(credit_card)
213
213
  xml.tag! 'CardHoldersName', credit_card.name
214
214
  xml.tag! 'CardType', card_type(credit_card.brand)
215
- xml.tag! 'WalletProviderID', options[:wallet_provider_id] if options[:wallet_provider_id]
216
215
 
216
+ add_wallet_provider_id(xml, credit_card, options)
217
217
  add_credit_card_eci(xml, credit_card, options)
218
218
  add_credit_card_verification_strings(xml, credit_card, options)
219
219
  end
@@ -221,10 +221,9 @@ module ActiveMerchant #:nodoc:
221
221
 
222
222
  def add_credit_card_eci(xml, credit_card, options)
223
223
  eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
224
- # Discover requires any Apple Pay transaction, regardless of in-app
225
- # or web, and regardless of the ECI contained in the PKPaymentToken,
226
- # to have an ECI value explicitly of 04.
227
- '04'
224
+ # Payeezy requires an ECI of 5 for apple pay transactions
225
+ # See: https://support.payeezy.com/hc/en-us/articles/203730589-Ecommerce-Flag-Values
226
+ '05'
228
227
  else
229
228
  (credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
230
229
  end
@@ -269,16 +268,29 @@ module ActiveMerchant #:nodoc:
269
268
  first_name: params[2],
270
269
  last_name: params[3],
271
270
  month: params[4],
272
- year: params[5])
271
+ year: params[5]
272
+ )
273
273
 
274
274
  xml.tag! 'TransarmorToken', params[0]
275
275
  xml.tag! 'Expiry_Date', expdate(credit_card)
276
276
  xml.tag! 'CardHoldersName', credit_card.name
277
277
  xml.tag! 'CardType', card_type(credit_card.brand)
278
- xml.tag! 'WalletProviderID', options[:wallet_provider_id] if options[:wallet_provider_id]
278
+
279
+ add_wallet_provider_id(xml, credit_card, options)
279
280
  add_card_authentication_data(xml, options)
280
281
  end
281
282
 
283
+ def add_wallet_provider_id(xml, credit_card, options)
284
+ provider_id = if options[:wallet_provider_id]
285
+ options[:wallet_provider_id]
286
+ elsif credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay
287
+ # See: https://support.payeezy.com/hc/en-us/articles/206601408-First-Data-Payeezy-Gateway-Web-Service-API-Reference-Guide#3.9
288
+ 4
289
+ end
290
+
291
+ xml.tag! 'WalletProviderID', provider_id if provider_id
292
+ end
293
+
282
294
  def add_customer_data(xml, options)
283
295
  xml.tag! 'Customer_Ref', options[:customer] if options[:customer]
284
296
  xml.tag! 'Client_IP', options[:ip] if options[:ip]
@@ -371,10 +383,9 @@ module ActiveMerchant #:nodoc:
371
383
  Response.new(successful?(response), message_from(response), response,
372
384
  test: test?,
373
385
  authorization: successful?(response) ? response_authorization(action, response, credit_card) : '',
374
- avs_result: {code: response[:avs]},
386
+ avs_result: { code: response[:avs] },
375
387
  cvv_result: response[:cvv2],
376
- error_code: standard_error_code(response)
377
- )
388
+ error_code: standard_error_code(response))
378
389
  end
379
390
 
380
391
  def headers(method, url, request)
@@ -19,19 +19,19 @@ module ActiveMerchant #:nodoc:
19
19
  'diners_club' => 'DINERS'
20
20
  }
21
21
 
22
- def initialize(options={})
22
+ def initialize(options = {})
23
23
  requires!(options, :username, :password, :account_id)
24
24
  super
25
25
  end
26
26
 
27
- def purchase(amount, payment_method, options={})
27
+ def purchase(amount, payment_method, options = {})
28
28
  MultiResponse.run do |r|
29
29
  r.process { authorize(amount, payment_method, options) }
30
30
  r.process { capture(amount, r.authorization, options) }
31
31
  end
32
32
  end
33
33
 
34
- def authorize(amount, payment_method, options={})
34
+ def authorize(amount, payment_method, options = {})
35
35
  post = {}
36
36
  add_invoice(post, amount, options)
37
37
  add_payment_method(post, payment_method)
@@ -40,7 +40,7 @@ module ActiveMerchant #:nodoc:
40
40
  commit('ProcessAuthorise', post)
41
41
  end
42
42
 
43
- def capture(amount, authorization, options={})
43
+ def capture(amount, authorization, options = {})
44
44
  post = {}
45
45
  add_invoice(post, amount, options)
46
46
  add_reference(post, authorization)
@@ -49,7 +49,7 @@ module ActiveMerchant #:nodoc:
49
49
  commit('ProcessCapture', post)
50
50
  end
51
51
 
52
- def refund(amount, authorization, options={})
52
+ def refund(amount, authorization, options = {})
53
53
  post = {}
54
54
  add_invoice(post, amount, options)
55
55
  add_reference(post, authorization)
@@ -71,7 +71,7 @@ module ActiveMerchant #:nodoc:
71
71
 
72
72
  private
73
73
 
74
- CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
74
+ CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
75
75
  CURRENCY_CODES['NZD'] = '554'
76
76
 
77
77
  def add_invoice(post, money, options)
@@ -142,7 +142,7 @@ module ActiveMerchant #:nodoc:
142
142
  end
143
143
 
144
144
  def envelope_wrap(action, body)
145
- <<~EOS
145
+ <<~XML
146
146
  <?xml version="1.0" encoding="utf-8"?>
147
147
  <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
148
148
  <soap12:Body>
@@ -151,7 +151,7 @@ module ActiveMerchant #:nodoc:
151
151
  </#{action}>
152
152
  </soap12:Body>
153
153
  </soap12:Envelope>
154
- EOS
154
+ XML
155
155
  end
156
156
 
157
157
  def url
@@ -3,7 +3,7 @@ module ActiveMerchant #:nodoc:
3
3
  class Flo2cashSimpleGateway < Flo2cashGateway
4
4
  self.display_name = 'Flo2Cash Simple'
5
5
 
6
- def purchase(amount, payment_method, options={})
6
+ def purchase(amount, payment_method, options = {})
7
7
  post = {}
8
8
  add_invoice(post, amount, options)
9
9
  add_payment_method(post, payment_method)
@@ -15,36 +15,40 @@ module ActiveMerchant #:nodoc:
15
15
  self.homepage_url = 'https://www.forte.net'
16
16
  self.display_name = 'Forte'
17
17
 
18
- def initialize(options={})
18
+ def initialize(options = {})
19
19
  requires!(options, :api_key, :secret, :location_id, :account_id)
20
20
  super
21
21
  end
22
22
 
23
- def purchase(money, payment_method, options={})
23
+ def purchase(money, payment_method, options = {})
24
24
  post = {}
25
25
  add_amount(post, money, options)
26
+ add_service_fee(post, options)
26
27
  add_invoice(post, options)
27
28
  add_payment_method(post, payment_method, options)
28
29
  add_billing_address(post, payment_method, options)
29
30
  add_shipping_address(post, options)
31
+ add_xdata(post, options)
30
32
  post[:action] = 'sale'
31
33
 
32
34
  commit(:post, post)
33
35
  end
34
36
 
35
- def authorize(money, payment_method, options={})
37
+ def authorize(money, payment_method, options = {})
36
38
  post = {}
37
39
  add_amount(post, money, options)
40
+ add_service_fee(post, options)
38
41
  add_invoice(post, options)
39
42
  add_payment_method(post, payment_method, options)
40
43
  add_billing_address(post, payment_method, options)
41
44
  add_shipping_address(post, options)
45
+ add_xdata(post, options)
42
46
  post[:action] = 'authorize'
43
47
 
44
48
  commit(:post, post)
45
49
  end
46
50
 
47
- def capture(money, authorization, options={})
51
+ def capture(money, authorization, options = {})
48
52
  post = {}
49
53
  post[:transaction_id] = transaction_id_from(authorization)
50
54
  post[:authorization_code] = authorization_code_from(authorization) || ''
@@ -53,7 +57,7 @@ module ActiveMerchant #:nodoc:
53
57
  commit(:put, post)
54
58
  end
55
59
 
56
- def credit(money, payment_method, options={})
60
+ def credit(money, payment_method, options = {})
57
61
  post = {}
58
62
  add_amount(post, money, options)
59
63
  add_invoice(post, options)
@@ -64,7 +68,7 @@ module ActiveMerchant #:nodoc:
64
68
  commit(:post, post)
65
69
  end
66
70
 
67
- def refund(money, authorization, options={})
71
+ def refund(money, authorization, options = {})
68
72
  post = {}
69
73
  add_amount(post, money, options)
70
74
  post[:original_transaction_id] = transaction_id_from(authorization)
@@ -74,7 +78,7 @@ module ActiveMerchant #:nodoc:
74
78
  commit(:post, post)
75
79
  end
76
80
 
77
- def void(authorization, options={})
81
+ def void(authorization, options = {})
78
82
  post = {}
79
83
  post[:transaction_id] = transaction_id_from(authorization)
80
84
  post[:authorization_code] = authorization_code_from(authorization)
@@ -83,7 +87,7 @@ module ActiveMerchant #:nodoc:
83
87
  commit(:put, post)
84
88
  end
85
89
 
86
- def verify(credit_card, options={})
90
+ def verify(credit_card, options = {})
87
91
  MultiResponse.run(:use_first_response) do |r|
88
92
  r.process { authorize(100, credit_card, options) }
89
93
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -116,6 +120,20 @@ module ActiveMerchant #:nodoc:
116
120
  post[:authorization_amount] = amount(money)
117
121
  end
118
122
 
123
+ def add_service_fee(post, options)
124
+ post[:service_fee_amount] = options[:service_fee_amount] if options[:service_fee_amount]
125
+ end
126
+
127
+ def add_xdata(post, options)
128
+ post[:xdata] = {}
129
+ if xdata = options[:xdata]
130
+ (1..9).each do |n|
131
+ field = "xdata_#{n}".to_sym
132
+ post[:xdata][field] = xdata[field] if xdata[field]
133
+ end
134
+ end
135
+ end
136
+
119
137
  def add_billing_address(post, payment, options)
120
138
  post[:billing_address] = {}
121
139
  if address = options[:billing_address] || options[:address]
@@ -12,19 +12,19 @@ module ActiveMerchant #:nodoc:
12
12
  self.money_format = :cents
13
13
  self.supported_cardtypes = %i[visa master american_express discover naranja cabal]
14
14
 
15
- def initialize(options={})
15
+ def initialize(options = {})
16
16
  requires!(options, :merchant_id, :api_key_id, :secret_api_key)
17
17
  super
18
18
  end
19
19
 
20
- def purchase(money, payment, options={})
20
+ def purchase(money, payment, options = {})
21
21
  MultiResponse.run do |r|
22
22
  r.process { authorize(money, payment, options) }
23
23
  r.process { capture(money, r.authorization, options) } if should_request_capture?(r, options[:requires_approval])
24
24
  end
25
25
  end
26
26
 
27
- def authorize(money, payment, options={})
27
+ def authorize(money, payment, options = {})
28
28
  post = nestable_hash
29
29
  add_order(post, money, options)
30
30
  add_payment(post, payment, options)
@@ -32,10 +32,11 @@ module ActiveMerchant #:nodoc:
32
32
  add_address(post, payment, options)
33
33
  add_creator_info(post, options)
34
34
  add_fraud_fields(post, options)
35
+ add_external_cardholder_authentication_data(post, options)
35
36
  commit(:authorize, post)
36
37
  end
37
38
 
38
- def capture(money, authorization, options={})
39
+ def capture(money, authorization, options = {})
39
40
  post = nestable_hash
40
41
  add_order(post, money, options, capture: true)
41
42
  add_customer_data(post, options)
@@ -43,7 +44,7 @@ module ActiveMerchant #:nodoc:
43
44
  commit(:capture, post, authorization)
44
45
  end
45
46
 
46
- def refund(money, authorization, options={})
47
+ def refund(money, authorization, options = {})
47
48
  post = nestable_hash
48
49
  add_amount(post, money, options)
49
50
  add_refund_customer_data(post, options)
@@ -51,13 +52,13 @@ module ActiveMerchant #:nodoc:
51
52
  commit(:refund, post, authorization)
52
53
  end
53
54
 
54
- def void(authorization, options={})
55
+ def void(authorization, options = {})
55
56
  post = nestable_hash
56
57
  add_creator_info(post, options)
57
58
  commit(:void, post, authorization)
58
59
  end
59
60
 
60
- def verify(payment, options={})
61
+ def verify(payment, options = {})
61
62
  MultiResponse.run(:use_first_response) do |r|
62
63
  r.process { authorize(100, payment, options) }
63
64
  r.process { void(r.authorization, options) }
@@ -142,7 +143,7 @@ module ActiveMerchant #:nodoc:
142
143
  post['shoppingCartExtension']['extensionID'] = options[:extension_ID] if options[:extension_ID]
143
144
  end
144
145
 
145
- def add_amount(post, money, options={})
146
+ def add_amount(post, money, options = {})
146
147
  post['amountOfMoney'] = {
147
148
  'amount' => amount(money),
148
149
  'currencyCode' => options[:currency] || currency(money)
@@ -200,21 +201,21 @@ module ActiveMerchant #:nodoc:
200
201
  shipping_address = options[:shipping_address]
201
202
  if billing_address = options[:billing_address] || options[:address]
202
203
  post['order']['customer']['billingAddress'] = {
203
- 'street' => billing_address[:address1],
204
- 'additionalInfo' => billing_address[:address2],
204
+ 'street' => truncate(billing_address[:address1], 50),
205
+ 'additionalInfo' => truncate(billing_address[:address2], 50),
205
206
  'zip' => billing_address[:zip],
206
207
  'city' => billing_address[:city],
207
- 'state' => billing_address[:state],
208
+ 'state' => truncate(billing_address[:state], 35),
208
209
  'countryCode' => billing_address[:country]
209
210
  }
210
211
  end
211
212
  if shipping_address
212
213
  post['order']['customer']['shippingAddress'] = {
213
- 'street' => shipping_address[:address1],
214
- 'additionalInfo' => shipping_address[:address2],
214
+ 'street' => truncate(shipping_address[:address1], 50),
215
+ 'additionalInfo' => truncate(shipping_address[:address2], 50),
215
216
  'zip' => shipping_address[:zip],
216
217
  'city' => shipping_address[:city],
217
- 'state' => shipping_address[:state],
218
+ 'state' => truncate(shipping_address[:state], 35),
218
219
  'countryCode' => shipping_address[:country]
219
220
  }
220
221
  post['order']['customer']['shippingAddress']['name'] = {
@@ -232,6 +233,24 @@ module ActiveMerchant #:nodoc:
232
233
  post['fraudFields'] = fraud_fields unless fraud_fields.empty?
233
234
  end
234
235
 
236
+ def add_external_cardholder_authentication_data(post, options)
237
+ return unless threeds_2_options = options[:three_d_secure]
238
+
239
+ authentication_data = {}
240
+ authentication_data[:acsTransactionId] = threeds_2_options[:acs_transaction_id] if threeds_2_options[:acs_transaction_id]
241
+ authentication_data[:cavv] = threeds_2_options[:cavv] if threeds_2_options[:cavv]
242
+ authentication_data[:cavvAlgorithm] = threeds_2_options[:cavv_algorithm] if threeds_2_options[:cavv_algorithm]
243
+ authentication_data[:directoryServerTransactionId] = threeds_2_options[:ds_transaction_id] if threeds_2_options[:ds_transaction_id]
244
+ authentication_data[:eci] = threeds_2_options[:eci] if threeds_2_options[:eci]
245
+ authentication_data[:threeDSecureVersion] = threeds_2_options[:version] if threeds_2_options[:version]
246
+ authentication_data[:validationResult] = threeds_2_options[:authentication_response_status] if threeds_2_options[:authentication_response_status]
247
+ authentication_data[:xid] = threeds_2_options[:xid] if threeds_2_options[:xid]
248
+
249
+ post['cardPaymentMethodSpecificInput'] ||= {}
250
+ post['cardPaymentMethodSpecificInput']['threeDSecure'] ||= {}
251
+ post['cardPaymentMethodSpecificInput']['threeDSecure']['externalCardholderAuthenticationData'] = authentication_data unless authentication_data.empty?
252
+ end
253
+
235
254
  def add_number_of_installments(post, options)
236
255
  post['order']['additionalInput']['numberOfInstallments'] = options[:number_of_installments] if options[:number_of_installments]
237
256
  end
@@ -296,12 +315,12 @@ module ActiveMerchant #:nodoc:
296
315
  end
297
316
 
298
317
  def auth_digest(action, post, authorization = nil)
299
- data = <<~EOS
318
+ data = <<~REQUEST
300
319
  POST
301
320
  #{content_type}
302
321
  #{date}
303
322
  #{uri(action, authorization)}
304
- EOS
323
+ REQUEST
305
324
  digest = OpenSSL::Digest.new('sha256')
306
325
  key = @options[:secret_api_key]
307
326
  "GCS v1HMAC:#{@options[:api_key_id]}:#{Base64.strict_encode64(OpenSSL::HMAC.digest(digest, key, data))}"
@@ -20,12 +20,12 @@ module ActiveMerchant #:nodoc:
20
20
  # :global_password - Your Global password
21
21
  # :term_type - 3 character field assigned by Global Transport after
22
22
  # - your application is certified.
23
- def initialize(options={})
23
+ def initialize(options = {})
24
24
  requires!(options, :global_user_name, :global_password, :term_type)
25
25
  super
26
26
  end
27
27
 
28
- def purchase(money, payment_method, options={})
28
+ def purchase(money, payment_method, options = {})
29
29
  post = {}
30
30
  add_invoice(post, money, options)
31
31
  add_payment_method(post, payment_method)
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  commit('Sale', post, options)
35
35
  end
36
36
 
37
- def authorize(money, payment_method, options={})
37
+ def authorize(money, payment_method, options = {})
38
38
  post = {}
39
39
  add_invoice(post, money, options)
40
40
  add_payment_method(post, payment_method)
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
43
43
  commit('Auth', post, options)
44
44
  end
45
45
 
46
- def capture(money, authorization, options={})
46
+ def capture(money, authorization, options = {})
47
47
  post = {}
48
48
  add_invoice(post, money, options)
49
49
  add_auth(post, authorization)
@@ -51,7 +51,7 @@ module ActiveMerchant #:nodoc:
51
51
  commit('Force', post, options)
52
52
  end
53
53
 
54
- def refund(money, authorization, options={})
54
+ def refund(money, authorization, options = {})
55
55
  post = {}
56
56
  add_invoice(post, money, options)
57
57
  add_auth(post, authorization)
@@ -59,14 +59,14 @@ module ActiveMerchant #:nodoc:
59
59
  commit('Return', post, options)
60
60
  end
61
61
 
62
- def void(authorization, options={})
62
+ def void(authorization, options = {})
63
63
  post = {}
64
64
  add_auth(post, authorization)
65
65
 
66
66
  commit('Void', post, options)
67
67
  end
68
68
 
69
- def verify(payment_method, options={})
69
+ def verify(payment_method, options = {})
70
70
  post = {}
71
71
  add_payment_method(post, payment_method)
72
72
  add_address(post, options)