activemerchant 1.79.2 → 1.129.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +1391 -0
  3. data/README.md +29 -14
  4. data/lib/active_merchant/billing/avs_result.rb +25 -28
  5. data/lib/active_merchant/billing/base.rb +0 -13
  6. data/lib/active_merchant/billing/check.rb +55 -22
  7. data/lib/active_merchant/billing/compatibility.rb +10 -12
  8. data/lib/active_merchant/billing/credit_card.rb +82 -62
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  10. data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
  11. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  12. data/lib/active_merchant/billing/gateway.rb +61 -56
  13. data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
  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 +35 -36
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
  21. data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
  24. data/lib/active_merchant/billing/gateways/banwire.rb +12 -12
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +115 -115
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
  33. data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
  34. data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
  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 +561 -259
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
  42. data/lib/active_merchant/billing/gateways/cams.rb +31 -31
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
  52. data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
  56. data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
  57. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  58. data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
  59. data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
  60. data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
  61. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  62. data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
  63. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
  64. data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
  65. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
  66. data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
  67. data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
  68. data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
  69. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  70. data/lib/active_merchant/billing/gateways/dibs.rb +34 -40
  71. data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
  72. data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
  73. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  74. data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
  75. data/lib/active_merchant/billing/gateways/element.rb +106 -56
  76. data/lib/active_merchant/billing/gateways/epay.rb +74 -64
  77. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  78. data/lib/active_merchant/billing/gateways/eway.rb +74 -73
  79. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  80. data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
  81. data/lib/active_merchant/billing/gateways/exact.rb +29 -37
  82. data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
  83. data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
  84. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  85. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
  86. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  87. data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
  88. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
  89. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  90. data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
  91. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
  92. data/lib/active_merchant/billing/gateways/forte.rb +70 -40
  93. data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
  94. data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
  95. data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
  96. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  97. data/lib/active_merchant/billing/gateways/hps.rb +236 -69
  98. data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
  99. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  100. data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
  101. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  102. data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
  103. data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
  104. data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
  105. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  106. data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
  107. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  108. data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
  109. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
  110. data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
  111. data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
  112. data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
  113. data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
  114. data/lib/active_merchant/billing/gateways/litle.rb +247 -53
  115. data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
  116. data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
  117. data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
  118. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
  119. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  120. data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
  121. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  122. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
  123. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
  124. data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
  125. data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
  126. data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
  127. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  128. data/lib/active_merchant/billing/gateways/migs.rb +45 -40
  129. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  130. data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
  131. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
  132. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  133. data/lib/active_merchant/billing/gateways/monei.rb +255 -138
  134. data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
  135. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  136. data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
  137. data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
  138. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
  139. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  140. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  141. data/lib/active_merchant/billing/gateways/netbanx.rb +167 -80
  142. data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
  143. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  144. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  145. data/lib/active_merchant/billing/gateways/nmi.rb +134 -48
  146. data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
  147. data/lib/active_merchant/billing/gateways/omise.rb +30 -31
  148. data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
  149. data/lib/active_merchant/billing/gateways/opp.rb +166 -144
  150. data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
  151. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  152. data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
  153. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
  154. data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
  155. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  156. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  157. data/lib/active_merchant/billing/gateways/pay_conex.rb +39 -40
  158. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
  159. data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
  160. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  161. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
  162. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  163. data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
  164. data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
  165. data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
  166. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  167. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
  168. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  169. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  170. data/lib/active_merchant/billing/gateways/payflow.rb +178 -54
  171. data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
  172. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
  173. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
  174. data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
  175. data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
  176. data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
  177. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  178. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  179. data/lib/active_merchant/billing/gateways/paypal.rb +27 -14
  180. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
  182. data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
  183. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
  185. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  186. data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
  187. data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
  188. data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
  189. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  190. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  191. data/lib/active_merchant/billing/gateways/pin.rb +87 -34
  192. data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
  193. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  194. data/lib/active_merchant/billing/gateways/priority.rb +392 -0
  195. data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
  196. data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
  197. data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
  198. data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
  199. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  200. data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
  201. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
  202. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
  203. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
  204. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
  205. data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
  206. data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
  207. data/lib/active_merchant/billing/gateways/reach.rb +277 -0
  208. data/lib/active_merchant/billing/gateways/realex.rb +132 -50
  209. data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
  210. data/lib/active_merchant/billing/gateways/s5.rb +16 -16
  211. data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
  212. data/lib/active_merchant/billing/gateways/sage.rb +49 -48
  213. data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
  214. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  215. data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
  216. data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
  217. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
  218. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  219. data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
  220. data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
  221. data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
  222. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
  223. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  224. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  225. data/lib/active_merchant/billing/gateways/spreedly_core.rb +66 -47
  226. data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
  227. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
  228. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
  229. data/lib/active_merchant/billing/gateways/telr.rb +46 -48
  230. data/lib/active_merchant/billing/gateways/tns.rb +8 -7
  231. data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
  232. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
  233. data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
  234. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  235. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  236. data/lib/active_merchant/billing/gateways/trexle.rb +22 -18
  237. data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
  238. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  239. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
  240. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
  241. data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
  242. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  243. data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
  244. data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
  245. data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
  246. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  247. data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
  248. data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
  249. data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
  250. data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
  251. data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
  252. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
  253. data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
  254. data/lib/active_merchant/billing/model.rb +2 -2
  255. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
  256. data/lib/active_merchant/billing/rails.rb +1 -1
  257. data/lib/active_merchant/billing/response.rb +32 -13
  258. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  259. data/lib/active_merchant/billing.rb +1 -0
  260. data/lib/active_merchant/connection.rb +24 -38
  261. data/lib/active_merchant/country.rb +9 -5
  262. data/lib/active_merchant/errors.rb +4 -1
  263. data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
  264. data/lib/active_merchant/network_connection_retries.rb +28 -31
  265. data/lib/active_merchant/post_data.rb +5 -3
  266. data/lib/active_merchant/posts_data.rb +5 -7
  267. data/lib/active_merchant/version.rb +1 -1
  268. data/lib/active_merchant.rb +3 -3
  269. data/lib/activemerchant.rb +1 -1
  270. data/lib/certs/cacert.pem +1592 -2329
  271. data/lib/support/gateway_support.rb +8 -10
  272. data/lib/support/ssl_verify.rb +9 -14
  273. data/lib/support/ssl_version.rb +9 -10
  274. metadata +98 -37
  275. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  278. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  279. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -309
@@ -4,15 +4,18 @@ 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'
15
16
 
17
+ API_VERSION = 'v40'
18
+
16
19
  def initialize(options = {})
17
20
  requires!(options, :company, :merchant, :password)
18
21
  super
@@ -35,7 +38,9 @@ module ActiveMerchant #:nodoc:
35
38
  post[:card] = credit_card_hash(creditcard)
36
39
  post[:billingAddress] = billing_address_hash(options) if options[:billing_address]
37
40
  post[:deliveryAddress] = shipping_address_hash(options) if options[:shipping_address]
38
- add_3ds(post, options) if options[:execute_threed]
41
+ post[:shopperStatement] = options[:shopper_statement] if options[:shopper_statement]
42
+
43
+ add_3ds(post, options)
39
44
  commit('authorise', post)
40
45
  end
41
46
 
@@ -66,7 +71,29 @@ module ActiveMerchant #:nodoc:
66
71
  post[:nationality] = options[:nationality] if options[:nationality]
67
72
  post[:shopperName] = options[:shopper_name] if options[:shopper_name]
68
73
 
69
- commit('refundWithData', post)
74
+ if options[:third_party_payout]
75
+ post[:recurring] = options[:recurring_contract] || { contract: 'PAYOUT' }
76
+ MultiResponse.run do |r|
77
+ r.process {
78
+ commit(
79
+ 'storeDetailAndSubmitThirdParty',
80
+ post,
81
+ @options[:store_payout_account],
82
+ @options[:store_payout_password]
83
+ )
84
+ }
85
+ r.process {
86
+ commit(
87
+ 'confirmThirdParty',
88
+ modification_request(r.authorization, @options),
89
+ @options[:review_payout_account],
90
+ @options[:review_payout_password]
91
+ )
92
+ }
93
+ end
94
+ else
95
+ commit('refundWithData', post)
96
+ end
70
97
  end
71
98
 
72
99
  def void(identification, options = {})
@@ -84,7 +111,7 @@ module ActiveMerchant #:nodoc:
84
111
  def store(creditcard, options = {})
85
112
  post = store_request(options)
86
113
  post[:card] = credit_card_hash(creditcard)
87
- post[:recurring] = {:contract => 'RECURRING'}
114
+ post[:recurring] = { contract: 'RECURRING' }
88
115
 
89
116
  commit('store', post)
90
117
  end
@@ -105,30 +132,31 @@ module ActiveMerchant #:nodoc:
105
132
  # Smartpay may return AVS codes not covered by standard AVSResult codes.
106
133
  # Smartpay's descriptions noted below.
107
134
  AVS_MAPPING = {
108
- '0' => 'R', # Unknown
109
- '1' => 'A', # Address matches, postal code doesn't
110
- '2' => 'N', # Neither postal code nor address match
111
- '3' => 'R', # AVS unavailable
112
- '4' => 'E', # AVS not supported for this card type
113
- '5' => 'U', # No AVS data provided
114
- '6' => 'Z', # Postal code matches, address doesn't match
115
- '7' => 'D', # Both postal code and address match
116
- '8' => 'U', # Address not checked, postal code unknown
117
- '9' => 'B', # Address matches, postal code unknown
118
- '10' => 'N', # Address doesn't match, postal code unknown
119
- '11' => 'U', # Postal code not checked, address unknown
120
- '12' => 'B', # Address matches, postal code not checked
121
- '13' => 'U', # Address doesn't match, postal code not checked
122
- '14' => 'P', # Postal code matches, address unknown
123
- '15' => 'P', # Postal code matches, address not checked
124
- '16' => 'N', # Postal code doesn't match, address unknown
125
- '17' => 'U', # Postal code doesn't match, address not checked
126
- '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
127
154
  }
128
155
 
129
- def commit(action, post)
156
+ def commit(action, post, account = 'ws', password = @options[:password])
130
157
  request = post_data(flatten_hash(post))
131
- raw_response = ssl_post(build_url(action), request, headers)
158
+ request_headers = headers(account, password)
159
+ raw_response = ssl_post(build_url(action), request, request_headers)
132
160
  response = parse(raw_response)
133
161
 
134
162
  Response.new(
@@ -136,21 +164,20 @@ module ActiveMerchant #:nodoc:
136
164
  message_from(response),
137
165
  response,
138
166
  test: test?,
139
- avs_result: AVSResult.new(:code => parse_avs_code(response)),
167
+ avs_result: AVSResult.new(code: parse_avs_code(response)),
140
168
  authorization: response['recurringDetailReference'] || authorization_from(post, response)
141
169
  )
142
-
143
170
  rescue ResponseError => e
144
171
  case e.response.code
145
172
  when '401'
146
- return Response.new(false, 'Invalid credentials', {}, :test => test?)
173
+ return Response.new(false, 'Invalid credentials', {}, test: test?)
147
174
  when '403'
148
- return Response.new(false, 'Not allowed', {}, :test => test?)
149
- when '422'
150
- return Response.new(false, 'Unprocessable Entity', {}, :test => test?)
151
- when '500'
152
- if e.response.body.split(' ')[0] == 'validation'
153
- return Response.new(false, e.response.body.split(' ', 3)[2], {}, :test => test?)
175
+ return Response.new(false, 'Not allowed', {}, test: test?)
176
+ when '422', '500'
177
+ if e.response.body.split(/\W+/).any? { |word| %w(validation configuration security).include?(word) }
178
+ error_message = e.response.body[/#{Regexp.escape('message=')}(.*?)#{Regexp.escape('&')}/m, 1].tr('+', ' ')
179
+ error_code = e.response.body[/#{Regexp.escape('errorCode=')}(.*?)#{Regexp.escape('&')}/m, 1]
180
+ return Response.new(false, error_code + ': ' + error_message, {}, test: test?)
154
181
  end
155
182
  end
156
183
  raise
@@ -160,11 +187,12 @@ module ActiveMerchant #:nodoc:
160
187
  authorization = [parameters[:originalReference], response['pspReference']].compact
161
188
 
162
189
  return nil if authorization.empty?
163
- return authorization.join("#")
190
+
191
+ return authorization.join('#')
164
192
  end
165
193
 
166
194
  def parse_avs_code(response)
167
- AVS_MAPPING[response["avsResult"][0..1].strip] if response["avsResult"]
195
+ AVS_MAPPING[response['additionalData']['avsResult'][0..1].strip] if response.dig('additionalData', 'avsResult')
168
196
  end
169
197
 
170
198
  def flatten_hash(hash, prefix = nil)
@@ -180,20 +208,26 @@ module ActiveMerchant #:nodoc:
180
208
  flat_hash
181
209
  end
182
210
 
183
- def headers
211
+ def headers(account, password)
184
212
  {
185
213
  'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
186
- 'Authorization' => 'Basic ' + Base64.strict_encode64("ws@Company.#{@options[:company]}:#{@options[:password]}").strip
214
+ 'Authorization' => 'Basic ' + Base64.strict_encode64("#{account}@Company.#{@options[:company]}:#{password}").strip
187
215
  }
188
216
  end
189
217
 
190
218
  def parse(response)
191
- Hash[
192
- response.split('&').map do |x|
193
- key, val = x.split('=', 2)
194
- [key.split('.').last, CGI.unescape(val)]
219
+ parsed_response = {}
220
+ params = CGI.parse(response)
221
+ params.each do |key, value|
222
+ parsed_key = key.split('.', 2)
223
+ if parsed_key.size > 1
224
+ parsed_response[parsed_key[0]] ||= {}
225
+ parsed_response[parsed_key[0]][parsed_key[1]] = value[0]
226
+ else
227
+ parsed_response[parsed_key[0]] = value[0]
195
228
  end
196
- ]
229
+ end
230
+ parsed_response
197
231
  end
198
232
 
199
233
  def post_data(data)
@@ -208,25 +242,28 @@ module ActiveMerchant #:nodoc:
208
242
  return response['resultCode'] if response.has_key?('resultCode') # Payment request
209
243
  return response['response'] if response['response'] # Modification request
210
244
  return response['result'] if response.has_key?('result') # Store/Recurring request
245
+
211
246
  'Failure' # Negative fallback in case of error
212
247
  end
213
248
 
214
249
  def success_from(response)
215
250
  return true if response['result'] == 'Success'
216
- return true if response['resultCode'] == 'Authorised'
217
- return true if response['resultCode'] == 'Received'
218
- successful_responses = %w([capture-received] [cancel-received] [refund-received])
219
- successful_responses.include?(response['response'])
251
+
252
+ successful_results = %w(Authorised Received [payout-submit-received])
253
+ successful_responses = %w([capture-received] [cancel-received] [refund-received] [payout-confirm-received])
254
+ successful_results.include?(response['resultCode']) || successful_responses.include?(response['response'])
220
255
  end
221
256
 
222
257
  def build_url(action)
223
258
  case action
224
259
  when 'store'
225
- "#{test? ? self.test_url : self.live_url}/Recurring/v12/storeToken"
260
+ "#{test? ? self.test_url : self.live_url}/Recurring/#{API_VERSION}/storeToken"
226
261
  when 'finalize3ds'
227
- "#{test? ? self.test_url : self.live_url}/Payment/v12/authorise3d"
262
+ "#{test? ? self.test_url : self.live_url}/Payment/#{API_VERSION}/authorise3d"
263
+ when 'storeDetailAndSubmitThirdParty', 'confirmThirdParty'
264
+ "#{test? ? self.test_url : self.live_url}/Payout/#{API_VERSION}/#{action}"
228
265
  else
229
- "#{test? ? self.test_url : self.live_url}/Payment/v12/#{action}"
266
+ "#{test? ? self.test_url : self.live_url}/Payment/#{API_VERSION}/#{action}"
230
267
  end
231
268
  end
232
269
 
@@ -249,24 +286,24 @@ module ActiveMerchant #:nodoc:
249
286
  def parse_street(address)
250
287
  address_to_parse = "#{address[:address1]} #{address[:address2]}"
251
288
  street = address[:street] || address_to_parse.split(/\s+/).keep_if { |x| x !~ /\d/ }.join(' ')
252
- street.empty? ? "Not Provided" : street
289
+ street.empty? ? 'Not Provided' : street
253
290
  end
254
291
 
255
292
  def parse_house_number(address)
256
293
  address_to_parse = "#{address[:address1]} #{address[:address2]}"
257
294
  house = address[:houseNumberOrName] || address_to_parse.split(/\s+/).keep_if { |x| x =~ /\d/ }.join(' ')
258
- house.empty? ? "Not Provided" : house
295
+ house.empty? ? 'Not Provided' : house
259
296
  end
260
297
 
261
298
  def create_address_hash(address, house, street)
262
299
  hash = {}
263
300
  hash[:houseNumberOrName] = house
264
301
  hash[:street] = street
265
- hash[:city] = address[:city] if address[:city]
266
- hash[:stateOrProvince] = address[:state] if address[:state]
267
- hash[:postalCode] = address[:zip] if address[:zip]
268
- hash[:country] = address[:country] if address[:country]
269
- hash
302
+ hash[:city] = address[:city]
303
+ hash[:stateOrProvince] = address[:state]
304
+ hash[:postalCode] = address[:zip]
305
+ hash[:country] = address[:country]
306
+ hash.keep_if { |_, v| v }
270
307
  end
271
308
 
272
309
  def amount_hash(money, currency)
@@ -295,31 +332,65 @@ module ActiveMerchant #:nodoc:
295
332
  end
296
333
 
297
334
  def psp_reference_from(authorization)
298
- authorization.nil? ? nil : authorization.split("#").first
335
+ authorization.nil? ? nil : authorization.split('#').first
299
336
  end
300
337
 
301
338
  def payment_request(money, options)
302
339
  hash = {}
303
- hash[:merchantAccount] = @options[:merchant]
304
- hash[:reference] = options[:order_id] if options[:order_id]
305
- hash[:shopperEmail] = options[:email] if options[:email]
306
- hash[:shopperIP] = options[:ip] if options[:ip]
307
- hash[:shopperReference] = options[:customer] if options[:customer]
308
- hash[:shopperInteraction] = options[:shopper_interaction] if options[:shopper_interaction]
340
+ hash[:merchantAccount] = @options[:merchant]
341
+ hash[:reference] = options[:order_id]
342
+ hash[:shopperEmail] = options[:email]
343
+ hash[:shopperIP] = options[:ip]
344
+ hash[:shopperReference] = options[:customer]
345
+ hash[:shopperInteraction] = options[:shopper_interaction]
346
+ hash[:deviceFingerprint] = options[:device_fingerprint]
309
347
  hash.keep_if { |_, v| v }
310
348
  end
311
349
 
312
350
  def store_request(options)
313
351
  hash = {}
314
352
  hash[:merchantAccount] = @options[:merchant]
315
- hash[:shopperEmail] = options[:email] if options[:email]
353
+ hash[:shopperEmail] = options[:email]
316
354
  hash[:shopperReference] = options[:customer] if options[:customer]
317
355
  hash.keep_if { |_, v| v }
318
356
  end
319
357
 
320
358
  def add_3ds(post, options)
321
- post[:additionalData] = { executeThreeD: 'true' }
322
- post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] }
359
+ if three_ds_2_options = options[:three_ds_2]
360
+ device_channel = three_ds_2_options[:channel]
361
+ if device_channel == 'app'
362
+ post[:threeDS2RequestData] = { deviceChannel: device_channel }
363
+ else
364
+ add_browser_info(three_ds_2_options[:browser_info], post)
365
+ post[:threeDS2RequestData] = { deviceChannel: device_channel, notificationURL: three_ds_2_options[:notification_url] }
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
373
+ else
374
+ return unless options[:execute_threed] || options[:threed_dynamic]
375
+
376
+ post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] }
377
+ post[:additionalData] = { executeThreeD: 'true' } if options[:execute_threed]
378
+ end
379
+ end
380
+
381
+ def add_browser_info(browser_info, post)
382
+ return unless browser_info
383
+
384
+ post[:browserInfo] = {
385
+ acceptHeader: browser_info[:accept_header],
386
+ colorDepth: browser_info[:depth],
387
+ javaEnabled: browser_info[:java],
388
+ language: browser_info[:language],
389
+ screenHeight: browser_info[:height],
390
+ screenWidth: browser_info[:width],
391
+ timeZoneOffset: browser_info[:timezone],
392
+ userAgent: browser_info[:user_agent]
393
+ }
323
394
  end
324
395
  end
325
396
  end
@@ -1,15 +1,15 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class BarclaysEpdqExtraPlusGateway < OgoneGateway
4
- self.test_url = "https://mdepayments.epdq.co.uk/ncol/test/"
5
- self.live_url = "https://payments.epdq.co.uk/ncol/prod/"
4
+ self.test_url = 'https://mdepayments.epdq.co.uk/ncol/test/'
5
+ self.live_url = 'https://payments.epdq.co.uk/ncol/prod/'
6
6
 
7
- self.display_name = "Barclays ePDQ Extra Plus"
8
- self.homepage_url = "http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/"
7
+ self.display_name = 'Barclays ePDQ Extra Plus'
8
+ self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/'
9
9
 
10
- self.supported_countries = ["GB"]
11
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
12
- self.default_currency = "GBP"
10
+ self.supported_countries = ['GB']
11
+ self.supported_cardtypes = %i[visa master american_express diners_club discover jcb maestro]
12
+ self.default_currency = 'GBP'
13
13
  end
14
14
  end
15
15
  end
@@ -1,4 +1,4 @@
1
- require "digest/sha2"
1
+ require 'digest/sha2'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
@@ -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
 
@@ -72,7 +72,7 @@ module ActiveMerchant #:nodoc:
72
72
  def add_creditcard(post, creditcard)
73
73
  post[:CARDFULLNAME] = creditcard ? creditcard.name : ''
74
74
  post[:CARDCODE] = creditcard ? creditcard.number : ''
75
- post[:CARDVALIDITYDATE] = creditcard ? "%02d-%02s" % [creditcard.month, creditcard.year.to_s[-2..-1]] : ''
75
+ post[:CARDVALIDITYDATE] = creditcard ? '%02d-%02s' % [creditcard.month, creditcard.year.to_s[-2..-1]] : ''
76
76
  post[:CARDCVV] = creditcard ? creditcard.verification_value : ''
77
77
  end
78
78
 
@@ -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