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,287 @@
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
+ class HiPayGateway < Gateway
4
+ # to add more check => payment_product_list: https://developer.hipay.com/api-explorer/api-online-payments#/payments/generateHostedPaymentPage
5
+ PAYMENT_PRODUCT = {
6
+ 'visa' => 'visa',
7
+ 'master' => 'mastercard',
8
+ 'american_express' => 'american_express'
9
+ }
10
+
11
+ DEVICE_CHANEL = {
12
+ app: 1,
13
+ browser: 2,
14
+ three_ds_requestor_initiaded: 3
15
+ }
16
+
17
+ self.test_url = 'https://stage-secure-gateway.hipay-tpp.com/rest'
18
+ self.live_url = 'https://secure-gateway.hipay-tpp.com/rest'
19
+
20
+ self.supported_countries = %w[FR]
21
+ self.default_currency = 'EUR'
22
+ self.money_format = :dollars
23
+ self.supported_cardtypes = %i[visa master american_express]
24
+
25
+ self.homepage_url = 'https://hipay.com/'
26
+ self.display_name = 'HiPay'
27
+
28
+ def initialize(options = {})
29
+ requires!(options, :username, :password)
30
+ @username = options[:username]
31
+ @password = options[:password]
32
+ super
33
+ end
34
+
35
+ def purchase(money, payment_method, options = {})
36
+ authorize(money, payment_method, options.merge({ operation: 'Sale' }))
37
+ end
38
+
39
+ def authorize(money, payment_method, options = {})
40
+ MultiResponse.run do |r|
41
+ if payment_method.is_a?(CreditCard)
42
+ response = r.process { tokenize(payment_method, options) }
43
+ card_token = response.params['token']
44
+ elsif payment_method.is_a?(String)
45
+ _transaction_ref, card_token, payment_product = payment_method.split('|') if payment_method.split('|').size == 3
46
+ card_token, payment_product = payment_method.split('|') if payment_method.split('|').size == 2
47
+ end
48
+
49
+ payment_product = payment_method.is_a?(CreditCard) ? PAYMENT_PRODUCT[payment_method.brand] : PAYMENT_PRODUCT[payment_product&.downcase]
50
+
51
+ post = {
52
+ payment_product:,
53
+ operation: options[:operation] || 'Authorization',
54
+ cardtoken: card_token
55
+ }
56
+ add_address(post, options)
57
+ add_product_data(post, options)
58
+ add_invoice(post, money, options)
59
+ add_3ds(post, options)
60
+ r.process { commit('order', post) }
61
+ end
62
+ end
63
+
64
+ def capture(money, authorization, options)
65
+ reference_operation(money, authorization, options.merge({ operation: 'capture' }))
66
+ end
67
+
68
+ def store(payment_method, options = {})
69
+ tokenize(payment_method, options.merge({ multiuse: '1' }))
70
+ end
71
+
72
+ def unstore(authorization, options = {})
73
+ _transaction_ref, card_token, _payment_product = authorization.split('|') if authorization.split('|').size == 3
74
+ card_token, _payment_product = authorization.split('|') if authorization.split('|').size == 2
75
+ commit('unstore', { card_token: }, options, :delete)
76
+ end
77
+
78
+ def refund(money, authorization, options)
79
+ reference_operation(money, authorization, options.merge({ operation: 'refund' }))
80
+ end
81
+
82
+ def void(authorization, options)
83
+ reference_operation(nil, authorization, options.merge({ operation: 'cancel' }))
84
+ end
85
+
86
+ def supports_scrubbing?
87
+ true
88
+ end
89
+
90
+ def scrub(transcript)
91
+ transcript.
92
+ gsub(%r((Authorization: Basic )[\w =]+), '\1[FILTERED]').
93
+ gsub(%r((card_number=)\w+), '\1[FILTERED]\2').
94
+ gsub(%r((cvc=)\w+), '\1[FILTERED]\2')
95
+ end
96
+
97
+ private
98
+
99
+ def reference_operation(money, authorization, options)
100
+ post = {}
101
+ post[:operation] = options[:operation]
102
+ post[:currency] = (options[:currency] || currency(money))
103
+ post[:amount] = amount(money) if options[:operation] == 'refund' || options[:operation] == 'capture'
104
+ commit(options[:operation], post, { transaction_reference: authorization.split('|').first })
105
+ end
106
+
107
+ def add_product_data(post, options)
108
+ post[:orderid] = options[:order_id] if options[:order_id]
109
+ post[:description] = options[:description]
110
+ end
111
+
112
+ def add_invoice(post, money, options)
113
+ post[:currency] = (options[:currency] || currency(money))
114
+ post[:amount] = amount(money)
115
+ end
116
+
117
+ def add_credit_card(post, credit_card)
118
+ post[:card_number] = credit_card.number
119
+ post[:card_expiry_month] = credit_card.month
120
+ post[:card_expiry_year] = credit_card.year
121
+ post[:card_holder] = credit_card.name
122
+ post[:cvc] = credit_card.verification_value
123
+ end
124
+
125
+ def add_address(post, options)
126
+ return unless billing_address = options[:billing_address]
127
+
128
+ post[:streetaddress] = billing_address[:address1] if billing_address[:address1]
129
+ post[:streetaddress2] = billing_address[:address2] if billing_address[:address2]
130
+ post[:city] = billing_address[:city] if billing_address[:city]
131
+ post[:recipient_info] = billing_address[:company] if billing_address[:company]
132
+ post[:state] = billing_address[:state] if billing_address[:state]
133
+ post[:country] = billing_address[:country] if billing_address[:country]
134
+ post[:zipcode] = billing_address[:zip] if billing_address[:zip]
135
+ post[:country] = billing_address[:country] if billing_address[:country]
136
+ post[:phone] = billing_address[:phone] if billing_address[:phone]
137
+ end
138
+
139
+ def tokenize(payment_method, options = {})
140
+ post = {}
141
+ add_credit_card(post, payment_method)
142
+ post[:multi_use] = options[:multiuse] ? '1' : '0'
143
+ post[:generate_request_id] = '0'
144
+ commit('store', post, options)
145
+ end
146
+
147
+ def add_3ds(post, options)
148
+ return unless options[:execute_threed] && options[:three_ds_2]
149
+
150
+ browser_info_3ds = options[:three_ds_2][:browser_info]
151
+
152
+ browser_info_hash = {
153
+ java_enabled: browser_info_3ds[:java],
154
+ javascript_enabled: (browser_info_3ds[:javascript] || false),
155
+ ipaddr: options[:ip],
156
+ http_accept: '*\\/*',
157
+ http_user_agent: browser_info_3ds[:user_agent],
158
+ language: browser_info_3ds[:language],
159
+ color_depth: browser_info_3ds[:depth],
160
+ screen_height: browser_info_3ds[:height],
161
+ screen_width: browser_info_3ds[:width],
162
+ timezone: browser_info_3ds[:timezone]
163
+ }
164
+
165
+ browser_info_hash['device_fingerprint'] = options[:device_fingerprint] if options[:device_fingerprint]
166
+ post[:browser_info] = browser_info_hash.to_json
167
+ post.to_json
168
+
169
+ post[:accept_url] = options[:accept_url] if options[:accept_url]
170
+ post[:decline_url] = options[:decline_url] if options[:decline_url]
171
+ post[:pending_url] = options[:pending_url] if options[:pending_url]
172
+ post[:exception_url] = options[:exception_url] if options[:exception_url]
173
+ post[:cancel_url] = options[:cancel_url] if options[:cancel_url]
174
+ post[:notify_url] = browser_info_3ds[:notification_url] if browser_info_3ds[:notification_url]
175
+ post[:authentication_indicator] = DEVICE_CHANEL[options[:three_ds_2][:channel]] || 0
176
+ end
177
+
178
+ def parse(body)
179
+ return {} if body.blank?
180
+
181
+ JSON.parse(body)
182
+ end
183
+
184
+ def commit(action, post, options = {}, method = :post)
185
+ raw_response = begin
186
+ ssl_request(method, url(action, options), post_data(post), request_headers)
187
+ rescue ResponseError => e
188
+ e.response.body
189
+ end
190
+
191
+ response = parse(raw_response)
192
+
193
+ Response.new(
194
+ success_from(action, response),
195
+ message_from(action, response),
196
+ response,
197
+ authorization: authorization_from(action, response),
198
+ test: test?,
199
+ error_code: error_code_from(action, response)
200
+ )
201
+ end
202
+
203
+ def error_code_from(action, response)
204
+ (response['code'] || response.dig('reason', 'code')).to_s unless success_from(action, response)
205
+ end
206
+
207
+ def success_from(action, response)
208
+ case action
209
+ when 'order'
210
+ response['state'] == 'completed' || (response['state'] == 'forwarding' && response['status'] == '140')
211
+ when 'capture'
212
+ response['status'] == '118' && response['message'] == 'Captured'
213
+ when 'refund'
214
+ response['status'] == '124' && response['message'] == 'Refund Requested'
215
+ when 'cancel'
216
+ response['status'] == '175' && response['message'] == 'Authorization Cancellation requested'
217
+ when 'store'
218
+ response.include? 'token'
219
+ when 'unstore'
220
+ response['code'] == '204'
221
+ else
222
+ false
223
+ end
224
+ end
225
+
226
+ def message_from(action, response)
227
+ response['message']
228
+ end
229
+
230
+ def authorization_from(action, response)
231
+ authorization_string(response['transactionReference'], response['token'], response['brand'])
232
+ end
233
+
234
+ def authorization_string(*args)
235
+ args.flatten.compact.reject(&:empty?).join('|')
236
+ end
237
+
238
+ def post_data(params)
239
+ params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
240
+ end
241
+
242
+ def url(action, options = {})
243
+ case action
244
+ when 'store'
245
+ "#{token_url}/create"
246
+ when 'unstore'
247
+ token_url
248
+ when 'capture', 'refund', 'cancel'
249
+ endpoint = "maintenance/transaction/#{options[:transaction_reference]}"
250
+ base_url(endpoint)
251
+ else
252
+ base_url(action)
253
+ end
254
+ end
255
+
256
+ def base_url(endpoint)
257
+ "#{test? ? test_url : live_url}/v1/#{endpoint}"
258
+ end
259
+
260
+ def token_url
261
+ "https://#{'stage-' if test?}secure2-vault.hipay-tpp.com/rest/v2/token"
262
+ end
263
+
264
+ def basic_auth
265
+ Base64.strict_encode64("#{@username}:#{@password}")
266
+ end
267
+
268
+ def request_headers
269
+ {
270
+ 'Accept' => 'application/json',
271
+ 'Content-Type' => 'application/x-www-form-urlencoded',
272
+ 'Authorization' => "Basic #{basic_auth}"
273
+ }
274
+ end
275
+
276
+ def handle_response(response)
277
+ case response.code.to_i
278
+ # to get the response code after unstore(delete instrument), because the body is nil
279
+ when 200...300
280
+ response.body || { code: response.code }.to_json
281
+ else
282
+ raise ResponseError.new(response)
283
+ end
284
+ end
285
+ end
286
+ end
287
+ end
@@ -1,10 +1,12 @@
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 HpsGateway < Gateway
6
- self.live_url = 'https://posgateway.secureexchange.net/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl'
7
- self.test_url = 'https://posgateway.cert.secureexchange.net/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl'
6
+ version '1.0'
7
+
8
+ self.live_url = 'https://api2.heartlandportico.com/hps.exchange.posgateway/posgatewayservice.asmx'
9
+ self.test_url = 'https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx'
8
10
 
9
11
  self.supported_countries = ['US']
10
12
  self.default_currency = 'USD'
@@ -17,11 +19,6 @@ module ActiveMerchant #:nodoc:
17
19
 
18
20
  PAYMENT_DATA_SOURCE_MAPPING = {
19
21
  apple_pay: 'ApplePay',
20
- master: 'MasterCard 3DSecure',
21
- visa: 'Visa 3DSecure',
22
- american_express: 'AMEX 3DSecure',
23
- discover: 'Discover 3DSecure',
24
- android_pay: 'GooglePayApp',
25
22
  google_pay: 'GooglePayApp'
26
23
  }
27
24
 
@@ -30,15 +27,16 @@ module ActiveMerchant #:nodoc:
30
27
  super
31
28
  end
32
29
 
33
- def authorize(money, card_or_token, options = {})
30
+ def authorize(money, payment_method, options = {})
34
31
  commit('CreditAuth') do |xml|
35
32
  add_amount(xml, money)
36
33
  add_allow_dup(xml)
37
- add_card_or_token_customer_data(xml, card_or_token, options)
34
+ add_card_or_token_customer_data(xml, payment_method, options)
38
35
  add_details(xml, options)
39
36
  add_descriptor_name(xml, options)
40
- add_card_or_token_payment(xml, card_or_token, options)
41
- add_three_d_secure(xml, card_or_token, options)
37
+ add_card_or_token_payment(xml, payment_method, options)
38
+ add_wallet_data(xml, payment_method, options)
39
+ add_three_d_secure(xml, payment_method, options)
42
40
  add_stored_credentials(xml, options)
43
41
  end
44
42
  end
@@ -110,7 +108,8 @@ module ActiveMerchant #:nodoc:
110
108
  gsub(%r((<hps:SecretAPIKey>)[^<]*(<\/hps:SecretAPIKey>))i, '\1[FILTERED]\2').
111
109
  gsub(%r((<hps:PaymentData>)[^<]*(<\/hps:PaymentData>))i, '\1[FILTERED]\2').
112
110
  gsub(%r((<hps:RoutingNumber>)[^<]*(<\/hps:RoutingNumber>))i, '\1[FILTERED]\2').
113
- gsub(%r((<hps:AccountNumber>)[^<]*(<\/hps:AccountNumber>))i, '\1[FILTERED]\2')
111
+ gsub(%r((<hps:AccountNumber>)[^<]*(<\/hps:AccountNumber>))i, '\1[FILTERED]\2').
112
+ gsub(%r((<hps:Cryptogram>)[^<]*(<\/hps:Cryptogram>))i, '\1[FILTERED]\2')
114
113
  end
115
114
 
116
115
  private
@@ -125,28 +124,30 @@ module ActiveMerchant #:nodoc:
125
124
  end
126
125
  end
127
126
 
128
- def commit_credit_sale(money, card_or_token, options)
127
+ def commit_credit_sale(money, payment_method, options)
129
128
  commit('CreditSale') do |xml|
130
129
  add_amount(xml, money)
131
130
  add_allow_dup(xml)
132
- add_card_or_token_customer_data(xml, card_or_token, options)
131
+ add_card_or_token_customer_data(xml, payment_method, options)
133
132
  add_details(xml, options)
134
133
  add_descriptor_name(xml, options)
135
- add_card_or_token_payment(xml, card_or_token, options)
136
- add_three_d_secure(xml, card_or_token, options)
134
+ add_card_or_token_payment(xml, payment_method, options)
135
+ add_wallet_data(xml, payment_method, options)
136
+ add_three_d_secure(xml, payment_method, options)
137
137
  add_stored_credentials(xml, options)
138
138
  end
139
139
  end
140
140
 
141
- def commit_recurring_billing_sale(money, card_or_token, options)
141
+ def commit_recurring_billing_sale(money, payment_method, options)
142
142
  commit('RecurringBilling') do |xml|
143
143
  add_amount(xml, money)
144
144
  add_allow_dup(xml)
145
- add_card_or_token_customer_data(xml, card_or_token, options)
145
+ add_card_or_token_customer_data(xml, payment_method, options)
146
146
  add_details(xml, options)
147
147
  add_descriptor_name(xml, options)
148
- add_card_or_token_payment(xml, card_or_token, options)
149
- add_three_d_secure(xml, card_or_token, options)
148
+ add_card_or_token_payment(xml, payment_method, options)
149
+ add_wallet_data(xml, payment_method, options)
150
+ add_three_d_secure(xml, payment_method, options)
150
151
  add_stored_credentials(xml, options)
151
152
  add_stored_credentials_for_recurring_billing(xml, options)
152
153
  end
@@ -254,32 +255,24 @@ module ActiveMerchant #:nodoc:
254
255
  xml.hps :TxnDescriptor, options[:descriptor_name] if options[:descriptor_name]
255
256
  end
256
257
 
257
- def add_three_d_secure(xml, card_or_token, options)
258
- if card_or_token.is_a?(NetworkTokenizationCreditCard)
259
- build_three_d_secure(xml, {
260
- source: card_or_token.source,
261
- cavv: card_or_token.payment_cryptogram,
262
- eci: card_or_token.eci,
263
- xid: card_or_token.transaction_id
264
- })
265
- elsif options[:three_d_secure]
266
- options[:three_d_secure][:source] ||= card_brand(card_or_token)
267
- build_three_d_secure(xml, options[:three_d_secure])
258
+ def add_wallet_data(xml, payment_method, options)
259
+ return unless payment_method.is_a?(NetworkTokenizationCreditCard)
260
+
261
+ xml.hps :WalletData do
262
+ xml.hps :PaymentSource, PAYMENT_DATA_SOURCE_MAPPING[payment_method.source]
263
+ xml.hps :Cryptogram, payment_method.payment_cryptogram
264
+ xml.hps :ECI, strip_leading_zero(payment_method.eci) if payment_method.eci
268
265
  end
269
266
  end
270
267
 
271
- def build_three_d_secure(xml, three_d_secure)
272
- # PaymentDataSource is required when supplying the SecureECommerce data group,
273
- # and the gateway currently only allows the values within the mapping
274
- return unless PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]
268
+ def add_three_d_secure(xml, card_or_token, options)
269
+ return unless (three_d_secure = options[:three_d_secure])
275
270
 
276
- xml.hps :SecureECommerce do
277
- xml.hps :PaymentDataSource, PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]
278
- xml.hps :TypeOfPaymentData, '3DSecure' # Only type currently supported
279
- xml.hps :PaymentData, three_d_secure[:cavv] if three_d_secure[:cavv]
280
- # the gateway only allows a single character for the ECI
281
- xml.hps :ECommerceIndicator, strip_leading_zero(three_d_secure[:eci]) if three_d_secure[:eci]
282
- xml.hps :XID, three_d_secure[:xid] if three_d_secure[:xid]
271
+ xml.hps :Secure3D do
272
+ xml.hps :Version, three_d_secure[:version]
273
+ xml.hps :AuthenticationValue, three_d_secure[:cavv] if three_d_secure[:cavv]
274
+ xml.hps :ECI, strip_leading_zero(three_d_secure[:eci]) if three_d_secure[:eci]
275
+ xml.hps :DirectoryServerTxnId, three_d_secure[:ds_transaction_id] if three_d_secure[:ds_transaction_id]
283
276
  end
284
277
  end
285
278
 
@@ -330,7 +323,7 @@ module ActiveMerchant #:nodoc:
330
323
  } do
331
324
  xml.SOAP :Body do
332
325
  xml.hps :PosRequest do
333
- xml.hps 'Ver1.0'.to_sym do
326
+ xml.hps :"Ver#{fetch_version}" do
334
327
  xml.hps :Header do
335
328
  xml.hps :SecretAPIKey, @options[:secret_api_key]
336
329
  xml.hps :DeveloperID, @options[:developer_id] if @options[:developer_id]
@@ -383,8 +376,8 @@ module ActiveMerchant #:nodoc:
383
376
  response
384
377
  end
385
378
 
386
- def commit(action, reference = nil, &request)
387
- data = build_request(action, &request)
379
+ def commit(action, reference = nil, &)
380
+ data = build_request(action, &)
388
381
 
389
382
  response =
390
383
  begin
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class IatsPaymentsGateway < Gateway
4
4
  class_attribute :live_na_url, :live_uk_url
5
5
 
@@ -185,8 +185,13 @@ module ActiveMerchant #:nodoc:
185
185
  end
186
186
 
187
187
  def commit(action, parameters)
188
- response = parse(ssl_post(url(action), post_data(action, parameters),
189
- { 'Content-Type' => 'application/soap+xml; charset=utf-8' }))
188
+ response = parse(
189
+ ssl_post(
190
+ url(action),
191
+ post_data(action, parameters),
192
+ { 'Content-Type' => 'application/soap+xml; charset=utf-8' }
193
+ )
194
+ )
190
195
 
191
196
  Response.new(
192
197
  success_from(response),
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class InContextPaypalExpressGateway < PaypalExpressGateway
4
4
  self.test_redirect_url = 'https://www.sandbox.paypal.com/checkoutnow'
5
5
  self.live_redirect_url = 'https://www.paypal.com/checkoutnow'
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '..', 'check.rb')
2
- module ActiveMerchant #:nodoc:
3
- module Billing #:nodoc:
2
+ module ActiveMerchant # :nodoc:
3
+ module Billing # :nodoc:
4
4
  class InspireGateway < Gateway
5
5
  self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
6
6
 
@@ -172,11 +172,14 @@ module ActiveMerchant #:nodoc:
172
172
 
173
173
  response = parse(ssl_post(self.live_url, post_data(action, parameters)))
174
174
 
175
- Response.new(response['response'] == '1', message_from(response), response,
175
+ Response.new(
176
+ response['response'] == '1',
177
+ message_from(response), response,
176
178
  authorization: response['transactionid'],
177
179
  test: test?,
178
180
  cvv_result: response['cvvresponse'],
179
- avs_result: { code: response['avsresponse'] })
181
+ avs_result: { code: response['avsresponse'] }
182
+ )
180
183
  end
181
184
 
182
185
  def message_from(response)
@@ -196,8 +199,7 @@ module ActiveMerchant #:nodoc:
196
199
  post[:password] = @options[:password]
197
200
  post[:type] = action if action
198
201
 
199
- request = post.merge(parameters).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
200
- request
202
+ post.merge(parameters).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
201
203
  end
202
204
 
203
205
  def determine_funding_source(source)
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class InstapayGateway < Gateway
4
4
  self.live_url = 'https://trans.instapaygateway.com/cgi-bin/process.cgi'
5
5
 
@@ -140,10 +140,14 @@ module ActiveMerchant #:nodoc:
140
140
  data = ssl_post self.live_url, post_data(action, parameters)
141
141
  response = parse(data)
142
142
 
143
- Response.new(response[:success], response[:message], response,
143
+ Response.new(
144
+ response[:success],
145
+ response[:message],
146
+ response,
144
147
  authorization: response[:transaction_id],
145
148
  avs_result: { code: response[:avs_result] },
146
- cvv_result: response[:cvv_result])
149
+ cvv_result: response[:cvv_result]
150
+ )
147
151
  end
148
152
 
149
153
  def post_data(action, parameters = {})
@@ -151,8 +155,7 @@ module ActiveMerchant #:nodoc:
151
155
  post[:acctid] = @options[:login]
152
156
  post[:merchantpin] = @options[:password] if @options[:password]
153
157
  post[:action] = action
154
- request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
155
- request
158
+ post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
156
159
  end
157
160
  end
158
161
  end
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class IpgGateway < Gateway
4
4
  self.test_url = 'https://test.ipg-online.com/ipgapi/services'
5
5
  self.live_url = 'https://www5.ipg-online.com/ipgapi/services'
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
18
18
  ACTION_REQUEST_ITEMS = %w(vault unstore)
19
19
 
20
20
  def initialize(options = {})
21
- requires!(options, :store_id, :user_id, :password, :pem, :pem_password)
21
+ requires!(options, :user_id, :password, :pem, :pem_password)
22
22
  @credentials = options
23
23
  @hosted_data_id = nil
24
24
  super
@@ -86,8 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
  transcript.
87
87
  gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
88
88
  gsub(%r((<v1:CardNumber>).+(</v1:CardNumber>)), '\1[FILTERED]\2').
89
- gsub(%r((<v1:CardCodeValue>).+(</v1:CardCodeValue>)), '\1[FILTERED]\2').
90
- gsub(%r((<v1:StoreId>).+(</v1:StoreId>)), '\1[FILTERED]\2')
89
+ gsub(%r((<v1:CardCodeValue>).+(</v1:CardCodeValue>)), '\1[FILTERED]\2')
91
90
  end
92
91
 
93
92
  private
@@ -151,7 +150,7 @@ module ActiveMerchant #:nodoc:
151
150
  end
152
151
 
153
152
  def add_storage_item(xml, credit_card, options)
154
- requires!(options.merge!({ credit_card: credit_card, hosted_data_id: @hosted_data_id }), :credit_card, :hosted_data_id)
153
+ requires!(options.merge!({ credit_card:, hosted_data_id: @hosted_data_id }), :credit_card, :hosted_data_id)
155
154
  xml.tag!('ns2:StoreHostedData') do
156
155
  xml.tag!('ns2:DataStorageItem') do
157
156
  add_credit_card(xml, credit_card, {}, 'ns2')
@@ -162,7 +161,7 @@ module ActiveMerchant #:nodoc:
162
161
  end
163
162
 
164
163
  def add_unstore_item(xml, hosted_data_id)
165
- requires!({}.merge!({ hosted_data_id: hosted_data_id }), :hosted_data_id)
164
+ requires!({}.merge!({ hosted_data_id: }), :hosted_data_id)
166
165
  xml.tag!('ns2:StoreHostedData') do
167
166
  xml.tag!('ns2:DataStorageItem') do
168
167
  xml.tag!('ns2:Function', 'delete')
@@ -265,7 +264,7 @@ module ActiveMerchant #:nodoc:
265
264
  end
266
265
 
267
266
  def add_payment(xml, money, payment, options)
268
- requires!(options.merge!({ money: money }), :currency, :money)
267
+ requires!(options.merge!({ money: }), :currency, :money)
269
268
  xml.tag!('v1:Payment') do
270
269
  xml.tag!('v1:HostedDataID', payment) if payment&.is_a?(String)
271
270
  xml.tag!('v1:HostedDataStoreID', options[:hosted_data_store_id]) if options[:hosted_data_store_id]
@@ -273,7 +272,7 @@ module ActiveMerchant #:nodoc:
273
272
  xml.tag!('v1:SubTotal', options[:sub_total]) if options[:sub_total]
274
273
  xml.tag!('v1:ValueAddedTax', options[:value_added_tax]) if options[:value_added_tax]
275
274
  xml.tag!('v1:DeliveryAmount', options[:delivery_amount]) if options[:delivery_amount]
276
- xml.tag!('v1:ChargeTotal', money)
275
+ xml.tag!('v1:ChargeTotal', amount(money))
277
276
  xml.tag!('v1:Currency', CURRENCY_CODES[options[:currency]])
278
277
  xml.tag!('v1:numberOfInstallments', options[:number_of_installments]) if options[:number_of_installments]
279
278
  end
@@ -317,7 +316,10 @@ module ActiveMerchant #:nodoc:
317
316
  end
318
317
 
319
318
  def encoded_credentials
320
- Base64.encode64("WS#{@credentials[:store_id]}._.#{@credentials[:user_id]}:#{@credentials[:password]}").delete("\n")
319
+ # We remove 'WS' and add it back on the next line because the ipg docs are a little confusing.
320
+ # Some merchants will likely add it to their user_id and others won't.
321
+ user_id = @credentials[:user_id].sub(/^WS/, '')
322
+ Base64.encode64("WS#{user_id}:#{@credentials[:password]}").delete("\n")
321
323
  end
322
324
 
323
325
  def envelope_namespaces
@@ -344,6 +346,8 @@ module ActiveMerchant #:nodoc:
344
346
  end
345
347
 
346
348
  def override_store_id(options)
349
+ raise ArgumentError, 'store_id must be provieded' if @credentials[:store_id].blank? && options[:store_id].blank?
350
+
347
351
  @credentials[:store_id] = options[:store_id] if options[:store_id].present?
348
352
  end
349
353
 
@@ -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 IppGateway < Gateway
6
6
  self.live_url = 'https://www.ippayments.com.au/interface/api/dts.asmx'
7
7
  self.test_url = 'https://demo.ippayments.com.au/interface/api/dts.asmx'