activemerchant 1.133.0 → 1.138.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +450 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/lib/active_merchant/billing/apple_pay_payment_token.rb +2 -2
  5. data/lib/active_merchant/billing/base.rb +2 -2
  6. data/lib/active_merchant/billing/check.rb +16 -4
  7. data/lib/active_merchant/billing/compatibility.rb +4 -4
  8. data/lib/active_merchant/billing/credit_card.rb +35 -16
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +13 -2
  10. data/lib/active_merchant/billing/credit_card_methods.rb +74 -19
  11. data/lib/active_merchant/billing/gateway.rb +22 -2
  12. data/lib/active_merchant/billing/gateways/adyen.rb +282 -87
  13. data/lib/active_merchant/billing/gateways/airwallex.rb +46 -25
  14. data/lib/active_merchant/billing/gateways/alelo.rb +29 -11
  15. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +49 -41
  17. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +14 -10
  18. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -5
  19. data/lib/active_merchant/billing/gateways/axcessms.rb +9 -5
  20. data/lib/active_merchant/billing/gateways/balanced.rb +2 -2
  21. data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
  22. data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/banwire.rb +6 -4
  24. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +8 -8
  25. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +2 -2
  26. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  27. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -8
  28. data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
  29. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +2 -2
  30. data/lib/active_merchant/billing/gateways/blue_pay.rb +15 -7
  31. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
  32. data/lib/active_merchant/billing/gateways/bogus.rb +2 -2
  33. data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/bpoint.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +3 -1
  36. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +68 -23
  37. data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
  38. data/lib/active_merchant/billing/gateways/braintree_blue.rb +266 -89
  39. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -3
  40. data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/cams.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/card_connect.rb +7 -4
  43. data/lib/active_merchant/billing/gateways/card_save.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/card_stream.rb +12 -13
  45. data/lib/active_merchant/billing/gateways/cardknox.rb +2 -2
  46. data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -2
  47. data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
  48. data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
  50. data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +331 -0
  51. data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
  52. data/lib/active_merchant/billing/gateways/cecabank.rb +9 -242
  53. data/lib/active_merchant/billing/gateways/cenpos.rb +9 -3
  54. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/checkout_v2.rb +362 -50
  56. data/lib/active_merchant/billing/gateways/clearhaus.rb +2 -2
  57. data/lib/active_merchant/billing/gateways/commerce_hub.rb +117 -35
  58. data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
  59. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  60. data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
  61. data/lib/active_merchant/billing/gateways/credorax.rb +109 -20
  62. data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
  63. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  64. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +2 -2
  65. data/lib/active_merchant/billing/gateways/cyber_source.rb +379 -100
  66. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +147 -76
  67. data/lib/active_merchant/billing/gateways/d_local.rb +45 -22
  68. data/lib/active_merchant/billing/gateways/data_cash.rb +22 -18
  69. data/lib/active_merchant/billing/gateways/datatrans.rb +284 -0
  70. data/lib/active_merchant/billing/gateways/decidir.rb +82 -46
  71. data/lib/active_merchant/billing/gateways/decidir_plus.rb +31 -35
  72. data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
  73. data/lib/active_merchant/billing/gateways/dibs.rb +3 -3
  74. data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/ebanx.rb +116 -68
  76. data/lib/active_merchant/billing/gateways/efsnet.rb +13 -8
  77. data/lib/active_merchant/billing/gateways/elavon.rb +80 -47
  78. data/lib/active_merchant/billing/gateways/element.rb +39 -10
  79. data/lib/active_merchant/billing/gateways/epay.rb +8 -4
  80. data/lib/active_merchant/billing/gateways/evo_ca.rb +8 -4
  81. data/lib/active_merchant/billing/gateways/eway.rb +6 -4
  82. data/lib/active_merchant/billing/gateways/eway_managed.rb +8 -4
  83. data/lib/active_merchant/billing/gateways/eway_rapid.rb +3 -3
  84. data/lib/active_merchant/billing/gateways/exact.rb +8 -4
  85. data/lib/active_merchant/billing/gateways/fat_zebra.rb +37 -7
  86. data/lib/active_merchant/billing/gateways/federated_canada.rb +8 -4
  87. data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
  88. data/lib/active_merchant/billing/gateways/first_giving.rb +2 -2
  89. data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
  90. data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
  91. data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
  92. data/lib/active_merchant/billing/gateways/first_pay.rb +8 -174
  93. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +8 -4
  94. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +9 -5
  95. data/lib/active_merchant/billing/gateways/flex_charge.rb +359 -0
  96. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -2
  97. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
  98. data/lib/active_merchant/billing/gateways/forte.rb +6 -4
  99. data/lib/active_merchant/billing/gateways/fortis.rb +347 -0
  100. data/lib/active_merchant/billing/gateways/garanti.rb +6 -4
  101. data/lib/active_merchant/billing/gateways/global_collect.rb +69 -50
  102. data/lib/active_merchant/billing/gateways/global_transport.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
  104. data/lib/active_merchant/billing/gateways/hi_pay.rb +287 -0
  105. data/lib/active_merchant/billing/gateways/hps.rb +40 -47
  106. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  107. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +2 -2
  108. data/lib/active_merchant/billing/gateways/inspire.rb +8 -6
  109. data/lib/active_merchant/billing/gateways/instapay.rb +9 -6
  110. data/lib/active_merchant/billing/gateways/ipg.rb +14 -10
  111. data/lib/active_merchant/billing/gateways/ipp.rb +2 -2
  112. data/lib/active_merchant/billing/gateways/iridium.rb +18 -8
  113. data/lib/active_merchant/billing/gateways/itransact.rb +8 -4
  114. data/lib/active_merchant/billing/gateways/iveri.rb +12 -9
  115. data/lib/active_merchant/billing/gateways/ixopay.rb +4 -4
  116. data/lib/active_merchant/billing/gateways/jetpay.rb +6 -4
  117. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +9 -6
  118. data/lib/active_merchant/billing/gateways/komoju.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/kushki.rb +79 -16
  120. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/linkpoint.rb +8 -4
  122. data/lib/active_merchant/billing/gateways/litle.rb +37 -54
  123. data/lib/active_merchant/billing/gateways/loan_payment_pro.rb +267 -0
  124. data/lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb +93 -0
  125. data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/maxipago.rb +4 -4
  127. data/lib/active_merchant/billing/gateways/mercado_pago.rb +32 -11
  128. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +10 -7
  129. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  130. data/lib/active_merchant/billing/gateways/merchant_partners.rb +2 -2
  131. data/lib/active_merchant/billing/gateways/merchant_ware.rb +13 -6
  132. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +13 -6
  133. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -5
  134. data/lib/active_merchant/billing/gateways/mercury.rb +11 -5
  135. data/lib/active_merchant/billing/gateways/metrics_global.rb +10 -8
  136. data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
  137. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -6
  138. data/lib/active_merchant/billing/gateways/migs.rb +8 -4
  139. data/lib/active_merchant/billing/gateways/mit.rb +10 -5
  140. data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +21 -13
  142. data/lib/active_merchant/billing/gateways/moka.rb +2 -2
  143. data/lib/active_merchant/billing/gateways/monei.rb +3 -3
  144. data/lib/active_merchant/billing/gateways/moneris.rb +11 -5
  145. data/lib/active_merchant/billing/gateways/money_movers.rb +8 -4
  146. data/lib/active_merchant/billing/gateways/multi_pay.rb +267 -0
  147. data/lib/active_merchant/billing/gateways/mundipagg.rb +5 -3
  148. data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -10
  149. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +2 -2
  150. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
  151. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  152. data/lib/active_merchant/billing/gateways/netbanx.rb +4 -6
  153. data/lib/active_merchant/billing/gateways/netbilling.rb +8 -4
  154. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/network_merchants.rb +9 -5
  156. data/lib/active_merchant/billing/gateways/nmi.rb +29 -8
  157. data/lib/active_merchant/billing/gateways/nuvei.rb +573 -0
  158. data/lib/active_merchant/billing/gateways/ogone.rb +8 -4
  159. data/lib/active_merchant/billing/gateways/omise.rb +2 -2
  160. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  161. data/lib/active_merchant/billing/gateways/opp.rb +3 -4
  162. data/lib/active_merchant/billing/gateways/optimal_payment.rb +12 -6
  163. data/lib/active_merchant/billing/gateways/orbital/orbital_codes.rb +273 -0
  164. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
  165. data/lib/active_merchant/billing/gateways/orbital.rb +114 -94
  166. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +9 -6
  167. data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
  168. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  169. data/lib/active_merchant/billing/gateways/pay_arc.rb +9 -7
  170. data/lib/active_merchant/billing/gateways/pay_conex.rb +6 -4
  171. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -4
  172. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -5
  173. data/lib/active_merchant/billing/gateways/pay_junction.rb +8 -4
  174. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  175. data/lib/active_merchant/billing/gateways/pay_secure.rb +8 -4
  176. data/lib/active_merchant/billing/gateways/pay_trace.rb +36 -22
  177. data/lib/active_merchant/billing/gateways/paybox_direct.rb +14 -14
  178. data/lib/active_merchant/billing/gateways/payeezy.rb +26 -13
  179. data/lib/active_merchant/billing/gateways/payex.rb +8 -6
  180. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
  182. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
  183. data/lib/active_merchant/billing/gateways/payflow.rb +12 -11
  184. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  185. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
  186. data/lib/active_merchant/billing/gateways/payflow_uk.rb +2 -2
  187. data/lib/active_merchant/billing/gateways/payment_express.rb +10 -6
  188. data/lib/active_merchant/billing/gateways/paymentez.rb +30 -16
  189. data/lib/active_merchant/billing/gateways/paymill.rb +6 -4
  190. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +17 -12
  191. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +2 -2
  192. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +2 -2
  193. data/lib/active_merchant/billing/gateways/paypal.rb +4 -2
  194. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  195. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
  196. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -2
  197. data/lib/active_merchant/billing/gateways/paysafe.rb +48 -24
  198. data/lib/active_merchant/billing/gateways/payscout.rb +9 -6
  199. data/lib/active_merchant/billing/gateways/paystation.rb +9 -5
  200. data/lib/active_merchant/billing/gateways/payu_in.rb +2 -2
  201. data/lib/active_merchant/billing/gateways/payu_latam.rb +7 -5
  202. data/lib/active_merchant/billing/gateways/payway.rb +6 -2
  203. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +6 -6
  204. data/lib/active_merchant/billing/gateways/pin.rb +126 -41
  205. data/lib/active_merchant/billing/gateways/plexo.rb +71 -20
  206. data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
  207. data/lib/active_merchant/billing/gateways/priority.rb +29 -24
  208. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  209. data/lib/active_merchant/billing/gateways/psigate.rb +8 -4
  210. data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
  211. data/lib/active_merchant/billing/gateways/qbms.rb +9 -5
  212. data/lib/active_merchant/billing/gateways/quantum.rb +9 -5
  213. data/lib/active_merchant/billing/gateways/quickbooks.rb +27 -17
  214. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
  215. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +8 -4
  216. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -2
  217. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
  218. data/lib/active_merchant/billing/gateways/rapyd.rb +172 -53
  219. data/lib/active_merchant/billing/gateways/reach.rb +16 -9
  220. data/lib/active_merchant/billing/gateways/redsys.rb +7 -15
  221. data/lib/active_merchant/billing/gateways/redsys_rest.rb +545 -0
  222. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  223. data/lib/active_merchant/billing/gateways/safe_charge.rb +47 -24
  224. data/lib/active_merchant/billing/gateways/sage.rb +14 -6
  225. data/lib/active_merchant/billing/gateways/sage_pay.rb +81 -7
  226. data/lib/active_merchant/billing/gateways/sallie_mae.rb +8 -4
  227. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -5
  228. data/lib/active_merchant/billing/gateways/secure_pay.rb +10 -8
  229. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -15
  230. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +8 -4
  231. data/lib/active_merchant/billing/gateways/securion_pay.rb +26 -12
  232. data/lib/active_merchant/billing/gateways/shift4.rb +34 -26
  233. data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
  234. data/lib/active_merchant/billing/gateways/simetrik.rb +26 -17
  235. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -4
  236. data/lib/active_merchant/billing/gateways/smart_ps.rb +10 -7
  237. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -4
  238. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -6
  239. data/lib/active_merchant/billing/gateways/stripe.rb +88 -84
  240. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +388 -77
  241. data/lib/active_merchant/billing/gateways/sum_up.rb +224 -0
  242. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +6 -4
  243. data/lib/active_merchant/billing/gateways/telr.rb +6 -7
  244. data/lib/active_merchant/billing/gateways/trans_first.rb +6 -4
  245. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +10 -18
  246. data/lib/active_merchant/billing/gateways/transact_pro.rb +3 -3
  247. data/lib/active_merchant/billing/gateways/transax.rb +2 -2
  248. data/lib/active_merchant/billing/gateways/transnational.rb +2 -2
  249. data/lib/active_merchant/billing/gateways/trexle.rb +2 -2
  250. data/lib/active_merchant/billing/gateways/trust_commerce.rb +9 -5
  251. data/lib/active_merchant/billing/gateways/usa_epay.rb +2 -2
  252. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -31
  253. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +8 -4
  254. data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
  255. data/lib/active_merchant/billing/gateways/vantiv_express.rb +668 -0
  256. data/lib/active_merchant/billing/gateways/verifi.rb +12 -8
  257. data/lib/active_merchant/billing/gateways/versa_pay.rb +307 -0
  258. data/lib/active_merchant/billing/gateways/viaklix.rb +8 -4
  259. data/lib/active_merchant/billing/gateways/visanet_peru.rb +5 -5
  260. data/lib/active_merchant/billing/gateways/vpos.rb +25 -13
  261. data/lib/active_merchant/billing/gateways/webpay.rb +3 -3
  262. data/lib/active_merchant/billing/gateways/wepay.rb +6 -4
  263. data/lib/active_merchant/billing/gateways/wirecard.rb +10 -6
  264. data/lib/active_merchant/billing/gateways/wompi.rb +14 -7
  265. data/lib/active_merchant/billing/gateways/world_net.rb +2 -2
  266. data/lib/active_merchant/billing/gateways/worldpay.rb +297 -113
  267. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +16 -13
  268. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  269. data/lib/active_merchant/billing/gateways/xpay.rb +244 -0
  270. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -3
  271. data/lib/active_merchant/billing/payment_token.rb +2 -2
  272. data/lib/active_merchant/billing/response.rb +7 -6
  273. data/lib/active_merchant/billing.rb +1 -0
  274. data/lib/active_merchant/connection.rb +8 -20
  275. data/lib/active_merchant/country.rb +3 -1
  276. data/lib/active_merchant/errors.rb +12 -2
  277. data/lib/active_merchant/net_http_ssl_connection.rb +35 -0
  278. data/lib/active_merchant/posts_data.rb +19 -4
  279. data/lib/active_merchant/version.rb +1 -1
  280. data/lib/active_merchant/versionable.rb +29 -0
  281. data/lib/certs/cacert.pem +1326 -1491
  282. data/lib/support/gateway_support.rb +3 -3
  283. data/lib/support/ssl_verify.rb +6 -6
  284. data/lib/support/ssl_version.rb +8 -8
  285. metadata +35 -9
@@ -0,0 +1,224 @@
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
+ class SumUpGateway < Gateway
4
+ version 'v0.1'
5
+ self.live_url = "https://api.sumup.com/#{fetch_version}/"
6
+
7
+ self.supported_countries = %w(AT BE BG BR CH CL CO CY CZ DE DK EE ES FI FR
8
+ GB GR HR HU IE IT LT LU LV MT NL NO PL PT RO
9
+ SE SI SK US)
10
+ self.currencies_with_three_decimal_places = %w(EUR BGN BRL CHF CZK DKK GBP
11
+ HUF NOK PLN SEK USD)
12
+ self.default_currency = 'USD'
13
+
14
+ self.homepage_url = 'https://www.sumup.com/'
15
+ self.display_name = 'SumUp'
16
+
17
+ STANDARD_ERROR_CODE_MAPPING = {
18
+ multiple_invalid_parameters: 'MULTIPLE_INVALID_PARAMETERS'
19
+ }
20
+
21
+ def initialize(options = {})
22
+ requires!(options, :access_token, :pay_to_email)
23
+ super
24
+ end
25
+
26
+ def purchase(money, payment, options = {})
27
+ MultiResponse.run do |r|
28
+ r.process { create_checkout(money, payment, options) } unless options[:checkout_id]
29
+ r.process { complete_checkout(options[:checkout_id] || r.params['id'], payment, options) }
30
+ end
31
+ end
32
+
33
+ def refund(money, authorization, options = {})
34
+ transaction_id = authorization.split('#').last
35
+ post = money ? { amount: amount(money) } : {}
36
+ add_merchant_data(post, options)
37
+
38
+ commit('me/refund/' + transaction_id, post)
39
+ end
40
+
41
+ def supports_scrubbing?
42
+ true
43
+ end
44
+
45
+ def scrub(transcript)
46
+ transcript.
47
+ gsub(%r((Authorization: Bearer )\w+), '\1[FILTERED]').
48
+ gsub(%r(("pay_to_email\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
49
+ gsub(%r(("number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
50
+ gsub(%r(("cvv\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
51
+ end
52
+
53
+ private
54
+
55
+ def create_checkout(money, payment, options)
56
+ post = {}
57
+
58
+ add_merchant_data(post, options)
59
+ add_invoice(post, money, options)
60
+ add_address(post, options)
61
+ add_customer_data(post, payment, options)
62
+ add_3ds_data(post, options)
63
+
64
+ commit('checkouts', post)
65
+ end
66
+
67
+ def complete_checkout(checkout_id, payment, options = {})
68
+ post = {}
69
+
70
+ add_payment(post, payment, options)
71
+
72
+ commit('checkouts/' + checkout_id, post, :put)
73
+ end
74
+
75
+ def add_customer_data(post, payment, options)
76
+ post[:customer_id] = options[:customer_id]
77
+ post[:personal_details] = {
78
+ email: options[:email],
79
+ first_name: payment&.first_name,
80
+ last_name: payment&.last_name,
81
+ tax_id: options[:tax_id]
82
+ }
83
+ end
84
+
85
+ def add_merchant_data(post, options)
86
+ # Required field: pay_to_email
87
+ # Description: Email address of the merchant to whom the payment is made.
88
+ post[:pay_to_email] = @options[:pay_to_email]
89
+ end
90
+
91
+ def add_address(post, options)
92
+ post[:personal_details] ||= {}
93
+ if address = (options[:billing_address] || options[:shipping_address] || options[:address])
94
+ post[:personal_details][:address] = {
95
+ city: address[:city],
96
+ state: address[:state],
97
+ country: address[:country],
98
+ line_1: address[:address1],
99
+ postal_code: address[:zip]
100
+ }
101
+ end
102
+ end
103
+
104
+ def add_invoice(post, money, options)
105
+ post[:checkout_reference] = options[:partner_id] && options[:order_id] ? "#{options[:partner_id]}-#{options[:order_id]}" : options[:order_id]
106
+ post[:amount] = amount(money)
107
+ post[:currency] = options[:currency] || currency(money)
108
+ post[:description] = options[:description]
109
+ end
110
+
111
+ def add_payment(post, payment, options)
112
+ post[:payment_type] = options[:payment_type] || 'card'
113
+
114
+ post[:card] = {
115
+ name: payment.name,
116
+ number: payment.number,
117
+ expiry_month: format(payment.month, :two_digits),
118
+ expiry_year: payment.year,
119
+ cvv: payment.verification_value
120
+ }
121
+ end
122
+
123
+ def add_3ds_data(post, options)
124
+ post[:redirect_url] = options[:redirect_url] if options[:redirect_url]
125
+ end
126
+
127
+ def commit(action, post, method = :post)
128
+ response = api_request(action, post.compact, method)
129
+ succeeded = success_from(response)
130
+
131
+ Response.new(
132
+ succeeded,
133
+ message_from(succeeded, response),
134
+ action.include?('refund') ? { response_code: response.to_s } : response,
135
+ authorization: authorization_from(response),
136
+ test: test?,
137
+ error_code: error_code_from(succeeded, response)
138
+ )
139
+ end
140
+
141
+ def api_request(action, post, method)
142
+ raw_response =
143
+ begin
144
+ ssl_request(method, live_url + action, post.to_json, auth_headers)
145
+ rescue ResponseError => e
146
+ e.response.body
147
+ end
148
+ response = parse(raw_response)
149
+ response = response.is_a?(Hash) ? response.symbolize_keys : response
150
+
151
+ return format_errors(response) if raw_response.include?('error_code') && response.is_a?(Array)
152
+
153
+ response
154
+ end
155
+
156
+ def parse(body)
157
+ JSON.parse(body)
158
+ end
159
+
160
+ def success_from(response)
161
+ (response.is_a?(Hash) && response[:next_step]) ||
162
+ response == 204 ||
163
+ %w(PENDING PAID).include?(response[:status]) ||
164
+ response[:transactions]&.all? { |transaction| transaction.symbolize_keys[:status] == 'SUCCESSFUL' }
165
+ end
166
+
167
+ def message_from(succeeded, response)
168
+ if succeeded
169
+ return 'Succeeded' if (response.is_a?(Hash) && response[:next_step]) || response == 204
170
+
171
+ return response[:status]
172
+ end
173
+
174
+ response[:message] || response[:error_message] || response[:status]
175
+ end
176
+
177
+ def authorization_from(response)
178
+ return nil if response.is_a?(Integer)
179
+
180
+ return response[:id] unless response[:transaction_id]
181
+
182
+ [response[:id], response[:transaction_id]].join('#')
183
+ end
184
+
185
+ def auth_headers
186
+ {
187
+ 'Content-Type' => 'application/json',
188
+ 'Authorization' => "Bearer #{options[:access_token]}"
189
+ }
190
+ end
191
+
192
+ def error_code_from(succeeded, response)
193
+ response[:error_code] unless succeeded
194
+ end
195
+
196
+ def format_error(error, key)
197
+ {
198
+ :error_code => error['error_code'],
199
+ key => error['param']
200
+ }
201
+ end
202
+
203
+ def format_errors(errors)
204
+ return format_error(errors.first, :message) if errors.size == 1
205
+
206
+ return {
207
+ error_code: STANDARD_ERROR_CODE_MAPPING[:multiple_invalid_parameters],
208
+ message: 'Validation error',
209
+ errors: errors.map { |error| format_error(error, :param) }
210
+ }
211
+ end
212
+
213
+ def handle_response(response)
214
+ case response.code.to_i
215
+ # to get the response code (204) when the body is nil
216
+ when 200...300
217
+ response.body || response.code
218
+ else
219
+ raise ResponseError.new(response)
220
+ end
221
+ end
222
+ end
223
+ end
224
+ end
@@ -1,7 +1,7 @@
1
1
  require 'json'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class SwipeCheckoutGateway < Gateway
6
6
  TRANSACTION_APPROVED_MSG = 'Transaction approved'
7
7
  TRANSACTION_DECLINED_MSG = 'Transaction declined'
@@ -104,12 +104,14 @@ module ActiveMerchant #:nodoc:
104
104
  result = response['data']['result']
105
105
  success = (result == 'accepted' || (test? && result == 'test-accepted'))
106
106
 
107
- Response.new(success,
107
+ Response.new(
108
+ success,
108
109
  success ?
109
110
  TRANSACTION_APPROVED_MSG :
110
111
  TRANSACTION_DECLINED_MSG,
111
112
  response,
112
- test: test?)
113
+ test: test?
114
+ )
113
115
  else
114
116
  build_error_response(message, response)
115
117
  end
@@ -1,7 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class TelrGateway < Gateway
6
6
  self.display_name = 'Telr'
7
7
  self.homepage_url = 'http://www.telr.com/'
@@ -58,7 +58,7 @@ module ActiveMerchant #:nodoc:
58
58
  def void(authorization, options = {})
59
59
  _, amount, currency = split_authorization(authorization)
60
60
  commit(:void) do |doc|
61
- add_invoice(doc, 'void', amount.to_i, authorization, options.merge(currency: currency))
61
+ add_invoice(doc, 'void', amount.to_i, authorization, options.merge(currency:))
62
62
  end
63
63
  end
64
64
 
@@ -162,9 +162,9 @@ module ActiveMerchant #:nodoc:
162
162
  country.code(:alpha2)
163
163
  end
164
164
 
165
- def commit(action, amount = nil, currency = nil)
165
+ def commit(action, amount = nil, currency = nil, &block)
166
166
  currency = default_currency if currency == nil
167
- request = build_xml_request { |doc| yield(doc) }
167
+ request = build_xml_request(&block)
168
168
  response = ssl_post(live_url, request, headers)
169
169
  parsed = parse(response)
170
170
 
@@ -231,8 +231,7 @@ module ActiveMerchant #:nodoc:
231
231
 
232
232
  def authorization_from(action, response, amount, currency)
233
233
  auth = response[:tranref]
234
- auth = [auth, amount, currency].join('|')
235
- auth
234
+ [auth, amount, currency].join('|')
236
235
  end
237
236
 
238
237
  def split_authorization(authorization)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class TransFirstGateway < Gateway
4
4
  self.test_url = 'https://ws.cert.transfirst.com'
5
5
  self.live_url = 'https://webservices.primerchants.com'
@@ -166,6 +166,9 @@ module ActiveMerchant #:nodoc:
166
166
  end
167
167
  end
168
168
 
169
+ response
170
+ rescue StandardError
171
+ response[:message] = data&.to_s&.strip
169
172
  response
170
173
  end
171
174
 
@@ -219,8 +222,7 @@ module ActiveMerchant #:nodoc:
219
222
  params[:MerchantID] = @options[:login]
220
223
  params[:RegKey] = @options[:password]
221
224
 
222
- request = params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
223
- request
225
+ params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
224
226
  end
225
227
 
226
228
  def add_pair(post, key, value, options = {})
@@ -1,7 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class TransFirstTransactionExpressGateway < Gateway
6
6
  self.display_name = 'TransFirst Transaction Express'
7
7
  self.homepage_url = 'http://transactionexpress.com/'
@@ -438,29 +438,21 @@ module ActiveMerchant #:nodoc:
438
438
  end
439
439
 
440
440
  # -- request methods ---------------------------------------------------
441
- def build_xml_transaction_request
442
- build_xml_request('SendTranRequest') do |doc|
443
- yield doc
444
- end
441
+ def build_xml_transaction_request(&block)
442
+ build_xml_request('SendTranRequest', &block)
445
443
  end
446
444
 
447
- def build_xml_payment_storage_request
448
- build_xml_request('UpdtRecurrProfRequest') do |doc|
449
- yield doc
450
- end
445
+ def build_xml_payment_storage_request(&block)
446
+ build_xml_request('UpdtRecurrProfRequest', &block)
451
447
  end
452
448
 
453
- def build_xml_payment_update_request
449
+ def build_xml_payment_update_request(&block)
454
450
  merchant_product_type = 5 # credit card
455
- build_xml_request('UpdtRecurrProfRequest', merchant_product_type) do |doc|
456
- yield doc
457
- end
451
+ build_xml_request('UpdtRecurrProfRequest', merchant_product_type, &block)
458
452
  end
459
453
 
460
- def build_xml_payment_search_request
461
- build_xml_request('FndRecurrProfRequest') do |doc|
462
- yield doc
463
- end
454
+ def build_xml_payment_search_request(&block)
455
+ build_xml_request('FndRecurrProfRequest', &block)
464
456
  end
465
457
 
466
458
  def build_xml_request(wrapper, merchant_product_type = nil)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  # For more information visit {Transact Pro Services}[https://www.transactpro.lv/business/]
4
4
  #
5
5
  # This gateway was formerly associated with www.1stpayments.net
@@ -172,7 +172,7 @@ module ActiveMerchant #:nodoc:
172
172
  { status: 'success', id: m[2] } :
173
173
  { status: 'failure', message: m[2] }
174
174
  else
175
- Hash[status: body]
175
+ { status: body }
176
176
  end
177
177
  end
178
178
 
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), 'smart_ps.rb')
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class TransaxGateway < SmartPs
6
6
  self.live_url = self.test_url = 'https://secure.nelixtransax.net/api/transact.php'
7
7
 
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class TransnationalGateway < NetworkMerchantsGateway
4
4
  self.homepage_url = 'http://www.tnbci.com/'
5
5
  self.display_name = 'Transnational'
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class TrexleGateway < Gateway
4
4
  self.test_url = 'https://core.trexle.com/api/v1'
5
5
  self.live_url = 'https://core.trexle.com/api/v1'
@@ -4,8 +4,8 @@ rescue LoadError
4
4
  # Falls back to an SSL post to TrustCommerce
5
5
  end
6
6
 
7
- module ActiveMerchant #:nodoc:
8
- module Billing #:nodoc:
7
+ module ActiveMerchant # :nodoc:
8
+ module Billing # :nodoc:
9
9
  # TO USE:
10
10
  # First, make sure you have everything setup correctly and all of your dependencies in place with:
11
11
  #
@@ -288,7 +288,7 @@ module ActiveMerchant #:nodoc:
288
288
 
289
289
  parameters = {
290
290
  amount: amount(money),
291
- cycle: cycle,
291
+ cycle:,
292
292
  verify: options[:verify] || 'y',
293
293
  billingid: options[:billingid] || nil,
294
294
  payments: options[:payments] || nil
@@ -450,11 +450,15 @@ module ActiveMerchant #:nodoc:
450
450
  # to be considered successful, transaction status must be either "approved" or "accepted"
451
451
  success = SUCCESS_TYPES.include?(data['status'])
452
452
  message = message_from(data)
453
- Response.new(success, message, data,
453
+ Response.new(
454
+ success,
455
+ message,
456
+ data,
454
457
  test: test?,
455
458
  authorization: authorization_from(action, data),
456
459
  cvv_result: data['cvv'],
457
- avs_result: { code: data['avs'] })
460
+ avs_result: { code: data['avs'] }
461
+ )
458
462
  end
459
463
 
460
464
  def parse(body)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  ##
4
4
  # Delegates to the appropriate gateway, either the Transaction or Advanced
5
5
  # depending on options passed to new.
@@ -1,8 +1,8 @@
1
1
  require 'securerandom'
2
2
  require 'digest'
3
3
 
4
- module ActiveMerchant #:nodoc:
5
- module Billing #:nodoc:
4
+ module ActiveMerchant # :nodoc:
5
+ module Billing # :nodoc:
6
6
  # ==== USA ePay Advanced SOAP Interface
7
7
  #
8
8
  # This class encapsulates USA ePay's Advanced SOAP Interface. The Advanced Soap Interface allows
@@ -64,13 +64,13 @@ module ActiveMerchant #:nodoc:
64
64
  class UsaEpayAdvancedGateway < Gateway
65
65
  API_VERSION = '1.4'
66
66
 
67
- TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' #:nodoc:
68
- LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' #:nodoc:
67
+ TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' # :nodoc:
68
+ LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' # :nodoc:
69
69
 
70
70
  self.test_url = TEST_URL_BASE
71
71
  self.live_url = LIVE_URL_BASE
72
72
 
73
- FAILURE_MESSAGE = 'Default Failure' #:nodoc:
73
+ FAILURE_MESSAGE = 'Default Failure' # :nodoc:
74
74
 
75
75
  self.supported_countries = ['US']
76
76
  self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
82
82
  notes: [:string, 'Notes'],
83
83
  data: [:string, 'CustomData'],
84
84
  url: [:string, 'URL']
85
- } #:nodoc:
85
+ } # :nodoc:
86
86
 
87
87
  CUSTOMER_RECURRING_BILLING_OPTIONS = {
88
88
  enabled: [:boolean, 'Enabled'],
@@ -95,19 +95,19 @@ module ActiveMerchant #:nodoc:
95
95
  source: [:string, 'Source'],
96
96
  send_receipt: [:boolean, 'SendReceipt'],
97
97
  receipt_note: [:string, 'ReceiptNote']
98
- } #:nodoc:
98
+ } # :nodoc:
99
99
 
100
100
  CUSTOMER_POINT_OF_SALE_OPTIONS = {
101
101
  price_tier: [:string, 'PriceTier'],
102
102
  tax_class: [:string, 'TaxClass'],
103
103
  lookup_code: [:string, 'LookupCode']
104
- } #:nodoc:
104
+ } # :nodoc:
105
105
 
106
106
  CUSTOMER_OPTIONS = [
107
107
  CUSTOMER_PROFILE_OPTIONS,
108
108
  CUSTOMER_RECURRING_BILLING_OPTIONS,
109
109
  CUSTOMER_POINT_OF_SALE_OPTIONS
110
- ].inject(:merge) #:nodoc:
110
+ ].inject(:merge) # :nodoc:
111
111
 
112
112
  COMMON_ADDRESS_OPTIONS = {
113
113
  first_name: [:string, 'FirstName'],
@@ -120,7 +120,7 @@ module ActiveMerchant #:nodoc:
120
120
  email: [:string, 'Email'],
121
121
  fax: [:string, 'Fax'],
122
122
  company: [:string, 'Company']
123
- } #:nodoc:
123
+ } # :nodoc:
124
124
 
125
125
  ADDRESS_OPTIONS = [
126
126
  COMMON_ADDRESS_OPTIONS,
@@ -128,7 +128,7 @@ module ActiveMerchant #:nodoc:
128
128
  address1: [:string, 'Street'],
129
129
  address2: [:string, 'Street2']
130
130
  }
131
- ].inject(:merge) #:nodoc
131
+ ].inject(:merge) # :nodoc
132
132
 
133
133
  CUSTOMER_UPDATE_DATA_FIELDS = [
134
134
  CUSTOMER_PROFILE_OPTIONS,
@@ -146,7 +146,7 @@ module ActiveMerchant #:nodoc:
146
146
  check_format: [:string, 'CheckFormat'],
147
147
  record_type: [:string, 'RecordType']
148
148
  }
149
- ].inject(:merge) #:nodoc
149
+ ].inject(:merge) # :nodoc
150
150
 
151
151
  CUSTOMER_TRANSACTION_REQUEST_OPTIONS = {
152
152
  command: [:string, 'Command'],
@@ -161,7 +161,7 @@ module ActiveMerchant #:nodoc:
161
161
  recurring: [:boolean, 'isRecurring'],
162
162
  verification_value: [:string, 'CardCode'],
163
163
  software: [:string, 'Software']
164
- } #:nodoc:
164
+ } # :nodoc:
165
165
 
166
166
  TRANSACTION_REQUEST_OBJECT_OPTIONS = {
167
167
  command: [:string, 'Command'],
@@ -174,7 +174,7 @@ module ActiveMerchant #:nodoc:
174
174
  customer_receipt: [:boolean, 'CustReceipt'],
175
175
  customer_template: [:boolean, 'CustReceiptName'],
176
176
  software: [:string, 'Software']
177
- } #:nodoc:
177
+ } # :nodoc:
178
178
 
179
179
  TRANSACTION_DETAIL_OPTIONS = {
180
180
  invoice: [:string, 'Invoice'],
@@ -188,7 +188,7 @@ module ActiveMerchant #:nodoc:
188
188
  allow_partial_auth: [:boolean, 'AllowPartialAuth'],
189
189
  currency: [:string, 'Currency'],
190
190
  non_tax: [:boolean, 'NonTax']
191
- } #:nodoc:
191
+ } # :nodoc:
192
192
 
193
193
  TRANSACTION_DETAIL_MONEY_OPTIONS = {
194
194
  amount: [:double, 'Amount'],
@@ -198,7 +198,7 @@ module ActiveMerchant #:nodoc:
198
198
  shipping: [:double, 'Shipping'],
199
199
  discount: [:double, 'Discount'],
200
200
  subtotal: [:double, 'Subtotal']
201
- } #:nodoc:
201
+ } # :nodoc:
202
202
 
203
203
  CREDIT_CARD_DATA_OPTIONS = {
204
204
  magnetic_stripe: [:string, 'MagStripe'],
@@ -211,7 +211,7 @@ module ActiveMerchant #:nodoc:
211
211
  eci: [:integer, 'ECI'],
212
212
  internal_card_authorization: [:boolean, 'InternalCardAuth'],
213
213
  pares: [:string, 'Pares']
214
- } #:nodoc:
214
+ } # :nodoc:
215
215
 
216
216
  CHECK_DATA_OPTIONS = {
217
217
  drivers_license: [:string, 'DriversLicense'],
@@ -221,13 +221,13 @@ module ActiveMerchant #:nodoc:
221
221
  epc_code: [:string, 'EpcCode'],
222
222
  front_image: [:string, 'FrontImage'],
223
223
  back_image: [:string, 'BackImage']
224
- } #:nodoc:
224
+ } # :nodoc:
225
225
 
226
226
  RECURRING_BILLING_OPTIONS = {
227
227
  schedule: [:string, 'Schedule'],
228
228
  number_left: [:integer, 'NumLeft'],
229
229
  enabled: [:boolean, 'Enabled']
230
- } #:nodoc:
230
+ } # :nodoc:
231
231
 
232
232
  AVS_RESULTS = {
233
233
  'Y' => %w(YYY Y YYA YYD),
@@ -248,13 +248,13 @@ module ActiveMerchant #:nodoc:
248
248
  }.inject({}) do |map, (type, codes)|
249
249
  codes.each { |code| map[code] = type }
250
250
  map
251
- end #:nodoc:
251
+ end # :nodoc:
252
252
 
253
253
  AVS_CUSTOM_MESSAGES = {
254
254
  'XXW' => 'Card number not on file.',
255
255
  'XXU' => 'Address information not verified for domestic transaction.',
256
256
  'XXE' => 'Address verification not allowed for card type.'
257
- } #:nodoc:
257
+ } # :nodoc:
258
258
 
259
259
  # Create a new gateway.
260
260
  #
@@ -679,7 +679,7 @@ module ActiveMerchant #:nodoc:
679
679
  TRANSACTION_METHODS = %i[
680
680
  run_sale run_auth_only run_credit
681
681
  run_check_sale run_check_credit
682
- ] #:nodoc:
682
+ ] # :nodoc:
683
683
 
684
684
  TRANSACTION_METHODS.each do |method|
685
685
  define_method method do |options|
@@ -1030,15 +1030,17 @@ module ActiveMerchant #:nodoc:
1030
1030
 
1031
1031
  # Build soap header, etc.
1032
1032
  def build_request(action, options = {})
1033
- soap = Builder::XmlMarkup.new
1034
- soap.instruct!(:xml, version: '1.0', encoding: 'utf-8')
1035
- soap.tag! 'SOAP-ENV:Envelope',
1033
+ envelope_obj = {
1036
1034
  'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
1037
1035
  'xmlns:ns1' => 'urn:usaepay',
1038
1036
  'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
1039
1037
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
1040
1038
  'xmlns:SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/',
1041
- 'SOAP-ENV:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' do
1039
+ 'SOAP-ENV:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
1040
+ }
1041
+ soap = Builder::XmlMarkup.new
1042
+ soap.instruct!(:xml, version: '1.0', encoding: 'utf-8')
1043
+ soap.tag! 'SOAP-ENV:Envelope', envelope_obj do
1042
1044
  soap.tag! 'SOAP-ENV:Body' do
1043
1045
  send("build_#{action}", soap, options)
1044
1046
  end
@@ -1335,8 +1337,7 @@ module ActiveMerchant #:nodoc:
1335
1337
  case
1336
1338
  when payment_method[:method].kind_of?(ActiveMerchant::Billing::CreditCard)
1337
1339
  build_tag soap, :string, 'CardNumber', payment_method[:method].number
1338
- build_tag soap, :string, 'CardExpiration',
1339
- "#{'%02d' % payment_method[:method].month}#{payment_method[:method].year.to_s[-2..-1]}"
1340
+ build_tag soap, :string, 'CardExpiration', "#{'%02d' % payment_method[:method].month}#{payment_method[:method].year.to_s[-2..-1]}"
1340
1341
  if options[:billing_address]
1341
1342
  build_tag soap, :string, 'AvsStreet', options[:billing_address][:address1]
1342
1343
  build_tag soap, :string, 'AvsZip', options[:billing_address][:zip]
@@ -1520,8 +1521,8 @@ module ActiveMerchant #:nodoc:
1520
1521
 
1521
1522
  begin
1522
1523
  soap = ssl_post(url, request, 'Content-Type' => 'text/xml')
1523
- rescue ActiveMerchant::ResponseError => error
1524
- soap = error.response.body
1524
+ rescue ActiveMerchant::ResponseError => e
1525
+ soap = e.response.body
1525
1526
  end
1526
1527
 
1527
1528
  build_response(action, soap)
@@ -1537,7 +1538,7 @@ module ActiveMerchant #:nodoc:
1537
1538
  message,
1538
1539
  response_params,
1539
1540
  test: test?,
1540
- authorization: authorization,
1541
+ authorization:,
1541
1542
  avs_result: avs_from(avs),
1542
1543
  cvv_result: cvv
1543
1544
  )