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
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.live_url = self.test_url = 'https://secure.payscout.com/api/transact.php'
5
5
 
6
6
  self.supported_countries = ['US']
7
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
7
+ self.supported_cardtypes = %i[visa master american_express discover]
8
8
  self.default_currency = 'USD'
9
9
  self.homepage_url = 'http://www.payscout.com/'
10
10
  self.display_name = 'Payscout'
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
62
62
  post[:address1] = address[:address1].to_s
63
63
  post[:address2] = address[:address2].to_s
64
64
  post[:city] = address[:city].to_s
65
- post[:state] = (address[:state].blank? ? 'n/a' : address[:state])
65
+ post[:state] = (address[:state].blank? ? 'n/a' : address[:state])
66
66
  post[:zip] = address[:zip].to_s
67
67
  post[:country] = address[:country].to_s
68
68
  post[:phone] = address[:phone].to_s
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
78
78
  post[:shipping_address2] = address[:address2].to_s
79
79
  post[:shipping_city] = address[:city].to_s
80
80
  post[:shipping_country] = address[:country].to_s
81
- post[:shipping_state] = (address[:state].blank? ? 'n/a' : address[:state])
81
+ post[:shipping_state] = (address[:state].blank? ? 'n/a' : address[:state])
82
82
  post[:shipping_zip] = address[:zip].to_s
83
83
  post[:shipping_email] = address[:email].to_s
84
84
  end
@@ -116,12 +116,11 @@ module ActiveMerchant #:nodoc:
116
116
  message = message_from(response)
117
117
  test_mode = (test? || message =~ /TESTMODE/)
118
118
  Response.new(success?(response), message, response,
119
- :test => test_mode,
120
- :authorization => response['transactionid'],
121
- :fraud_review => fraud_review?(response),
122
- :avs_result => { :code => response['avsresponse'] },
123
- :cvv_result => response['cvvresponse']
124
- )
119
+ test: test_mode,
120
+ authorization: response['transactionid'],
121
+ fraud_review: fraud_review?(response),
122
+ avs_result: { code: response['avsresponse'] },
123
+ cvv_result: response['cvvresponse'])
125
124
  end
126
125
 
127
126
  def message_from(response)
@@ -1,7 +1,6 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class PaystationGateway < Gateway
4
-
5
4
  self.live_url = self.test_url = 'https://www.paystation.co.nz/direct/paystation.dll'
6
5
 
7
6
  # an "error code" of "0" means "No error - transaction successful"
@@ -14,7 +13,7 @@ module ActiveMerchant #:nodoc:
14
13
  self.supported_countries = ['NZ']
15
14
 
16
15
  # TODO: check this with paystation (amex and diners need to be enabled)
17
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club ]
16
+ self.supported_cardtypes = %i[visa master american_express diners_club]
18
17
 
19
18
  self.homepage_url = 'http://paystation.co.nz'
20
19
  self.display_name = 'Paystation'
@@ -75,7 +74,7 @@ module ActiveMerchant #:nodoc:
75
74
  commit(post)
76
75
  end
77
76
 
78
- def refund(money, authorization, options={})
77
+ def refund(money, authorization, options = {})
79
78
  post = new_request
80
79
  add_amount(post, money, options)
81
80
  add_invoice(post, options)
@@ -84,7 +83,7 @@ module ActiveMerchant #:nodoc:
84
83
  commit(post)
85
84
  end
86
85
 
87
- def verify(credit_card, options={})
86
+ def verify(credit_card, options = {})
88
87
  authorize(0, credit_card, options)
89
88
  end
90
89
 
@@ -128,7 +127,7 @@ module ActiveMerchant #:nodoc:
128
127
  end
129
128
 
130
129
  def add_token(post, token)
131
- post[:fp] = 't' # turn on "future payments" - what paystation calls Token Billing
130
+ post[:fp] = 't' # turn on "future payments" - what paystation calls Token Billing
132
131
  post[:ft] = token
133
132
  end
134
133
 
@@ -179,9 +178,8 @@ module ActiveMerchant #:nodoc:
179
178
  message = message_from(response)
180
179
 
181
180
  PaystationResponse.new(success?(response), message, response,
182
- :test => (response[:tm]&.casecmp('t')&.zero?),
183
- :authorization => response[:paystation_transaction_id]
184
- )
181
+ test: (response[:tm]&.casecmp('t')&.zero?),
182
+ authorization: response[:paystation_transaction_id])
185
183
  end
186
184
 
187
185
  def success?(response)
@@ -195,7 +193,6 @@ module ActiveMerchant #:nodoc:
195
193
  def format_date(month, year)
196
194
  "#{format(year, :two_digits)}#{format(month, :two_digits)}"
197
195
  end
198
-
199
196
  end
200
197
 
201
198
  class PaystationResponse < Response
@@ -11,17 +11,17 @@ module ActiveMerchant #:nodoc:
11
11
 
12
12
  self.supported_countries = ['IN']
13
13
  self.default_currency = 'INR'
14
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :maestro]
14
+ self.supported_cardtypes = %i[visa master american_express diners_club maestro]
15
15
 
16
16
  self.homepage_url = 'https://www.payu.in/'
17
17
  self.display_name = 'PayU India'
18
18
 
19
- def initialize(options={})
19
+ def initialize(options = {})
20
20
  requires!(options, :key, :salt)
21
21
  super
22
22
  end
23
23
 
24
- def purchase(money, payment, options={})
24
+ def purchase(money, payment, options = {})
25
25
  requires!(options, :order_id)
26
26
 
27
27
  post = {}
@@ -33,7 +33,7 @@ module ActiveMerchant #:nodoc:
33
33
 
34
34
  MultiResponse.run do |r|
35
35
  r.process { commit(url('purchase'), post) }
36
- if(r.params['enrolled'].to_s == '0')
36
+ if r.params['enrolled'].to_s == '0'
37
37
  r.process { commit(r.params['post_uri'], r.params['form_post_vars']) }
38
38
  else
39
39
  r.process { handle_3dsecure(r) }
@@ -41,7 +41,7 @@ module ActiveMerchant #:nodoc:
41
41
  end
42
42
  end
43
43
 
44
- def refund(money, authorization, options={})
44
+ def refund(money, authorization, options = {})
45
45
  raise ArgumentError, 'Amount is required' unless money
46
46
 
47
47
  post = {}
@@ -154,20 +154,21 @@ module ActiveMerchant #:nodoc:
154
154
 
155
155
  def clean(value, format, maxlength)
156
156
  value ||= ''
157
- value = case format
158
- when :alphanumeric
159
- value.gsub(/[^A-Za-z0-9]/, '')
160
- when :name
161
- value.gsub(/[^A-Za-z ]/, '')
162
- when :numeric
163
- value.gsub(/[^0-9]/, '')
164
- when :text
165
- value.gsub(/[^A-Za-z0-9@\-_\/\. ]/, '')
166
- when nil
167
- value
168
- else
169
- raise "Unknown format #{format} for #{value}"
170
- end
157
+ value =
158
+ case format
159
+ when :alphanumeric
160
+ value.gsub(/[^A-Za-z0-9]/, '')
161
+ when :name
162
+ value.gsub(/[^A-Za-z ]/, '')
163
+ when :numeric
164
+ value.gsub(/[^0-9]/, '')
165
+ when :text
166
+ value.gsub(/[^A-Za-z0-9@\-_\/\. ]/, '')
167
+ when nil
168
+ value
169
+ else
170
+ raise "Unknown format #{format} for #{value}"
171
+ end
171
172
  value[0...maxlength]
172
173
  end
173
174
 
@@ -9,14 +9,15 @@ module ActiveMerchant #:nodoc:
9
9
  self.test_url = 'https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi'
10
10
  self.live_url = 'https://api.payulatam.com/payments-api/4.0/service.cgi'
11
11
 
12
- self.supported_countries = ['AR', 'BR', 'CL', 'CO', 'MX', 'PA', 'PE']
12
+ self.supported_countries = %w[AR BR CL CO MX PA PE]
13
13
  self.default_currency = 'USD'
14
14
  self.money_format = :dollars
15
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :naranja, :cabal]
15
+ self.supported_cardtypes = %i[visa master american_express diners_club naranja cabal]
16
16
 
17
17
  BRAND_MAP = {
18
18
  'visa' => 'VISA',
19
19
  'master' => 'MASTERCARD',
20
+ 'maestro' => 'MASTERCARD',
20
21
  'american_express' => 'AMEX',
21
22
  'diners_club' => 'DINERS',
22
23
  'naranja' => 'NARANJA',
@@ -30,24 +31,24 @@ module ActiveMerchant #:nodoc:
30
31
  'PEN' => 500
31
32
  }
32
33
 
33
- def initialize(options={})
34
+ def initialize(options = {})
34
35
  requires!(options, :merchant_id, :account_id, :api_login, :api_key, :payment_country)
35
36
  super
36
37
  end
37
38
 
38
- def purchase(amount, payment_method, options={})
39
+ def purchase(amount, payment_method, options = {})
39
40
  post = {}
40
41
  auth_or_sale(post, 'AUTHORIZATION_AND_CAPTURE', amount, payment_method, options)
41
42
  commit('purchase', post)
42
43
  end
43
44
 
44
- def authorize(amount, payment_method, options={})
45
+ def authorize(amount, payment_method, options = {})
45
46
  post = {}
46
47
  auth_or_sale(post, 'AUTHORIZATION', amount, payment_method, options)
47
48
  commit('auth', post)
48
49
  end
49
50
 
50
- def capture(amount, authorization, options={})
51
+ def capture(amount, authorization, options = {})
51
52
  post = {}
52
53
 
53
54
  add_credentials(post, 'SUBMIT_TRANSACTION', options)
@@ -62,7 +63,7 @@ module ActiveMerchant #:nodoc:
62
63
  commit('capture', post)
63
64
  end
64
65
 
65
- def void(authorization, options={})
66
+ def void(authorization, options = {})
66
67
  post = {}
67
68
 
68
69
  add_credentials(post, 'SUBMIT_TRANSACTION', options)
@@ -72,17 +73,24 @@ module ActiveMerchant #:nodoc:
72
73
  commit('void', post)
73
74
  end
74
75
 
75
- def refund(amount, authorization, options={})
76
+ def refund(amount, authorization, options = {})
76
77
  post = {}
77
78
 
78
79
  add_credentials(post, 'SUBMIT_TRANSACTION', options)
79
- add_transaction_elements(post, 'REFUND', options)
80
- add_reference(post, authorization)
81
80
 
81
+ if options[:partial_refund]
82
+ add_transaction_elements(post, 'PARTIAL_REFUND', options)
83
+ post[:transaction][:additionalValues] ||= {}
84
+ post[:transaction][:additionalValues][:TX_VALUE] = invoice_for(amount, options)[:TX_VALUE]
85
+ else
86
+ add_transaction_elements(post, 'REFUND', options)
87
+ end
88
+
89
+ add_reference(post, authorization)
82
90
  commit('refund', post)
83
91
  end
84
92
 
85
- def verify(credit_card, options={})
93
+ def verify(credit_card, options = {})
86
94
  minimum = MINIMUMS[options[:currency].upcase] if options[:currency]
87
95
  amount = options[:verify_amount] || minimum || 100
88
96
 
@@ -96,7 +104,7 @@ module ActiveMerchant #:nodoc:
96
104
  post = {}
97
105
 
98
106
  add_credentials(post, 'CREATE_TOKEN')
99
- add_payment_method_to_be_tokenized(post, payment_method)
107
+ add_payment_method_to_be_tokenized(post, payment_method, options)
100
108
 
101
109
  commit('store', post)
102
110
  end
@@ -133,7 +141,7 @@ module ActiveMerchant #:nodoc:
133
141
  add_extra_parameters(post, options)
134
142
  end
135
143
 
136
- def add_credentials(post, command, options={})
144
+ def add_credentials(post, command, options = {})
137
145
  post[:test] = test? unless command == 'CREATE_TOKEN'
138
146
  post[:language] = options[:language] || 'en'
139
147
  post[:command] = command
@@ -180,12 +188,13 @@ module ActiveMerchant #:nodoc:
180
188
 
181
189
  def billing_address_fields(options)
182
190
  return unless address = options[:billing_address]
191
+
183
192
  billing_address = {}
184
193
  billing_address[:street1] = address[:address1]
185
194
  billing_address[:street2] = address[:address2]
186
195
  billing_address[:city] = address[:city]
187
196
  billing_address[:state] = address[:state]
188
- billing_address[:country] = address[:country]
197
+ billing_address[:country] = address[:country] unless address[:country].blank?
189
198
  billing_address[:postalCode] = address[:zip] if @options[:payment_country] == 'MX'
190
199
  billing_address[:phone] = address[:phone]
191
200
  billing_address
@@ -200,7 +209,7 @@ module ActiveMerchant #:nodoc:
200
209
  buyer[:merchantBuyerId] = buyer_hash[:merchant_buyer_id]
201
210
  buyer[:cnpj] = buyer_hash[:cnpj] if @options[:payment_country] == 'BR'
202
211
  buyer[:emailAddress] = buyer_hash[:email]
203
- buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone] if options[:shipping_address]) || ''
212
+ buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone_number] if options[:shipping_address]) || ''
204
213
  buyer[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
205
214
  else
206
215
  buyer[:fullName] = payment_method.name.strip
@@ -209,7 +218,7 @@ module ActiveMerchant #:nodoc:
209
218
  buyer[:merchantBuyerId] = options[:merchant_buyer_id]
210
219
  buyer[:cnpj] = options[:cnpj] if @options[:payment_country] == 'BR'
211
220
  buyer[:emailAddress] = options[:email]
212
- buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone] if options[:shipping_address]) || ''
221
+ buyer[:contactPhone] = (options[:billing_address][:phone] if options[:billing_address]) || (options[:shipping_address][:phone_number] if options[:shipping_address]) || ''
213
222
  buyer[:shippingAddress] = shipping_address_fields(options) if options[:shipping_address]
214
223
  end
215
224
  post[:transaction][:order][:buyer] = buyer
@@ -217,6 +226,7 @@ module ActiveMerchant #:nodoc:
217
226
 
218
227
  def shipping_address_fields(options)
219
228
  return unless address = options[:shipping_address]
229
+
220
230
  shipping_address = {}
221
231
  shipping_address[:street1] = address[:address1]
222
232
  shipping_address[:street2] = address[:address2]
@@ -224,7 +234,7 @@ module ActiveMerchant #:nodoc:
224
234
  shipping_address[:state] = address[:state]
225
235
  shipping_address[:country] = address[:country]
226
236
  shipping_address[:postalCode] = address[:zip]
227
- shipping_address[:phone] = address[:phone]
237
+ shipping_address[:phone] = address[:phone_number]
228
238
  shipping_address
229
239
  end
230
240
 
@@ -269,6 +279,10 @@ module ActiveMerchant #:nodoc:
269
279
  Digest::MD5.hexdigest(signature_string)
270
280
  end
271
281
 
282
+ def codensa_bin?(number)
283
+ number.start_with?('590712')
284
+ end
285
+
272
286
  def add_payment_method(post, payment_method, options)
273
287
  if payment_method.is_a?(String)
274
288
  brand, token = split_authorization(payment_method)
@@ -286,18 +300,22 @@ module ActiveMerchant #:nodoc:
286
300
  credit_card[:name] = payment_method.name.strip
287
301
  credit_card[:processWithoutCvv2] = true if add_process_without_cvv2(payment_method, options)
288
302
  post[:transaction][:creditCard] = credit_card
289
- post[:transaction][:paymentMethod] = BRAND_MAP[payment_method.brand.to_s]
303
+ post[:transaction][:paymentMethod] = codensa_bin?(payment_method.number) ? 'CODENSA' : BRAND_MAP[payment_method.brand.to_s]
290
304
  end
291
305
  end
292
306
 
293
307
  def add_process_without_cvv2(payment_method, options)
294
308
  return true if payment_method.verification_value.blank? && options[:cvv].blank?
309
+
295
310
  false
296
311
  end
297
312
 
298
313
  def add_extra_parameters(post, options)
299
314
  extra_parameters = {}
300
315
  extra_parameters[:INSTALLMENTS_NUMBER] = options[:installments_number] || 1
316
+ extra_parameters[:EXTRA1] = options[:extra_1] if options[:extra_1]
317
+ extra_parameters[:EXTRA2] = options[:extra_2] if options[:extra_2]
318
+ extra_parameters[:EXTRA3] = options[:extra_3] if options[:extra_3]
301
319
  post[:transaction][:extraParameters] = extra_parameters
302
320
  end
303
321
 
@@ -310,15 +328,14 @@ module ActiveMerchant #:nodoc:
310
328
  post[:transaction][:reason] = 'n/a'
311
329
  end
312
330
 
313
- def add_payment_method_to_be_tokenized(post, payment_method)
331
+ def add_payment_method_to_be_tokenized(post, payment_method, options)
314
332
  credit_card_token = {}
315
- credit_card_token[:payerId] = generate_unique_id
333
+ credit_card_token[:payerId] = options[:payer_id] || generate_unique_id
316
334
  credit_card_token[:name] = payment_method.name.strip
317
- credit_card_token[:identificationNumber] = generate_unique_id
335
+ credit_card_token[:identificationNumber] = options[:dni_number]
318
336
  credit_card_token[:paymentMethod] = BRAND_MAP[payment_method.brand.to_s]
319
337
  credit_card_token[:number] = payment_method.number
320
338
  credit_card_token[:expirationDate] = format(payment_method.year, :four_digits).to_s + '/' + format(payment_method.month, :two_digits).to_s
321
- credit_card_token[:securityCode] = payment_method.verification_value
322
339
  post[:creditCardToken] = credit_card_token
323
340
  end
324
341
 
@@ -344,8 +361,8 @@ module ActiveMerchant #:nodoc:
344
361
 
345
362
  def headers
346
363
  {
347
- 'Content-Type' => 'application/json',
348
- 'Accept' => 'application/json'
364
+ 'Content-Type' => 'application/json',
365
+ 'Accept' => 'application/json'
349
366
  }
350
367
  end
351
368
 
@@ -378,22 +395,38 @@ module ActiveMerchant #:nodoc:
378
395
  def message_from(action, success, response)
379
396
  case action
380
397
  when 'store'
381
- return response['code'] if success
382
- error_description = response['creditCardToken']['errorDescription'] if response['creditCardToken']
383
- response['error'] || error_description || 'FAILED'
398
+ message_from_store(success, response)
384
399
  when 'verify_credentials'
385
- return 'VERIFIED' if success
386
- 'FAILED'
400
+ message_from_verify_credentials(success)
387
401
  else
388
- if response['transactionResponse']
389
- response_message = response['transactionResponse']['responseMessage']
390
- response_code = response['transactionResponse']['responseCode'] || response['transactionResponse']['pendingReason']
391
- end
392
- return response_code if success
393
- response['error'] || response_message || response_code || 'FAILED'
402
+ message_from_transaction_response(success, response)
394
403
  end
395
404
  end
396
405
 
406
+ def message_from_store(success, response)
407
+ return response['code'] if success
408
+
409
+ error_description = response['creditCardToken']['errorDescription'] if response['creditCardToken']
410
+ response['error'] || error_description || 'FAILED'
411
+ end
412
+
413
+ def message_from_verify_credentials(success)
414
+ return 'VERIFIED' if success
415
+
416
+ 'FAILED'
417
+ end
418
+
419
+ def message_from_transaction_response(success, response)
420
+ response_code = response.dig('transactionResponse', 'responseCode') || response.dig('transactionResponse', 'pendingReason')
421
+ return response_code if success
422
+ return response_code + ' | ' + response.dig('transactionResponse', 'paymentNetworkResponseErrorMessage') if response.dig('transactionResponse', 'paymentNetworkResponseErrorMessage')
423
+ return response.dig('transactionResponse', 'responseMessage') if response.dig('transactionResponse', 'responseMessage')
424
+ return response['error'] if response['error']
425
+ return response_code if response_code
426
+
427
+ 'FAILED'
428
+ end
429
+
397
430
  def authorization_from(action, response)
398
431
  case action
399
432
  when 'store'
@@ -422,7 +455,7 @@ module ActiveMerchant #:nodoc:
422
455
  when 'verify_credentials'
423
456
  response['error'] || 'FAILED'
424
457
  else
425
- response['transactionResponse']['errorCode'] || response['transactionResponse']['responseCode'] if response['transactionResponse']
458
+ response['transactionResponse']['paymentNetworkResponseCode'] || response['transactionResponse']['errorCode'] if response['transactionResponse']
426
459
  end
427
460
  end
428
461
 
@@ -435,7 +468,7 @@ module ActiveMerchant #:nodoc:
435
468
  false,
436
469
  message_from('', false, response),
437
470
  response,
438
- :test => test?
471
+ test: test?
439
472
  )
440
473
  end
441
474
 
@@ -3,8 +3,8 @@ module ActiveMerchant
3
3
  class PaywayGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://ccapi.client.qvalent.com/payway/ccapi'
5
5
 
6
- self.supported_countries = [ 'AU' ]
7
- self.supported_cardtypes = [ :visa, :master, :diners_club, :american_express, :bankcard ]
6
+ self.supported_countries = ['AU']
7
+ self.supported_cardtypes = %i[visa master diners_club american_express bankcard]
8
8
  self.display_name = 'Pay Way'
9
9
  self.homepage_url = 'http://www.payway.com.au'
10
10
  self.default_currency = 'AUD'
@@ -17,7 +17,7 @@ module ActiveMerchant
17
17
  '3' => 'Rejected'
18
18
  }
19
19
 
20
- RESPONSE_CODES= {
20
+ RESPONSE_CODES = {
21
21
  '00' => 'Completed Successfully',
22
22
  '01' => 'Refer to card issuer',
23
23
  '03' => 'Invalid merchant',
@@ -74,16 +74,16 @@ module ActiveMerchant
74
74
  'QZ' => 'Zero value transaction'
75
75
  }
76
76
 
77
- TRANSACTIONS = {
78
- :authorize => 'preauth',
79
- :purchase => 'capture',
80
- :capture => 'captureWithoutAuth',
81
- :status => 'query',
82
- :refund => 'refund',
83
- :store => 'registerAccount'
77
+ TRANSACTIONS = {
78
+ authorize: 'preauth',
79
+ purchase: 'capture',
80
+ capture: 'captureWithoutAuth',
81
+ status: 'query',
82
+ refund: 'refund',
83
+ store: 'registerAccount'
84
84
  }
85
85
 
86
- def initialize(options={})
86
+ def initialize(options = {})
87
87
  @options = options
88
88
 
89
89
  @options[:merchant] ||= 'TEST' if test?
@@ -92,7 +92,7 @@ module ActiveMerchant
92
92
  @options[:eci] ||= 'SSL'
93
93
  end
94
94
 
95
- def authorize(amount, payment_method, options={})
95
+ def authorize(amount, payment_method, options = {})
96
96
  requires!(options, :order_id)
97
97
 
98
98
  post = {}
@@ -101,7 +101,7 @@ module ActiveMerchant
101
101
  commit(:authorize, post)
102
102
  end
103
103
 
104
- def capture(amount, authorization, options={})
104
+ def capture(amount, authorization, options = {})
105
105
  requires!(options, :order_id)
106
106
 
107
107
  post = {}
@@ -110,7 +110,7 @@ module ActiveMerchant
110
110
  commit(:capture, post)
111
111
  end
112
112
 
113
- def purchase(amount, payment_method, options={})
113
+ def purchase(amount, payment_method, options = {})
114
114
  requires!(options, :order_id)
115
115
 
116
116
  post = {}
@@ -119,7 +119,7 @@ module ActiveMerchant
119
119
  commit(:purchase, post)
120
120
  end
121
121
 
122
- def refund(amount, authorization, options={})
122
+ def refund(amount, authorization, options = {})
123
123
  requires!(options, :order_id)
124
124
 
125
125
  post = {}
@@ -128,7 +128,7 @@ module ActiveMerchant
128
128
  commit(:refund, post)
129
129
  end
130
130
 
131
- def store(credit_card, options={})
131
+ def store(credit_card, options = {})
132
132
  requires!(options, :billing_id)
133
133
 
134
134
  post = {}
@@ -137,7 +137,7 @@ module ActiveMerchant
137
137
  commit(:store, post)
138
138
  end
139
139
 
140
- def status(options={})
140
+ def status(options = {})
141
141
  requires!(options, :order_id)
142
142
 
143
143
  commit(:status, 'customer.orderNumber' => options[:order_id])
@@ -193,14 +193,14 @@ module ActiveMerchant
193
193
  success = (params[:summary_code] ? (params[:summary_code] == '0') : (params[:response_code] == '00'))
194
194
 
195
195
  Response.new(success, message, params,
196
- :test => (@options[:merchant].to_s == 'TEST'),
197
- :authorization => post[:order_number]
198
- )
196
+ test: (@options[:merchant].to_s == 'TEST'),
197
+ authorization: post[:order_number])
199
198
  rescue ActiveMerchant::ResponseError => e
200
199
  raise unless e.response.code == '403'
201
- return Response.new(false, 'Invalid credentials', {}, :test => test?)
200
+
201
+ return Response.new(false, 'Invalid credentials', {}, test: test?)
202
202
  rescue ActiveMerchant::ClientCertificateError
203
- return Response.new(false, 'Invalid certificate', {}, :test => test?)
203
+ return Response.new(false, 'Invalid certificate', {}, test: test?)
204
204
  end
205
205
  end
206
206
  end