activemerchant 1.45.0 → 1.126.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +2167 -2
  3. data/CONTRIBUTORS +57 -0
  4. data/README.md +62 -41
  5. data/lib/active_merchant/billing/avs_result.rb +25 -28
  6. data/lib/active_merchant/billing/base.rb +11 -35
  7. data/lib/active_merchant/billing/check.rb +28 -24
  8. data/lib/active_merchant/billing/compatibility.rb +10 -12
  9. data/lib/active_merchant/billing/credit_card.rb +141 -69
  10. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  11. data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
  12. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  13. data/lib/active_merchant/billing/gateway.rb +125 -61
  14. data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
  15. data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
  21. data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
  24. data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
  33. data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
  34. data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
  42. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
  52. data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  57. data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  59. data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  61. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  62. data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
  63. data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
  64. data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
  65. data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
  66. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  67. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  68. data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
  69. data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
  70. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  71. data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
  72. data/lib/active_merchant/billing/gateways/element.rb +386 -0
  73. data/lib/active_merchant/billing/gateways/epay.rb +92 -71
  74. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  75. data/lib/active_merchant/billing/gateways/eway.rb +85 -73
  76. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  77. data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
  78. data/lib/active_merchant/billing/gateways/exact.rb +37 -36
  79. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  80. data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
  81. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  82. data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
  83. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  84. data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
  85. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
  86. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  87. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  88. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  89. data/lib/active_merchant/billing/gateways/forte.rb +286 -0
  90. data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
  91. data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
  92. data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
  93. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  94. data/lib/active_merchant/billing/gateways/hps.rb +252 -68
  95. data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
  96. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  97. data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
  98. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  99. data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
  100. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  101. data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
  102. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  103. data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
  104. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
  111. data/lib/active_merchant/billing/gateways/litle.rb +371 -94
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
  121. data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
  124. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  125. data/lib/active_merchant/billing/gateways/migs.rb +101 -37
  126. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
  128. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
  129. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  130. data/lib/active_merchant/billing/gateways/monei.rb +422 -0
  131. data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
  132. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  133. data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
  134. data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
  135. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
  136. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  137. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  138. data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
  139. data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
  140. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  141. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  142. data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
  143. data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
  144. data/lib/active_merchant/billing/gateways/omise.rb +323 -0
  145. data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
  146. data/lib/active_merchant/billing/gateways/opp.rb +394 -0
  147. data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  149. data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
  150. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
  151. data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
  152. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  153. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  154. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  155. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
  156. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  157. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  158. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
  159. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  160. data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
  161. data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
  162. data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
  163. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  167. data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
  169. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
  170. data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
  172. data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
  173. data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
  175. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
  177. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  178. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
  179. data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
  180. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
  182. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  183. data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
  184. data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
  185. data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
  186. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  187. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  188. data/lib/active_merchant/billing/gateways/pin.rb +113 -37
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  190. data/lib/active_merchant/billing/gateways/priority.rb +369 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
  192. data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
  194. data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
  195. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
  203. data/lib/active_merchant/billing/gateways/realex.rb +154 -52
  204. data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
  205. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  206. data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
  207. data/lib/active_merchant/billing/gateways/sage.rb +404 -133
  208. data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
  209. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  210. data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
  211. data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
  212. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
  213. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  214. data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
  215. data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
  216. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
  217. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  218. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  219. data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
  220. data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
  221. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
  222. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
  223. data/lib/active_merchant/billing/gateways/telr.rb +273 -0
  224. data/lib/active_merchant/billing/gateways/tns.rb +16 -217
  225. data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
  226. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
  227. data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
  228. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  229. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  230. data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
  231. data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
  232. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  233. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
  234. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
  235. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  236. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  237. data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
  238. data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
  239. data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
  240. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  241. data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
  242. data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
  243. data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
  244. data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
  245. data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
  246. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
  247. data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
  248. data/lib/active_merchant/billing/gateways.rb +8 -11
  249. data/lib/active_merchant/billing/model.rb +2 -2
  250. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  251. data/lib/active_merchant/billing/payment_token.rb +1 -1
  252. data/lib/active_merchant/billing/rails.rb +1 -1
  253. data/lib/active_merchant/billing/response.rb +19 -13
  254. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  255. data/lib/active_merchant/billing.rb +3 -0
  256. data/lib/active_merchant/connection.rb +196 -0
  257. data/lib/active_merchant/country.rb +13 -8
  258. data/lib/active_merchant/errors.rb +6 -0
  259. data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
  260. data/lib/active_merchant/network_connection_retries.rb +78 -0
  261. data/lib/active_merchant/post_data.rb +26 -0
  262. data/lib/active_merchant/posts_data.rb +92 -0
  263. data/lib/active_merchant/version.rb +1 -1
  264. data/lib/active_merchant.rb +14 -59
  265. data/lib/activemerchant.rb +1 -1
  266. data/lib/certs/cacert.pem +3214 -0
  267. data/lib/support/gateway_support.rb +8 -10
  268. data/lib/support/outbound_hosts.rb +13 -10
  269. data/lib/support/ssl_verify.rb +9 -14
  270. data/lib/support/ssl_version.rb +86 -0
  271. metadata +136 -94
  272. checksums.yaml.gz.sig +0 -1
  273. data/lib/active_merchant/billing/gateways/app55.rb +0 -176
  274. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  275. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  278. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  279. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  280. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
  281. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
  282. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  283. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  284. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  285. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
  286. data/lib/active_merchant/offsite_payments_shim.rb +0 -19
  287. data.tar.gz.sig +0 -0
  288. metadata.gz.sig +0 -0
@@ -3,97 +3,97 @@ module ActiveMerchant
3
3
  class PlugnpayGateway < Gateway
4
4
  class PlugnpayPostData < PostData
5
5
  # Fields that will be sent even if they are blank
6
- self.required_fields = [ :publisher_name, :publisher_password,
7
- :card_amount, :card_name, :card_number, :card_exp, :orderID ]
6
+ self.required_fields = %i[publisher_name publisher_password
7
+ card_amount card_name card_number card_exp orderID]
8
8
  end
9
9
  self.live_url = self.test_url = 'https://pay1.plugnpay.com/payment/pnpremote.cgi'
10
10
 
11
11
  CARD_CODE_MESSAGES = {
12
- "M" => "Card verification number matched",
13
- "N" => "Card verification number didn't match",
14
- "P" => "Card verification number was not processed",
15
- "S" => "Card verification number should be on card but was not indicated",
16
- "U" => "Issuer was not certified for card verification"
12
+ 'M' => 'Card verification number matched',
13
+ 'N' => "Card verification number didn't match",
14
+ 'P' => 'Card verification number was not processed',
15
+ 'S' => 'Card verification number should be on card but was not indicated',
16
+ 'U' => 'Issuer was not certified for card verification'
17
17
  }
18
18
 
19
- CARD_CODE_ERRORS = %w( N S )
19
+ CARD_CODE_ERRORS = %w(N S)
20
20
 
21
21
  AVS_MESSAGES = {
22
- "A" => "Street address matches billing information, zip/postal code does not",
23
- "B" => "Address information not provided for address verification check",
24
- "E" => "Address verification service error",
25
- "G" => "Non-U.S. card-issuing bank",
26
- "N" => "Neither street address nor zip/postal match billing information",
27
- "P" => "Address verification not applicable for this transaction",
28
- "R" => "Payment gateway was unavailable or timed out",
29
- "S" => "Address verification service not supported by issuer",
30
- "U" => "Address information is unavailable",
31
- "W" => "9-digit zip/postal code matches billing information, street address does not",
32
- "X" => "Street address and 9-digit zip/postal code matches billing information",
33
- "Y" => "Street address and 5-digit zip/postal code matches billing information",
34
- "Z" => "5-digit zip/postal code matches billing information, street address does not",
22
+ 'A' => 'Street address matches billing information, zip/postal code does not',
23
+ 'B' => 'Address information not provided for address verification check',
24
+ 'E' => 'Address verification service error',
25
+ 'G' => 'Non-U.S. card-issuing bank',
26
+ 'N' => 'Neither street address nor zip/postal match billing information',
27
+ 'P' => 'Address verification not applicable for this transaction',
28
+ 'R' => 'Payment gateway was unavailable or timed out',
29
+ 'S' => 'Address verification service not supported by issuer',
30
+ 'U' => 'Address information is unavailable',
31
+ 'W' => '9-digit zip/postal code matches billing information, street address does not',
32
+ 'X' => 'Street address and 9-digit zip/postal code matches billing information',
33
+ 'Y' => 'Street address and 5-digit zip/postal code matches billing information',
34
+ 'Z' => '5-digit zip/postal code matches billing information, street address does not'
35
35
  }
36
36
 
37
- AVS_ERRORS = %w( A E N R W Z )
37
+ AVS_ERRORS = %w(A E N R W Z)
38
38
 
39
39
  PAYMENT_GATEWAY_RESPONSES = {
40
- "P01" => "AVS Mismatch Failure",
41
- "P02" => "CVV2 Mismatch Failure",
42
- "P21" => "Transaction may not be marked",
43
- "P30" => "Test Tran. Bad Card",
44
- "P35" => "Test Tran. Problem",
45
- "P40" => "Username already exists",
46
- "P41" => "Username is blank",
47
- "P50" => "Fraud Screen Failure",
48
- "P51" => "Missing PIN Code",
49
- "P52" => "Invalid Bank Acct. No.",
50
- "P53" => "Invalid Bank Routing No.",
51
- "P54" => "Invalid/Missing Check No.",
52
- "P55" => "Invalid Credit Card No.",
53
- "P56" => "Invalid CVV2/CVC2 No.",
54
- "P57" => "Expired. CC Exp. Date",
55
- "P58" => "Missing Data",
56
- "P59" => "Missing Email Address",
57
- "P60" => "Zip Code does not match Billing State.",
58
- "P61" => "Invalid Billing Zip Code",
59
- "P62" => "Zip Code does not match Shipping State.",
60
- "P63" => "Invalid Shipping Zip Code",
61
- "P64" => "Invalid Credit Card CVV2/CVC2 Format.",
62
- "P65" => "Maximum number of attempts has been exceeded.",
63
- "P66" => "Credit Card number has been flagged and can not be used to access this service.",
64
- "P67" => "IP Address is on Blocked List.",
65
- "P68" => "Billing country does not match ipaddress country.",
66
- "P69" => "US based ipaddresses are currently blocked.",
67
- "P70" => "Credit Cards issued from this bank are currently not being accepted.",
68
- "P71" => "Credit Cards issued from this bank are currently not being accepted.",
69
- "P72" => "Daily volume exceeded.",
70
- "P73" => "Too many transactions within allotted time.",
71
- "P91" => "Missing/incorrect password",
72
- "P92" => "Account not configured for mobil administration",
73
- "P93" => "IP Not registered to username.",
74
- "P94" => "Mode not permitted for this account.",
75
- "P95" => "Currently Blank",
76
- "P96" => "Currently Blank",
77
- "P97" => "Processor not responding",
78
- "P98" => "Missing merchant/publisher name",
79
- "P99" => "Currently Blank"
40
+ 'P01' => 'AVS Mismatch Failure',
41
+ 'P02' => 'CVV2 Mismatch Failure',
42
+ 'P21' => 'Transaction may not be marked',
43
+ 'P30' => 'Test Tran. Bad Card',
44
+ 'P35' => 'Test Tran. Problem',
45
+ 'P40' => 'Username already exists',
46
+ 'P41' => 'Username is blank',
47
+ 'P50' => 'Fraud Screen Failure',
48
+ 'P51' => 'Missing PIN Code',
49
+ 'P52' => 'Invalid Bank Acct. No.',
50
+ 'P53' => 'Invalid Bank Routing No.',
51
+ 'P54' => 'Invalid/Missing Check No.',
52
+ 'P55' => 'Invalid Credit Card No.',
53
+ 'P56' => 'Invalid CVV2/CVC2 No.',
54
+ 'P57' => 'Expired. CC Exp. Date',
55
+ 'P58' => 'Missing Data',
56
+ 'P59' => 'Missing Email Address',
57
+ 'P60' => 'Zip Code does not match Billing State.',
58
+ 'P61' => 'Invalid Billing Zip Code',
59
+ 'P62' => 'Zip Code does not match Shipping State.',
60
+ 'P63' => 'Invalid Shipping Zip Code',
61
+ 'P64' => 'Invalid Credit Card CVV2/CVC2 Format.',
62
+ 'P65' => 'Maximum number of attempts has been exceeded.',
63
+ 'P66' => 'Credit Card number has been flagged and can not be used to access this service.',
64
+ 'P67' => 'IP Address is on Blocked List.',
65
+ 'P68' => 'Billing country does not match ipaddress country.',
66
+ 'P69' => 'US based ipaddresses are currently blocked.',
67
+ 'P70' => 'Credit Cards issued from this bank are currently not being accepted.',
68
+ 'P71' => 'Credit Cards issued from this bank are currently not being accepted.',
69
+ 'P72' => 'Daily volume exceeded.',
70
+ 'P73' => 'Too many transactions within allotted time.',
71
+ 'P91' => 'Missing/incorrect password',
72
+ 'P92' => 'Account not configured for mobil administration',
73
+ 'P93' => 'IP Not registered to username.',
74
+ 'P94' => 'Mode not permitted for this account.',
75
+ 'P95' => 'Currently Blank',
76
+ 'P96' => 'Currently Blank',
77
+ 'P97' => 'Processor not responding',
78
+ 'P98' => 'Missing merchant/publisher name',
79
+ 'P99' => 'Currently Blank'
80
80
  }
81
81
 
82
82
  TRANSACTIONS = {
83
- :authorization => 'auth',
84
- :purchase => 'auth',
85
- :capture => 'mark',
86
- :void => 'void',
87
- :refund => 'return',
88
- :credit => 'newreturn'
83
+ authorization: 'auth',
84
+ purchase: 'auth',
85
+ capture: 'mark',
86
+ void: 'void',
87
+ refund: 'return',
88
+ credit: 'newreturn'
89
89
  }
90
90
 
91
- SUCCESS_CODES = [ 'pending', 'success' ]
92
- FAILURE_CODES = [ 'badcard', 'fraud' ]
91
+ SUCCESS_CODES = %w[pending success]
92
+ FAILURE_CODES = %w[badcard fraud]
93
93
 
94
94
  self.default_currency = 'USD'
95
95
  self.supported_countries = ['US']
96
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
96
+ self.supported_cardtypes = %i[visa master american_express discover]
97
97
  self.homepage_url = 'http://www.plugnpay.com/'
98
98
  self.display_name = "Plug'n Pay"
99
99
 
@@ -172,23 +172,23 @@ module ActiveMerchant
172
172
  end
173
173
 
174
174
  private
175
+
175
176
  def commit(action, post)
176
- response = parse( ssl_post(self.live_url, post_data(action, post)) )
177
+ response = parse(ssl_post(self.live_url, post_data(action, post)))
177
178
  success = SUCCESS_CODES.include?(response[:finalstatus])
178
179
  message = success ? 'Success' : message_from(response)
179
180
 
180
181
  Response.new(success, message, response,
181
- :test => test?,
182
- :authorization => response[:orderid],
183
- :avs_result => { :code => response[:avs_code] },
184
- :cvv_result => response[:cvvresp]
185
- )
182
+ test: test?,
183
+ authorization: response[:orderid],
184
+ avs_result: { code: response[:avs_code] },
185
+ cvv_result: response[:cvvresp])
186
186
  end
187
187
 
188
188
  def parse(body)
189
189
  body = CGI.unescape(body)
190
190
  results = {}
191
- body.split('&').collect { |e| e.split('=') }.each do |key,value|
191
+ body.split('&').collect { |e| e.split('=') }.each do |key, value|
192
192
  results[key.downcase.to_sym] = normalize(value.to_s.strip)
193
193
  end
194
194
 
@@ -218,7 +218,7 @@ module ActiveMerchant
218
218
 
219
219
  def add_customer_data(post, options)
220
220
  post[:email] = options[:email]
221
- post[:dontsndmail] = 'yes' unless options[:send_email_confirmation]
221
+ post[:dontsndmail] = 'yes' unless options[:send_email_confirmation]
222
222
  post[:ipaddress] = options[:ip]
223
223
  end
224
224
 
@@ -255,7 +255,7 @@ module ActiveMerchant
255
255
  post[:state] = shipping_address[:state]
256
256
  else
257
257
  post[:state] = 'ZZ'
258
- post[:province] = shipping_address[:state]
258
+ post[:province] = shipping_address[:state]
259
259
  end
260
260
 
261
261
  post[:country] = shipping_address[:country]
@@ -273,8 +273,8 @@ module ActiveMerchant
273
273
  end
274
274
 
275
275
  def expdate(creditcard)
276
- year = sprintf("%.4i", creditcard.year)
277
- month = sprintf("%.2i", creditcard.month)
276
+ year = sprintf('%.4i', creditcard.year)
277
+ month = sprintf('%.2i', creditcard.month)
278
278
 
279
279
  "#{month}/#{year[-2..-1]}"
280
280
  end
@@ -0,0 +1,369 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class PriorityGateway < Gateway
4
+ # Sandbox and Production
5
+ self.test_url = 'https://sandbox.api.mxmerchant.com/checkout/v3/payment'
6
+ self.live_url = 'https://api.mxmerchant.com/checkout/v3/payment'
7
+
8
+ class_attribute :test_url_verify, :live_url_verify, :test_auth, :live_auth, :test_env_verify, :live_env_verify, :test_url_batch, :live_url_batch, :test_url_jwt, :live_url_jwt, :merchant
9
+
10
+ # Sandbox and Production - verify card
11
+ self.test_url_verify = 'https://sandbox-api2.mxmerchant.com/merchant/v1/bin'
12
+ self.live_url_verify = 'https://api2.mxmerchant.com/merchant/v1/bin'
13
+
14
+ # Sandbox and Production - check batch status
15
+ self.test_url_batch = 'https://sandbox.api.mxmerchant.com/checkout/v3/batch'
16
+ self.live_url_batch = 'https://api.mxmerchant.com/checkout/v3/batch'
17
+
18
+ # Sandbox and Production - generate jwt for verify card url
19
+ self.test_url_jwt = 'https://sandbox-api2.mxmerchant.com/security/v1/application/merchantId'
20
+ self.live_url_jwt = 'https://api2.mxmerchant.com/security/v1/application/merchantId'
21
+
22
+ self.supported_countries = ['US']
23
+ self.default_currency = 'USD'
24
+ self.supported_cardtypes = %i[visa master american_express discover]
25
+
26
+ self.homepage_url = 'https://mxmerchant.com/'
27
+ self.display_name = 'Priority'
28
+
29
+ def initialize(options = {})
30
+ requires!(options, :merchant_id, :key, :secret)
31
+ super
32
+ end
33
+
34
+ def basic_auth
35
+ Base64.strict_encode64("#{@options[:key]}:#{@options[:secret]}")
36
+ end
37
+
38
+ def request_headers
39
+ {
40
+ 'Content-Type' => 'application/json',
41
+ 'Authorization' => "Basic #{basic_auth}"
42
+ }
43
+ end
44
+
45
+ def request_verify_headers(jwt)
46
+ {
47
+ 'Authorization' => "Bearer #{jwt}"
48
+ }
49
+ end
50
+
51
+ def purchase(amount, credit_card, options = {})
52
+ params = {}
53
+ params['authOnly'] = false
54
+ params['isSettleFunds'] = true
55
+
56
+ add_merchant_id(params)
57
+ add_amount(params, amount, options)
58
+ add_auth_purchase_params(params, credit_card, options)
59
+
60
+ commit('purchase', params: params)
61
+ end
62
+
63
+ def authorize(amount, credit_card, options = {})
64
+ params = {}
65
+ params['authOnly'] = true
66
+ params['isSettleFunds'] = false
67
+
68
+ add_merchant_id(params)
69
+ add_amount(params, amount, options)
70
+ add_auth_purchase_params(params, credit_card, options)
71
+
72
+ commit('purchase', params: params)
73
+ end
74
+
75
+ def refund(amount, authorization, options = {})
76
+ params = {}
77
+ add_merchant_id(params)
78
+ params['paymentToken'] = payment_token(authorization) || options[:payment_token]
79
+
80
+ # refund amounts must be negative
81
+ params['amount'] = ('-' + localized_amount(amount.to_f, options[:currency])).to_f
82
+
83
+ commit('refund', params: params)
84
+ end
85
+
86
+ def capture(amount, authorization, options = {})
87
+ params = {}
88
+ add_merchant_id(params)
89
+ add_amount(params, amount, options)
90
+ params['paymentToken'] = payment_token(authorization) || options[:payment_token]
91
+ params['tenderType'] = options[:tender_type].present? ? options[:tender_type] : 'Card'
92
+
93
+ commit('capture', params: params)
94
+ end
95
+
96
+ def void(authorization, options = {})
97
+ params = {}
98
+
99
+ commit('void', params: params, iid: payment_id(authorization))
100
+ end
101
+
102
+ def verify(credit_card, _options = {})
103
+ jwt = create_jwt.params['jwtToken']
104
+
105
+ commit('verify', card_number: credit_card.number, jwt: jwt)
106
+ end
107
+
108
+ def get_payment_status(batch_id)
109
+ commit('get_payment_status', params: batch_id)
110
+ end
111
+
112
+ def close_batch(batch_id)
113
+ commit('close_batch', params: batch_id)
114
+ end
115
+
116
+ def create_jwt
117
+ commit('create_jwt', params: @options[:merchant_id])
118
+ end
119
+
120
+ def supports_scrubbing?
121
+ true
122
+ end
123
+
124
+ def scrub(transcript)
125
+ transcript.
126
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
127
+ gsub(%r((number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
128
+ gsub(%r((cvv\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
129
+ end
130
+
131
+ private
132
+
133
+ def add_amount(params, amount, options)
134
+ params['amount'] = localized_amount(amount.to_f, options[:currency])
135
+ end
136
+
137
+ def add_merchant_id(params)
138
+ params['merchantId'] = @options[:merchant_id]
139
+ end
140
+
141
+ def add_auth_purchase_params(params, credit_card, options)
142
+ add_replay_id(params, options)
143
+ add_credit_card(params, credit_card, 'purchase', options)
144
+ add_purchases_data(params, options)
145
+ add_shipping_data(params, options)
146
+ add_pos_data(params, options)
147
+ add_additional_data(params, options)
148
+ end
149
+
150
+ def add_replay_id(params, options)
151
+ params['replayId'] = options[:replay_id] if options[:replay_id]
152
+ end
153
+
154
+ def add_credit_card(params, credit_card, action, options)
155
+ return unless credit_card&.is_a?(CreditCard)
156
+
157
+ card_details = {}
158
+ card_details['expiryMonth'] = format(credit_card.month, :two_digits).to_s
159
+ card_details['expiryYear'] = format(credit_card.year, :two_digits).to_s
160
+ card_details['expiryDate'] = exp_date(credit_card)
161
+ card_details['cardType'] = credit_card.brand
162
+ card_details['last4'] = credit_card.last_digits
163
+ card_details['cvv'] = credit_card.verification_value
164
+ card_details['number'] = credit_card.number
165
+ card_details['avsStreet'] = options[:billing_address][:address1] if options[:billing_address]
166
+ card_details['avsZip'] = options[:billing_address][:zip] if options[:billing_address]
167
+
168
+ params['cardAccount'] = card_details
169
+ end
170
+
171
+ def exp_date(credit_card)
172
+ "#{format(credit_card.month, :two_digits)}/#{format(credit_card.year, :two_digits)}"
173
+ end
174
+
175
+ def add_additional_data(params, options)
176
+ params['isAuth'] = options[:is_auth].present? ? options[:is_auth] : 'true'
177
+ params['paymentType'] = options[:payment_type].present? ? options[:payment_type] : 'Sale'
178
+ params['tenderType'] = options[:tender_type].present? ? options[:tender_type] : 'Card'
179
+ params['taxExempt'] = options[:tax_exempt].present? ? options[:tax_exempt] : 'false'
180
+ params['taxAmount'] = options[:tax_amount] if options[:tax_amount]
181
+ params['shouldGetCreditCardLevel'] = options[:should_get_credit_card_level] if options[:should_get_credit_card_level]
182
+ params['source'] = options[:source] if options[:source]
183
+ params['invoice'] = options[:invoice] if options[:invoice]
184
+ end
185
+
186
+ def add_pos_data(params, options)
187
+ pos_data = {}
188
+
189
+ pos_data['cardholderPresence'] = options.dig(:pos_data, :cardholder_presence) || 'Ecom'
190
+ pos_data['deviceAttendance'] = options.dig(:pos_data, :device_attendance) || 'HomePc'
191
+ pos_data['deviceInputCapability'] = options.dig(:pos_data, :device_input_capability) || 'Unknown'
192
+ pos_data['deviceLocation'] = options.dig(:pos_data, :device_location) || 'HomePc'
193
+ pos_data['panCaptureMethod'] = options.dig(:pos_data, :pan_capture_method) || 'Manual'
194
+ pos_data['partialApprovalSupport'] = options.dig(:pos_data, :partial_approval_support) || 'NotSupported'
195
+ pos_data['pinCaptureCapability'] = options.dig(:pos_data, :pin_capture_capability) || 'Incapable'
196
+
197
+ params['posData'] = pos_data
198
+ end
199
+
200
+ def add_purchases_data(params, options)
201
+ return unless options[:purchases]
202
+
203
+ params['purchases'] = []
204
+
205
+ options[:purchases].each do |purchase|
206
+ purchase_object = {}
207
+
208
+ purchase_object['name'] = purchase[:name] if purchase[:name]
209
+ purchase_object['description'] = purchase[:description] if purchase[:description]
210
+ purchase_object['code'] = purchase[:code] if purchase[:code]
211
+ purchase_object['unitOfMeasure'] = purchase[:unit_of_measure] if purchase[:unit_of_measure]
212
+ purchase_object['unitPrice'] = purchase[:unit_price] if purchase[:unit_price]
213
+ purchase_object['quantity'] = purchase[:quantity] if purchase[:quantity]
214
+ purchase_object['taxRate'] = purchase[:tax_rate] if purchase[:tax_rate]
215
+ purchase_object['taxAmount'] = purchase[:tax_amount] if purchase[:tax_amount]
216
+ purchase_object['discountRate'] = purchase[:discount_rate] if purchase[:discount_rate]
217
+ purchase_object['discountAmount'] = purchase[:discount_amount] if purchase[:discount_amount]
218
+ purchase_object['extendedAmount'] = purchase[:extended_amount] if purchase[:extended_amount]
219
+ purchase_object['lineItemId'] = purchase[:line_item_id] if purchase[:line_item_id]
220
+
221
+ params['purchases'].append(purchase_object)
222
+ end
223
+ end
224
+
225
+ def add_shipping_data(params, options)
226
+ params['shipAmount'] = options[:ship_amount] if options[:ship_amount]
227
+
228
+ shipping_country = shipping_country_from(options)
229
+ params['shipToCountry'] = shipping_country if shipping_country
230
+
231
+ shipping_zip = shipping_zip_from(options)
232
+ params['shipToZip'] = shipping_zip if shipping_zip
233
+ end
234
+
235
+ def shipping_country_from(options)
236
+ options[:ship_to_country] || options.dig(:shipping_address, :country) || options.dig(:billing_address, :country)
237
+ end
238
+
239
+ def shipping_zip_from(options)
240
+ options[:ship_to_zip] || options.dig(:shipping_addres, :zip) || options.dig(:billing_address, :zip)
241
+ end
242
+
243
+ def payment_token(authorization)
244
+ return unless authorization
245
+ return authorization unless authorization.include?('|')
246
+
247
+ authorization.split('|').last
248
+ end
249
+
250
+ def payment_id(authorization)
251
+ return unless authorization
252
+ return authorization unless authorization.include?('|')
253
+
254
+ authorization.split('|').first
255
+ end
256
+
257
+ def commit(action, params: '', iid: '', card_number: nil, jwt: '')
258
+ response =
259
+ begin
260
+ case action
261
+ when 'void'
262
+ parse(ssl_request(:delete, url(action, params, ref_number: iid), nil, request_headers))
263
+ when 'verify'
264
+ parse(ssl_get(url(action, params, credit_card_number: card_number), request_verify_headers(jwt)))
265
+ when 'get_payment_status', 'create_jwt'
266
+ parse(ssl_get(url(action, params, ref_number: iid), request_headers))
267
+ when 'close_batch'
268
+ parse(ssl_request(:put, url(action, params, ref_number: iid), nil, request_headers))
269
+ else
270
+ parse(ssl_post(url(action, params), post_data(params), request_headers))
271
+ end
272
+ rescue ResponseError => e
273
+ # currently Priority returns a 404 with no body on certain calls. In those cases we will substitute the response status from response.message
274
+ gateway_response = e.response.body.presence || e.response.message
275
+ parse(gateway_response)
276
+ end
277
+
278
+ success = success_from(response, action)
279
+ Response.new(
280
+ success,
281
+ message_from(response),
282
+ response,
283
+ authorization: success ? authorization_from(response) : nil,
284
+ error_code: success || response == '' ? nil : error_from(response),
285
+ test: test?
286
+ )
287
+ end
288
+
289
+ def url(action, params, ref_number: '', credit_card_number: nil)
290
+ case action
291
+ when 'void'
292
+ base_url + "/#{ref_number}?force=true"
293
+ when 'verify'
294
+ (verify_url + '?search=') + credit_card_number.to_s[0..6]
295
+ when 'get_payment_status', 'close_batch'
296
+ batch_url + "/#{params}"
297
+ when 'create_jwt'
298
+ jwt_url + "/#{params}/token"
299
+ else
300
+ base_url + '?includeCustomerMatches=false&echo=true'
301
+ end
302
+ end
303
+
304
+ def base_url
305
+ test? ? test_url : live_url
306
+ end
307
+
308
+ def verify_url
309
+ test? ? self.test_url_verify : self.live_url_verify
310
+ end
311
+
312
+ def jwt_url
313
+ test? ? self.test_url_jwt : self.live_url_jwt
314
+ end
315
+
316
+ def batch_url
317
+ test? ? self.test_url_batch : self.live_url_batch
318
+ end
319
+
320
+ def handle_response(response)
321
+ case response.code.to_i
322
+ when 204
323
+ { status: 'Success' }.to_json
324
+ when 200...300
325
+ response.body
326
+ else
327
+ raise ResponseError.new(response)
328
+ end
329
+ end
330
+
331
+ def parse(body)
332
+ return {} if body.blank?
333
+
334
+ parsed_response = JSON.parse(body)
335
+ parsed_response.is_a?(String) ? { 'message' => parsed_response } : parsed_response
336
+ rescue JSON::ParserError
337
+ message = 'Invalid JSON response received from Priority Gateway. Please contact Priority Gateway if you continue to receive this message.'
338
+ message += " (The raw response returned by the API was #{body.inspect})"
339
+ {
340
+ 'message' => message
341
+ }
342
+ end
343
+
344
+ def success_from(response, action)
345
+ return !response['bank'].empty? if action == 'verify' && response['bank']
346
+
347
+ %w[Approved Open Success Settled Voided].include?(response['status'])
348
+ end
349
+
350
+ def message_from(response)
351
+ return response['details'][0] if response['details'] && response['details'][0]
352
+
353
+ response['authMessage'] || response['message'] || response['status']
354
+ end
355
+
356
+ def authorization_from(response)
357
+ [response['id'], response['paymentToken']].join('|')
358
+ end
359
+
360
+ def error_from(response)
361
+ response['errorCode'] || response['status']
362
+ end
363
+
364
+ def post_data(params)
365
+ params.to_json
366
+ end
367
+ end
368
+ end
369
+ end