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
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class AirwallexGateway < Gateway
4
4
  self.test_url = 'https://api-demo.airwallex.com/api/v1'
5
5
  self.live_url = 'https://pci-api.airwallex.com/api/v1'
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  @client_id = options[:client_id]
33
33
  @client_api_key = options[:client_api_key]
34
34
  super
35
- @access_token = setup_access_token
35
+ @access_token = options[:access_token] || setup_access_token
36
36
  end
37
37
 
38
38
  def purchase(money, card, options = {})
@@ -133,13 +133,27 @@ module ActiveMerchant #:nodoc:
133
133
  'x-client-id' => @client_id,
134
134
  'x-api-key' => @client_api_key
135
135
  }
136
- response = ssl_post(build_request_url(:login), nil, token_headers)
137
- JSON.parse(response)['token']
136
+
137
+ begin
138
+ raw_response = ssl_post(build_request_url(:login), nil, token_headers)
139
+ rescue ResponseError => e
140
+ raise OAuthResponseError.new(e)
141
+ else
142
+ response = JSON.parse(raw_response)
143
+ if (token = response['token'])
144
+ token
145
+ else
146
+ oauth_response = Response.new(false, response['message'])
147
+ raise OAuthResponseError.new(oauth_response)
148
+ end
149
+ end
138
150
  end
139
151
 
140
152
  def build_request_url(action, id = nil)
141
153
  base_url = (test? ? test_url : live_url)
142
- base_url + ENDPOINTS[action].to_s % { id: id }
154
+ endpoint = ENDPOINTS[action].to_s
155
+ endpoint = id.present? ? endpoint % { id: } : endpoint
156
+ base_url + endpoint
143
157
  end
144
158
 
145
159
  def add_referrer_data(post)
@@ -221,16 +235,23 @@ module ActiveMerchant #:nodoc:
221
235
  end
222
236
 
223
237
  def add_order(post, options)
224
- return unless shipping_address = options[:shipping_address]
238
+ return unless options[:shipping_address] || options[:products]
239
+
240
+ if shipping_address = options[:shipping_address]
241
+ physical_address = build_shipping_address(shipping_address)
242
+ first_name, last_name = split_names(shipping_address[:name])
243
+ shipping = {}
244
+ shipping[:first_name] = first_name if first_name
245
+ shipping[:last_name] = last_name if last_name
246
+ shipping[:phone_number] = shipping_address[:phone_number] if shipping_address[:phone_number]
247
+ shipping[:address] = physical_address
248
+ end
249
+
250
+ order = {}
251
+ order[:shipping] = shipping if shipping
252
+ order[:products] = options[:products] if options[:products]
225
253
 
226
- physical_address = build_shipping_address(shipping_address)
227
- first_name, last_name = split_names(shipping_address[:name])
228
- shipping = {}
229
- shipping[:first_name] = first_name if first_name
230
- shipping[:last_name] = last_name if last_name
231
- shipping[:phone_number] = shipping_address[:phone_number] if shipping_address[:phone_number]
232
- shipping[:address] = physical_address
233
- post[:order] = { shipping: shipping }
254
+ post[:order] = order
234
255
  end
235
256
 
236
257
  def build_shipping_address(shipping_address)
@@ -278,11 +299,11 @@ module ActiveMerchant #:nodoc:
278
299
  pm_options = post.dig('payment_method_options', 'card')
279
300
 
280
301
  external_three_ds = {
281
- 'version': format_three_ds_version(three_d_secure),
282
- 'eci': three_d_secure[:eci]
302
+ version: format_three_ds_version(three_d_secure),
303
+ eci: three_d_secure[:eci]
283
304
  }.merge(three_ds_version_specific_fields(three_d_secure))
284
305
 
285
- pm_options ? pm_options.merge!('external_three_ds': external_three_ds) : post['payment_method_options'] = { 'card': { 'external_three_ds': external_three_ds } }
306
+ pm_options ? pm_options.merge!(external_three_ds:) : post['payment_method_options'] = { card: { external_three_ds: } }
286
307
  end
287
308
 
288
309
  def format_three_ds_version(three_d_secure)
@@ -295,14 +316,14 @@ module ActiveMerchant #:nodoc:
295
316
  def three_ds_version_specific_fields(three_d_secure)
296
317
  if three_d_secure[:version].to_f >= 2
297
318
  {
298
- 'authentication_value': three_d_secure[:cavv],
299
- 'ds_transaction_id': three_d_secure[:ds_transaction_id],
300
- 'three_ds_server_transaction_id': three_d_secure[:three_ds_server_trans_id]
319
+ authentication_value: three_d_secure[:cavv],
320
+ ds_transaction_id: three_d_secure[:ds_transaction_id],
321
+ three_ds_server_transaction_id: three_d_secure[:three_ds_server_trans_id]
301
322
  }
302
323
  else
303
324
  {
304
- 'cavv': three_d_secure[:cavv],
305
- 'xid': three_d_secure[:xid]
325
+ cavv: three_d_secure[:cavv],
326
+ xid: three_d_secure[:xid]
306
327
  }
307
328
  end
308
329
  end
@@ -312,7 +333,7 @@ module ActiveMerchant #:nodoc:
312
333
  end
313
334
 
314
335
  def add_descriptor(post, options)
315
- post[:descriptor] = options[:description] if options[:description]
336
+ post[:descriptor] = truncate(options[:description], 32) if options[:description]
316
337
  end
317
338
 
318
339
  def parse(body)
@@ -359,7 +380,7 @@ module ActiveMerchant #:nodoc:
359
380
  end
360
381
 
361
382
  def authorization_from(response)
362
- response.dig('latest_payment_attempt', 'payment_intent_id')
383
+ response.dig('latest_payment_attempt', 'payment_intent_id') || response.dig('payment_intent_id')
363
384
  end
364
385
 
365
386
  def error_code_from(response)
@@ -1,7 +1,7 @@
1
1
  require 'jose'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class AleloGateway < Gateway
6
6
  class_attribute :prelive_url
7
7
 
@@ -110,8 +110,18 @@ module ActiveMerchant #:nodoc:
110
110
  'Content-Type' => 'application/x-www-form-urlencoded'
111
111
  }
112
112
 
113
- parsed = parse(ssl_post(url('captura-oauth-provider/oauth/token'), post_data(params), headers))
114
- Response.new(true, parsed[:access_token], parsed)
113
+ begin
114
+ raw_response = ssl_post(url('captura-oauth-provider/oauth/token'), post_data(params), headers)
115
+ rescue ResponseError => e
116
+ raise OAuthResponseError.new(e)
117
+ else
118
+ response = parse(raw_response)
119
+ if (access_token = response[:access_token])
120
+ Response.new(true, access_token, response)
121
+ else
122
+ raise OAuthResponseError.new(response)
123
+ end
124
+ end
115
125
  end
116
126
 
117
127
  def remote_encryption_key(access_token)
@@ -139,14 +149,16 @@ module ActiveMerchant #:nodoc:
139
149
  end
140
150
 
141
151
  {
142
- key: key,
143
- uuid: uuid,
144
- access_token: access_token,
152
+ key:,
153
+ uuid:,
154
+ access_token:,
145
155
  multiresp: multiresp.responses.present? ? multiresp : nil
146
156
  }
147
- rescue ResponseError => error
157
+ rescue ActiveMerchant::OAuthResponseError => e
158
+ raise e
159
+ rescue ResponseError => e
148
160
  # retry to generate a new access_token when the provided one is expired
149
- raise error unless try_again && %w(401 404).include?(error.response.code) && @options[:access_token].present?
161
+ raise e unless retry?(try_again, e, :access_token)
150
162
 
151
163
  @options.delete(:access_token)
152
164
  @options.delete(:encryption_key)
@@ -161,7 +173,7 @@ module ActiveMerchant #:nodoc:
161
173
  token = JOSE::JWE.block_encrypt(jwk, body.to_json, alg_enc).compact
162
174
 
163
175
  encrypted_body = {
164
- token: token,
176
+ token:,
165
177
  uuid: credentials[:uuid]
166
178
  }
167
179
 
@@ -206,9 +218,11 @@ module ActiveMerchant #:nodoc:
206
218
  multiresp.process { resp }
207
219
 
208
220
  multiresp
221
+ rescue ActiveMerchant::OAuthResponseError => e
222
+ raise OAuthResponseError.new(e)
209
223
  rescue ActiveMerchant::ResponseError => e
210
224
  # Retry on a possible expired encryption key
211
- if try_again && %w(401 404).include?(e.response.code) && @options[:encryption_key].present?
225
+ if retry?(try_again, e, :encryption_key)
212
226
  @options.delete(:encryption_key)
213
227
  commit(action, body, options, false)
214
228
  else
@@ -217,6 +231,10 @@ module ActiveMerchant #:nodoc:
217
231
  end
218
232
  end
219
233
 
234
+ def retry?(try_again, error, key)
235
+ try_again && %w(401 404).include?(error.response.code) && @options[key].present?
236
+ end
237
+
220
238
  def success_from(action, response)
221
239
  case action
222
240
  when 'capture/transaction/refund'
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class AlliedWalletGateway < Gateway
4
4
  self.display_name = 'Allied Wallet'
5
5
  self.homepage_url = 'https://www.alliedwallet.com'
@@ -85,11 +85,10 @@ module ActiveMerchant
85
85
  AVS_REASON_CODES = %w(27 45)
86
86
 
87
87
  TRACKS = {
88
- 1 => /^%(?<format_code>.)(?<pan>[\d]{1,19}+)\^(?<name>.{2,26})\^(?<expiration>[\d]{0,4}|\^)(?<service_code>[\d]{0,3}|\^)(?<discretionary_data>.*)\?\Z/,
89
- 2 => /\A;(?<pan>[\d]{1,19}+)=(?<expiration>[\d]{0,4}|=)(?<service_code>[\d]{0,3}|=)(?<discretionary_data>.*)\?\Z/
88
+ 1 => /^%(?<format_code>.)(?<pan>\d{1,19}+)\^(?<name>.{2,26})\^(?<expiration>\d{0,4}|\^)(?<service_code>\d{0,3}|\^)(?<discretionary_data>.*)\?\Z/,
89
+ 2 => /\A;(?<pan>\d{1,19}+)=(?<expiration>\d{0,4}|=)(?<service_code>\d{0,3}|=)(?<discretionary_data>.*)\?\Z/
90
90
  }.freeze
91
91
 
92
- APPLE_PAY_DATA_DESCRIPTOR = 'COMMON.APPLE.INAPP.PAYMENT'
93
92
  PAYMENT_METHOD_NOT_SUPPORTED_ERROR = '155'
94
93
  INELIGIBLE_FOR_ISSUING_CREDIT_ERROR = '54'
95
94
 
@@ -165,7 +164,7 @@ module ActiveMerchant
165
164
  xml.transactionType('refundTransaction')
166
165
  xml.amount(amount(amount))
167
166
 
168
- add_payment_source(xml, payment, options, :credit)
167
+ add_payment_method(xml, payment, options, :credit)
169
168
  xml.refTransId(transaction_id_from(options[:transaction_id])) if options[:transaction_id]
170
169
  add_invoice(xml, 'refundTransaction', options)
171
170
  add_customer_data(xml, payment, options)
@@ -190,7 +189,7 @@ module ActiveMerchant
190
189
  return 100 unless options[:verify_amount].present?
191
190
 
192
191
  amount = options[:verify_amount]
193
- raise ArgumentError.new 'verify_amount value must be an integer' unless amount.is_a?(Integer) && !amount.negative? || amount.is_a?(String) && amount.match?(/^\d+$/) && !amount.to_i.negative?
192
+ raise ArgumentError.new 'verify_amount value must be an integer' unless (amount.is_a?(Integer) && !amount.negative?) || (amount.is_a?(String) && amount.match?(/^\d+$/) && !amount.to_i.negative?)
194
193
  raise ArgumentError.new 'Billing address including zip code is required for a 0 amount verify' if amount.to_i.zero? && !validate_billing_address_values?(options)
195
194
 
196
195
  amount.to_i
@@ -262,7 +261,7 @@ module ActiveMerchant
262
261
  xml.transactionRequest do
263
262
  xml.transactionType(transaction_type)
264
263
  xml.amount(amount(amount))
265
- add_payment_source(xml, payment, options)
264
+ add_payment_method(xml, payment, options)
266
265
  add_invoice(xml, transaction_type, options)
267
266
  add_tax_fields(xml, options)
268
267
  add_duty_fields(xml, options)
@@ -273,6 +272,7 @@ module ActiveMerchant
273
272
  add_market_type_device_type(xml, payment, options)
274
273
  add_settings(xml, payment, options)
275
274
  add_user_fields(xml, amount, options)
275
+ add_surcharge_fields(xml, options)
276
276
  add_ship_from_address(xml, options)
277
277
  add_processing_options(xml, options)
278
278
  add_subsequent_auth_information(xml, options)
@@ -287,8 +287,9 @@ module ActiveMerchant
287
287
  add_tax_fields(xml, options)
288
288
  add_shipping_fields(xml, options)
289
289
  add_duty_fields(xml, options)
290
- add_payment_source(xml, payment, options)
290
+ add_payment_method(xml, payment, options)
291
291
  add_invoice(xml, transaction_type, options)
292
+ add_surcharge_fields(xml, options)
292
293
  add_tax_exempt_status(xml, options)
293
294
  end
294
295
  end
@@ -407,20 +408,27 @@ module ActiveMerchant
407
408
  end
408
409
  end
409
410
 
410
- def add_payment_source(xml, source, options, action = nil)
411
- return unless source
411
+ def add_payment_method(xml, payment_method, options, action = nil)
412
+ return unless payment_method
412
413
 
413
- if source.is_a?(String)
414
- add_token_payment_method(xml, source, options)
415
- elsif card_brand(source) == 'check'
416
- add_check(xml, source)
417
- elsif card_brand(source) == 'apple_pay'
418
- add_apple_pay_payment_token(xml, source)
414
+ case payment_method
415
+ when String
416
+ add_token_payment_method(xml, payment_method, options)
417
+ when Check
418
+ add_check(xml, payment_method)
419
419
  else
420
- add_credit_card(xml, source, action)
420
+ if network_token?(payment_method, options, action)
421
+ add_network_token(xml, payment_method)
422
+ else
423
+ add_credit_card(xml, payment_method, action)
424
+ end
421
425
  end
422
426
  end
423
427
 
428
+ def network_token?(payment_method, options, action)
429
+ payment_method.instance_of?(NetworkTokenizationCreditCard) && action != :credit
430
+ end
431
+
424
432
  def camel_case_lower(key)
425
433
  String(key).split('_').inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
426
434
  end
@@ -499,7 +507,6 @@ module ActiveMerchant
499
507
  xml.cardNumber(truncate(credit_card.number, 16))
500
508
  xml.expirationDate(format(credit_card.month, :two_digits) + '/' + format(credit_card.year, :four_digits))
501
509
  xml.cardCode(credit_card.verification_value) if credit_card.valid_card_verification_value?(credit_card.verification_value, credit_card.brand)
502
- xml.cryptogram(credit_card.payment_cryptogram) if credit_card.is_a?(NetworkTokenizationCreditCard) && action != :credit
503
510
  end
504
511
  end
505
512
  end
@@ -526,17 +533,20 @@ module ActiveMerchant
526
533
  xml.customerPaymentProfileId(customer_payment_profile_id)
527
534
  end
528
535
 
529
- def add_apple_pay_payment_token(xml, apple_pay_payment_token)
536
+ def add_network_token(xml, payment_method)
530
537
  xml.payment do
531
- xml.opaqueData do
532
- xml.dataDescriptor(APPLE_PAY_DATA_DESCRIPTOR)
533
- xml.dataValue(Base64.strict_encode64(apple_pay_payment_token.payment_data.to_json))
538
+ xml.creditCard do
539
+ xml.cardNumber(truncate(payment_method.number, 16))
540
+ xml.expirationDate(format(payment_method.month, :two_digits) + '/' + format(payment_method.year, :four_digits))
541
+ xml.isPaymentToken(true)
542
+ xml.cryptogram(payment_method.payment_cryptogram)
534
543
  end
535
544
  end
536
545
  end
537
546
 
538
547
  def add_market_type_device_type(xml, payment, options)
539
- return if payment.is_a?(String) || card_brand(payment) == 'check' || card_brand(payment) == 'apple_pay'
548
+ return unless payment.is_a?(CreditCard)
549
+ return if payment.is_a?(NetworkTokenizationCreditCard)
540
550
 
541
551
  if valid_track_data
542
552
  xml.retail do
@@ -701,6 +711,16 @@ module ActiveMerchant
701
711
  end
702
712
  end
703
713
 
714
+ def add_surcharge_fields(xml, options)
715
+ surcharge = options[:surcharge] if options[:surcharge]
716
+ if surcharge.is_a?(Hash)
717
+ xml.surcharge do
718
+ xml.amount(amount(surcharge[:amount].to_i)) if surcharge[:amount]
719
+ xml.description(surcharge[:description]) if surcharge[:description]
720
+ end
721
+ end
722
+ end
723
+
704
724
  def add_shipping_fields(xml, options)
705
725
  shipping = options[:shipping]
706
726
  if shipping.is_a?(Hash)
@@ -754,13 +774,7 @@ module ActiveMerchant
754
774
  xml.customerProfileId options[:customer_profile_id]
755
775
  xml.paymentProfile do
756
776
  add_billing_address(xml, credit_card, options)
757
- xml.payment do
758
- xml.creditCard do
759
- xml.cardNumber(truncate(credit_card.number, 16))
760
- xml.expirationDate(format(credit_card.year, :four_digits) + '-' + format(credit_card.month, :two_digits))
761
- xml.cardCode(credit_card.verification_value) if credit_card.verification_value
762
- end
763
- end
777
+ add_credit_card(xml, credit_card, :cim_store_update)
764
778
  end
765
779
  end
766
780
  end
@@ -776,13 +790,7 @@ module ActiveMerchant
776
790
  xml.customerType('individual')
777
791
  add_billing_address(xml, credit_card, options)
778
792
  add_shipping_address(xml, options, 'shipToList')
779
- xml.payment do
780
- xml.creditCard do
781
- xml.cardNumber(truncate(credit_card.number, 16))
782
- xml.expirationDate(format(credit_card.year, :four_digits) + '-' + format(credit_card.month, :two_digits))
783
- xml.cardCode(credit_card.verification_value) if credit_card.verification_value
784
- end
785
- end
793
+ add_credit_card(xml, credit_card, :cim_store)
786
794
  end
787
795
  end
788
796
  end
@@ -831,8 +839,8 @@ module ActiveMerchant
831
839
  end
832
840
  end
833
841
 
834
- def commit(action, options = {}, &payload)
835
- raw_response = ssl_post(url, post_data(action, &payload), headers)
842
+ def commit(action, options = {}, &)
843
+ raw_response = ssl_post(url, post_data(action, &), headers)
836
844
  response = parse(action, raw_response, options)
837
845
 
838
846
  avs_result_code = response[:avs_result_code].upcase if response[:avs_result_code]
@@ -847,8 +855,8 @@ module ActiveMerchant
847
855
  response,
848
856
  authorization: authorization_from(action, response),
849
857
  test: test?,
850
- avs_result: avs_result,
851
- cvv_result: cvv_result,
858
+ avs_result:,
859
+ cvv_result:,
852
860
  fraud_review: fraud_review?(response),
853
861
  error_code: map_error_code(response[:response_code], response[:response_reason_code])
854
862
  )
@@ -895,7 +903,7 @@ module ActiveMerchant
895
903
  doc = Nokogiri::XML(body)
896
904
  doc.remove_namespaces!
897
905
 
898
- response = { action: action }
906
+ response = { action: }
899
907
 
900
908
  response[:response_code] = if (element = doc.at_xpath('//transactionResponse/responseCode'))
901
909
  empty?(element.content) ? nil : element.content.to_i
@@ -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 on the Authorize.Net Gateway please visit their {Integration Center}[http://developer.authorize.net/]
4
4
  #
5
5
  # The login and password are not the username and password you use to
@@ -126,7 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  # * <tt>subscription_id</tt> -- A string containing the +subscription_id+ of the recurring payment already in place
127
127
  # for a given credit card. (REQUIRED)
128
128
  def cancel_recurring(subscription_id)
129
- request = build_recurring_request(:cancel, subscription_id: subscription_id)
129
+ request = build_recurring_request(:cancel, subscription_id:)
130
130
  recurring_commit(:cancel, request)
131
131
  end
132
132
 
@@ -139,7 +139,7 @@ module ActiveMerchant #:nodoc:
139
139
  # * <tt>subscription_id</tt> -- A string containing the +subscription_id+ of the recurring payment already in place
140
140
  # for a given credit card. (REQUIRED)
141
141
  def status_recurring(subscription_id)
142
- request = build_recurring_request(:status, subscription_id: subscription_id)
142
+ request = build_recurring_request(:status, subscription_id:)
143
143
  recurring_commit(:status, request)
144
144
  end
145
145
 
@@ -208,9 +208,9 @@ module ActiveMerchant #:nodoc:
208
208
  # The amount to be billed to the customer
209
209
  # for each payment in the subscription
210
210
  xml.tag!('amount', amount(options[:amount])) if options[:amount]
211
- if trial = options[:trial]
211
+ if trial = options[:trial] && (trial[:amount])
212
212
  # The amount to be charged for each payment during a trial period (conditional)
213
- xml.tag!('trialAmount', amount(trial[:amount])) if trial[:amount]
213
+ xml.tag!('trialAmount', amount(trial[:amount]))
214
214
  end
215
215
  # Contains either the customer’s credit card
216
216
  # or bank account payment information
@@ -260,9 +260,9 @@ module ActiveMerchant #:nodoc:
260
260
  # Contains information about the interval of time between payments
261
261
  add_interval(xml, options)
262
262
  add_duration(xml, options)
263
- if trial = options[:trial]
263
+ if trial = options[:trial] && (trial[:occurrences])
264
264
  # Number of billing occurrences or payments in the trial period (optional)
265
- xml.tag!('trialOccurrences', trial[:occurrences]) if trial[:occurrences]
265
+ xml.tag!('trialOccurrences', trial[:occurrences])
266
266
  end
267
267
  end
268
268
  end
@@ -393,9 +393,13 @@ module ActiveMerchant #:nodoc:
393
393
  test_mode = test? || message =~ /Test Mode/
394
394
  success = response[:result_code] == 'Ok'
395
395
 
396
- Response.new(success, message, response,
396
+ Response.new(
397
+ success,
398
+ message,
399
+ response,
397
400
  test: test_mode,
398
- authorization: response[:subscription_id])
401
+ authorization: response[:subscription_id]
402
+ )
399
403
  end
400
404
 
401
405
  def recurring_parse(action, xml)
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  # ==== Customer Information Manager (CIM)
6
6
  #
7
7
  # The Authorize.Net Customer Information Manager (CIM) is an optional additional service that allows you to store sensitive payment information on
@@ -695,9 +695,7 @@ module ActiveMerchant #:nodoc:
695
695
  add_order(xml, transaction[:order]) if transaction[:order].present?
696
696
 
697
697
  end
698
- if %i[auth_capture auth_only capture_only].include?(transaction[:type])
699
- xml.tag!('recurringBilling', transaction[:recurring_billing]) if transaction.has_key?(:recurring_billing)
700
- end
698
+ xml.tag!('recurringBilling', transaction[:recurring_billing]) if %i[auth_capture auth_only capture_only].include?(transaction[:type]) && transaction.has_key?(:recurring_billing)
701
699
  tag_unless_blank(xml, 'cardCode', transaction[:card_code]) unless %i[void refund prior_auth_capture].include?(transaction[:type])
702
700
  end
703
701
  end
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class AxcessmsGateway < Gateway
4
4
  self.test_url = 'https://test.ctpe.io/payment/ctpe'
5
5
  self.live_url = 'https://ctpe.io/payment/ctpe'
@@ -71,9 +71,13 @@ module ActiveMerchant #:nodoc:
71
71
  message = "#{response[:reason]} - #{response[:return]}"
72
72
  authorization = response[:unique_id]
73
73
 
74
- Response.new(success, message, response,
75
- authorization: authorization,
76
- test: (response[:mode] != 'LIVE'))
74
+ Response.new(
75
+ success,
76
+ message,
77
+ response,
78
+ authorization:,
79
+ test: (response[:mode] != 'LIVE')
80
+ )
77
81
  end
78
82
 
79
83
  def parse(body)
@@ -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
  # For more information on Balanced visit https://www.balancedpayments.com
6
6
  # or visit #balanced on irc.freenode.net
7
7
  #
@@ -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 BamboraApacGateway < Gateway
6
6
  self.live_url = 'https://www.bambora.co.nz/interface/api'
7
7
  self.test_url = 'https://demo.bambora.co.nz/interface/api'
@@ -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
  # For more information visit {Bank Frick Acquiring Services}[http://www.bankfrickacquiring.com/merchantsolutions_en.html]
6
6
  #
7
7
  # Written by Piers Chambers (Varyonic.com)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class BanwireGateway < Gateway
4
4
  URL = 'https://banwire.com/api.pago_pro'
5
5
 
@@ -89,11 +89,13 @@ module ActiveMerchant #:nodoc:
89
89
  response = json_error(raw_response)
90
90
  end
91
91
 
92
- Response.new(success?(response),
92
+ Response.new(
93
+ success?(response),
93
94
  response['message'],
94
95
  response,
95
96
  test: test?,
96
- authorization: response['code_auth'])
97
+ authorization: response['code_auth']
98
+ )
97
99
  end
98
100
 
99
101
  def success?(response)
@@ -1,6 +1,8 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class BarclaycardSmartpayGateway < Gateway
4
+ version 'v40'
5
+
4
6
  self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
5
7
  self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
6
8
 
@@ -14,8 +16,6 @@ module ActiveMerchant #:nodoc:
14
16
  self.homepage_url = 'https://www.barclaycardsmartpay.com/'
15
17
  self.display_name = 'Barclaycard Smartpay'
16
18
 
17
- API_VERSION = 'v40'
18
-
19
19
  def initialize(options = {})
20
20
  requires!(options, :company, :merchant, :password)
21
21
  super
@@ -257,13 +257,13 @@ module ActiveMerchant #:nodoc:
257
257
  def build_url(action)
258
258
  case action
259
259
  when 'store'
260
- "#{test? ? self.test_url : self.live_url}/Recurring/#{API_VERSION}/storeToken"
260
+ "#{test? ? self.test_url : self.live_url}/Recurring/#{fetch_version}/storeToken"
261
261
  when 'finalize3ds'
262
- "#{test? ? self.test_url : self.live_url}/Payment/#{API_VERSION}/authorise3d"
262
+ "#{test? ? self.test_url : self.live_url}/Payment/#{fetch_version}/authorise3d"
263
263
  when 'storeDetailAndSubmitThirdParty', 'confirmThirdParty'
264
- "#{test? ? self.test_url : self.live_url}/Payout/#{API_VERSION}/#{action}"
264
+ "#{test? ? self.test_url : self.live_url}/Payout/#{fetch_version}/#{action}"
265
265
  else
266
- "#{test? ? self.test_url : self.live_url}/Payment/#{API_VERSION}/#{action}"
266
+ "#{test? ? self.test_url : self.live_url}/Payment/#{fetch_version}/#{action}"
267
267
  end
268
268
  end
269
269
 
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class BarclaysEpdqExtraPlusGateway < OgoneGateway
4
4
  self.test_url = 'https://mdepayments.epdq.co.uk/ncol/test/'
5
5
  self.live_url = 'https://payments.epdq.co.uk/ncol/prod/'
@@ -1,7 +1,7 @@
1
1
  require 'digest/sha2'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class Be2billGateway < Gateway
6
6
  self.test_url = 'https://secure-test.be2bill.com/front/service/rest/process.php'
7
7
  self.live_url = 'https://secure-magenta1.be2bill.com/front/service/rest/process.php'