activemerchant 1.100.0 → 1.133.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +1057 -0
  3. data/README.md +11 -9
  4. data/lib/active_merchant/billing/avs_result.rb +9 -9
  5. data/lib/active_merchant/billing/base.rb +0 -13
  6. data/lib/active_merchant/billing/check.rb +49 -17
  7. data/lib/active_merchant/billing/compatibility.rb +5 -4
  8. data/lib/active_merchant/billing/credit_card.rb +55 -8
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
  10. data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
  11. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  12. data/lib/active_merchant/billing/gateway.rb +38 -36
  13. data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
  14. data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
  15. data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +14 -14
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
  21. data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
  24. data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
  33. data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
  34. data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
  40. data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
  41. data/lib/active_merchant/billing/gateways/cams.rb +10 -10
  42. data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
  43. data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
  44. data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
  45. data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
  46. data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
  47. data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
  48. data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
  49. data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
  50. data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
  51. data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
  52. data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
  53. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
  54. data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
  55. data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
  57. data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
  59. data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
  61. data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
  62. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
  63. data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
  64. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
  65. data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
  66. data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
  67. data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
  68. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  69. data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
  70. data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
  71. data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
  72. data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
  73. data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
  74. data/lib/active_merchant/billing/gateways/element.rb +71 -21
  75. data/lib/active_merchant/billing/gateways/epay.rb +43 -43
  76. data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
  77. data/lib/active_merchant/billing/gateways/eway.rb +9 -9
  78. data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
  79. data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
  80. data/lib/active_merchant/billing/gateways/exact.rb +19 -20
  81. data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
  82. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
  83. data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
  84. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
  85. data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
  86. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
  87. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
  88. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
  89. data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
  90. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  91. data/lib/active_merchant/billing/gateways/forte.rb +38 -22
  92. data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
  93. data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
  94. data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
  95. data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
  96. data/lib/active_merchant/billing/gateways/hps.rb +171 -50
  97. data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
  98. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
  100. data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
  101. data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
  102. data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
  103. data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
  104. data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
  105. data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
  106. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  107. data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
  108. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
  109. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  110. data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
  111. data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
  112. data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
  113. data/lib/active_merchant/billing/gateways/litle.rb +181 -45
  114. data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
  115. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
  117. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
  118. data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
  119. data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
  120. data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
  121. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
  122. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
  123. data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
  124. data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
  125. data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
  126. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  127. data/lib/active_merchant/billing/gateways/migs.rb +18 -21
  128. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  129. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
  130. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  131. data/lib/active_merchant/billing/gateways/monei.rb +236 -150
  132. data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
  133. data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
  134. data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
  135. data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
  136. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
  137. data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
  138. data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
  139. data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
  140. data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
  141. data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
  142. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
  143. data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
  144. data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
  145. data/lib/active_merchant/billing/gateways/omise.rb +15 -16
  146. data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
  147. data/lib/active_merchant/billing/gateways/opp.rb +39 -33
  148. data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
  149. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
  150. data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
  151. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
  152. data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
  153. data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
  154. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  155. data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
  156. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
  157. data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
  158. data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
  159. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
  160. data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
  161. data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
  162. data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
  163. data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
  164. data/lib/active_merchant/billing/gateways/payex.rb +24 -25
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  167. data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  169. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  170. data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
  171. data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
  172. data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
  173. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  175. data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
  176. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  177. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  178. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
  179. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  180. data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
  181. data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
  182. data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
  183. data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
  184. data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
  185. data/lib/active_merchant/billing/gateways/payway.rb +22 -22
  186. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  187. data/lib/active_merchant/billing/gateways/pin.rb +60 -21
  188. data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
  190. data/lib/active_merchant/billing/gateways/priority.rb +392 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
  192. data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
  194. data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
  195. data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
  203. data/lib/active_merchant/billing/gateways/reach.rb +277 -0
  204. data/lib/active_merchant/billing/gateways/realex.rb +42 -16
  205. data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
  206. data/lib/active_merchant/billing/gateways/s5.rb +10 -9
  207. data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
  208. data/lib/active_merchant/billing/gateways/sage.rb +19 -21
  209. data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
  210. data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
  211. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
  212. data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
  213. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
  214. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
  215. data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
  216. data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
  217. data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
  218. data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
  219. data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
  220. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
  221. data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
  222. data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
  223. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
  224. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
  225. data/lib/active_merchant/billing/gateways/telr.rb +17 -18
  226. data/lib/active_merchant/billing/gateways/tns.rb +3 -7
  227. data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
  228. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
  229. data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
  230. data/lib/active_merchant/billing/gateways/transax.rb +1 -2
  231. data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
  232. data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
  233. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
  234. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
  235. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
  236. data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
  237. data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
  238. data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
  239. data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
  240. data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
  241. data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
  242. data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
  243. data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
  244. data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
  245. data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
  246. data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
  247. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
  248. data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
  249. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
  250. data/lib/active_merchant/billing/response.rb +25 -6
  251. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  252. data/lib/active_merchant/billing.rb +1 -0
  253. data/lib/active_merchant/connection.rb +14 -15
  254. data/lib/active_merchant/country.rb +3 -1
  255. data/lib/active_merchant/errors.rb +4 -1
  256. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  257. data/lib/active_merchant/network_connection_retries.rb +15 -17
  258. data/lib/active_merchant/post_data.rb +3 -2
  259. data/lib/active_merchant/posts_data.rb +2 -2
  260. data/lib/active_merchant/version.rb +1 -1
  261. data/lib/active_merchant.rb +2 -2
  262. data/lib/certs/cacert.pem +1587 -2361
  263. data/lib/support/gateway_support.rb +1 -1
  264. data/lib/support/ssl_verify.rb +3 -7
  265. data/lib/support/ssl_version.rb +2 -3
  266. metadata +86 -34
  267. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -6,8 +6,8 @@ module ActiveMerchant #:nodoc:
6
6
  self.live_url = 'https://www.bambora.co.nz/interface/api'
7
7
  self.test_url = 'https://demo.bambora.co.nz/interface/api'
8
8
 
9
- self.supported_countries = ['AU', 'NZ']
10
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
9
+ self.supported_countries = %w[AU NZ]
10
+ self.supported_cardtypes = %i[visa master american_express diners_club jcb]
11
11
 
12
12
  self.homepage_url = 'http://www.bambora.com/'
13
13
  self.display_name = 'Bambora Asia-Pacific'
@@ -18,19 +18,19 @@ module ActiveMerchant #:nodoc:
18
18
  '05' => STANDARD_ERROR_CODE[:card_declined],
19
19
  '06' => STANDARD_ERROR_CODE[:processing_error],
20
20
  '14' => STANDARD_ERROR_CODE[:invalid_number],
21
- '54' => STANDARD_ERROR_CODE[:expired_card],
21
+ '54' => STANDARD_ERROR_CODE[:expired_card]
22
22
  }
23
23
 
24
- def initialize(options={})
24
+ def initialize(options = {})
25
25
  requires!(options, :username, :password)
26
26
  super
27
27
  end
28
28
 
29
- def purchase(money, payment, options={})
29
+ def purchase(money, payment, options = {})
30
30
  commit('SubmitSinglePayment') do |xml|
31
31
  xml.Transaction do
32
32
  xml.CustRef options[:order_id]
33
- add_amount(xml, money)
33
+ xml.Amount amount(money)
34
34
  xml.TrnType '1'
35
35
  add_payment(xml, payment)
36
36
  add_credentials(xml, options)
@@ -39,11 +39,11 @@ module ActiveMerchant #:nodoc:
39
39
  end
40
40
  end
41
41
 
42
- def authorize(money, payment, options={})
42
+ def authorize(money, payment, options = {})
43
43
  commit('SubmitSinglePayment') do |xml|
44
44
  xml.Transaction do
45
45
  xml.CustRef options[:order_id]
46
- add_amount(xml, money)
46
+ xml.Amount amount(money)
47
47
  xml.TrnType '2'
48
48
  add_payment(xml, payment)
49
49
  add_credentials(xml, options)
@@ -52,37 +52,37 @@ module ActiveMerchant #:nodoc:
52
52
  end
53
53
  end
54
54
 
55
- def capture(money, authorization, options={})
55
+ def capture(money, authorization, options = {})
56
56
  commit('SubmitSingleCapture') do |xml|
57
57
  xml.Capture do
58
58
  xml.Receipt authorization
59
- add_amount(xml, money)
59
+ xml.Amount amount(money)
60
60
  add_credentials(xml, options)
61
61
  end
62
62
  end
63
63
  end
64
64
 
65
- def refund(money, authorization, options={})
65
+ def refund(money, authorization, options = {})
66
66
  commit('SubmitSingleRefund') do |xml|
67
67
  xml.Refund do
68
68
  xml.Receipt authorization
69
- add_amount(xml, money)
69
+ xml.Amount amount(money)
70
70
  add_credentials(xml, options)
71
71
  end
72
72
  end
73
73
  end
74
74
 
75
- def void(money, authorization, options={})
75
+ def void(authorization, options = {})
76
76
  commit('SubmitSingleVoid') do |xml|
77
77
  xml.Void do
78
78
  xml.Receipt authorization
79
- add_amount(xml, money)
79
+ xml.Amount amount(options[:amount])
80
80
  add_credentials(xml, options)
81
81
  end
82
82
  end
83
83
  end
84
84
 
85
- def store(payment, options={})
85
+ def store(payment, options = {})
86
86
  commit('TokeniseCreditCard') do |xml|
87
87
  xml.TokeniseCreditCard do
88
88
  xml.CardNumber payment.number
@@ -116,10 +116,6 @@ module ActiveMerchant #:nodoc:
116
116
  end
117
117
  end
118
118
 
119
- def add_amount(xml, money)
120
- xml.Amount amount(money)
121
- end
122
-
123
119
  def add_payment(xml, payment)
124
120
  if payment.is_a?(String)
125
121
  add_token(xml, payment)
@@ -136,7 +132,7 @@ module ActiveMerchant #:nodoc:
136
132
  end
137
133
 
138
134
  def add_credit_card(xml, payment)
139
- xml.CreditCard :Registered => 'False' do
135
+ xml.CreditCard Registered: 'False' do
140
136
  xml.CardNumber payment.number
141
137
  xml.ExpM format(payment.month, :two_digits)
142
138
  xml.ExpY format(payment.year, :four_digits)
@@ -9,9 +9,9 @@ module ActiveMerchant #:nodoc:
9
9
  self.test_url = 'https://test.ctpe.io/payment/ctpe'
10
10
  self.live_url = 'https://ctpe.io/payment/ctpe'
11
11
 
12
- self.supported_countries = ['LI', 'US']
12
+ self.supported_countries = %w[LI US]
13
13
  self.default_currency = 'EUR'
14
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
14
+ self.supported_cardtypes = %i[visa master american_express discover]
15
15
 
16
16
  self.homepage_url = 'http://www.bankfrickacquiring.com/'
17
17
  self.display_name = 'Bank Frick'
@@ -24,15 +24,15 @@ module ActiveMerchant #:nodoc:
24
24
  'authonly' => 'CC.PA',
25
25
  'capture' => 'CC.CP',
26
26
  'refund' => 'CC.RF',
27
- 'void' => 'CC.RV',
27
+ 'void' => 'CC.RV'
28
28
  }
29
29
 
30
- def initialize(options={})
30
+ def initialize(options = {})
31
31
  requires!(options, :sender, :channel, :userid, :userpwd)
32
32
  super
33
33
  end
34
34
 
35
- def purchase(money, payment, options={})
35
+ def purchase(money, payment, options = {})
36
36
  post = {}
37
37
  add_invoice(post, money, options)
38
38
  add_payment(post, payment)
@@ -42,7 +42,7 @@ module ActiveMerchant #:nodoc:
42
42
  commit('sale', post)
43
43
  end
44
44
 
45
- def authorize(money, payment, options={})
45
+ def authorize(money, payment, options = {})
46
46
  post = {}
47
47
  add_invoice(post, money, options)
48
48
  add_payment(post, payment)
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
52
52
  commit('authonly', post)
53
53
  end
54
54
 
55
- def capture(money, authorization, options={})
55
+ def capture(money, authorization, options = {})
56
56
  post = {}
57
57
  post[:authorization] = authorization
58
58
  add_invoice(post, money, options)
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  commit('capture', post)
61
61
  end
62
62
 
63
- def refund(money, authorization, options={})
63
+ def refund(money, authorization, options = {})
64
64
  post = {}
65
65
  post[:authorization] = authorization
66
66
  add_invoice(post, money, options)
@@ -68,14 +68,14 @@ module ActiveMerchant #:nodoc:
68
68
  commit('refund', post)
69
69
  end
70
70
 
71
- def void(authorization, options={})
71
+ def void(authorization, options = {})
72
72
  post = {}
73
73
  post[:authorization] = authorization
74
74
 
75
75
  commit('void', post)
76
76
  end
77
77
 
78
- def verify(credit_card, options={})
78
+ def verify(credit_card, options = {})
79
79
  MultiResponse.run(:use_first_response) do |r|
80
80
  r.process { authorize(100, credit_card, options) }
81
81
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -97,7 +97,7 @@ module ActiveMerchant #:nodoc:
97
97
  post[:zip] = address[:zip].to_s
98
98
  post[:city] = address[:city].to_s
99
99
  post[:country] = address[:country].to_s
100
- post[:state] = address[:state].blank? ? 'n/a' : address[:state]
100
+ post[:state] = address[:state].blank? ? 'n/a' : address[:state]
101
101
  end
102
102
  end
103
103
 
@@ -119,7 +119,7 @@ module ActiveMerchant #:nodoc:
119
119
  end
120
120
 
121
121
  def parse(body)
122
- results = {}
122
+ results = {}
123
123
  xml = Nokogiri::XML(body)
124
124
  resp = xml.xpath('//Response/Transaction/Identification')
125
125
  resp.children.each do |element|
@@ -166,7 +166,7 @@ module ActiveMerchant #:nodoc:
166
166
  end
167
167
 
168
168
  def build_xml_request(action, data)
169
- xml = Builder::XmlMarkup.new :indent => 2
169
+ xml = Builder::XmlMarkup.new indent: 2
170
170
  xml.Request(version: '1.0') do
171
171
  xml.Header do
172
172
  xml.Security(sender: @options[:sender], type: 'MERCHANT')
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  URL = 'https://banwire.com/api.pago_pro'
5
5
 
6
6
  self.supported_countries = ['MX']
7
- self.supported_cardtypes = [:visa, :master, :american_express]
7
+ self.supported_cardtypes = %i[visa master american_express]
8
8
  self.homepage_url = 'http://www.banwire.com/'
9
9
  self.display_name = 'Banwire'
10
10
 
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  post[:card_num] = creditcard.number
64
64
  post[:card_name] = creditcard.name
65
65
  post[:card_type] = card_brand(creditcard)
66
- post[:card_exp] = "#{sprintf("%02d", creditcard.month)}/#{creditcard.year.to_s[-2, 2]}"
66
+ post[:card_exp] = "#{sprintf('%02d', creditcard.month)}/#{creditcard.year.to_s[-2, 2]}"
67
67
  post[:card_ccv2] = creditcard.verification_value
68
68
  end
69
69
 
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
 
75
75
  def card_brand(card)
76
76
  brand = super
77
- ({'master' => 'mastercard', 'american_express' => 'amex'}[brand] || brand)
77
+ ({ 'master' => 'mastercard', 'american_express' => 'amex' }[brand] || brand)
78
78
  end
79
79
 
80
80
  def parse(body)
@@ -92,8 +92,8 @@ module ActiveMerchant #:nodoc:
92
92
  Response.new(success?(response),
93
93
  response['message'],
94
94
  response,
95
- :test => test?,
96
- :authorization => response['code_auth'])
95
+ test: test?,
96
+ authorization: response['code_auth'])
97
97
  end
98
98
 
99
99
  def success?(response)
@@ -4,11 +4,12 @@ module ActiveMerchant #:nodoc:
4
4
  self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
5
5
  self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
6
6
 
7
- self.supported_countries = ['AL', 'AD', 'AM', 'AT', 'AZ', 'BY', 'BE', 'BA', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IS', 'IE', 'IT', 'KZ', 'LV', 'LI', 'LT', 'LU', 'MK', 'MT', 'MD', 'MC', 'ME', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SM', 'RS', 'SK', 'SI', 'ES', 'SE', 'CH', 'TR', 'UA', 'GB', 'VA']
7
+ self.supported_countries = %w[AL AD AM AT AZ BY BE BA BG HR CY CZ DK EE FI FR DE GR HU IS IE IT KZ LV LI LT LU MK MT MD MC ME NL NO PL PT RO RU SM RS SK SI ES SE CH TR UA GB VA]
8
8
  self.default_currency = 'EUR'
9
- self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND)
9
+ self.currencies_with_three_decimal_places = %w(BHD KWD OMR RSD TND IQD JOD LYD)
10
10
  self.money_format = :cents
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :dankort, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb dankort maestro]
12
+ self.currencies_without_fractions = %w(CVE DJF GNF IDR JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
12
13
 
13
14
  self.homepage_url = 'https://www.barclaycardsmartpay.com/'
14
15
  self.display_name = 'Barclaycard Smartpay'
@@ -71,21 +72,23 @@ module ActiveMerchant #:nodoc:
71
72
  post[:shopperName] = options[:shopper_name] if options[:shopper_name]
72
73
 
73
74
  if options[:third_party_payout]
74
- post[:recurring] = options[:recurring_contract] || {contract: 'PAYOUT'}
75
+ post[:recurring] = options[:recurring_contract] || { contract: 'PAYOUT' }
75
76
  MultiResponse.run do |r|
76
77
  r.process {
77
78
  commit(
78
79
  'storeDetailAndSubmitThirdParty',
79
80
  post,
80
81
  @options[:store_payout_account],
81
- @options[:store_payout_password])
82
+ @options[:store_payout_password]
83
+ )
82
84
  }
83
85
  r.process {
84
86
  commit(
85
87
  'confirmThirdParty',
86
88
  modification_request(r.authorization, @options),
87
89
  @options[:review_payout_account],
88
- @options[:review_payout_password])
90
+ @options[:review_payout_password]
91
+ )
89
92
  }
90
93
  end
91
94
  else
@@ -108,7 +111,7 @@ module ActiveMerchant #:nodoc:
108
111
  def store(creditcard, options = {})
109
112
  post = store_request(options)
110
113
  post[:card] = credit_card_hash(creditcard)
111
- post[:recurring] = {:contract => 'RECURRING'}
114
+ post[:recurring] = { contract: 'RECURRING' }
112
115
 
113
116
  commit('store', post)
114
117
  end
@@ -129,25 +132,25 @@ module ActiveMerchant #:nodoc:
129
132
  # Smartpay may return AVS codes not covered by standard AVSResult codes.
130
133
  # Smartpay's descriptions noted below.
131
134
  AVS_MAPPING = {
132
- '0' => 'R', # Unknown
133
- '1' => 'A', # Address matches, postal code doesn't
134
- '2' => 'N', # Neither postal code nor address match
135
- '3' => 'R', # AVS unavailable
136
- '4' => 'E', # AVS not supported for this card type
137
- '5' => 'U', # No AVS data provided
138
- '6' => 'Z', # Postal code matches, address doesn't match
139
- '7' => 'D', # Both postal code and address match
140
- '8' => 'U', # Address not checked, postal code unknown
141
- '9' => 'B', # Address matches, postal code unknown
142
- '10' => 'N', # Address doesn't match, postal code unknown
143
- '11' => 'U', # Postal code not checked, address unknown
144
- '12' => 'B', # Address matches, postal code not checked
145
- '13' => 'U', # Address doesn't match, postal code not checked
146
- '14' => 'P', # Postal code matches, address unknown
147
- '15' => 'P', # Postal code matches, address not checked
148
- '16' => 'N', # Postal code doesn't match, address unknown
149
- '17' => 'U', # Postal code doesn't match, address not checked
150
- '18' => 'I' # Neither postal code nor address were checked
135
+ '0' => 'R', # Unknown
136
+ '1' => 'A', # Address matches, postal code doesn't
137
+ '2' => 'N', # Neither postal code nor address match
138
+ '3' => 'R', # AVS unavailable
139
+ '4' => 'E', # AVS not supported for this card type
140
+ '5' => 'U', # No AVS data provided
141
+ '6' => 'Z', # Postal code matches, address doesn't match
142
+ '7' => 'D', # Both postal code and address match
143
+ '8' => 'U', # Address not checked, postal code unknown
144
+ '9' => 'B', # Address matches, postal code unknown
145
+ '10' => 'N', # Address doesn't match, postal code unknown
146
+ '11' => 'U', # Postal code not checked, address unknown
147
+ '12' => 'B', # Address matches, postal code not checked
148
+ '13' => 'U', # Address doesn't match, postal code not checked
149
+ '14' => 'P', # Postal code matches, address unknown
150
+ '15' => 'P', # Postal code matches, address not checked
151
+ '16' => 'N', # Postal code doesn't match, address unknown
152
+ '17' => 'U', # Postal code doesn't match, address not checked
153
+ '18' => 'I' # Neither postal code nor address were checked
151
154
  }
152
155
 
153
156
  def commit(action, post, account = 'ws', password = @options[:password])
@@ -161,20 +164,20 @@ module ActiveMerchant #:nodoc:
161
164
  message_from(response),
162
165
  response,
163
166
  test: test?,
164
- avs_result: AVSResult.new(:code => parse_avs_code(response)),
167
+ avs_result: AVSResult.new(code: parse_avs_code(response)),
165
168
  authorization: response['recurringDetailReference'] || authorization_from(post, response)
166
169
  )
167
170
  rescue ResponseError => e
168
171
  case e.response.code
169
172
  when '401'
170
- return Response.new(false, 'Invalid credentials', {}, :test => test?)
173
+ return Response.new(false, 'Invalid credentials', {}, test: test?)
171
174
  when '403'
172
- return Response.new(false, 'Not allowed', {}, :test => test?)
175
+ return Response.new(false, 'Not allowed', {}, test: test?)
173
176
  when '422', '500'
174
177
  if e.response.body.split(/\W+/).any? { |word| %w(validation configuration security).include?(word) }
175
178
  error_message = e.response.body[/#{Regexp.escape('message=')}(.*?)#{Regexp.escape('&')}/m, 1].tr('+', ' ')
176
179
  error_code = e.response.body[/#{Regexp.escape('errorCode=')}(.*?)#{Regexp.escape('&')}/m, 1]
177
- return Response.new(false, error_code + ': ' + error_message, {}, :test => test?)
180
+ return Response.new(false, error_code + ': ' + error_message, {}, test: test?)
178
181
  end
179
182
  end
180
183
  raise
@@ -184,6 +187,7 @@ module ActiveMerchant #:nodoc:
184
187
  authorization = [parameters[:originalReference], response['pspReference']].compact
185
188
 
186
189
  return nil if authorization.empty?
190
+
187
191
  return authorization.join('#')
188
192
  end
189
193
 
@@ -238,6 +242,7 @@ module ActiveMerchant #:nodoc:
238
242
  return response['resultCode'] if response.has_key?('resultCode') # Payment request
239
243
  return response['response'] if response['response'] # Modification request
240
244
  return response['result'] if response.has_key?('result') # Store/Recurring request
245
+
241
246
  'Failure' # Negative fallback in case of error
242
247
  end
243
248
 
@@ -359,8 +364,15 @@ module ActiveMerchant #:nodoc:
359
364
  add_browser_info(three_ds_2_options[:browser_info], post)
360
365
  post[:threeDS2RequestData] = { deviceChannel: device_channel, notificationURL: three_ds_2_options[:notification_url] }
361
366
  end
367
+
368
+ if options.has_key?(:execute_threed)
369
+ post[:additionalData] ||= {}
370
+ post[:additionalData][:executeThreeD] = options[:execute_threed]
371
+ post[:additionalData][:scaExemption] = options[:sca_exemption] if options[:sca_exemption]
372
+ end
362
373
  else
363
374
  return unless options[:execute_threed] || options[:threed_dynamic]
375
+
364
376
  post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] }
365
377
  post[:additionalData] = { executeThreeD: 'true' } if options[:execute_threed]
366
378
  end
@@ -368,6 +380,7 @@ module ActiveMerchant #:nodoc:
368
380
 
369
381
  def add_browser_info(browser_info, post)
370
382
  return unless browser_info
383
+
371
384
  post[:browserInfo] = {
372
385
  acceptHeader: browser_info[:accept_header],
373
386
  colorDepth: browser_info[:depth],
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
  self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/'
9
9
 
10
10
  self.supported_countries = ['GB']
11
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express diners_club discover jcb maestro]
12
12
  self.default_currency = 'GBP'
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  self.display_name = 'Be2Bill'
10
10
  self.homepage_url = 'http://www.be2bill.com/'
11
11
  self.supported_countries = ['FR']
12
- self.supported_cardtypes = [:visa, :master, :american_express]
12
+ self.supported_cardtypes = %i[visa master american_express]
13
13
  self.default_currency = 'EUR'
14
14
  self.money_format = :cents
15
15
 
@@ -92,8 +92,8 @@ module ActiveMerchant #:nodoc:
92
92
  successful?(response),
93
93
  message_from(response),
94
94
  response,
95
- :authorization => response['TRANSACTIONID'],
96
- :test => test?
95
+ authorization: response['TRANSACTIONID'],
96
+ test: test?
97
97
  )
98
98
  end
99
99
 
@@ -111,8 +111,8 @@ module ActiveMerchant #:nodoc:
111
111
 
112
112
  def post_data(action, parameters = {})
113
113
  {
114
- :method => action,
115
- :params => parameters.merge(HASH: signature(parameters, action))
114
+ method: action,
115
+ params: parameters.merge(HASH: signature(parameters, action))
116
116
  }.to_query
117
117
  end
118
118
 
@@ -9,20 +9,20 @@ module ActiveMerchant #:nodoc:
9
9
  SP_SERVICE_VERSION = '1.1'
10
10
 
11
11
  TRANSACTIONS = {
12
- :authorization => 'PA',
13
- :purchase => 'P',
14
- :capture => 'PAC',
15
- :refund => 'R',
16
- :void => 'VP',
17
- :check_purchase => 'D',
18
- :check_refund => 'C',
19
- :void_purchase => 'VP',
20
- :void_refund => 'VR'
12
+ authorization: 'PA',
13
+ purchase: 'P',
14
+ capture: 'PAC',
15
+ refund: 'R',
16
+ void: 'VP',
17
+ check_purchase: 'D',
18
+ check_refund: 'C',
19
+ void_purchase: 'VP',
20
+ void_refund: 'VR'
21
21
  }
22
22
 
23
23
  PROFILE_OPERATIONS = {
24
- :new => 'N',
25
- :modify => 'M'
24
+ new: 'N',
25
+ modify: 'M'
26
26
  }
27
27
 
28
28
  CVD_CODES = {
@@ -41,24 +41,24 @@ module ActiveMerchant #:nodoc:
41
41
  }
42
42
 
43
43
  PERIODS = {
44
- :days => 'D',
45
- :weeks => 'W',
46
- :months => 'M',
47
- :years => 'Y'
44
+ days: 'D',
45
+ weeks: 'W',
46
+ months: 'M',
47
+ years: 'Y'
48
48
  }
49
49
 
50
50
  PERIODICITIES = {
51
- :daily => [:days, 1],
52
- :weekly => [:weeks, 1],
53
- :biweekly => [:weeks, 2],
54
- :monthly => [:months, 1],
55
- :bimonthly => [:months, 2],
56
- :yearly => [:years, 1]
51
+ daily: [:days, 1],
52
+ weekly: [:weeks, 1],
53
+ biweekly: [:weeks, 2],
54
+ monthly: [:months, 1],
55
+ bimonthly: [:months, 2],
56
+ yearly: [:years, 1]
57
57
  }
58
58
 
59
59
  RECURRING_OPERATION = {
60
- :update => 'M',
61
- :cancel => 'C'
60
+ update: 'M',
61
+ cancel: 'C'
62
62
  }
63
63
 
64
64
  STATES = {
@@ -131,10 +131,10 @@ module ActiveMerchant #:nodoc:
131
131
  base.default_currency = 'CAD'
132
132
 
133
133
  # The countries the gateway supports merchants from as 2 digit ISO country codes
134
- base.supported_countries = ['CA', 'US']
134
+ base.supported_countries = %w[CA US]
135
135
 
136
136
  # The card types supported by the payment gateway
137
- base.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
137
+ base.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
138
138
 
139
139
  # The homepage URL of the gateway
140
140
  base.homepage_url = 'http://www.beanstream.com/'
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
  end
156
156
 
157
157
  def capture(money, authorization, options = {})
158
- reference, _, _ = split_auth(authorization)
158
+ reference, = split_auth(authorization)
159
159
  post = {}
160
160
  add_amount(post, money)
161
161
  add_reference(post, reference)
@@ -256,9 +256,10 @@ module ActiveMerchant #:nodoc:
256
256
  end
257
257
 
258
258
  def prepare_address_for_non_american_countries(options)
259
- [ options[:billing_address], options[:shipping_address] ].compact.each do |address|
259
+ [options[:billing_address], options[:shipping_address]].compact.each do |address|
260
260
  next if empty?(address[:country])
261
- unless ['US', 'CA'].include?(address[:country])
261
+
262
+ unless %w[US CA].include?(address[:country])
262
263
  address[:state] = '--'
263
264
  address[:zip] = '000000' unless address[:zip]
264
265
  end
@@ -366,6 +367,7 @@ module ActiveMerchant #:nodoc:
366
367
  if interval.respond_to? :parts
367
368
  parts = interval.parts
368
369
  raise ArgumentError.new("Cannot recur with mixed interval (#{interval}). Use only one of: days, weeks, months or years") if parts.length > 1
370
+
369
371
  parts.first
370
372
  elsif interval.kind_of? Hash
371
373
  requires!(interval, :unit)
@@ -408,15 +410,14 @@ module ActiveMerchant #:nodoc:
408
410
  recurring_post(post_data(params, false))
409
411
  end
410
412
 
411
- def post(data, use_profile_api=nil)
413
+ def post(data, use_profile_api = nil)
412
414
  response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
413
415
  response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
414
416
  build_response(success?(response), message_from(response), response,
415
- :test => test? || response[:authCode] == 'TEST',
416
- :authorization => authorization_from(response),
417
- :cvv_result => CVD_CODES[response[:cvdId]],
418
- :avs_result => { :code => AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
419
- )
417
+ test: test? || response[:authCode] == 'TEST',
418
+ authorization: authorization_from(response),
419
+ cvv_result: CVD_CODES[response[:cvdId]],
420
+ avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] })
420
421
  end
421
422
 
422
423
  def recurring_post(data)
@@ -441,7 +442,7 @@ module ActiveMerchant #:nodoc:
441
442
  end
442
443
 
443
444
  def add_source(post, source)
444
- if source.is_a?(String) or source.is_a?(Integer)
445
+ if source.is_a?(String) || source.is_a?(Integer)
445
446
  post[:customerCode] = source
446
447
  else
447
448
  card_brand(source) == 'check' ? add_check(post, source) : add_credit_card(post, source)
@@ -466,7 +467,7 @@ module ActiveMerchant #:nodoc:
466
467
  params[:vbvEnabled] = '0'
467
468
  params[:scEnabled] = '0'
468
469
 
469
- params.reject { |k, v| v.blank? }.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
470
+ params.reject { |_k, v| v.blank? }.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
470
471
  end
471
472
  end
472
473
  end
@@ -76,6 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  add_transaction_type(post, :authorization)
77
77
  add_customer_ip(post, options)
78
78
  add_recurring_payment(post, options)
79
+ add_three_ds(post, options)
79
80
  commit(post)
80
81
  end
81
82
 
@@ -88,6 +89,7 @@ module ActiveMerchant #:nodoc:
88
89
  add_transaction_type(post, purchase_action(source))
89
90
  add_customer_ip(post, options)
90
91
  add_recurring_payment(post, options)
92
+ add_three_ds(post, options)
91
93
  commit(post)
92
94
  end
93
95
 
@@ -104,7 +106,7 @@ module ActiveMerchant #:nodoc:
104
106
  end
105
107
  end
106
108
 
107
- def verify(source, options={})
109
+ def verify(source, options = {})
108
110
  MultiResponse.run(:use_first_response) do |r|
109
111
  r.process { authorize(100, source, options) }
110
112
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -175,10 +177,10 @@ module ActiveMerchant #:nodoc:
175
177
  # can't actually delete a secure profile with the supplicated API. This function sets the status of the profile to closed (C).
176
178
  # Closed profiles will have to removed manually.
177
179
  def delete(vault_id)
178
- update(vault_id, false, {:status => 'C'})
180
+ update(vault_id, false, { status: 'C' })
179
181
  end
180
182
 
181
- alias_method :unstore, :delete
183
+ alias unstore delete
182
184
 
183
185
  # Update the values (such as CC expiration) stored at
184
186
  # the gateway. The CC number must be supplied in the
@@ -215,6 +217,22 @@ module ActiveMerchant #:nodoc:
215
217
  def build_response(*args)
216
218
  Response.new(*args)
217
219
  end
220
+
221
+ def add_three_ds(post, options)
222
+ return unless three_d_secure = options[:three_d_secure]
223
+
224
+ post[:SecureXID] = (three_d_secure[:ds_transaction_id] || three_d_secure[:xid]) if three_d_secure.slice(:ds_transaction_id, :xid).values.any?
225
+ post[:SecureECI] = formatted_three_ds_eci(three_d_secure[:eci]) if three_d_secure[:eci].present?
226
+ post[:SecureCAVV] = three_d_secure[:cavv] if three_d_secure[:cavv].present?
227
+ end
228
+
229
+ def formatted_three_ds_eci(val)
230
+ case val
231
+ when '05', '02' then 5
232
+ when '06', '01' then 6
233
+ else val.to_i
234
+ end
235
+ end
218
236
  end
219
237
  end
220
238
  end