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
@@ -1,27 +1,27 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class WorldpayOnlinePaymentsGateway < Gateway
4
- self.live_url = 'https://api.worldpay.com/v1/'
4
+ self.live_url = 'https://api.worldpay.com/v1/'
5
5
 
6
6
  self.default_currency = 'GBP'
7
7
 
8
8
  self.money_format = :cents
9
9
 
10
10
  self.supported_countries = %w(HK US GB BE CH CZ DE DK ES FI FR GR HU IE IT LU MT NL NO PL PT SE SG TR)
11
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
11
+ self.supported_cardtypes = %i[visa master american_express discover jcb maestro]
12
12
 
13
13
  self.homepage_url = 'http://online.worldpay.com'
14
14
  self.display_name = 'Worldpay Online Payments'
15
15
 
16
- def initialize(options={})
16
+ def initialize(options = {})
17
17
  requires!(options, :client_key, :service_key)
18
18
  @client_key = options[:client_key]
19
19
  @service_key = options[:service_key]
20
20
  super
21
21
  end
22
22
 
23
- def authorize(money, credit_card, options={})
24
- response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
23
+ def authorize(money, credit_card, options = {})
24
+ response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
25
25
  if response.success?
26
26
  options[:authorizeOnly] = true
27
27
  post = create_post_for_auth_or_purchase(response.authorization, money, options)
@@ -30,24 +30,23 @@ module ActiveMerchant #:nodoc:
30
30
  response
31
31
  end
32
32
 
33
- def capture(money, authorization, options={})
33
+ def capture(money, authorization, options = {})
34
34
  if authorization
35
- commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount'=>money}, options, 'capture')
35
+ commit(:post, "orders/#{CGI.escape(authorization)}/capture", { 'captureAmount' => money }, options, 'capture')
36
36
  else
37
37
  Response.new(false,
38
38
  'FAILED',
39
39
  'FAILED',
40
- :test => test?,
41
- :authorization => false,
42
- :avs_result => {},
43
- :cvv_result => {},
44
- :error_code => false
45
- )
40
+ test: test?,
41
+ authorization: false,
42
+ avs_result: {},
43
+ cvv_result: {},
44
+ error_code: false)
46
45
  end
47
46
  end
48
47
 
49
- def purchase(money, credit_card, options={})
50
- response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
48
+ def purchase(money, credit_card, options = {})
49
+ response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
51
50
  if response.success?
52
51
  post = create_post_for_auth_or_purchase(response.authorization, money, options)
53
52
  response = commit(:post, 'orders', post, options, 'purchase')
@@ -55,20 +54,18 @@ module ActiveMerchant #:nodoc:
55
54
  response
56
55
  end
57
56
 
58
- def refund(money, orderCode, options={})
59
- obj = money ? {'refundAmount' => money} : {}
57
+ def refund(money, orderCode, options = {})
58
+ obj = money ? { 'refundAmount' => money } : {}
60
59
  commit(:post, "orders/#{CGI.escape(orderCode)}/refund", obj, options, 'refund')
61
60
  end
62
61
 
63
- def void(orderCode, options={})
62
+ def void(orderCode, options = {})
64
63
  response = commit(:delete, "orders/#{CGI.escape(orderCode)}", nil, options, 'void')
65
- if !response.success? && (response.params && response.params['customCode'] != 'ORDER_NOT_FOUND')
66
- response = refund(nil, orderCode)
67
- end
64
+ response = refund(nil, orderCode) if !response.success? && (response.params && response.params['customCode'] != 'ORDER_NOT_FOUND')
68
65
  response
69
66
  end
70
67
 
71
- def verify(credit_card, options={})
68
+ def verify(credit_card, options = {})
72
69
  authorize(0, credit_card, options)
73
70
  end
74
71
 
@@ -76,18 +73,18 @@ module ActiveMerchant #:nodoc:
76
73
 
77
74
  def create_token(reusable, name, exp_month, exp_year, number, cvc)
78
75
  obj = {
79
- 'reusable'=> reusable,
80
- 'paymentMethod'=> {
81
- 'type'=> 'Card',
82
- 'name'=> name,
83
- 'expiryMonth'=> exp_month,
84
- 'expiryYear'=> exp_year,
85
- 'cardNumber'=> number,
86
- 'cvc'=> cvc
76
+ 'reusable' => reusable,
77
+ 'paymentMethod' => {
78
+ 'type' => 'Card',
79
+ 'name' => name,
80
+ 'expiryMonth' => exp_month,
81
+ 'expiryYear' => exp_year,
82
+ 'cardNumber' => number,
83
+ 'cvc' => cvc
87
84
  },
88
- 'clientKey'=> @client_key
85
+ 'clientKey' => @client_key
89
86
  }
90
- token_response = commit(:post, 'tokens', obj, {'Authorization' => @service_key}, 'token')
87
+ token_response = commit(:post, 'tokens', obj, { 'Authorization' => @service_key }, 'token')
91
88
  token_response
92
89
  end
93
90
 
@@ -97,16 +94,16 @@ module ActiveMerchant #:nodoc:
97
94
  'orderDescription' => options[:description] || 'Worldpay Order',
98
95
  'amount' => money,
99
96
  'currencyCode' => options[:currency] || default_currency,
100
- 'name' => options[:billing_address]&&options[:billing_address][:name] ? options[:billing_address][:name] : '',
97
+ 'name' => options[:billing_address] && options[:billing_address][:name] ? options[:billing_address][:name] : '',
101
98
  'billingAddress' => {
102
- 'address1'=>options[:billing_address]&&options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
103
- 'address2'=>options[:billing_address]&&options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
104
- 'address3'=>'',
105
- 'postalCode'=>options[:billing_address]&&options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
106
- 'city'=>options[:billing_address]&&options[:billing_address][:city] ? options[:billing_address][:city] : '',
107
- 'state'=>options[:billing_address]&&options[:billing_address][:state] ? options[:billing_address][:state] : '',
108
- 'countryCode'=>options[:billing_address]&&options[:billing_address][:country] ? options[:billing_address][:country] : ''
109
- },
99
+ 'address1' => options[:billing_address] && options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
100
+ 'address2' => options[:billing_address] && options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
101
+ 'address3' => '',
102
+ 'postalCode' => options[:billing_address] && options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
103
+ 'city' => options[:billing_address] && options[:billing_address][:city] ? options[:billing_address][:city] : '',
104
+ 'state' => options[:billing_address] && options[:billing_address][:state] ? options[:billing_address][:state] : '',
105
+ 'countryCode' => options[:billing_address] && options[:billing_address][:country] ? options[:billing_address][:country] : ''
106
+ },
110
107
  'customerOrderCode' => options[:order_id],
111
108
  'orderType' => 'ECOM',
112
109
  'authorizeOnly' => options[:authorizeOnly] ? true : false
@@ -123,15 +120,13 @@ module ActiveMerchant #:nodoc:
123
120
  'Content-Type' => 'application/json',
124
121
  'User-Agent' => "Worldpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
125
122
  'X-Worldpay-Client-User-Agent' => user_agent,
126
- 'X-Worldpay-Client-User-Metadata' => {:ip => options[:ip]}.to_json
123
+ 'X-Worldpay-Client-User-Metadata' => { ip: options[:ip] }.to_json
127
124
  }
128
- if options['Authorization']
129
- headers['Authorization'] = options['Authorization']
130
- end
125
+ headers['Authorization'] = options['Authorization'] if options['Authorization']
131
126
  headers
132
127
  end
133
128
 
134
- def commit(method, url, parameters=nil, options = {}, type = false)
129
+ def commit(method, url, parameters = nil, options = {}, type = false)
135
130
  raw_response = response = nil
136
131
  success = false
137
132
  begin
@@ -151,7 +146,7 @@ module ActiveMerchant #:nodoc:
151
146
  success = true
152
147
  elsif type == 'purchase' && response['paymentStatus'] == 'SUCCESS'
153
148
  success = true
154
- elsif type == 'capture' || type=='refund' || type=='void'
149
+ elsif type == 'capture' || type == 'refund' || type == 'void'
155
150
  success = true
156
151
  end
157
152
  end
@@ -178,12 +173,11 @@ module ActiveMerchant #:nodoc:
178
173
  Response.new(success,
179
174
  success ? 'SUCCESS' : response['message'],
180
175
  response,
181
- :test => test?,
182
- :authorization => authorization,
183
- :avs_result => {},
184
- :cvv_result => {},
185
- :error_code => success ? nil : response['customCode']
186
- )
176
+ test: test?,
177
+ authorization: authorization,
178
+ avs_result: {},
179
+ cvv_result: {},
180
+ error_code: success ? nil : response['customCode'])
187
181
  end
188
182
 
189
183
  def test?
@@ -209,7 +203,6 @@ module ActiveMerchant #:nodoc:
209
203
  def handle_response(response)
210
204
  response.body
211
205
  end
212
-
213
206
  end
214
207
  end
215
208
  end
@@ -15,14 +15,14 @@ module ActiveMerchant #:nodoc:
15
15
  self.supported_countries = ['US']
16
16
  self.default_currency = 'USD'
17
17
  self.money_format = :dollars
18
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb]
18
+ self.supported_cardtypes = %i[visa master american_express discover jcb]
19
19
 
20
- def initialize(options={})
20
+ def initialize(options = {})
21
21
  requires!(options, :acctid, :subid, :merchantpin)
22
22
  super
23
23
  end
24
24
 
25
- def purchase(money, payment_method, options={})
25
+ def purchase(money, payment_method, options = {})
26
26
  post = {}
27
27
  add_invoice(post, money, options)
28
28
  add_payment_method(post, payment_method)
@@ -31,7 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  commit('purchase', options, post)
32
32
  end
33
33
 
34
- def authorize(money, payment, options={})
34
+ def authorize(money, payment, options = {})
35
35
  post = {}
36
36
  add_invoice(post, money, options)
37
37
  add_credit_card(post, payment)
@@ -40,7 +40,7 @@ module ActiveMerchant #:nodoc:
40
40
  commit('authorize', options, post)
41
41
  end
42
42
 
43
- def capture(amount, authorization, options={})
43
+ def capture(amount, authorization, options = {})
44
44
  post = {}
45
45
  add_invoice(post, amount, options)
46
46
  add_reference(post, authorization)
@@ -49,7 +49,7 @@ module ActiveMerchant #:nodoc:
49
49
  commit('capture', options, post)
50
50
  end
51
51
 
52
- def refund(amount, authorization, options={})
52
+ def refund(amount, authorization, options = {})
53
53
  post = {}
54
54
  add_invoice(post, amount, options)
55
55
  add_reference(post, authorization)
@@ -58,14 +58,14 @@ module ActiveMerchant #:nodoc:
58
58
  commit('refund', options, post)
59
59
  end
60
60
 
61
- def void(authorization, options={})
61
+ def void(authorization, options = {})
62
62
  post = {}
63
63
  add_reference(post, authorization)
64
64
 
65
65
  commit('void', options, post)
66
66
  end
67
67
 
68
- def verify(credit_card, options={})
68
+ def verify(credit_card, options = {})
69
69
  MultiResponse.run(:use_first_response) do |r|
70
70
  r.process { authorize(100, credit_card, options) }
71
71
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -91,7 +91,7 @@ module ActiveMerchant #:nodoc:
91
91
  end
92
92
 
93
93
  def add_customer_data(post, options)
94
- if(billing_address = (options[:billing_address] || options[:address]))
94
+ if (billing_address = (options[:billing_address] || options[:address]))
95
95
  post[:ci_companyname] = billing_address[:company]
96
96
  post[:ci_billaddr1] = billing_address[:address1]
97
97
  post[:ci_billaddr2] = billing_address[:address2]
@@ -105,13 +105,13 @@ module ActiveMerchant #:nodoc:
105
105
  post[:ci_ipaddress] = billing_address[:ip]
106
106
  end
107
107
 
108
- if(shipping_address = options[:shipping_address])
108
+ if (shipping_address = options[:shipping_address])
109
109
  post[:ci_shipaddr1] = shipping_address[:address1]
110
110
  post[:ci_shipaddr2] = shipping_address[:address2]
111
111
  post[:ci_shipcity] = shipping_address[:city]
112
112
  post[:ci_shipstate] = shipping_address[:state]
113
- post[:ci_shipzip] = shipping_address[:zip]
114
- post[:ci_shipcountry] = shipping_address[:country]
113
+ post[:ci_shipzip] = shipping_address[:zip]
114
+ post[:ci_shipcountry] = shipping_address[:country]
115
115
  end
116
116
  end
117
117
 
@@ -139,7 +139,7 @@ module ActiveMerchant #:nodoc:
139
139
 
140
140
  ACCOUNT_TYPES = {
141
141
  'checking' => '1',
142
- 'savings' => '2',
142
+ 'savings' => '2'
143
143
  }
144
144
 
145
145
  def add_check(post, payment_method)
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
  'refund' => 'ns_credit',
179
179
  'authorize' => 'ns_quicksale_cc',
180
180
  'capture' => 'ns_quicksale_cc',
181
- 'void' => 'ns_void',
181
+ 'void' => 'ns_void'
182
182
  }
183
183
 
184
184
  def commit(action, options, post)
@@ -196,8 +196,8 @@ module ActiveMerchant #:nodoc:
196
196
  succeeded,
197
197
  message_from(succeeded, raw),
198
198
  raw,
199
- :authorization => authorization_from(raw),
200
- :test => test?
199
+ authorization: authorization_from(raw),
200
+ test: test?
201
201
  )
202
202
  end
203
203
 
@@ -14,10 +14,10 @@ module ActiveMerchant #:nodoc:
14
14
  self.require_verification_value = false
15
15
  self.require_name = false
16
16
 
17
- attr_accessor :payment_cryptogram, :eci, :transaction_id
17
+ attr_accessor :payment_cryptogram, :eci, :transaction_id, :metadata
18
18
  attr_writer :source
19
19
 
20
- SOURCES = %i(apple_pay android_pay google_pay)
20
+ SOURCES = %i(apple_pay android_pay google_pay network_token)
21
21
 
22
22
  def source
23
23
  if defined?(@source) && SOURCES.include?(@source)
@@ -4,12 +4,16 @@ module ActiveMerchant #:nodoc:
4
4
  end
5
5
 
6
6
  class Response
7
- attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code, :emv_authorization
7
+ attr_reader :params, :message, :test, :authorization, :avs_result, :cvv_result, :error_code, :emv_authorization, :network_transaction_id
8
8
 
9
9
  def success?
10
10
  @success
11
11
  end
12
12
 
13
+ def failure?
14
+ !success?
15
+ end
16
+
13
17
  def test?
14
18
  @test
15
19
  end
@@ -25,18 +29,19 @@ module ActiveMerchant #:nodoc:
25
29
  @fraud_review = options[:fraud_review]
26
30
  @error_code = options[:error_code]
27
31
  @emv_authorization = options[:emv_authorization]
32
+ @network_transaction_id = options[:network_transaction_id]
28
33
 
29
34
  @avs_result = if options[:avs_result].kind_of?(AVSResult)
30
35
  options[:avs_result].to_hash
31
36
  else
32
37
  AVSResult.new(options[:avs_result]).to_hash
33
- end
38
+ end
34
39
 
35
40
  @cvv_result = if options[:cvv_result].kind_of?(CVVResult)
36
41
  options[:cvv_result].to_hash
37
42
  else
38
43
  CVVResult.new(options[:cvv_result]).to_hash
39
- end
44
+ end
40
45
  end
41
46
  end
42
47
 
@@ -53,14 +58,14 @@ module ActiveMerchant #:nodoc:
53
58
  @primary_response = nil
54
59
  end
55
60
 
56
- def process(ignore_result=false)
61
+ def process(ignore_result = false)
57
62
  return unless success?
58
63
 
59
64
  response = yield
60
65
  self << response
61
66
 
62
67
  unless ignore_result
63
- if(@use_first_response && response.success?)
68
+ if @use_first_response && response.success?
64
69
  @primary_response ||= response
65
70
  else
66
71
  @primary_response = response
@@ -80,7 +85,21 @@ module ActiveMerchant #:nodoc:
80
85
  (primary_response ? primary_response.success? : true)
81
86
  end
82
87
 
83
- %w(params message test authorization avs_result cvv_result error_code emv_authorization test? fraud_review?).each do |m|
88
+ def avs_result
89
+ return @primary_response.try(:avs_result) if @use_first_response
90
+
91
+ result = responses.reverse.find { |r| r.avs_result['code'].present? }
92
+ result.try(:avs_result) || responses.last.try(:avs_result)
93
+ end
94
+
95
+ def cvv_result
96
+ return @primary_response.try(:cvv_result) if @use_first_response
97
+
98
+ result = responses.reverse.find { |r| r.cvv_result['code'].present? }
99
+ result.try(:cvv_result) || responses.last.try(:cvv_result)
100
+ end
101
+
102
+ %w(params message test authorization error_code emv_authorization test? fraud_review?).each do |m|
84
103
  class_eval %(
85
104
  def #{m}
86
105
  (@responses.empty? ? nil : primary_response.#{m})
@@ -0,0 +1,27 @@
1
+ module ActiveMerchant
2
+ module Billing
3
+ module ThreeDSecureEciMapper
4
+ NON_THREE_D_SECURE_TRANSACTION = :non_three_d_secure_transaction
5
+ ATTEMPTED_AUTHENTICATION_TRANSACTION = :attempted_authentication_transaction
6
+ FULLY_AUTHENTICATED_TRANSACTION = :fully_authenticated_transaction
7
+
8
+ ECI_00_01_02_MAP = { '00' => NON_THREE_D_SECURE_TRANSACTION, '01' => ATTEMPTED_AUTHENTICATION_TRANSACTION, '02' => FULLY_AUTHENTICATED_TRANSACTION }.freeze
9
+ ECI_05_06_07_MAP = { '05' => FULLY_AUTHENTICATED_TRANSACTION, '06' => ATTEMPTED_AUTHENTICATION_TRANSACTION, '07' => NON_THREE_D_SECURE_TRANSACTION }.freeze
10
+ BRAND_TO_ECI_MAP = {
11
+ american_express: ECI_05_06_07_MAP,
12
+ dankort: ECI_05_06_07_MAP,
13
+ diners_club: ECI_05_06_07_MAP,
14
+ discover: ECI_05_06_07_MAP,
15
+ elo: ECI_05_06_07_MAP,
16
+ jcb: ECI_05_06_07_MAP,
17
+ maestro: ECI_00_01_02_MAP,
18
+ master: ECI_00_01_02_MAP,
19
+ visa: ECI_05_06_07_MAP
20
+ }.freeze
21
+
22
+ def self.map(brand, eci)
23
+ BRAND_TO_ECI_MAP.dig(brand, eci)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -13,3 +13,4 @@ require 'active_merchant/billing/apple_pay_payment_token'
13
13
  require 'active_merchant/billing/response'
14
14
  require 'active_merchant/billing/gateways'
15
15
  require 'active_merchant/billing/gateway'
16
+ require 'active_merchant/billing/three_d_secure_eci_mapper'
@@ -62,6 +62,7 @@ module ActiveMerchant
62
62
 
63
63
  def wiredump_device=(device)
64
64
  raise ArgumentError, "can't wiredump to frozen #{device.class}" if device&.frozen?
65
+
65
66
  @wiredump_device = device
66
67
  end
67
68
 
@@ -71,20 +72,19 @@ module ActiveMerchant
71
72
  headers = headers.dup
72
73
  headers['connection'] ||= 'close'
73
74
 
74
- retry_exceptions(:max_retries => max_retries, :logger => logger, :tag => tag) do
75
- begin
76
- info "connection_http_method=#{method.to_s.upcase} connection_uri=#{endpoint}", tag
75
+ retry_exceptions(max_retries: max_retries, logger: logger, tag: tag) do
76
+ info "connection_http_method=#{method.to_s.upcase} connection_uri=#{endpoint}", tag
77
77
 
78
- result = nil
78
+ result = nil
79
79
 
80
- realtime = Benchmark.realtime do
81
- http.start unless http.started?
82
- @ssl_connection = http.ssl_connection
83
- info "connection_ssl_version=#{ssl_connection[:version]} connection_ssl_cipher=#{ssl_connection[:cipher]}", tag
80
+ realtime = Benchmark.realtime do
81
+ http.start unless http.started?
82
+ @ssl_connection = http.ssl_connection
83
+ info "connection_ssl_version=#{ssl_connection[:version]} connection_ssl_cipher=#{ssl_connection[:cipher]}", tag
84
84
 
85
- result = case method
85
+ result =
86
+ case method
86
87
  when :get
87
- raise ArgumentError, 'GET requests do not support a request body' if body
88
88
  http.get(endpoint.request_uri, headers)
89
89
  when :post
90
90
  debug body
@@ -110,12 +110,11 @@ module ActiveMerchant
110
110
  else
111
111
  raise ArgumentError, "Unsupported request method #{method.to_s.upcase}"
112
112
  end
113
- end
114
-
115
- info '--> %d %s (%d %.4fs)' % [result.code, result.message, result.body ? result.body.length : 0, realtime], tag
116
- debug result.body
117
- result
118
113
  end
114
+
115
+ info '--> %d %s (%d %.4fs)' % [result.code, result.message, result.body ? result.body.length : 0, realtime], tag
116
+ debug result.body
117
+ result
119
118
  end
120
119
  ensure
121
120
  info 'connection_request_total_time=%.4fs' % [Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start], tag
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
 
40
40
  def initialize(options = {})
41
41
  @name = options.delete(:name)
42
- @codes = options.collect { |k, v| CountryCode.new(v) }
42
+ @codes = options.collect { |_k, v| CountryCode.new(v) }
43
43
  end
44
44
 
45
45
  def code(format)
@@ -184,6 +184,7 @@ module ActiveMerchant #:nodoc:
184
184
  { alpha2: 'KP', name: 'Korea, Democratic People\'s Republic of', alpha3: 'PRK', numeric: '408' },
185
185
  { alpha2: 'KR', name: 'Korea, Republic of', alpha3: 'KOR', numeric: '410' },
186
186
  { alpha2: 'XK', name: 'Kosovo', alpha3: 'XKX', numeric: '900' },
187
+ { alpha2: 'QZ', name: 'Kosovo', alpha3: 'XKX', numeric: '900' },
187
188
  { alpha2: 'KW', name: 'Kuwait', alpha3: 'KWT', numeric: '414' },
188
189
  { alpha2: 'KG', name: 'Kyrgyzstan', alpha3: 'KGZ', numeric: '417' },
189
190
  { alpha2: 'LA', name: 'Lao People\'s Democratic Republic', alpha3: 'LAO', numeric: '418' },
@@ -330,6 +331,7 @@ module ActiveMerchant #:nodoc:
330
331
  country = COUNTRIES.detect { |c| c[:name].casecmp(name).zero? }
331
332
  end
332
333
  raise InvalidCountryCodeError, "No country could be found for the country #{name}" if country.nil?
334
+
333
335
  Country.new(country.dup)
334
336
  end
335
337
  end
@@ -23,10 +23,13 @@ module ActiveMerchant #:nodoc:
23
23
  end
24
24
 
25
25
  def to_s
26
- "Failed with #{response.code} #{response.message if response.respond_to?(:message)}"
26
+ "Failed with #{response.code if response.respond_to?(:code)} #{response.message if response.respond_to?(:message)}"
27
27
  end
28
28
  end
29
29
 
30
+ class OAuthResponseError < ResponseError # :nodoc:
31
+ end
32
+
30
33
  class ClientCertificateError < ActiveMerchantError # :nodoc
31
34
  end
32
35
 
@@ -4,6 +4,7 @@ module NetHttpSslConnection
4
4
  refine Net::HTTP do
5
5
  def ssl_connection
6
6
  return {} unless use_ssl? && @socket.present?
7
+
7
8
  { version: @socket.io.ssl_version, cipher: @socket.io.cipher[0] }
8
9
  end
9
10
  end
@@ -17,26 +17,24 @@ module ActiveMerchant
17
17
  base.send(:attr_accessor, :retry_safe)
18
18
  end
19
19
 
20
- def retry_exceptions(options={})
20
+ def retry_exceptions(options = {})
21
21
  connection_errors = DEFAULT_CONNECTION_ERRORS.merge(options[:connection_exceptions] || {})
22
22
 
23
23
  retry_network_exceptions(options) do
24
- begin
25
- yield
26
- rescue Errno::ECONNREFUSED => e
27
- raise ActiveMerchant::RetriableConnectionError.new('The remote server refused the connection', e)
28
- rescue OpenSSL::X509::CertificateError => e
29
- NetworkConnectionRetries.log(options[:logger], :error, e.message, options[:tag])
30
- raise ActiveMerchant::ClientCertificateError, 'The remote server did not accept the provided SSL certificate'
31
- rescue Zlib::BufError
32
- raise ActiveMerchant::InvalidResponseError, 'The remote server replied with an invalid response'
33
- rescue *connection_errors.keys => e
34
- raise ActiveMerchant::ConnectionError.new(derived_error_message(connection_errors, e.class), e)
35
- end
24
+ yield
25
+ rescue Errno::ECONNREFUSED => e
26
+ raise ActiveMerchant::RetriableConnectionError.new('The remote server refused the connection', e)
27
+ rescue OpenSSL::X509::CertificateError => e
28
+ NetworkConnectionRetries.log(options[:logger], :error, e.message, options[:tag])
29
+ raise ActiveMerchant::ClientCertificateError, 'The remote server did not accept the provided SSL certificate'
30
+ rescue Zlib::BufError
31
+ raise ActiveMerchant::InvalidResponseError, 'The remote server replied with an invalid response'
32
+ rescue *connection_errors.keys => e
33
+ raise ActiveMerchant::ConnectionError.new(derived_error_message(connection_errors, e.class), e)
36
34
  end
37
35
  end
38
36
 
39
- def self.log(logger, level, message, tag=nil)
37
+ def self.log(logger, level, message, tag = nil)
40
38
  tag ||= self.class.to_s
41
39
  message = "[#{tag}] #{message}"
42
40
  logger&.send(level, message)
@@ -52,17 +50,17 @@ module ActiveMerchant
52
50
  begin
53
51
  request_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
54
52
  result = yield
55
- log_with_retry_details(options[:logger], initial_retries-retries + 1, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, 'success', options[:tag])
53
+ log_with_retry_details(options[:logger], initial_retries - retries + 1, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, 'success', options[:tag])
56
54
  result
57
55
  rescue ActiveMerchant::RetriableConnectionError => e
58
56
  retries -= 1
59
57
 
60
- log_with_retry_details(options[:logger], initial_retries-retries, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, e.message, options[:tag])
58
+ log_with_retry_details(options[:logger], initial_retries - retries, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, e.message, options[:tag])
61
59
  retry unless retries.zero?
62
60
  raise ActiveMerchant::ConnectionError.new(e.message, e)
63
61
  rescue ActiveMerchant::ConnectionError, ActiveMerchant::InvalidResponseError => e
64
62
  retries -= 1
65
- log_with_retry_details(options[:logger], initial_retries-retries, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, e.message, options[:tag])
63
+ log_with_retry_details(options[:logger], initial_retries - retries, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, e.message, options[:tag])
66
64
  retry if (options[:retry_safe] || retry_safe) && !retries.zero?
67
65
  raise
68
66
  end
@@ -2,11 +2,12 @@ require 'cgi'
2
2
 
3
3
  module ActiveMerchant
4
4
  class PostData < Hash
5
- class_attribute :required_fields, :instance_writer => false
5
+ class_attribute :required_fields, instance_writer: false
6
6
  self.required_fields = []
7
7
 
8
8
  def []=(key, value)
9
9
  return if value.blank? && !required?(key)
10
+
10
11
  super
11
12
  end
12
13
 
@@ -14,7 +15,7 @@ module ActiveMerchant
14
15
  collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
15
16
  end
16
17
 
17
- alias_method :to_s, :to_post_data
18
+ alias to_s to_post_data
18
19
 
19
20
  private
20
21
 
@@ -1,5 +1,5 @@
1
1
  module ActiveMerchant #:nodoc:
2
- module PostsData #:nodoc:
2
+ module PostsData #:nodoc:
3
3
  def self.included(base)
4
4
  base.class_attribute :ssl_strict
5
5
  base.ssl_strict = true
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  base.class_attribute :proxy_port
33
33
  end
34
34
 
35
- def ssl_get(endpoint, headers={})
35
+ def ssl_get(endpoint, headers = {})
36
36
  ssl_request(:get, endpoint, nil, headers)
37
37
  end
38
38
 
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.100.0'
2
+ VERSION = '1.133.0'
3
3
  end