tanga_activemerchant 1.37.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (306) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +1202 -0
  3. data/CONTRIBUTORS +414 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +221 -0
  6. data/gem-public_cert.pem +20 -0
  7. data/lib/active_merchant/billing/avs_result.rb +98 -0
  8. data/lib/active_merchant/billing/base.rb +57 -0
  9. data/lib/active_merchant/billing/check.rb +69 -0
  10. data/lib/active_merchant/billing/credit_card.rb +283 -0
  11. data/lib/active_merchant/billing/credit_card_formatting.rb +21 -0
  12. data/lib/active_merchant/billing/credit_card_methods.rb +143 -0
  13. data/lib/active_merchant/billing/cvv_result.rb +38 -0
  14. data/lib/active_merchant/billing/expiry_date.rb +34 -0
  15. data/lib/active_merchant/billing/gateway.rb +181 -0
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +725 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +956 -0
  18. data/lib/active_merchant/billing/gateways/balanced.rb +468 -0
  19. data/lib/active_merchant/billing/gateways/banwire.rb +105 -0
  20. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +314 -0
  21. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +393 -0
  23. data/lib/active_merchant/billing/gateways/beanstream.rb +169 -0
  24. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
  25. data/lib/active_merchant/billing/gateways/blue_pay.rb +501 -0
  26. data/lib/active_merchant/billing/gateways/bogus.rb +142 -0
  27. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
  28. data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
  29. data/lib/active_merchant/billing/gateways/braintree_blue.rb +401 -0
  30. data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
  31. data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
  32. data/lib/active_merchant/billing/gateways/card_stream.rb +225 -0
  33. data/lib/active_merchant/billing/gateways/card_stream_modern.rb +155 -0
  34. data/lib/active_merchant/billing/gateways/cc5.rb +156 -0
  35. data/lib/active_merchant/billing/gateways/certo_direct.rb +277 -0
  36. data/lib/active_merchant/billing/gateways/cyber_source.rb +639 -0
  37. data/lib/active_merchant/billing/gateways/data_cash.rb +591 -0
  38. data/lib/active_merchant/billing/gateways/efsnet.rb +230 -0
  39. data/lib/active_merchant/billing/gateways/elavon.rb +312 -0
  40. data/lib/active_merchant/billing/gateways/epay.rb +275 -0
  41. data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
  42. data/lib/active_merchant/billing/gateways/eway.rb +225 -0
  43. data/lib/active_merchant/billing/gateways/eway_managed.rb +291 -0
  44. data/lib/active_merchant/billing/gateways/eway_rapid.rb +320 -0
  45. data/lib/active_merchant/billing/gateways/exact.rb +218 -0
  46. data/lib/active_merchant/billing/gateways/fat_zebra.rb +173 -0
  47. data/lib/active_merchant/billing/gateways/federated_canada.rb +167 -0
  48. data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
  49. data/lib/active_merchant/billing/gateways/first_pay.rb +176 -0
  50. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +314 -0
  51. data/lib/active_merchant/billing/gateways/garanti.rb +257 -0
  52. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  53. data/lib/active_merchant/billing/gateways/iats_payments.rb +35 -0
  54. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +249 -0
  55. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +13 -0
  56. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +29 -0
  57. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +66 -0
  58. data/lib/active_merchant/billing/gateways/inspire.rb +221 -0
  59. data/lib/active_merchant/billing/gateways/instapay.rb +163 -0
  60. data/lib/active_merchant/billing/gateways/iridium.rb +262 -0
  61. data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
  62. data/lib/active_merchant/billing/gateways/jetpay.rb +275 -0
  63. data/lib/active_merchant/billing/gateways/linkpoint.rb +447 -0
  64. data/lib/active_merchant/billing/gateways/litle.rb +554 -0
  65. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +176 -0
  66. data/lib/active_merchant/billing/gateways/merchant_one.rb +115 -0
  67. data/lib/active_merchant/billing/gateways/merchant_ware.rb +322 -0
  68. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +275 -0
  69. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +191 -0
  70. data/lib/active_merchant/billing/gateways/mercury.rb +311 -0
  71. data/lib/active_merchant/billing/gateways/metrics_global.rb +322 -0
  72. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
  73. data/lib/active_merchant/billing/gateways/migs.rb +265 -0
  74. data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
  75. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +219 -0
  76. data/lib/active_merchant/billing/gateways/moneris.rb +244 -0
  77. data/lib/active_merchant/billing/gateways/moneris_us.rb +208 -0
  78. data/lib/active_merchant/billing/gateways/nab_transact.rb +277 -0
  79. data/lib/active_merchant/billing/gateways/net_registry.rb +193 -0
  80. data/lib/active_merchant/billing/gateways/netaxept.rb +181 -0
  81. data/lib/active_merchant/billing/gateways/netbilling.rb +197 -0
  82. data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
  83. data/lib/active_merchant/billing/gateways/nmi.rb +20 -0
  84. data/lib/active_merchant/billing/gateways/ogone.rb +421 -0
  85. data/lib/active_merchant/billing/gateways/optimal_payment.rb +297 -0
  86. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  87. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +46 -0
  88. data/lib/active_merchant/billing/gateways/orbital.rb +633 -0
  89. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +261 -0
  90. data/lib/active_merchant/billing/gateways/pay_junction.rb +396 -0
  91. data/lib/active_merchant/billing/gateways/pay_secure.rb +119 -0
  92. data/lib/active_merchant/billing/gateways/paybox_direct.rb +196 -0
  93. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +209 -0
  94. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
  95. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
  96. data/lib/active_merchant/billing/gateways/payflow.rb +268 -0
  97. data/lib/active_merchant/billing/gateways/payflow_express.rb +224 -0
  98. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
  99. data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
  100. data/lib/active_merchant/billing/gateways/payment_express.rb +353 -0
  101. data/lib/active_merchant/billing/gateways/paymill.rb +179 -0
  102. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +670 -0
  103. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +61 -0
  104. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +248 -0
  105. data/lib/active_merchant/billing/gateways/paypal.rb +106 -0
  106. data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
  107. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +43 -0
  108. data/lib/active_merchant/billing/gateways/paypal_express.rb +239 -0
  109. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
  110. data/lib/active_merchant/billing/gateways/paystation.rb +199 -0
  111. data/lib/active_merchant/billing/gateways/payway.rb +207 -0
  112. data/lib/active_merchant/billing/gateways/pin.rb +165 -0
  113. data/lib/active_merchant/billing/gateways/plugnpay.rb +294 -0
  114. data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
  115. data/lib/active_merchant/billing/gateways/psl_card.rb +303 -0
  116. data/lib/active_merchant/billing/gateways/qbms.rb +292 -0
  117. data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
  118. data/lib/active_merchant/billing/gateways/quickpay.rb +335 -0
  119. data/lib/active_merchant/billing/gateways/realex.rb +303 -0
  120. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  121. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +93 -0
  122. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +114 -0
  123. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +102 -0
  124. data/lib/active_merchant/billing/gateways/sage.rb +152 -0
  125. data/lib/active_merchant/billing/gateways/sage_pay.rb +324 -0
  126. data/lib/active_merchant/billing/gateways/sallie_mae.rb +143 -0
  127. data/lib/active_merchant/billing/gateways/samurai.rb +118 -0
  128. data/lib/active_merchant/billing/gateways/secure_net.rb +261 -0
  129. data/lib/active_merchant/billing/gateways/secure_pay.rb +28 -0
  130. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +279 -0
  131. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +112 -0
  132. data/lib/active_merchant/billing/gateways/skip_jack.rb +453 -0
  133. data/lib/active_merchant/billing/gateways/smart_ps.rb +272 -0
  134. data/lib/active_merchant/billing/gateways/spreedly_core.rb +233 -0
  135. data/lib/active_merchant/billing/gateways/stripe.rb +316 -0
  136. data/lib/active_merchant/billing/gateways/trans_first.rb +126 -0
  137. data/lib/active_merchant/billing/gateways/transax.rb +23 -0
  138. data/lib/active_merchant/billing/gateways/transnational.rb +239 -0
  139. data/lib/active_merchant/billing/gateways/trust_commerce.rb +421 -0
  140. data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
  141. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1501 -0
  142. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +201 -0
  143. data/lib/active_merchant/billing/gateways/verifi.rb +232 -0
  144. data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
  145. data/lib/active_merchant/billing/gateways/vindicia.rb +361 -0
  146. data/lib/active_merchant/billing/gateways/webpay.rb +57 -0
  147. data/lib/active_merchant/billing/gateways/wirecard.rb +313 -0
  148. data/lib/active_merchant/billing/gateways/worldpay.rb +303 -0
  149. data/lib/active_merchant/billing/gateways.rb +17 -0
  150. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  151. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  152. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  153. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  154. data/lib/active_merchant/billing/integrations/action_view_helper.rb +73 -0
  155. data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +229 -0
  156. data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +340 -0
  157. data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +38 -0
  158. data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
  159. data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
  160. data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
  161. data/lib/active_merchant/billing/integrations/bogus.rb +23 -0
  162. data/lib/active_merchant/billing/integrations/chronopay/helper.rb +120 -0
  163. data/lib/active_merchant/billing/integrations/chronopay/notification.rb +158 -0
  164. data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
  165. data/lib/active_merchant/billing/integrations/chronopay.rb +23 -0
  166. data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +200 -0
  167. data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +76 -0
  168. data/lib/active_merchant/billing/integrations/direc_pay/return.rb +32 -0
  169. data/lib/active_merchant/billing/integrations/direc_pay/status.rb +37 -0
  170. data/lib/active_merchant/billing/integrations/direc_pay.rb +41 -0
  171. data/lib/active_merchant/billing/integrations/directebanking/helper.rb +90 -0
  172. data/lib/active_merchant/billing/integrations/directebanking/notification.rb +120 -0
  173. data/lib/active_merchant/billing/integrations/directebanking/return.rb +11 -0
  174. data/lib/active_merchant/billing/integrations/directebanking.rb +47 -0
  175. data/lib/active_merchant/billing/integrations/dotpay/helper.rb +77 -0
  176. data/lib/active_merchant/billing/integrations/dotpay/notification.rb +86 -0
  177. data/lib/active_merchant/billing/integrations/dotpay/return.rb +11 -0
  178. data/lib/active_merchant/billing/integrations/dotpay.rb +22 -0
  179. data/lib/active_merchant/billing/integrations/dwolla/common.rb +23 -0
  180. data/lib/active_merchant/billing/integrations/dwolla/helper.rb +43 -0
  181. data/lib/active_merchant/billing/integrations/dwolla/notification.rb +64 -0
  182. data/lib/active_merchant/billing/integrations/dwolla/return.rb +49 -0
  183. data/lib/active_merchant/billing/integrations/dwolla.rb +23 -0
  184. data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +34 -0
  185. data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +84 -0
  186. data/lib/active_merchant/billing/integrations/e_payment_plans.rb +48 -0
  187. data/lib/active_merchant/billing/integrations/easy_pay/common.rb +40 -0
  188. data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +36 -0
  189. data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +59 -0
  190. data/lib/active_merchant/billing/integrations/easy_pay.rb +30 -0
  191. data/lib/active_merchant/billing/integrations/epay/helper.rb +55 -0
  192. data/lib/active_merchant/billing/integrations/epay/notification.rb +110 -0
  193. data/lib/active_merchant/billing/integrations/epay.rb +21 -0
  194. data/lib/active_merchant/billing/integrations/first_data/helper.rb +61 -0
  195. data/lib/active_merchant/billing/integrations/first_data/notification.rb +56 -0
  196. data/lib/active_merchant/billing/integrations/first_data.rb +38 -0
  197. data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
  198. data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
  199. data/lib/active_merchant/billing/integrations/gestpay/notification.rb +85 -0
  200. data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
  201. data/lib/active_merchant/billing/integrations/gestpay.rb +25 -0
  202. data/lib/active_merchant/billing/integrations/helper.rb +117 -0
  203. data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
  204. data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
  205. data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
  206. data/lib/active_merchant/billing/integrations/hi_trust.rb +27 -0
  207. data/lib/active_merchant/billing/integrations/ipay88/helper.rb +114 -0
  208. data/lib/active_merchant/billing/integrations/ipay88/return.rb +95 -0
  209. data/lib/active_merchant/billing/integrations/ipay88.rb +19 -0
  210. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  211. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  212. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  213. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
  214. data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +119 -0
  215. data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +48 -0
  216. data/lib/active_merchant/billing/integrations/maksuturva.rb +86 -0
  217. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +75 -0
  218. data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +129 -0
  219. data/lib/active_merchant/billing/integrations/moneybookers.rb +26 -0
  220. data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
  221. data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
  222. data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
  223. data/lib/active_merchant/billing/integrations/nochex.rb +88 -0
  224. data/lib/active_merchant/billing/integrations/notification.rb +71 -0
  225. data/lib/active_merchant/billing/integrations/paxum/common.rb +24 -0
  226. data/lib/active_merchant/billing/integrations/paxum/helper.rb +42 -0
  227. data/lib/active_merchant/billing/integrations/paxum/notification.rb +33 -0
  228. data/lib/active_merchant/billing/integrations/paxum.rb +44 -0
  229. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
  230. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  231. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  232. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  233. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
  234. data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +116 -0
  235. data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +78 -0
  236. data/lib/active_merchant/billing/integrations/payflow_link.rb +21 -0
  237. data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
  238. data/lib/active_merchant/billing/integrations/paypal/notification.rb +227 -0
  239. data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
  240. data/lib/active_merchant/billing/integrations/paypal.rb +39 -0
  241. data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +15 -0
  242. data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +20 -0
  243. data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +15 -0
  244. data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +28 -0
  245. data/lib/active_merchant/billing/integrations/paysbuy.rb +36 -0
  246. data/lib/active_merchant/billing/integrations/payu_in/helper.rb +74 -0
  247. data/lib/active_merchant/billing/integrations/payu_in/notification.rb +165 -0
  248. data/lib/active_merchant/billing/integrations/payu_in/return.rb +36 -0
  249. data/lib/active_merchant/billing/integrations/payu_in.rb +43 -0
  250. data/lib/active_merchant/billing/integrations/platron/helper.rb +32 -0
  251. data/lib/active_merchant/billing/integrations/platron/notification.rb +113 -0
  252. data/lib/active_merchant/billing/integrations/platron.rb +28 -0
  253. data/lib/active_merchant/billing/integrations/pxpay/helper.rb +112 -0
  254. data/lib/active_merchant/billing/integrations/pxpay/notification.rb +157 -0
  255. data/lib/active_merchant/billing/integrations/pxpay/return.rb +25 -0
  256. data/lib/active_merchant/billing/integrations/pxpay.rb +31 -0
  257. data/lib/active_merchant/billing/integrations/quickpay/helper.rb +74 -0
  258. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +137 -0
  259. data/lib/active_merchant/billing/integrations/quickpay.rb +21 -0
  260. data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +23 -0
  261. data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +91 -0
  262. data/lib/active_merchant/billing/integrations/rbkmoney.rb +17 -0
  263. data/lib/active_merchant/billing/integrations/return.rb +42 -0
  264. data/lib/active_merchant/billing/integrations/robokassa/common.rb +19 -0
  265. data/lib/active_merchant/billing/integrations/robokassa/helper.rb +50 -0
  266. data/lib/active_merchant/billing/integrations/robokassa/notification.rb +55 -0
  267. data/lib/active_merchant/billing/integrations/robokassa/return.rb +17 -0
  268. data/lib/active_merchant/billing/integrations/robokassa.rb +49 -0
  269. data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +33 -0
  270. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +136 -0
  271. data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +210 -0
  272. data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +31 -0
  273. data/lib/active_merchant/billing/integrations/sage_pay_form.rb +37 -0
  274. data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +91 -0
  275. data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +139 -0
  276. data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
  277. data/lib/active_merchant/billing/integrations/two_checkout.rb +44 -0
  278. data/lib/active_merchant/billing/integrations/valitor/helper.rb +86 -0
  279. data/lib/active_merchant/billing/integrations/valitor/notification.rb +13 -0
  280. data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +97 -0
  281. data/lib/active_merchant/billing/integrations/valitor/return.rb +13 -0
  282. data/lib/active_merchant/billing/integrations/valitor.rb +33 -0
  283. data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +88 -0
  284. data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +59 -0
  285. data/lib/active_merchant/billing/integrations/verkkomaksut.rb +20 -0
  286. data/lib/active_merchant/billing/integrations/web_pay/common.rb +50 -0
  287. data/lib/active_merchant/billing/integrations/web_pay/helper.rb +68 -0
  288. data/lib/active_merchant/billing/integrations/web_pay/notification.rb +51 -0
  289. data/lib/active_merchant/billing/integrations/web_pay.rb +45 -0
  290. data/lib/active_merchant/billing/integrations/webmoney/common.rb +17 -0
  291. data/lib/active_merchant/billing/integrations/webmoney/helper.rb +40 -0
  292. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +47 -0
  293. data/lib/active_merchant/billing/integrations/webmoney.rb +43 -0
  294. data/lib/active_merchant/billing/integrations/world_pay/helper.rb +101 -0
  295. data/lib/active_merchant/billing/integrations/world_pay/notification.rb +160 -0
  296. data/lib/active_merchant/billing/integrations/world_pay.rb +34 -0
  297. data/lib/active_merchant/billing/integrations.rb +17 -0
  298. data/lib/active_merchant/billing/response.rb +77 -0
  299. data/lib/active_merchant/billing.rb +9 -0
  300. data/lib/active_merchant/version.rb +3 -0
  301. data/lib/active_merchant.rb +63 -0
  302. data/lib/activemerchant.rb +1 -0
  303. data/lib/support/gateway_support.rb +65 -0
  304. data/lib/support/outbound_hosts.rb +25 -0
  305. data/lib/support/ssl_verify.rb +93 -0
  306. metadata +506 -0
@@ -0,0 +1,303 @@
1
+ module ActiveMerchant
2
+ module Billing
3
+ #
4
+ # ActiveMerchant PSL Card Gateway
5
+ #
6
+ # Notes:
7
+ # -To be able to use the capture function, the IP address of the machine must be
8
+ # registered with PSL
9
+ # -ESALE_KEYED should only be used in situations where the cardholder perceives the
10
+ # transaction to be Internet-based, such as purchasing from a web site/on-line store.
11
+ # If the Internet is used purely for the transport of information from the merchant
12
+ # directly to the gateway then the appropriate cardholder present or not present message
13
+ # type should be used rather than the ‘E’ equivalent.
14
+ # -The CV2 / AVS policies are set up with the account settings when signing up for an account
15
+ class PslCardGateway < Gateway
16
+ self.money_format = :cents
17
+ self.default_currency = 'GBP'
18
+
19
+ self.supported_countries = ['GB']
20
+ # Visa Credit, Visa Debit, Mastercard, Maestro, Solo, Electron,
21
+ # American Express, Diners Club, JCB, International Maestro,
22
+ # Style, Clydesdale Financial Services, Other
23
+
24
+ self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club, :jcb, :switch, :solo, :maestro ]
25
+ self.homepage_url = 'http://www.paymentsolutionsltd.com/'
26
+ self.display_name = 'PSL Payment Solutions'
27
+
28
+ # Default ISO 3166 country code (GB)
29
+ cattr_accessor :location
30
+ self.location = 826
31
+
32
+ # PslCard server self.live_url - The url is the same whether testing or live - use
33
+ # the test account when testing...
34
+ self.live_url = self.test_url = 'https://pslcard3.paymentsolutionsltd.com/secure/transact.asp?'
35
+
36
+ # eCommerce sale transaction, details keyed by merchant or cardholder
37
+ MESSAGE_TYPE = 'ESALE_KEYED'
38
+
39
+ # The type of response that we want to get from PSL, options are HTML, XML or REDIRECT
40
+ RESPONSE_ACTION = 'HTML'
41
+
42
+ # Currency Codes
43
+ CURRENCY_CODES = {
44
+ 'AUD' => 036,
45
+ 'GBP' => 826,
46
+ 'USD' => 840
47
+ }
48
+
49
+ #The terminal used - only for swipe transactions, so hard coded to 32 for online
50
+ EMV_TERMINAL_TYPE = 32
51
+
52
+ #Different Dispatch types
53
+ DISPATCH_LATER = 'LATER'
54
+ DISPATCH_NOW = 'NOW'
55
+
56
+ # Return codes
57
+ APPROVED = '00'
58
+
59
+ #Nominal amount to authorize for a 'dispatch later' type
60
+ #The nominal amount is held straight away, when the goods are ready
61
+ #to be dispatched, PSL is informed and the full amount is the
62
+ #taken.
63
+ NOMINAL_AMOUNT = 101
64
+
65
+ AVS_CODE = {
66
+ "ALL MATCH" => 'Y',
67
+ "SECURITY CODE MATCH ONLY" => 'N',
68
+ "ADDRESS MATCH ONLY" => 'Y',
69
+ "NO DATA MATCHES" => 'N',
70
+ "DATA NOT CHECKED" => 'R',
71
+ "SECURITY CHECKS NOT SUPPORTED" => 'X'
72
+ }
73
+
74
+ CVV_CODE = {
75
+ "ALL MATCH" => 'M',
76
+ "SECURITY CODE MATCH ONLY" => 'M',
77
+ "ADDRESS MATCH ONLY" => 'N',
78
+ "NO DATA MATCHES" => 'N',
79
+ "DATA NOT CHECKED" => 'P',
80
+ "SECURITY CHECKS NOT SUPPORTED" => 'X'
81
+ }
82
+
83
+ # Create a new PslCardGateway
84
+ #
85
+ # The gateway requires that a valid :login be passed in the options hash
86
+ #
87
+ # Paramaters:
88
+ # -options:
89
+ # :login - the PslCard account login (required)
90
+ def initialize(options = {})
91
+ requires!(options, :login)
92
+
93
+ super
94
+ end
95
+
96
+ # Purchase the item straight away
97
+ #
98
+ # Parameters:
99
+ # -money: Amount to be charged as an Integer value in cents
100
+ # -authorization: the PSL cross reference from the previous authorization
101
+ # -options:
102
+ #
103
+ # Returns:
104
+ # -ActiveRecord::Billing::Response object
105
+ #
106
+ def purchase(money, credit_card, options = {})
107
+ post = {}
108
+
109
+ add_amount(post, money, DISPATCH_NOW, options)
110
+ add_credit_card(post, credit_card)
111
+ add_address(post, options)
112
+ add_invoice(post, options)
113
+ add_purchase_details(post)
114
+
115
+ commit(post)
116
+ end
117
+
118
+ # Authorize the transaction
119
+ #
120
+ # Reserves the funds on the customer's credit card, but does not
121
+ # charge the card.
122
+ #
123
+ # This implementation does not authorize the full amount, rather it checks that the full amount
124
+ # is available and only 'reserves' the nominal amount (currently a pound and a penny)
125
+ #
126
+ # Parameters:
127
+ # -money: Amount to be charged as an Integer value in cents
128
+ # -authorization: the PSL cross reference from the previous authorization
129
+ # -options:
130
+ #
131
+ # Returns:
132
+ # -ActiveRecord::Billing::Response object
133
+ #
134
+ def authorize(money, credit_card, options = {})
135
+ post = {}
136
+
137
+ add_amount(post, money, DISPATCH_LATER, options)
138
+ add_credit_card(post, credit_card)
139
+ add_address(post, options)
140
+ add_invoice(post, options)
141
+ add_purchase_details(post)
142
+
143
+ commit(post)
144
+ end
145
+
146
+ # Post an authorization.
147
+ #
148
+ # Captures the funds from an authorized transaction.
149
+ #
150
+ # Parameters:
151
+ # -money: Amount to be charged as an Integer value in cents
152
+ # -authorization: The PSL Cross Reference
153
+ # -options:
154
+ #
155
+ # Returns:
156
+ # -ActiveRecord::Billing::Response object
157
+ #
158
+ def capture(money, authorization, options = {})
159
+ post = {}
160
+
161
+ add_amount(post, money, DISPATCH_NOW, options)
162
+ add_reference(post, authorization)
163
+ add_purchase_details(post)
164
+
165
+ commit(post)
166
+ end
167
+
168
+ private
169
+
170
+ def add_credit_card(post, credit_card)
171
+ post[:QAName] = credit_card.name
172
+ post[:CardNumber] = credit_card.number
173
+ post[:EMVTerminalType] = EMV_TERMINAL_TYPE
174
+ post[:ExpMonth] = credit_card.month
175
+ post[:ExpYear] = credit_card.year
176
+
177
+ if requires_start_date_or_issue_number?(credit_card)
178
+ post[:IssueNumber] = credit_card.issue_number unless credit_card.issue_number.blank?
179
+ post[:StartMonth] = credit_card.start_month unless credit_card.start_month.blank?
180
+ post[:StartYear] = credit_card.start_year unless credit_card.start_year.blank?
181
+ end
182
+
183
+ # CV2 check
184
+ post[:AVSCV2Check] = credit_card.verification_value? ? 'YES' : 'NO'
185
+ post[:CV2] = credit_card.verification_value if credit_card.verification_value?
186
+ end
187
+
188
+ def add_address(post, options)
189
+ address = options[:billing_address] || options[:address]
190
+ return if address.nil?
191
+
192
+ post[:QAAddress] = [:address1, :address2, :city, :state].collect{|a| address[a]}.reject{|a| a.blank?}.join(' ')
193
+ post[:QAPostcode] = address[:zip]
194
+ end
195
+
196
+ def add_invoice(post, options)
197
+ post[:MerchantName] = options[:merchant] || 'Merchant Name' # May use this as the order_id field
198
+ post[:OrderID] = options[:order_id] unless options[:order_id].blank?
199
+ end
200
+
201
+ def add_reference(post, authorization)
202
+ post[:CrossReference] = authorization
203
+ end
204
+
205
+ def add_amount(post, money, dispatch_type, options)
206
+ post[:CurrencyCode] = currency_code(options[:currency] || currency(money))
207
+
208
+ if dispatch_type == DISPATCH_LATER
209
+ post[:amount] = amount(NOMINAL_AMOUNT)
210
+ post[:DispatchLaterAmount] = amount(money)
211
+ else
212
+ post[:amount] = amount(money)
213
+ end
214
+
215
+ post[:Dispatch] = dispatch_type
216
+ end
217
+
218
+ def add_purchase_details(post)
219
+ post[:EchoAmount] = 'YES'
220
+ post[:SCBI] = 'YES' # Return information about the transaction
221
+ post[:MessageType] = MESSAGE_TYPE
222
+ end
223
+
224
+ # Get the currency code for the passed money object
225
+ #
226
+ # The money class stores the currency as an ISO 4217:2001 Alphanumeric,
227
+ # however PSL requires the ISO 4217:2001 Numeric code.
228
+ #
229
+ # Parameters:
230
+ # -money: Integer value in cents
231
+ #
232
+ # Returns:
233
+ # -the ISO 4217:2001 Numberic currency code
234
+ #
235
+ def currency_code(currency)
236
+ CURRENCY_CODES[currency]
237
+ end
238
+
239
+ # Parse the PSL response and create a Response object
240
+ #
241
+ # Parameters:
242
+ # -body: The response string returned from PSL, Formatted:
243
+ # Key=value&key=value...
244
+ #
245
+ # Returns:
246
+ # -a hash with all of the values returned in the PSL response
247
+ #
248
+ def parse(body)
249
+
250
+ fields = {}
251
+ for line in body.split('&')
252
+ key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
253
+ fields[key] = CGI.unescape(value)
254
+ end
255
+ fields.symbolize_keys
256
+ end
257
+
258
+ # Send the passed data to PSL for processing
259
+ #
260
+ # Parameters:
261
+ # -request: The data that is to be sent to PSL
262
+ #
263
+ # Returns:
264
+ # - ActiveMerchant::Billing::Response object
265
+ #
266
+ def commit(request)
267
+ response = parse( ssl_post(self.live_url, post_data(request)) )
268
+
269
+ Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
270
+ :test => test?,
271
+ :authorization => response[:CrossReference],
272
+ :cvv_result => CVV_CODE[response[:AVSCV2Check]],
273
+ :avs_result => { :code => AVS_CODE[response[:AVSCV2Check]] }
274
+ )
275
+ end
276
+
277
+ # Put the passed data into a format that can be submitted to PSL
278
+ # Key=Value&Key=Value...
279
+ #
280
+ # Any ampersands and equal signs are removed from the data being posted
281
+ # as PSL puts them back into the response string which then cannot be parsed.
282
+ # This is after escaping before sending the request to PSL - this is a work
283
+ # around for the time being
284
+ #
285
+ # Parameters:
286
+ # -post: Hash of all the data to be sent
287
+ #
288
+ # Returns:
289
+ # -String: the data to be sent
290
+ #
291
+ def post_data(post)
292
+ post[:CountryCode] = self.location
293
+ post[:MerchantID] = @options[:login]
294
+ post[:ValidityID] = @options[:password]
295
+ post[:ResponseAction] = RESPONSE_ACTION
296
+
297
+ post.collect { |key, value|
298
+ "#{key}=#{CGI.escape(value.to_s.tr('&=', ' '))}"
299
+ }.join("&")
300
+ end
301
+ end
302
+ end
303
+ end
@@ -0,0 +1,292 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class QbmsGateway < Gateway
4
+ API_VERSION = '4.0'
5
+
6
+ class_attribute :test_url, :live_url
7
+
8
+ self.test_url = "https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway"
9
+ self.live_url = "https://webmerchantaccount.quickbooks.com/j/AppGateway"
10
+
11
+ self.homepage_url = 'http://payments.intuit.com/'
12
+ self.display_name = 'QuickBooks Merchant Services'
13
+ self.default_currency = 'USD'
14
+ self.supported_cardtypes = [ :visa, :master, :discover, :american_express, :diners_club, :jcb ]
15
+ self.supported_countries = [ 'US' ]
16
+
17
+ TYPES = {
18
+ :authorize => 'CustomerCreditCardAuth',
19
+ :capture => 'CustomerCreditCardCapture',
20
+ :purchase => 'CustomerCreditCardCharge',
21
+ :refund => 'CustomerCreditCardTxnVoidOrRefund',
22
+ :void => 'CustomerCreditCardTxnVoid',
23
+ :query => 'MerchantAccountQuery',
24
+ }
25
+
26
+ # Creates a new QbmsGateway
27
+ #
28
+ # The gateway requires that a valid app id, app login, and ticket be passed
29
+ # in the +options+ hash.
30
+ #
31
+ # ==== Options
32
+ #
33
+ # * <tt>:login</tt> -- The App Login (REQUIRED)
34
+ # * <tt>:ticket</tt> -- The Connection Ticket. (REQUIRED)
35
+ # * <tt>:pem</tt> -- The PEM-encoded SSL client key and certificate. (REQUIRED)
36
+ # * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
37
+ # Otherwise, perform transactions against the production server.
38
+ #
39
+ def initialize(options = {})
40
+ requires!(options, :login, :ticket)
41
+ super
42
+ end
43
+
44
+ # Performs an authorization, which reserves the funds on the customer's credit card, but does not
45
+ # charge the card.
46
+ #
47
+ # ==== Parameters
48
+ #
49
+ # * <tt>money</tt> -- The amount to be authorized as an Integer value in cents.
50
+ # * <tt>creditcard</tt> -- The CreditCard details for the transaction.
51
+ # * <tt>options</tt> -- A hash of optional parameters.
52
+ #
53
+ def authorize(money, creditcard, options = {})
54
+ commit(:authorize, money, options.merge(:credit_card => creditcard))
55
+ end
56
+
57
+ # Perform a purchase, which is essentially an authorization and capture in a single operation.
58
+ #
59
+ # ==== Parameters
60
+ #
61
+ # * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
62
+ # * <tt>creditcard</tt> -- The CreditCard details for the transaction.
63
+ # * <tt>options</tt> -- A hash of optional parameters.
64
+ #
65
+ def purchase(money, creditcard, options = {})
66
+ commit(:purchase, money, options.merge(:credit_card => creditcard))
67
+ end
68
+
69
+ # Captures the funds from an authorized transaction.
70
+ #
71
+ # ==== Parameters
72
+ #
73
+ # * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
74
+ # * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
75
+ #
76
+ def capture(money, authorization, options = {})
77
+ commit(:capture, money, options.merge(:transaction_id => authorization))
78
+ end
79
+
80
+ # Void a previous transaction
81
+ #
82
+ # ==== Parameters
83
+ #
84
+ # * <tt>authorization</tt> - The authorization returned from the previous authorize request.
85
+ #
86
+ def void(authorization, options = {})
87
+ commit(:void, nil, options.merge(:transaction_id => authorization))
88
+ end
89
+
90
+ # Credit an account.
91
+ #
92
+ # This transaction is also referred to as a Refund and indicates to the gateway that
93
+ # money should flow from the merchant to the customer.
94
+ #
95
+ # ==== Parameters
96
+ #
97
+ # * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
98
+ # * <tt>identification</tt> -- The ID of the original transaction against which the credit is being issued.
99
+ # * <tt>options</tt> -- A hash of parameters.
100
+ #
101
+ #
102
+ def credit(money, identification, options = {})
103
+ deprecated CREDIT_DEPRECATION_MESSAGE
104
+ refund(money, identification, options = {})
105
+ end
106
+
107
+ def refund(money, identification, options = {})
108
+ commit(:refund, money, options.merge(:transaction_id => identification))
109
+ end
110
+
111
+ # Query the merchant account status
112
+ def query
113
+ commit(:query, nil, {})
114
+ end
115
+
116
+ private
117
+
118
+ def hosted?
119
+ @options[:pem]
120
+ end
121
+
122
+ def commit(action, money, parameters)
123
+ url = test? ? self.test_url : self.live_url
124
+
125
+ type = TYPES[action]
126
+ parameters[:trans_request_id] ||= SecureRandom.hex(10)
127
+
128
+ req = build_request(type, money, parameters)
129
+
130
+ data = ssl_post(url, req, "Content-Type" => "application/x-qbmsxml")
131
+ response = parse(type, data)
132
+ message = (response[:status_message] || '').strip
133
+
134
+ Response.new(success?(response), message, response,
135
+ :test => test?,
136
+ :authorization => response[:credit_card_trans_id],
137
+ :fraud_review => fraud_review?(response),
138
+ :avs_result => { :code => avs_result(response) },
139
+ :cvv_result => cvv_result(response)
140
+ )
141
+ end
142
+
143
+ def success?(response)
144
+ response[:status_code] == 0
145
+ end
146
+
147
+ def fraud_review?(response)
148
+ [10100, 10101].member? response[:status_code]
149
+ end
150
+
151
+ def parse(type, body)
152
+ xml = REXML::Document.new(body)
153
+
154
+ signon = REXML::XPath.first(xml, "//SignonMsgsRs/#{hosted? ? 'SignonAppCertRs' : 'SignonDesktopRs'}")
155
+ status_code = signon.attributes["statusCode"].to_i
156
+
157
+ if status_code != 0
158
+ return {
159
+ :status_code => status_code,
160
+ :status_message => signon.attributes["statusMessage"],
161
+ }
162
+ end
163
+
164
+ response = REXML::XPath.first(xml, "//QBMSXMLMsgsRs/#{type}Rs")
165
+
166
+ results = {
167
+ :status_code => response.attributes["statusCode"].to_i,
168
+ :status_message => response.attributes["statusMessage"],
169
+ }
170
+
171
+ response.elements.each do |e|
172
+ name = e.name.underscore.to_sym
173
+ value = e.text()
174
+
175
+ if old_value = results[name]
176
+ results[name] = [old_value] if !old_value.kind_of?(Array)
177
+ results[name] << value
178
+ else
179
+ results[name] = value
180
+ end
181
+ end
182
+
183
+ results
184
+ end
185
+
186
+ def build_request(type, money, parameters = {})
187
+ xml = Builder::XmlMarkup.new(:indent => 0)
188
+
189
+ xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
190
+ xml.instruct!(:qbmsxml, :version => API_VERSION)
191
+
192
+ xml.tag!("QBMSXML") do
193
+ xml.tag!("SignonMsgsRq") do
194
+ xml.tag!(hosted? ? "SignonAppCertRq" : "SignonDesktopRq") do
195
+ xml.tag!("ClientDateTime", Time.now.xmlschema)
196
+ xml.tag!("ApplicationLogin", @options[:login])
197
+ xml.tag!("ConnectionTicket", @options[:ticket])
198
+ end
199
+ end
200
+
201
+ xml.tag!("QBMSXMLMsgsRq") do
202
+ xml.tag!("#{type}Rq") do
203
+ method("build_#{type}").call(xml, money, parameters)
204
+ end
205
+ end
206
+ end
207
+
208
+ xml.target!
209
+ end
210
+
211
+ def build_CustomerCreditCardAuth(xml, money, parameters)
212
+ cc = parameters[:credit_card]
213
+ name = "#{cc.first_name} #{cc.last_name}"[0...30]
214
+
215
+ xml.tag!("TransRequestID", parameters[:trans_request_id])
216
+ xml.tag!("CreditCardNumber", cc.number)
217
+ xml.tag!("ExpirationMonth", cc.month)
218
+ xml.tag!("ExpirationYear", cc.year)
219
+ xml.tag!("IsECommerce", "true")
220
+ xml.tag!("Amount", amount(money))
221
+ xml.tag!("NameOnCard", name)
222
+ add_address(xml, parameters)
223
+ xml.tag!("CardSecurityCode", cc.verification_value) if cc.verification_value?
224
+ end
225
+
226
+ def build_CustomerCreditCardCapture(xml, money, parameters)
227
+ xml.tag!("TransRequestID", parameters[:trans_request_id])
228
+ xml.tag!("CreditCardTransID", parameters[:transaction_id])
229
+ xml.tag!("Amount", amount(money))
230
+ end
231
+
232
+ def build_CustomerCreditCardCharge(xml, money, parameters)
233
+ cc = parameters[:credit_card]
234
+ name = "#{cc.first_name} #{cc.last_name}"[0...30]
235
+
236
+ xml.tag!("TransRequestID", parameters[:trans_request_id])
237
+ xml.tag!("CreditCardNumber", cc.number)
238
+ xml.tag!("ExpirationMonth", cc.month)
239
+ xml.tag!("ExpirationYear", cc.year)
240
+ xml.tag!("IsECommerce", "true")
241
+ xml.tag!("Amount", amount(money))
242
+ xml.tag!("NameOnCard", name)
243
+ add_address(xml, parameters)
244
+ xml.tag!("CardSecurityCode", cc.verification_value) if cc.verification_value?
245
+ end
246
+
247
+ def build_CustomerCreditCardTxnVoidOrRefund(xml, money, parameters)
248
+ xml.tag!("TransRequestID", parameters[:trans_request_id])
249
+ xml.tag!("CreditCardTransID", parameters[:transaction_id])
250
+ xml.tag!("Amount", amount(money))
251
+ end
252
+
253
+ def build_CustomerCreditCardTxnVoid(xml, money, parameters)
254
+ xml.tag!("TransRequestID", parameters[:trans_request_id])
255
+ xml.tag!("CreditCardTransID", parameters[:transaction_id])
256
+ end
257
+
258
+ # Called reflectively by build_request
259
+ def build_MerchantAccountQuery(xml, money, parameters)
260
+ end
261
+
262
+ def add_address(xml, parameters)
263
+ if address = parameters[:billing_address] || parameters[:address]
264
+ xml.tag!("CreditCardAddress", (address[:address1] || "")[0...30])
265
+ xml.tag!("CreditCardPostalCode", (address[:zip] || "")[0...9])
266
+ end
267
+ end
268
+
269
+ def cvv_result(response)
270
+ case response[:card_security_code_match]
271
+ when "Pass" then 'M'
272
+ when "Fail" then 'N'
273
+ when "NotAvailable" then 'P'
274
+ end
275
+ end
276
+
277
+ def avs_result(response)
278
+ case "#{response[:avs_street]}|#{response[:avs_zip]}"
279
+ when "Pass|Pass" then "D"
280
+ when "Pass|Fail" then "A"
281
+ when "Pass|NotAvailable" then "B"
282
+ when "Fail|Pass" then "Z"
283
+ when "Fail|Fail" then "C"
284
+ when "Fail|NotAvailable" then "N"
285
+ when "NotAvailable|Pass" then "P"
286
+ when "NotAvailable|Fail" then "N"
287
+ when "NotAvailable|NotAvailable" then "U"
288
+ end
289
+ end
290
+ end
291
+ end
292
+ end