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
@@ -36,15 +36,15 @@ module ActiveMerchant #:nodoc:
36
36
  #
37
37
  #
38
38
  class RedsysGateway < Gateway
39
- self.live_url = 'https://sis.sermepa.es/sis/operaciones'
39
+ self.live_url = 'https://sis.redsys.es/sis/operaciones'
40
40
  self.test_url = 'https://sis-t.redsys.es:25443/sis/operaciones'
41
41
 
42
- self.supported_countries = ['ES']
42
+ self.supported_countries = %w[ES FR GB IT PL PT]
43
43
  self.default_currency = 'EUR'
44
44
  self.money_format = :cents
45
45
 
46
46
  # Not all card types may be activated by the bank!
47
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :diners_club]
47
+ self.supported_cardtypes = %i[visa master american_express jcb diners_club unionpay]
48
48
  self.homepage_url = 'http://www.redsys.es/'
49
49
  self.display_name = 'Redsys'
50
50
 
@@ -91,11 +91,11 @@ module ActiveMerchant #:nodoc:
91
91
  # More operations are supported by the gateway itself, but
92
92
  # are not supported in this library.
93
93
  SUPPORTED_TRANSACTIONS = {
94
- :purchase => 'A',
95
- :authorize => '1',
96
- :capture => '2',
97
- :refund => '3',
98
- :cancel => '9'
94
+ purchase: '0',
95
+ authorize: '1',
96
+ capture: '2',
97
+ refund: '3',
98
+ cancel: '9'
99
99
  }
100
100
 
101
101
  # These are the text meanings sent back by the acquirer when
@@ -126,6 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  184 => 'Authentication error',
127
127
  190 => 'Refusal with no specific reason',
128
128
  191 => 'Expiry date incorrect',
129
+ 195 => 'Requires SCA authentication',
129
130
 
130
131
  201 => 'Card expired',
131
132
  202 => 'Card blocked temporarily or under suspicion of fraud',
@@ -170,6 +171,10 @@ module ActiveMerchant #:nodoc:
170
171
  9914 => 'KO Confirmation'
171
172
  }
172
173
 
174
+ # Expected values as per documentation
175
+ THREE_DS_V1 = '1.0.2'
176
+ THREE_DS_V2 = '2.1.0'
177
+
173
178
  # Creates a new instance
174
179
  #
175
180
  # Redsys requires a login and secret_key, and optionally also accepts a
@@ -197,10 +202,13 @@ module ActiveMerchant #:nodoc:
197
202
  add_amount(data, money, options)
198
203
  add_order(data, options[:order_id])
199
204
  add_payment(data, payment)
200
- add_threeds(data, options) if options[:execute_threed]
205
+ add_external_mpi_fields(data, options)
206
+ add_three_ds_data(data, options) if options[:execute_threed]
207
+ add_stored_credential_options(data, options)
201
208
  data[:description] = options[:description]
202
209
  data[:store_in_vault] = options[:store]
203
210
  data[:sca_exemption] = options[:sca_exemption]
211
+ data[:sca_exemption_direct_payment_enabled] = options[:sca_exemption_direct_payment_enabled]
204
212
 
205
213
  commit data, options
206
214
  end
@@ -213,10 +221,13 @@ module ActiveMerchant #:nodoc:
213
221
  add_amount(data, money, options)
214
222
  add_order(data, options[:order_id])
215
223
  add_payment(data, payment)
216
- add_threeds(data, options) if options[:execute_threed]
224
+ add_external_mpi_fields(data, options)
225
+ add_three_ds_data(data, options) if options[:execute_threed]
226
+ add_stored_credential_options(data, options)
217
227
  data[:description] = options[:description]
218
228
  data[:store_in_vault] = options[:store]
219
229
  data[:sca_exemption] = options[:sca_exemption]
230
+ data[:sca_exemption_direct_payment_enabled] = options[:sca_exemption_direct_payment_enabled]
220
231
 
221
232
  commit data, options
222
233
  end
@@ -225,7 +236,7 @@ module ActiveMerchant #:nodoc:
225
236
  data = {}
226
237
  add_action(data, :capture)
227
238
  add_amount(data, money, options)
228
- order_id, _, _ = split_authorization(authorization)
239
+ order_id, = split_authorization(authorization)
229
240
  add_order(data, order_id)
230
241
  data[:description] = options[:description]
231
242
 
@@ -236,7 +247,7 @@ module ActiveMerchant #:nodoc:
236
247
  data = {}
237
248
  add_action(data, :cancel)
238
249
  order_id, amount, currency = split_authorization(authorization)
239
- add_amount(data, amount, :currency => currency)
250
+ add_amount(data, amount, currency: currency)
240
251
  add_order(data, order_id)
241
252
  data[:description] = options[:description]
242
253
 
@@ -247,7 +258,7 @@ module ActiveMerchant #:nodoc:
247
258
  data = {}
248
259
  add_action(data, :refund)
249
260
  add_amount(data, money, options)
250
- order_id, _, _ = split_authorization(authorization)
261
+ order_id, = split_authorization(authorization)
251
262
  add_order(data, order_id)
252
263
  data[:description] = options[:description]
253
264
 
@@ -255,9 +266,13 @@ module ActiveMerchant #:nodoc:
255
266
  end
256
267
 
257
268
  def verify(creditcard, options = {})
258
- MultiResponse.run(:use_first_response) do |r|
259
- r.process { authorize(100, creditcard, options) }
260
- r.process(:ignore_result) { void(r.authorization, options) }
269
+ if options[:sca_exemption_behavior_override] == 'endpoint_and_ntid'
270
+ purchase(0, creditcard, options)
271
+ else
272
+ MultiResponse.run(:use_first_response) do |r|
273
+ r.process { authorize(100, creditcard, options) }
274
+ r.process(:ignore_result) { void(r.authorization, options) }
275
+ end
261
276
  end
262
277
  end
263
278
 
@@ -270,8 +285,10 @@ module ActiveMerchant #:nodoc:
270
285
  gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
271
286
  gsub(%r((%3CDS_MERCHANT_PAN%3E)\d+(%3C%2FDS_MERCHANT_PAN%3E))i, '\1[FILTERED]\2').
272
287
  gsub(%r((%3CDS_MERCHANT_CVV2%3E)\d+(%3C%2FDS_MERCHANT_CVV2%3E))i, '\1[FILTERED]\2').
288
+ gsub(%r((&lt;DS_MERCHANT_PAN&gt;)\d+(&lt;/DS_MERCHANT_PAN&gt;))i, '\1[FILTERED]\2').
273
289
  gsub(%r((<DS_MERCHANT_PAN>)\d+(</DS_MERCHANT_PAN>))i, '\1[FILTERED]\2').
274
290
  gsub(%r((<DS_MERCHANT_CVV2>)\d+(</DS_MERCHANT_CVV2>))i, '\1[FILTERED]\2').
291
+ gsub(%r((&lt;DS_MERCHANT_CVV2&gt;)\d+(&lt;/DS_MERCHANT_CVV2&gt;))i, '\1[FILTERED]\2').
275
292
  gsub(%r((DS_MERCHANT_CVV2)%2F%3E%0A%3C%2F)i, '\1[BLANK]').
276
293
  gsub(%r((DS_MERCHANT_CVV2)%2F%3E%3C)i, '\1[BLANK]').
277
294
  gsub(%r((DS_MERCHANT_CVV2%3E)(%3C%2FDS_MERCHANT_CVV2))i, '\1[BLANK]\2').
@@ -299,8 +316,8 @@ module ActiveMerchant #:nodoc:
299
316
  test? ? test_url : live_url
300
317
  end
301
318
 
302
- def threeds_url
303
- test? ? 'https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2': 'https://sis.redsys.es/sis/services/SerClsWSEntradaV2'
319
+ def webservice_url
320
+ test? ? 'https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2' : 'https://sis.redsys.es/sis/services/SerClsWSEntradaV2'
304
321
  end
305
322
 
306
323
  def add_payment(data, card)
@@ -311,52 +328,99 @@ module ActiveMerchant #:nodoc:
311
328
  year = sprintf('%.4i', card.year)
312
329
  month = sprintf('%.2i', card.month)
313
330
  data[:card] = {
314
- :name => name,
315
- :pan => card.number,
316
- :date => "#{year[2..3]}#{month}",
317
- :cvv => card.verification_value
331
+ name: name,
332
+ pan: card.number,
333
+ date: "#{year[2..3]}#{month}",
334
+ cvv: card.verification_value
318
335
  }
319
336
  end
320
337
  end
321
338
 
322
- def add_threeds(data, options)
323
- if options[:execute_threed] == true
324
- data[:threeds] = {threeDSInfo: 'CardData'}
339
+ def add_external_mpi_fields(data, options)
340
+ return unless options[:three_d_secure]
341
+
342
+ if options[:three_d_secure][:version] == THREE_DS_V2
343
+ data[:threeDSServerTransID] = options[:three_d_secure][:three_ds_server_trans_id] if options[:three_d_secure][:three_ds_server_trans_id]
344
+ data[:dsTransID] = options[:three_d_secure][:ds_transaction_id] if options[:three_d_secure][:ds_transaction_id]
345
+ data[:authenticacionValue] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
346
+ data[:protocolVersion] = options[:three_d_secure][:version] if options[:three_d_secure][:version]
347
+ data[:authenticacionMethod] = options[:authentication_method] if options[:authentication_method]
348
+ data[:authenticacionType] = options[:authentication_type] if options[:authentication_type]
349
+ data[:authenticacionFlow] = options[:authentication_flow] if options[:authentication_flow]
350
+ data[:eci_v2] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
351
+ elsif options[:three_d_secure][:version] == THREE_DS_V1
352
+ data[:txid] = options[:three_d_secure][:xid] if options[:three_d_secure][:xid]
353
+ data[:cavv] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
354
+ data[:eci_v1] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
355
+ end
356
+ end
357
+
358
+ def add_stored_credential_options(data, options)
359
+ return unless options[:stored_credential]
360
+
361
+ case options[:stored_credential][:initial_transaction]
362
+ when true
363
+ data[:DS_MERCHANT_COF_INI] = 'S'
364
+ when false
365
+ data[:DS_MERCHANT_COF_INI] = 'N'
366
+ data[:DS_MERCHANT_COF_TXNID] = options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
325
367
  end
368
+
369
+ case options[:stored_credential][:reason_type]
370
+ when 'recurring'
371
+ data[:DS_MERCHANT_COF_TYPE] = 'R'
372
+ when 'installment'
373
+ data[:DS_MERCHANT_COF_TYPE] = 'I'
374
+ when 'unscheduled'
375
+ return
376
+ end
377
+ end
378
+
379
+ def add_three_ds_data(data, options)
380
+ data[:three_ds_data] = { threeDSInfo: 'CardData' } if options[:execute_threed] == true
381
+ end
382
+
383
+ def determine_peticion_type(data)
384
+ three_ds_info = data.dig(:three_ds_data, :threeDSInfo)
385
+ return 'iniciaPeticion' if three_ds_info == 'CardData'
386
+ return 'trataPeticion' if three_ds_info == 'AuthenticationData' ||
387
+ three_ds_info == 'ChallengeResponse' ||
388
+ data[:sca_exemption] == 'MIT'
326
389
  end
327
390
 
328
- def determine_3ds_action(threeds_hash)
329
- return 'iniciaPeticion' if threeds_hash[:threeDSInfo] == 'CardData'
330
- return 'trataPeticion' if threeds_hash[:threeDSInfo] == 'AuthenticationData' ||
331
- threeds_hash[:threeDSInfo] == 'ChallengeResponse'
391
+ def use_webservice_endpoint?(data, options)
392
+ options[:use_webservice_endpoint].to_s == 'true' || data[:three_ds_data] || data[:sca_exemption] == 'MIT'
332
393
  end
333
394
 
334
395
  def commit(data, options = {})
335
- if data[:threeds]
336
- action = determine_3ds_action(data[:threeds])
337
- request = <<-EOS
396
+ xmlreq = xml_request_from(data, options)
397
+
398
+ if use_webservice_endpoint?(data, options)
399
+ peticion_type = determine_peticion_type(data)
400
+
401
+ request = <<-REQUEST
338
402
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.sis.sermepa.es" xmlns:intf="http://webservice.sis.sermepa.es" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
339
403
  <soapenv:Header/>
340
404
  <soapenv:Body>
341
- <intf:#{action} xmlns:intf="http://webservice.sis.sermepa.es">
405
+ <intf:#{peticion_type} xmlns:intf="http://webservice.sis.sermepa.es">
342
406
  <intf:datoEntrada>
343
- <![CDATA[#{xml_request_from(data, options)}]]>
407
+ <![CDATA[#{xmlreq}]]>
344
408
  </intf:datoEntrada>
345
- </intf:#{action}>
409
+ </intf:#{peticion_type}>
346
410
  </soapenv:Body>
347
411
  </soapenv:Envelope>
348
- EOS
349
- parse(ssl_post(threeds_url, request, headers(action)), action)
412
+ REQUEST
413
+ parse(ssl_post(webservice_url, request, headers(peticion_type)), peticion_type)
350
414
  else
351
- parse(ssl_post(url, "entrada=#{CGI.escape(xml_request_from(data, options))}", headers), action)
415
+ parse(ssl_post(url, "entrada=#{CGI.escape(xmlreq)}", headers), peticion_type)
352
416
  end
353
417
  end
354
418
 
355
- def headers(action=nil)
356
- if action
419
+ def headers(peticion_type = nil)
420
+ if peticion_type
357
421
  {
358
422
  'Content-Type' => 'text/xml',
359
- 'SOAPAction' => action
423
+ 'SOAPAction' => peticion_type
360
424
  }
361
425
  else
362
426
  {
@@ -375,9 +439,9 @@ module ActiveMerchant #:nodoc:
375
439
 
376
440
  def build_signature(data)
377
441
  str = data[:amount] +
378
- data[:order_id].to_s +
379
- @options[:login].to_s +
380
- data[:currency]
442
+ data[:order_id].to_s +
443
+ @options[:login].to_s +
444
+ data[:currency]
381
445
 
382
446
  if card = data[:card]
383
447
  str << card[:pan]
@@ -407,7 +471,7 @@ module ActiveMerchant #:nodoc:
407
471
  end
408
472
 
409
473
  def build_sha1_xml_request(data, options = {})
410
- xml = Builder::XmlMarkup.new :indent => 2
474
+ xml = Builder::XmlMarkup.new indent: 2
411
475
  build_merchant_data(xml, data, options)
412
476
  xml.target!
413
477
  end
@@ -419,6 +483,8 @@ module ActiveMerchant #:nodoc:
419
483
  end
420
484
 
421
485
  def build_merchant_data(xml, data, options = {})
486
+ # See https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2/wsdl/SerClsWSEntradaV2.wsdl
487
+ # (which results from calling #webservice_url + '?WSDL', https://sis-t.redsys.es:25443/sis/services/SerClsWSEntradaV2?WSDL)
422
488
  xml.DATOSENTRADA do
423
489
  # Basic elements
424
490
  xml.DS_Version 0.1
@@ -426,19 +492,37 @@ module ActiveMerchant #:nodoc:
426
492
  xml.DS_MERCHANT_AMOUNT data[:amount]
427
493
  xml.DS_MERCHANT_ORDER data[:order_id]
428
494
  xml.DS_MERCHANT_TRANSACTIONTYPE data[:action]
429
- xml.DS_MERCHANT_PRODUCTDESCRIPTION data[:description]
495
+ if data[:description] && use_webservice_endpoint?(data, options)
496
+ xml.DS_MERCHANT_PRODUCTDESCRIPTION CGI.escape(data[:description])
497
+ else
498
+ xml.DS_MERCHANT_PRODUCTDESCRIPTION data[:description]
499
+ end
430
500
  xml.DS_MERCHANT_TERMINAL options[:terminal] || @options[:terminal]
431
501
  xml.DS_MERCHANT_MERCHANTCODE @options[:login]
432
502
  xml.DS_MERCHANT_MERCHANTSIGNATURE build_signature(data) unless sha256_authentication?
433
- xml.DS_MERCHANT_EXCEP_SCA data[:sca_exemption] if data[:sca_exemption]
503
+
504
+ peticion_type = determine_peticion_type(data) if data[:three_ds_data]
505
+ if peticion_type == 'iniciaPeticion' && data[:sca_exemption]
506
+ xml.DS_MERCHANT_EXCEP_SCA 'Y'
507
+ else
508
+ xml.DS_MERCHANT_EXCEP_SCA data[:sca_exemption] if data[:sca_exemption]
509
+ xml.DS_MERCHANT_DIRECTPAYMENT data[:sca_exemption_direct_payment_enabled] || 'true' if data[:sca_exemption] == 'MIT'
510
+ end
434
511
 
435
512
  # Only when card is present
436
513
  if data[:card]
437
- xml.DS_MERCHANT_TITULAR data[:card][:name]
514
+ if data[:card][:name] && use_webservice_endpoint?(data, options)
515
+ xml.DS_MERCHANT_TITULAR CGI.escape(data[:card][:name])
516
+ else
517
+ xml.DS_MERCHANT_TITULAR data[:card][:name]
518
+ end
438
519
  xml.DS_MERCHANT_PAN data[:card][:pan]
439
520
  xml.DS_MERCHANT_EXPIRYDATE data[:card][:date]
440
521
  xml.DS_MERCHANT_CVV2 data[:card][:cvv]
441
522
  xml.DS_MERCHANT_IDENTIFIER 'REQUIRED' if data[:store_in_vault]
523
+
524
+ build_merchant_mpi_external(xml, data)
525
+
442
526
  elsif data[:credit_card_token]
443
527
  xml.DS_MERCHANT_IDENTIFIER data[:credit_card_token]
444
528
  xml.DS_MERCHANT_DIRECTPAYMENT 'true'
@@ -446,36 +530,49 @@ module ActiveMerchant #:nodoc:
446
530
 
447
531
  # Set moto flag only if explicitly requested via moto field
448
532
  # Requires account configuration to be able to use
449
- if options.dig(:moto) && options.dig(:metadata, :manual_entry)
450
- xml.DS_MERCHANT_DIRECTPAYMENT 'moto'
451
- end
533
+ xml.DS_MERCHANT_DIRECTPAYMENT 'moto' if options.dig(:moto) && options.dig(:metadata, :manual_entry)
452
534
 
453
- if data[:threeds]
454
- xml.DS_MERCHANT_EMV3DS data[:threeds].to_json
535
+ xml.DS_MERCHANT_EMV3DS data[:three_ds_data].to_json if data[:three_ds_data]
536
+
537
+ if options[:stored_credential]
538
+ xml.DS_MERCHANT_COF_INI data[:DS_MERCHANT_COF_INI]
539
+ xml.DS_MERCHANT_COF_TYPE data[:DS_MERCHANT_COF_TYPE]
540
+ xml.DS_MERCHANT_COF_TXNID data[:DS_MERCHANT_COF_TXNID] if data[:DS_MERCHANT_COF_TXNID]
541
+ xml.DS_MERCHANT_DIRECTPAYMENT 'false' if options[:stored_credential][:initial_transaction]
455
542
  end
456
543
  end
457
544
  end
458
545
 
546
+ def build_merchant_mpi_external(xml, data)
547
+ return unless data[:txid] || data[:threeDSServerTransID]
548
+
549
+ ds_merchant_mpi_external = {}
550
+ ds_merchant_mpi_external[:TXID] = data[:txid] if data[:txid]
551
+ ds_merchant_mpi_external[:CAVV] = data[:cavv] if data[:cavv]
552
+ ds_merchant_mpi_external[:ECI] = data[:eci_v1] if data[:eci_v1]
553
+
554
+ ds_merchant_mpi_external[:threeDSServerTransID] = data[:threeDSServerTransID] if data[:threeDSServerTransID]
555
+ ds_merchant_mpi_external[:dsTransID] = data[:dsTransID] if data[:dsTransID]
556
+ ds_merchant_mpi_external[:authenticacionValue] = data[:authenticacionValue] if data[:authenticacionValue]
557
+ ds_merchant_mpi_external[:protocolVersion] = data[:protocolVersion] if data[:protocolVersion]
558
+ ds_merchant_mpi_external[:Eci] = data[:eci_v2] if data[:eci_v2]
559
+ ds_merchant_mpi_external[:authenticacionMethod] = data[:authenticacionMethod] if data[:authenticacionMethod]
560
+ ds_merchant_mpi_external[:authenticacionType] = data[:authenticacionType] if data[:authenticacionType]
561
+ ds_merchant_mpi_external[:authenticacionFlow] = data[:authenticacionFlow] if data[:authenticacionFlow]
562
+
563
+ xml.DS_MERCHANT_MPIEXTERNAL ds_merchant_mpi_external.to_json unless ds_merchant_mpi_external.empty?
564
+ xml.target!
565
+ end
566
+
459
567
  def parse(data, action)
460
568
  params = {}
461
569
  success = false
462
570
  message = ''
463
- options = @options.merge(:test => test?)
571
+ options = @options.merge(test: test?)
464
572
  xml = Nokogiri::XML(data)
465
573
  code = xml.xpath('//RETORNOXML/CODIGO').text
466
574
 
467
- if ['iniciaPeticion', 'trataPeticion'].include?(action)
468
- vxml = Nokogiri::XML(data).remove_namespaces!.xpath("//Envelope/Body/#{action}Response/#{action}Return").inner_text
469
- xml = Nokogiri::XML(vxml)
470
- node = (action == 'iniciaPeticion' ? 'INFOTARJETA' : 'OPERACION')
471
- op = xml.xpath("//RETORNOXML/#{node}")
472
- op.children.each do |element|
473
- params[element.name.downcase.to_sym] = element.text
474
- end
475
- message = response_text_3ds(xml, params)
476
- options[:authorization] = build_authorization(params)
477
- success = params.size > 0 && is_success_response?(params[:ds_response])
478
- elsif code == '0'
575
+ if code == '0' && xml.xpath('//RETORNOXML/OPERACION').present?
479
576
  op = xml.xpath('//RETORNOXML/OPERACION')
480
577
  op.children.each do |element|
481
578
  params[element.name.downcase.to_sym] = element.text
@@ -483,10 +580,21 @@ module ActiveMerchant #:nodoc:
483
580
  if validate_signature(params)
484
581
  message = response_text(params[:ds_response])
485
582
  options[:authorization] = build_authorization(params)
486
- success = is_success_response?(params[:ds_response])
583
+ success = success_response?(params[:ds_response])
487
584
  else
488
585
  message = 'Response failed validation check'
489
586
  end
587
+ elsif %w[iniciaPeticion trataPeticion].include?(action)
588
+ vxml = Nokogiri::XML(data).remove_namespaces!.xpath("//Envelope/Body/#{action}Response/#{action}Return").inner_text
589
+ xml = Nokogiri::XML(vxml)
590
+ node = (action == 'iniciaPeticion' ? 'INFOTARJETA' : 'OPERACION')
591
+ op = xml.xpath("//RETORNOXML/#{node}")
592
+ op.children.each do |element|
593
+ params[element.name.downcase.to_sym] = element.text
594
+ end
595
+ message = response_text_3ds(xml, params)
596
+ options[:authorization] = build_authorization(params)
597
+ success = params.size > 0 && success_response?(params[:ds_response])
490
598
  else
491
599
  # Some kind of programmer error with the request!
492
600
  message = "#{code} ERROR"
@@ -501,14 +609,14 @@ module ActiveMerchant #:nodoc:
501
609
  sig.casecmp(data[:ds_signature].to_s).zero?
502
610
  else
503
611
  str = data[:ds_amount] +
504
- data[:ds_order].to_s +
505
- data[:ds_merchantcode] +
506
- data[:ds_currency] +
507
- data[:ds_response] +
508
- data[:ds_cardnumber].to_s +
509
- data[:ds_transactiontype].to_s +
510
- data[:ds_securepayment].to_s +
511
- @options[:secret_key]
612
+ data[:ds_order].to_s +
613
+ data[:ds_merchantcode] +
614
+ data[:ds_currency] +
615
+ data[:ds_response] +
616
+ data[:ds_cardnumber].to_s +
617
+ data[:ds_transactiontype].to_s +
618
+ data[:ds_securepayment].to_s +
619
+ @options[:secret_key]
512
620
 
513
621
  sig = Digest::SHA1.hexdigest(str)
514
622
  data[:ds_signature].to_s.downcase == sig
@@ -527,6 +635,7 @@ module ActiveMerchant #:nodoc:
527
635
  def currency_code(currency)
528
636
  return currency if currency =~ /^\d+$/
529
637
  raise ArgumentError, "Unknown currency #{currency}" unless CURRENCY_CODES[currency]
638
+
530
639
  CURRENCY_CODES[currency]
531
640
  end
532
641
 
@@ -537,7 +646,7 @@ module ActiveMerchant #:nodoc:
537
646
  def response_text(code)
538
647
  code = code.to_i
539
648
  code = 0 if code < 100
540
- RESPONSE_TEXTS[code] || 'Unkown code, please check in manual'
649
+ RESPONSE_TEXTS[code] || 'Unknown code, please check in manual'
541
650
  end
542
651
 
543
652
  def response_text_3ds(xml, params)
@@ -554,13 +663,13 @@ module ActiveMerchant #:nodoc:
554
663
  message
555
664
  end
556
665
 
557
- def is_success_response?(code)
666
+ def success_response?(code)
558
667
  (code.to_i < 100) || [400, 481, 500, 900].include?(code.to_i)
559
668
  end
560
669
 
561
670
  def clean_order_id(order_id)
562
671
  cleansed = order_id.gsub(/[^\da-zA-Z]/, '')
563
- if cleansed =~ /^\d{4}/
672
+ if /^\d{4}/.match?(cleansed)
564
673
  cleansed[0..11]
565
674
  else
566
675
  '%04d%s' % [rand(0..9999), cleansed[0...8]]
@@ -581,7 +690,7 @@ module ActiveMerchant #:nodoc:
581
690
  cipher = OpenSSL::Cipher.new('DES3')
582
691
  cipher.encrypt
583
692
 
584
- cipher.key = Base64.strict_decode64(key)
693
+ cipher.key = Base64.urlsafe_decode64(key)
585
694
  # The OpenSSL default of an all-zeroes ("\\0") IV is used.
586
695
  cipher.padding = 0
587
696
 
@@ -597,15 +706,11 @@ module ActiveMerchant #:nodoc:
597
706
 
598
707
  def xml_signed_fields(data)
599
708
  xml_signed_fields = data[:ds_amount] + data[:ds_order] + data[:ds_merchantcode] +
600
- data[:ds_currency] + data[:ds_response]
709
+ data[:ds_currency] + data[:ds_response]
601
710
 
602
- if data[:ds_cardnumber]
603
- xml_signed_fields += data[:ds_cardnumber]
604
- end
711
+ xml_signed_fields += data[:ds_cardnumber] if data[:ds_cardnumber]
605
712
 
606
- if data[:ds_emv3ds]
607
- xml_signed_fields += data[:ds_emv3ds]
608
- end
713
+ xml_signed_fields += data[:ds_emv3ds] if data[:ds_emv3ds]
609
714
 
610
715
  xml_signed_fields + data[:ds_transactiontype] + data[:ds_securepayment]
611
716
  end
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
 
9
9
  self.supported_countries = ['DK']
10
10
  self.default_currency = 'EUR'
11
- self.supported_cardtypes = [:visa, :master, :maestro]
11
+ self.supported_cardtypes = %i[visa master maestro]
12
12
 
13
13
  self.homepage_url = 'http://www.s5.dk/'
14
14
  self.display_name = 'S5'
@@ -22,12 +22,12 @@ module ActiveMerchant #:nodoc:
22
22
  'store' => 'CC.RG'
23
23
  }
24
24
 
25
- def initialize(options={})
25
+ def initialize(options = {})
26
26
  requires!(options, :sender, :channel, :login, :password)
27
27
  super
28
28
  end
29
29
 
30
- def purchase(money, payment, options={})
30
+ def purchase(money, payment, options = {})
31
31
  request = build_xml_request do |xml|
32
32
  add_identification(xml, options)
33
33
  add_payment(xml, money, 'sale', options)
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  commit(request)
40
40
  end
41
41
 
42
- def refund(money, authorization, options={})
42
+ def refund(money, authorization, options = {})
43
43
  request = build_xml_request do |xml|
44
44
  add_identification(xml, options, authorization)
45
45
  add_payment(xml, money, 'refund', options)
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  commit(request)
49
49
  end
50
50
 
51
- def authorize(money, payment, options={})
51
+ def authorize(money, payment, options = {})
52
52
  request = build_xml_request do |xml|
53
53
  add_identification(xml, options)
54
54
  add_payment(xml, money, 'authonly', options)
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  commit(request)
61
61
  end
62
62
 
63
- def capture(money, authorization, options={})
63
+ def capture(money, authorization, options = {})
64
64
  request = build_xml_request do |xml|
65
65
  add_identification(xml, options, authorization)
66
66
  add_payment(xml, money, 'capture', options)
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
69
69
  commit(request)
70
70
  end
71
71
 
72
- def void(authorization, options={})
72
+ def void(authorization, options = {})
73
73
  request = build_xml_request do |xml|
74
74
  add_identification(xml, options, authorization)
75
75
  add_payment(xml, nil, 'void', options)
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
89
89
  commit(request)
90
90
  end
91
91
 
92
- def verify(credit_card, options={})
92
+ def verify(credit_card, options = {})
93
93
  MultiResponse.run(:use_first_response) do |r|
94
94
  r.process { authorize(100, credit_card, options) }
95
95
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -143,6 +143,7 @@ module ActiveMerchant #:nodoc:
143
143
 
144
144
  def add_customer(xml, creditcard, options)
145
145
  return unless creditcard.respond_to?(:number)
146
+
146
147
  address = options[:billing_address]
147
148
  xml.Customer do
148
149
  xml.Contact do
@@ -180,7 +181,7 @@ module ActiveMerchant #:nodoc:
180
181
  end
181
182
 
182
183
  def parse(body)
183
- results = {}
184
+ results = {}
184
185
  xml = Nokogiri::XML(body)
185
186
  resp = xml.xpath('//Response/Transaction/Identification')
186
187
  resp.children.each do |element|