activemerchant 1.38.0 → 1.78.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (397) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +1344 -3
  3. data/CONTRIBUTORS +154 -0
  4. data/README.md +157 -144
  5. data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
  6. data/lib/active_merchant/billing/base.rb +21 -17
  7. data/lib/active_merchant/billing/check.rb +32 -22
  8. data/lib/active_merchant/billing/compatibility.rb +120 -0
  9. data/lib/active_merchant/billing/credit_card.rb +215 -67
  10. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
  11. data/lib/active_merchant/billing/credit_card_methods.rb +149 -52
  12. data/lib/active_merchant/billing/cvv_result.rb +15 -15
  13. data/lib/active_merchant/billing/gateway.rb +170 -24
  14. data/lib/active_merchant/billing/gateways/adyen.rb +284 -0
  15. data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +899 -606
  17. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
  18. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
  19. data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
  20. data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
  21. data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
  22. data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
  23. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +325 -0
  24. data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
  25. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
  26. data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
  27. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
  28. data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
  29. data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
  30. data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
  31. data/lib/active_merchant/billing/gateways/borgun.rb +222 -0
  32. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  33. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +14 -2
  34. data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/braintree_blue.rb +372 -137
  36. data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
  37. data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
  38. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  39. data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
  40. data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
  41. data/lib/active_merchant/billing/gateways/cardknox.rb +328 -0
  42. data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
  43. data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
  44. data/lib/active_merchant/billing/gateways/cc5.rb +45 -0
  45. data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
  46. data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
  47. data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
  48. data/lib/active_merchant/billing/gateways/checkout_v2.rb +226 -0
  49. data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
  50. data/lib/active_merchant/billing/gateways/clearhaus.rb +222 -0
  51. data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
  52. data/lib/active_merchant/billing/gateways/conekta.rb +224 -0
  53. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  54. data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
  55. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  56. data/lib/active_merchant/billing/gateways/cyber_source.rb +228 -98
  57. data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
  58. data/lib/active_merchant/billing/gateways/dibs.rb +205 -0
  59. data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
  60. data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
  61. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -14
  62. data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
  63. data/lib/active_merchant/billing/gateways/element.rb +356 -0
  64. data/lib/active_merchant/billing/gateways/epay.rb +23 -12
  65. data/lib/active_merchant/billing/gateways/eway.rb +12 -12
  66. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
  68. data/lib/active_merchant/billing/gateways/exact.rb +10 -1
  69. data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
  70. data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
  71. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
  72. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
  73. data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
  74. data/lib/active_merchant/billing/gateways/first_pay.rb +109 -124
  75. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
  76. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  77. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  78. data/lib/active_merchant/billing/gateways/forte.rb +256 -0
  79. data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
  80. data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
  81. data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
  82. data/lib/active_merchant/billing/gateways/hps.rb +305 -0
  83. data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
  84. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +2 -5
  85. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
  86. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  88. data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
  89. data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
  90. data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
  91. data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
  92. data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
  93. data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
  94. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
  95. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  96. data/lib/active_merchant/billing/gateways/kushki.rb +227 -0
  97. data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
  98. data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
  99. data/lib/active_merchant/billing/gateways/litle.rb +329 -439
  100. data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
  101. data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
  102. data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
  103. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -7
  104. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  105. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  106. data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
  107. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
  108. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -14
  109. data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
  110. data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
  111. data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
  112. data/lib/active_merchant/billing/gateways/migs.rb +74 -13
  113. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  114. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
  115. data/lib/active_merchant/billing/gateways/monei.rb +307 -0
  116. data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
  117. data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
  118. data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
  119. data/lib/active_merchant/billing/gateways/nab_transact.rb +78 -53
  120. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
  121. data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
  122. data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
  123. data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
  124. data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
  125. data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
  126. data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
  127. data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
  128. data/lib/active_merchant/billing/gateways/omise.rb +324 -0
  129. data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
  130. data/lib/active_merchant/billing/gateways/opp.rb +372 -0
  131. data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
  132. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
  133. data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
  134. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
  135. data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
  136. data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
  137. data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
  138. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
  139. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  140. data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
  141. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
  142. data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
  143. data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
  144. data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
  145. data/lib/active_merchant/billing/gateways/payex.rb +412 -0
  146. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
  147. data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
  148. data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
  149. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
  150. data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
  151. data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
  152. data/lib/active_merchant/billing/gateways/paymentez.rb +283 -0
  153. data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
  154. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +41 -8
  155. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  156. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
  157. data/lib/active_merchant/billing/gateways/paypal.rb +49 -20
  158. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  159. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
  160. data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
  161. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/payscout.rb +162 -0
  163. data/lib/active_merchant/billing/gateways/paystation.rb +22 -24
  164. data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
  165. data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
  166. data/lib/active_merchant/billing/gateways/pin.rb +68 -13
  167. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
  168. data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
  169. data/lib/active_merchant/billing/gateways/psigate.rb +3 -14
  170. data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
  171. data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
  172. data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
  173. data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
  174. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
  175. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
  176. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
  177. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
  178. data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
  179. data/lib/active_merchant/billing/gateways/realex.rb +27 -25
  180. data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
  181. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  182. data/lib/active_merchant/billing/gateways/safe_charge.rb +258 -0
  183. data/lib/active_merchant/billing/gateways/sage.rb +412 -119
  184. data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
  185. data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
  186. data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
  187. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
  188. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
  189. data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
  190. data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
  191. data/lib/active_merchant/billing/gateways/smart_ps.rb +13 -2
  192. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
  193. data/lib/active_merchant/billing/gateways/spreedly_core.rb +36 -11
  194. data/lib/active_merchant/billing/gateways/stripe.rb +461 -82
  195. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
  196. data/lib/active_merchant/billing/gateways/telr.rb +275 -0
  197. data/lib/active_merchant/billing/gateways/tns.rb +22 -0
  198. data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
  199. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
  200. data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
  201. data/lib/active_merchant/billing/gateways/transnational.rb +2 -231
  202. data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
  203. data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
  204. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
  205. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +150 -63
  206. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  207. data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
  208. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
  209. data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
  210. data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
  211. data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
  212. data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
  213. data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
  214. data/lib/active_merchant/billing/gateways/worldpay.rb +131 -36
  215. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -0
  216. data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
  217. data/lib/active_merchant/billing/gateways.rb +8 -11
  218. data/lib/active_merchant/billing/model.rb +30 -0
  219. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  220. data/lib/active_merchant/billing/payment_token.rb +21 -0
  221. data/lib/active_merchant/billing/rails.rb +3 -0
  222. data/lib/active_merchant/billing/response.rb +24 -17
  223. data/lib/active_merchant/billing.rb +7 -1
  224. data/lib/active_merchant/connection.rb +177 -0
  225. data/lib/active_merchant/country.rb +334 -0
  226. data/lib/active_merchant/empty.rb +20 -0
  227. data/lib/active_merchant/errors.rb +35 -0
  228. data/lib/active_merchant/network_connection_retries.rb +79 -0
  229. data/lib/active_merchant/post_data.rb +24 -0
  230. data/lib/active_merchant/posts_data.rb +84 -0
  231. data/lib/active_merchant/version.rb +1 -1
  232. data/lib/active_merchant.rb +24 -21
  233. data/lib/certs/cacert.pem +3951 -0
  234. data/lib/support/gateway_support.rb +16 -10
  235. data/lib/support/outbound_hosts.rb +13 -10
  236. metadata +161 -306
  237. data/gem-public_cert.pem +0 -20
  238. data/lib/active_merchant/billing/expiry_date.rb +0 -34
  239. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  240. data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
  241. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
  242. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
  243. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
  244. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  245. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  246. data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
  247. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
  248. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
  249. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
  250. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
  251. data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
  252. data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -73
  253. data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
  254. data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
  255. data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
  256. data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
  257. data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
  258. data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
  259. data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
  260. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
  261. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
  262. data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
  263. data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
  264. data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
  265. data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
  266. data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
  267. data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
  268. data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
  269. data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
  270. data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
  271. data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
  272. data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
  273. data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
  274. data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
  275. data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
  276. data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
  277. data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
  278. data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
  279. data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
  280. data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
  281. data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
  282. data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
  283. data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
  284. data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
  285. data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
  286. data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
  287. data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
  288. data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
  289. data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
  290. data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
  291. data/lib/active_merchant/billing/integrations/epay.rb +0 -21
  292. data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
  293. data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
  294. data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
  295. data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
  296. data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
  297. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
  298. data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
  299. data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
  300. data/lib/active_merchant/billing/integrations/helper.rb +0 -117
  301. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
  302. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
  303. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
  304. data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
  305. data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -114
  306. data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
  307. data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
  308. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
  309. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
  310. data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
  311. data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
  312. data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
  313. data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
  314. data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
  315. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
  316. data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -129
  317. data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
  318. data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
  319. data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
  320. data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
  321. data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
  322. data/lib/active_merchant/billing/integrations/notification.rb +0 -71
  323. data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
  324. data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
  325. data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
  326. data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
  327. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
  328. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
  329. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
  330. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
  331. data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
  332. data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
  333. data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
  334. data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
  335. data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
  336. data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
  337. data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
  338. data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
  339. data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
  340. data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
  341. data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
  342. data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -28
  343. data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
  344. data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
  345. data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
  346. data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
  347. data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
  348. data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
  349. data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
  350. data/lib/active_merchant/billing/integrations/platron.rb +0 -28
  351. data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
  352. data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
  353. data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
  354. data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
  355. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -74
  356. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
  357. data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
  358. data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
  359. data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
  360. data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
  361. data/lib/active_merchant/billing/integrations/return.rb +0 -42
  362. data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
  363. data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
  364. data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
  365. data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
  366. data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
  367. data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
  368. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
  369. data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
  370. data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
  371. data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
  372. data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -91
  373. data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
  374. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
  375. data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
  376. data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
  377. data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
  378. data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
  379. data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
  380. data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
  381. data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
  382. data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
  383. data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
  384. data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
  385. data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
  386. data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
  387. data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
  388. data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
  389. data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
  390. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
  391. data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
  392. data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
  393. data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
  394. data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
  395. data/lib/active_merchant/billing/integrations.rb +0 -17
  396. data.tar.gz.sig +0 -0
  397. metadata.gz.sig +0 -0
@@ -0,0 +1,227 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class KushkiGateway < Gateway
4
+ self.display_name = "Kushki"
5
+ self.homepage_url = "https://www.kushkipagos.com"
6
+
7
+ self.test_url = "https://api-uat.kushkipagos.com/v1/"
8
+ self.live_url = "https://api.kushkipagos.com/v1/"
9
+
10
+ self.supported_countries = ["CO", "EC"]
11
+ self.default_currency = "USD"
12
+ self.money_format = :dollars
13
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
14
+
15
+ def initialize(options={})
16
+ requires!(options, :public_merchant_id, :private_merchant_id)
17
+ super
18
+ end
19
+
20
+ def purchase(amount, payment_method, options={})
21
+ MultiResponse.run() do |r|
22
+ r.process { tokenize(amount, payment_method, options) }
23
+ r.process { charge(amount, r.authorization, options) }
24
+ end
25
+ end
26
+
27
+ def refund(amount, authorization, options={})
28
+ action = "refund"
29
+
30
+ post = {}
31
+ post[:ticketNumber] = authorization
32
+
33
+ commit(action, post)
34
+ end
35
+
36
+ def void(authorization, options={})
37
+ action = "void"
38
+
39
+ post = {}
40
+ post[:ticketNumber] = authorization
41
+
42
+ commit(action, post)
43
+ end
44
+
45
+ def supports_scrubbing?
46
+ true
47
+ end
48
+
49
+ def scrub(transcript)
50
+ transcript.
51
+ gsub(%r((Private-Merchant-Id: )\d+), '\1[FILTERED]').
52
+ gsub(%r((\"card\\\":{\\\"number\\\":\\\")\d+), '\1[FILTERED]').
53
+ gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
54
+ end
55
+
56
+ private
57
+
58
+ def tokenize(amount, payment_method, options)
59
+ action = "tokenize"
60
+
61
+ post = {}
62
+ add_invoice(action, post, amount, options)
63
+ add_payment_method(post, payment_method, options)
64
+
65
+ commit(action, post)
66
+ end
67
+
68
+ def charge(amount, authorization, options)
69
+ action = "charge"
70
+
71
+ post = {}
72
+ add_reference(post, authorization, options)
73
+ add_invoice(action, post, amount, options)
74
+
75
+ commit(action, post)
76
+ end
77
+
78
+ def add_invoice(action, post, money, options)
79
+ if action == "tokenize"
80
+ post[:totalAmount] = amount(money).to_f
81
+ post[:currency] = options[:currency] || currency(money)
82
+ post[:isDeferred] = false
83
+ else
84
+ sum = {}
85
+ sum[:currency] = options[:currency] || currency(money)
86
+ add_amount_defaults(sum, money, options)
87
+ add_amount_by_country(sum, options)
88
+ post[:amount] = sum
89
+ end
90
+ end
91
+
92
+ def add_amount_defaults(sum, money, options)
93
+ sum[:subtotalIva] = amount(money).to_f
94
+ sum[:iva] = 0
95
+ sum[:subtotalIva0] = 0
96
+
97
+ if sum[:currency] == "COP"
98
+ extra_taxes = {}
99
+ extra_taxes[:propina] = 0
100
+ extra_taxes[:tasaAeroportuaria] = 0
101
+ extra_taxes[:agenciaDeViaje] = 0
102
+ extra_taxes[:iac] = 0
103
+ sum[:extraTaxes] = extra_taxes
104
+ else
105
+ sum[:ice] = 0
106
+ end
107
+ end
108
+
109
+ def add_amount_by_country(sum, options)
110
+ if amount = options[:amount]
111
+ sum[:subtotalIva] = amount[:subtotal_iva].to_f if amount[:subtotal_iva]
112
+ sum[:iva] = amount[:iva].to_f if amount[:iva]
113
+ sum[:subtotalIva0] = amount[:subtotal_iva_0].to_f if amount[:subtotal_iva_0]
114
+ sum[:ice] = amount[:ice].to_f if amount[:ice]
115
+ if extra_taxes = amount[:extra_taxes] && sum[:currency] == "COP"
116
+ sum[:extraTaxes][:propina] = extra_taxes[:propina].to_f if extra_taxes[:propina]
117
+ sum[:extraTaxes][:tasaAeroportuaria] = extra_taxes[:tasa_aeroportuaria].to_f if extra_taxes[:tasa_aeroportuaria]
118
+ sum[:extraTaxes][:agenciaDeViaje] = extra_taxes[:agencia_de_viaje].to_f if extra_taxes[:agencia_de_viaje]
119
+ sum[:extraTaxes][:iac] = extra_taxes[:iac].to_f if extra_taxes[:iac]
120
+ end
121
+ end
122
+ end
123
+
124
+ def add_payment_method(post, payment_method, options)
125
+ card = {}
126
+ card[:number] = payment_method.number
127
+ card[:cvv] = payment_method.verification_value
128
+ card[:expiryMonth] = format(payment_method.month, :two_digits)
129
+ card[:expiryYear] = format(payment_method.year, :two_digits)
130
+ card[:name] = payment_method.name
131
+ post[:card] = card
132
+ end
133
+
134
+ def add_reference(post, authorization, options)
135
+ post[:token] = authorization
136
+ end
137
+
138
+ ENDPOINT = {
139
+ "tokenize" => "tokens",
140
+ "charge" => "charges",
141
+ "void" => "charges",
142
+ "refund" => "refund"
143
+ }
144
+
145
+ def commit(action, params)
146
+ response = begin
147
+ parse(ssl_invoke(action, params))
148
+ rescue ResponseError => e
149
+ parse(e.response.body)
150
+ end
151
+
152
+ success = success_from(response)
153
+
154
+ Response.new(
155
+ success,
156
+ message_from(success, response),
157
+ response,
158
+ authorization: success ? authorization_from(response) : nil,
159
+ error_code: success ? nil : error_from(response),
160
+ test: test?
161
+ )
162
+ end
163
+
164
+ def ssl_invoke(action, params)
165
+ if ["void", "refund"].include?(action)
166
+ ssl_request(:delete, url(action, params), nil, headers(action))
167
+ else
168
+ ssl_post(url(action, params), post_data(params), headers(action))
169
+ end
170
+ end
171
+
172
+ def headers(action)
173
+ hfields = {}
174
+ hfields["Public-Merchant-Id"] = @options[:public_merchant_id] if action == "tokenize"
175
+ hfields["Private-Merchant-Id"] = @options[:private_merchant_id] unless action == "tokenize"
176
+ hfields["Content-Type"] = "application/json"
177
+ hfields
178
+ end
179
+
180
+ def post_data(params)
181
+ params.to_json
182
+ end
183
+
184
+ def url(action, params)
185
+ base_url = test? ? test_url : live_url
186
+
187
+ if ["void", "refund"].include?(action)
188
+ base_url + ENDPOINT[action] + "/" + params[:ticketNumber].to_s
189
+ else
190
+ base_url + ENDPOINT[action]
191
+ end
192
+ end
193
+
194
+ def parse(body)
195
+ begin
196
+ JSON.parse(body)
197
+ rescue JSON::ParserError
198
+ message = "Invalid JSON response received from KushkiGateway. Please contact KushkiGateway if you continue to receive this message."
199
+ message += " (The raw response returned by the API was #{body.inspect})"
200
+ {
201
+ "message" => message
202
+ }
203
+ end
204
+ end
205
+
206
+ def success_from(response)
207
+ return true if response["token"] || response["ticketNumber"] || response["code"] == "K000"
208
+ end
209
+
210
+ def message_from(succeeded, response)
211
+ if succeeded
212
+ "Succeeded"
213
+ else
214
+ response["message"]
215
+ end
216
+ end
217
+
218
+ def authorization_from(response)
219
+ response["token"] || response["ticketNumber"]
220
+ end
221
+
222
+ def error_from(response)
223
+ response["code"]
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,416 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class Latitude19Gateway < Gateway
4
+ self.display_name = "Latitude19 Gateway"
5
+ self.homepage_url = "http://www.l19tech.com"
6
+
7
+ self.live_url = "https://gateway.l19tech.com/payments/"
8
+ self.test_url = "https://gateway-sb.l19tech.com/payments/"
9
+
10
+ self.supported_countries = ["US", "CA"]
11
+ self.default_currency = "USD"
12
+ self.money_format = :cents
13
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
14
+
15
+ RESPONSE_CODE_MAPPING = {
16
+ '100' => 'Approved',
17
+ '101' => 'Local duplicate detected',
18
+ '102' => 'Accepted local capture with no match',
19
+ '103' => 'Auth succeeded but capture failed',
20
+ '104' => 'Auth succeeded but failed to save info',
21
+ '200' => STANDARD_ERROR_CODE[:card_declined],
22
+ '300' => 'Processor reject',
23
+ '301' => 'Local reject on user/password',
24
+ '302' => 'Local reject',
25
+ '303' => 'Processor unknown response',
26
+ '304' => 'Error parsing processor response',
27
+ '305' => 'Processor auth succeeded but settle failed',
28
+ '306' => 'Processor auth succeeded settle status unknown',
29
+ '307' => 'Processor settle status unknown',
30
+ '308' => 'Processor duplicate',
31
+ '400' => 'Not submitted',
32
+ '401' => 'Terminated before request submitted',
33
+ '402' => 'Local server busy',
34
+ '500' => 'Submitted not returned',
35
+ '501' => 'Terminated before response returned',
36
+ '502' => 'Processor returned timeout status',
37
+ '600' => 'Failed local capture with no match',
38
+ '601' => 'Failed local capture',
39
+ '700' => 'Failed local void (not in capture file)',
40
+ '701' => 'Failed local void',
41
+ '800' => 'Failed local refund (not authorized)',
42
+ '801' => 'Failed local refund'
43
+ }
44
+
45
+ BRAND_MAP = {
46
+ "master" => "MC",
47
+ "visa" => "VI",
48
+ "american_express" => "AX",
49
+ "discover" => "DS",
50
+ "diners_club" => "DC",
51
+ "jcb" => "JC"
52
+ }
53
+
54
+ def initialize(options={})
55
+ requires!(options, :account_number, :configuration_id, :secret)
56
+ super
57
+ end
58
+
59
+ def purchase(amount, payment_method, options={})
60
+ if payment_method.is_a?(String)
61
+ auth_or_sale("sale", payment_method, amount, nil, options)
62
+ else
63
+ MultiResponse.run() do |r|
64
+ r.process { get_session(options) }
65
+ r.process { get_token(r.authorization, payment_method, options) }
66
+ r.process { auth_or_sale("sale", r.authorization, amount, payment_method, options) }
67
+ end
68
+ end
69
+ end
70
+
71
+ def authorize(amount, payment_method, options={})
72
+ if payment_method.is_a?(String)
73
+ auth_or_sale("auth", payment_method, amount, nil, options)
74
+ else
75
+ MultiResponse.run() do |r|
76
+ r.process { get_session(options) }
77
+ r.process { get_token(r.authorization, payment_method, options) }
78
+ r.process { auth_or_sale("auth", r.authorization, amount, payment_method, options) }
79
+ end
80
+ end
81
+ end
82
+
83
+ def capture(amount, authorization, options={})
84
+ post = {}
85
+ post[:method] = "deposit"
86
+ add_request_id(post)
87
+
88
+ params = {}
89
+
90
+ _, params[:pgwTID] = split_authorization(authorization)
91
+
92
+ add_invoice(params, amount, options)
93
+ add_credentials(params, post[:method])
94
+
95
+ post[:params] = [params]
96
+ commit("v1/", post)
97
+ end
98
+
99
+ def void(authorization, options={})
100
+ method, pgwTID = split_authorization(authorization)
101
+ case method
102
+ when "auth"
103
+ reverse_or_void("reversal", pgwTID, options)
104
+ when "deposit", "sale"
105
+ reverse_or_void("void", pgwTID, options)
106
+ else
107
+ message = "Unsupported operation: successful Purchase, Authorize and unsettled Capture transactions can only be voided."
108
+ return Response.new(false, message)
109
+ end
110
+ end
111
+
112
+ def credit(amount, payment_method, options={})
113
+ if payment_method.is_a?(String)
114
+ refundWithCard(payment_method, amount, nil, options)
115
+ else
116
+ MultiResponse.run() do |r|
117
+ r.process { get_session(options) }
118
+ r.process { get_token(r.authorization, payment_method, options) }
119
+ r.process { refundWithCard(r.authorization, amount, payment_method, options) }
120
+ end
121
+ end
122
+ end
123
+
124
+ def verify(payment_method, options={}, action=nil)
125
+ if payment_method.is_a?(String)
126
+ verifyOnly(action, payment_method, nil, options)
127
+ else
128
+ MultiResponse.run() do |r|
129
+ r.process { get_session(options) }
130
+ r.process { get_token(r.authorization, payment_method, options) }
131
+ r.process { verifyOnly(action, r.authorization, payment_method, options) }
132
+ end
133
+ end
134
+ end
135
+
136
+ def store(payment_method, options={})
137
+ verify(payment_method, options, "store")
138
+ end
139
+
140
+ def supports_scrubbing?
141
+ true
142
+ end
143
+
144
+ def scrub(transcript)
145
+ transcript.
146
+ gsub(%r((\"cardNumber\\\":\\\")\d+), '\1[FILTERED]').
147
+ gsub(%r((\"cvv\\\":\\\")\d+), '\1[FILTERED]')
148
+ end
149
+
150
+
151
+ private
152
+
153
+ def add_request_id(post)
154
+ post[:id] = SecureRandom.hex(16)
155
+ end
156
+
157
+ def add_timestamp()
158
+ Time.now.getutc.strftime("%Y%m%d%H%M%S")
159
+ end
160
+
161
+ def add_hmac(params, method)
162
+ if method == "getSession"
163
+ hmac_message = params[:pgwAccountNumber] + "|" + params[:pgwConfigurationId] + "|" + params[:requestTimeStamp] + "|" + method
164
+ else
165
+ hmac_message = params[:pgwAccountNumber] + "|" + params[:pgwConfigurationId] + "|" + (params[:orderNumber] || "") + "|" + method + "|" + (params[:amount] || "") + "|" + (params[:sessionToken] || "") + "|" + (params[:accountToken] || "")
166
+ end
167
+
168
+ OpenSSL::HMAC.hexdigest('sha512', @options[:secret], hmac_message)
169
+ end
170
+
171
+ def add_credentials(params, method)
172
+ params[:pgwAccountNumber] = @options[:account_number]
173
+ params[:pgwConfigurationId] = @options[:configuration_id]
174
+
175
+ params[:requestTimeStamp] = add_timestamp() if method == "getSession"
176
+
177
+ params[:pgwHMAC] = add_hmac(params, method)
178
+ end
179
+
180
+ def add_invoice(params, money, options)
181
+ params[:amount] = amount(money)
182
+ params[:orderNumber] = options[:order_id]
183
+ params[:transactionClass] = options[:transaction_class] || "eCommerce"
184
+ end
185
+
186
+ def add_payment_method(params, credit_card)
187
+ params[:cardExp] = format(credit_card.month, :two_digits).to_s + "/" + format(credit_card.year, :two_digits).to_s
188
+ params[:cardType] = BRAND_MAP[credit_card.brand.to_s]
189
+ params[:cvv] = credit_card.verification_value
190
+ params[:firstName] = credit_card.first_name
191
+ params[:lastName] = credit_card.last_name
192
+ end
193
+
194
+ def add_customer_data(params, options)
195
+ if (billing_address = options[:billing_address] || options[:address])
196
+ params[:address1] = billing_address[:address1]
197
+ params[:address2] = billing_address[:address2]
198
+ params[:city] = billing_address[:city]
199
+ params[:stateProvince] = billing_address[:state]
200
+ params[:zipPostalCode] = billing_address[:zip]
201
+ params[:countryCode] = billing_address[:country]
202
+ end
203
+ end
204
+
205
+ def get_session(options={})
206
+ post = {}
207
+ post[:method] = "getSession"
208
+ add_request_id(post)
209
+
210
+ params = {}
211
+ add_credentials(params, post[:method])
212
+
213
+ post[:params] = [params]
214
+ commit("session", post)
215
+ end
216
+
217
+ def get_token(authorization, payment_method, options={})
218
+ post = {}
219
+ post[:method] = "tokenize"
220
+ add_request_id(post)
221
+
222
+ params = {}
223
+ _, params[:sessionId] = split_authorization(authorization)
224
+ params[:cardNumber] = payment_method.number
225
+
226
+ post[:params] = [params]
227
+ commit("token", post)
228
+ end
229
+
230
+ def auth_or_sale(method, authorization, amount, credit_card, options={})
231
+ post = {}
232
+ post[:method] = method
233
+ add_request_id(post)
234
+
235
+ params = {}
236
+ if credit_card
237
+ _, params[:sessionToken] = split_authorization(authorization)
238
+ add_payment_method(params, credit_card)
239
+ add_customer_data(params, options)
240
+ else
241
+ _, params[:accountToken] = split_authorization(authorization)
242
+ end
243
+ add_invoice(params, amount, options)
244
+ add_credentials(params, post[:method])
245
+
246
+ post[:params] = [params]
247
+ commit("v1/", post)
248
+ end
249
+
250
+ def verifyOnly(action, authorization, credit_card, options={})
251
+ post = {}
252
+ post[:method] = "verifyOnly"
253
+ add_request_id(post)
254
+
255
+ params = {}
256
+ if credit_card
257
+ _, params[:sessionToken] = split_authorization(authorization)
258
+ add_payment_method(params, credit_card)
259
+ add_customer_data(params, options)
260
+ else
261
+ _, params[:accountToken] = split_authorization(authorization)
262
+ end
263
+ params[:requestAccountToken] = "1" if action == "store"
264
+ add_invoice(params, 0, options)
265
+ add_credentials(params, post[:method])
266
+
267
+ post[:params] = [params]
268
+ commit("v1/", post)
269
+ end
270
+
271
+ def refundWithCard(authorization, amount, credit_card, options={})
272
+ post = {}
273
+ post[:method] = "refundWithCard"
274
+ add_request_id(post)
275
+
276
+ params = {}
277
+ if credit_card
278
+ _, params[:sessionToken] = split_authorization(authorization)
279
+ add_payment_method(params, credit_card)
280
+ else
281
+ _, params[:accountToken] = split_authorization(authorization)
282
+ end
283
+ add_invoice(params, amount, options)
284
+ add_credentials(params, post[:method])
285
+
286
+ post[:params] = [params]
287
+ commit("v1/", post)
288
+ end
289
+
290
+ def reverse_or_void(method, pgwTID, options={})
291
+ post = {}
292
+ post[:method] = method
293
+ add_request_id(post)
294
+
295
+ params = {}
296
+ params[:orderNumber] = options[:order_id]
297
+ params[:pgwTID] = pgwTID
298
+ add_credentials(params, post[:method])
299
+
300
+ post[:params] = [params]
301
+ commit("v1/", post)
302
+ end
303
+
304
+ def commit(endpoint, post)
305
+ begin
306
+ raw_response = ssl_post(url() + endpoint, post_data(post), headers)
307
+ response = parse(raw_response)
308
+ rescue ResponseError => e
309
+ raw_response = e.response.body
310
+ response_error(raw_response)
311
+ rescue JSON::ParserError
312
+ unparsable_response(raw_response)
313
+ else
314
+ success = success_from(response)
315
+ Response.new(
316
+ success,
317
+ message_from(response),
318
+ response,
319
+ authorization: success ? authorization_from(response, post[:method]) : nil,
320
+ avs_result: success ? avs_from(response) : nil,
321
+ cvv_result: success ? cvv_from(response) : nil,
322
+ error_code: success ? nil : error_from(response),
323
+ test: test?
324
+ )
325
+ end
326
+ end
327
+
328
+ def headers
329
+ {
330
+ "Content-Type" => "application/json"
331
+ }
332
+ end
333
+
334
+ def post_data(params)
335
+ params.to_json
336
+ end
337
+
338
+ def url
339
+ test? ? test_url : live_url
340
+ end
341
+
342
+ def parse(body)
343
+ JSON.parse(body)
344
+ end
345
+
346
+ def success_from(response)
347
+ return false if response["result"].nil? || response["error"]
348
+
349
+ if response["result"].key?("pgwResponseCode")
350
+ response["error"].nil? && response["result"]["lastActionSucceeded"] == 1 && response["result"]["pgwResponseCode"] == "100"
351
+ else
352
+ response["error"].nil? && response["result"]["lastActionSucceeded"] == 1
353
+ end
354
+ end
355
+
356
+ def message_from(response)
357
+ return response["error"] if response["error"]
358
+ return "Failed" unless response.key?("result")
359
+
360
+ if response["result"].key?("pgwResponseCode")
361
+ RESPONSE_CODE_MAPPING[response["result"]["pgwResponseCode"]] || response["result"]["responseText"]
362
+ else
363
+ response["result"]["lastActionSucceeded"] == 1 ? "Succeeded" : "Failed"
364
+ end
365
+ end
366
+
367
+ def error_from(response)
368
+ return response["error"] if response["error"]
369
+ return "Failed" unless response.key?("result")
370
+ return response["result"]["pgwResponseCode"] || response["result"]["processor"]["responseCode"] || "Failed"
371
+ end
372
+
373
+ def authorization_from(response, method)
374
+ method + "|" + (
375
+ response["result"]["sessionId"] ||
376
+ response["result"]["sessionToken"] ||
377
+ response["result"]["pgwTID"] ||
378
+ response["result"]["accountToken"]
379
+ )
380
+ end
381
+
382
+ def split_authorization(authorization)
383
+ authorization.split("|")
384
+ end
385
+
386
+ def avs_from(response)
387
+ response["result"].key?("avsResponse") ? AVSResult.new(code: response["result"]["avsResponse"]) : nil
388
+ end
389
+
390
+ def cvv_from(response)
391
+ response["result"].key?("cvvResponse") ? CVVResult.new(response["result"]["cvvResponse"]) : nil
392
+ end
393
+
394
+ def response_error(raw_response)
395
+ begin
396
+ response = parse(raw_response)
397
+ rescue JSON::ParserError
398
+ unparsable_response(raw_response)
399
+ else
400
+ return Response.new(
401
+ false,
402
+ message_from(response),
403
+ response,
404
+ :test => test?
405
+ )
406
+ end
407
+ end
408
+
409
+ def unparsable_response(raw_response)
410
+ message = "Invalid JSON response received from Latitude19Gateway. Please contact Latitude19Gateway if you continue to receive this message."
411
+ message += " (The raw response returned by the API was #{raw_response.inspect})"
412
+ return Response.new(false, message)
413
+ end
414
+ end
415
+ end
416
+ end
@@ -144,6 +144,8 @@ module ActiveMerchant #:nodoc:
144
144
  }.update(options)
145
145
 
146
146
  raise ArgumentError, "You need to pass in your pem file using the :pem parameter or set it globally using ActiveMerchant::Billing::LinkpointGateway.pem_file = File.read( File.dirname(__FILE__) + '/../mycert.pem' ) or similar" if @options[:pem].blank?
147
+
148
+ @options[:pem].strip!
147
149
  end
148
150
 
149
151
  # Send a purchase request with periodic options
@@ -166,6 +168,8 @@ module ActiveMerchant #:nodoc:
166
168
  # :comments Uh... comments
167
169
  #
168
170
  def recurring(money, creditcard, options={})
171
+ ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
172
+
169
173
  requires!(options, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily], :installments, :order_id )
170
174
 
171
175
  options.update(
@@ -239,10 +243,21 @@ module ActiveMerchant #:nodoc:
239
243
  end
240
244
 
241
245
  def credit(money, identification, options = {})
242
- deprecated CREDIT_DEPRECATION_MESSAGE
246
+ ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
243
247
  refund(money, identification, options)
244
248
  end
245
249
 
250
+ def supports_scrubbing
251
+ true
252
+ end
253
+
254
+ def scrub(transcript)
255
+ transcript.
256
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
257
+ gsub(%r((<cardnumber>)\d+(</cardnumber>))i, '\1[FILTERED]\2').
258
+ gsub(%r((<cvmvalue>)\d+(</cvmvalue>))i, '\1[FILTERED]\2')
259
+ end
260
+
246
261
  private
247
262
  # Commit the transaction by posting the XML file to the LinkPoint server
248
263
  def commit(money, creditcard, options = {})
@@ -277,7 +292,7 @@ module ActiveMerchant #:nodoc:
277
292
  if key == :items
278
293
  build_items(elem, value)
279
294
  else
280
- for k, v in params[key]
295
+ for k, _ in params[key]
281
296
  elem.add_element(k.to_s).text = params[key][k].to_s if params[key][k]
282
297
  end
283
298
  end
@@ -428,17 +443,6 @@ module ActiveMerchant #:nodoc:
428
443
  response
429
444
  end
430
445
 
431
- # Make a ruby type out of the response string
432
- def normalize(field)
433
- case field
434
- when "true" then true
435
- when "false" then false
436
- when "" then nil
437
- when "null" then nil
438
- else field
439
- end
440
- end
441
-
442
446
  def format_creditcard_expiry_year(year)
443
447
  sprintf("%.4i", year)[-2..-1]
444
448
  end