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,320 @@
1
+ require "nokogiri"
2
+ require "cgi"
3
+
4
+ module ActiveMerchant #:nodoc:
5
+ module Billing #:nodoc:
6
+ class EwayRapidGateway < Gateway
7
+ self.test_url = "https://api.sandbox.ewaypayments.com/"
8
+ self.live_url = "https://api.ewaypayments.com/"
9
+
10
+ self.money_format = :cents
11
+ self.supported_countries = ["AU"]
12
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
13
+ self.homepage_url = "http://www.eway.com.au/"
14
+ self.display_name = "eWAY Rapid 3.0"
15
+ self.default_currency = "AUD"
16
+
17
+ def initialize(options = {})
18
+ requires!(options, :login, :password)
19
+ super
20
+ end
21
+
22
+ # Public: Run a purchase transaction. Treats the Rapid 3.0 transparent
23
+ # redirect as an API endpoint in order to conform to the standard
24
+ # ActiveMerchant #purchase API.
25
+ #
26
+ # amount - The monetary amount of the transaction in cents.
27
+ # options - A standard ActiveMerchant options hash:
28
+ # :order_id - A merchant-supplied identifier for the
29
+ # transaction (optional).
30
+ # :description - A merchant-supplied description of the
31
+ # transaction (optional).
32
+ # :currency - Three letter currency code for the
33
+ # transaction (default: "AUD")
34
+ # :billing_address - Standard ActiveMerchant address hash
35
+ # (optional).
36
+ # :shipping_address - Standard ActiveMerchant address hash
37
+ # (optional).
38
+ # :ip - The ip of the consumer initiating the
39
+ # transaction (optional).
40
+ # :application_id - A string identifying the application
41
+ # submitting the transaction
42
+ # (default: "https://github.com/Shopify/active_merchant")
43
+ #
44
+ # Returns an ActiveMerchant::Billing::Response object
45
+ def purchase(amount, payment_method, options={})
46
+ MultiResponse.new.tap do |r|
47
+ # Rather than follow the redirect, we detect the 302 and capture the
48
+ # token out of the Location header in the run_purchase step. But we
49
+ # still need a placeholder url to pass to eWay, and that is what
50
+ # example.com is used for here.
51
+ r.process{setup_purchase(amount, options.merge(:redirect_url => "http://example.com/"))}
52
+ r.process{run_purchase(r.authorization, payment_method, r.params["formactionurl"])}
53
+ r.process{status(r.authorization)}
54
+ end
55
+ end
56
+
57
+ # Public: Acquire the token necessary to run a transparent redirect.
58
+ #
59
+ # amount - The monetary amount of the transaction in cents.
60
+ # options - A supplemented ActiveMerchant options hash:
61
+ # :redirect_url - The url to return the customer to after
62
+ # the transparent redirect is completed
63
+ # (required).
64
+ # :order_id - A merchant-supplied identifier for the
65
+ # transaction (optional).
66
+ # :description - A merchant-supplied description of the
67
+ # transaction (optional).
68
+ # :currency - Three letter currency code for the
69
+ # transaction (default: "AUD")
70
+ # :billing_address - Standard ActiveMerchant address hash
71
+ # (optional).
72
+ # :shipping_address - Standard ActiveMerchant address hash
73
+ # (optional).
74
+ # :ip - The ip of the consumer initiating the
75
+ # transaction (optional).
76
+ # :application_id - A string identifying the application
77
+ # submitting the transaction
78
+ # (default: "https://github.com/Shopify/active_merchant")
79
+ #
80
+ # Returns an EwayRapidResponse object, which conforms to the
81
+ # ActiveMerchant::Billing::Response API, but also exposes #form_url.
82
+ def setup_purchase(amount, options={})
83
+ requires!(options, :redirect_url)
84
+ request = build_xml_request("CreateAccessCodeRequest") do |doc|
85
+ add_metadata(doc, options)
86
+ add_invoice(doc, amount, options)
87
+ add_customer_data(doc, options)
88
+ end
89
+
90
+ commit(url_for("CreateAccessCode"), request)
91
+ end
92
+
93
+ # Public: Retrieve the status of a transaction.
94
+ #
95
+ # identification - The Eway Rapid 3.0 access code for the transaction
96
+ # (returned as the response.authorization by
97
+ # #setup_purchase).
98
+ #
99
+ # Returns an EwayRapidResponse object.
100
+ def status(identification)
101
+ request = build_xml_request("GetAccessCodeResultRequest") do |doc|
102
+ doc.AccessCode identification
103
+ end
104
+ commit(url_for("GetAccessCodeResult"), request)
105
+ end
106
+
107
+ # Public: Store card details and return a valid token
108
+ #
109
+ # options - A supplemented ActiveMerchant options hash:
110
+ # :order_id - A merchant-supplied identifier for the
111
+ # transaction (optional).
112
+ # :billing_address - Standard ActiveMerchant address hash
113
+ # (required).
114
+ # :ip - The ip of the consumer initiating the
115
+ # transaction (optional).
116
+ # :application_id - A string identifying the application
117
+ # submitting the transaction
118
+ # (default: "https://github.com/Shopify/active_merchant")
119
+ def store(payment_method, options = {})
120
+ requires!(options, :billing_address)
121
+ purchase(0, payment_method, options.merge(:request_method => "CreateTokenCustomer"))
122
+ end
123
+
124
+ private
125
+
126
+ def run_purchase(identification, payment_method, endpoint)
127
+ post = {
128
+ "accesscode" => identification
129
+ }
130
+ add_credit_card(post, payment_method)
131
+
132
+ commit_form(endpoint, build_form_request(post))
133
+ end
134
+
135
+ def add_metadata(doc, options)
136
+ doc.RedirectUrl(options[:redirect_url])
137
+ doc.CustomerIP options[:ip] if options[:ip]
138
+ doc.Method options[:request_method] || "ProcessPayment"
139
+ doc.DeviceID(options[:application_id] || application_id)
140
+ end
141
+
142
+ def add_invoice(doc, money, options)
143
+ doc.Payment do
144
+ doc.TotalAmount amount(money)
145
+ doc.InvoiceReference options[:order_id]
146
+ doc.InvoiceDescription options[:description]
147
+ currency_code = (options[:currency] || currency(money) || default_currency)
148
+ doc.CurrencyCode currency_code
149
+ end
150
+ end
151
+
152
+ def add_customer_data(doc, options)
153
+ doc.Customer do
154
+ add_address(doc, (options[:billing_address] || options[:address]), {:email => options[:email]})
155
+ end
156
+ doc.ShippingAddress do
157
+ add_address(doc, options[:shipping_address], {:skip_company => true})
158
+ end
159
+ end
160
+
161
+ def add_address(doc, address, options={})
162
+ return unless address
163
+ if name = address[:name]
164
+ parts = name.split(/\s+/)
165
+ doc.FirstName parts.shift if parts.size > 1
166
+ doc.LastName parts.join(" ")
167
+ end
168
+ doc.Title address[:title]
169
+ doc.CompanyName address[:company] unless options[:skip_company]
170
+ doc.Street1 address[:address1]
171
+ doc.Street2 address[:address2]
172
+ doc.City address[:city]
173
+ doc.State address[:state]
174
+ doc.PostalCode address[:zip]
175
+ doc.Country address[:country].to_s.downcase
176
+ doc.Phone address[:phone]
177
+ doc.Fax address[:fax]
178
+ doc.Email options[:email]
179
+ end
180
+
181
+ def add_credit_card(post, credit_card)
182
+ post["cardname"] = credit_card.name
183
+ post["cardnumber"] = credit_card.number
184
+ post["cardexpirymonth"] = credit_card.month
185
+ post["cardexpiryyear"] = credit_card.year
186
+ post["cardcvn"] = credit_card.verification_value
187
+ end
188
+
189
+ def build_xml_request(root)
190
+ builder = Nokogiri::XML::Builder.new
191
+ builder.__send__(root) do |doc|
192
+ yield(doc)
193
+ end
194
+ builder.to_xml
195
+ end
196
+
197
+ def build_form_request(post)
198
+ request = []
199
+ post.each do |key, value|
200
+ request << "EWAY_#{key.upcase}=#{CGI.escape(value.to_s)}"
201
+ end
202
+ request.join("&")
203
+ end
204
+
205
+ def url_for(action)
206
+ (test? ? test_url : live_url) + action + ".xml"
207
+ end
208
+
209
+ def commit(url, request, form_post=false)
210
+ headers = {
211
+ "Authorization" => ("Basic " + Base64.strict_encode64(@options[:login].to_s + ":" + @options[:password].to_s).chomp),
212
+ "Content-Type" => "text/xml"
213
+ }
214
+
215
+ raw = parse(ssl_post(url, request, headers))
216
+
217
+ succeeded = success?(raw)
218
+ EwayRapidResponse.new(
219
+ succeeded,
220
+ message_from(succeeded, raw),
221
+ raw,
222
+ :authorization => authorization_from(raw),
223
+ :test => test?,
224
+ :avs_result => avs_result_from(raw),
225
+ :cvv_result => cvv_result_from(raw)
226
+ )
227
+ rescue ActiveMerchant::ResponseError => e
228
+ return EwayRapidResponse.new(false, e.response.message, {:status_code => e.response.code}, :test => test?)
229
+ end
230
+
231
+ def commit_form(url, request)
232
+ http_response = raw_ssl_request(:post, url, request)
233
+
234
+ success = (http_response.code.to_s == "302")
235
+ message = (success ? "Succeeded" : http_response.body)
236
+ if success
237
+ authorization = CGI.unescape(http_response["Location"].split("=").last)
238
+ end
239
+ Response.new(success, message, {:location => http_response["Location"]}, :authorization => authorization, :test => test?)
240
+ end
241
+
242
+ def parse(xml)
243
+ response = {}
244
+
245
+ doc = Nokogiri::XML(xml)
246
+ doc.root.xpath("*").each do |node|
247
+ if (node.elements.size == 0)
248
+ response[node.name.downcase.to_sym] = node.text
249
+ else
250
+ node.elements.each do |childnode|
251
+ name = "#{node.name.downcase}_#{childnode.name.downcase}"
252
+ response[name.to_sym] = childnode.text
253
+ end
254
+ end
255
+ end unless doc.root.nil?
256
+
257
+ response
258
+ end
259
+
260
+ def success?(response)
261
+ if response[:errors]
262
+ false
263
+ elsif response[:responsecode] == "00"
264
+ true
265
+ elsif response[:transactionstatus]
266
+ (response[:transactionstatus] == "true")
267
+ else
268
+ true
269
+ end
270
+ end
271
+
272
+ def message_from(succeeded, response)
273
+ if response[:errors]
274
+ response[:errors]
275
+ elsif response[:responsecode]
276
+ ActiveMerchant::Billing::EwayGateway::MESSAGES[response[:responsecode]]
277
+ elsif response[:responsemessage]
278
+ response[:responsemessage]
279
+ elsif succeeded
280
+ "Succeeded"
281
+ else
282
+ "Failed"
283
+ end
284
+ end
285
+
286
+ def authorization_from(response)
287
+ response[:accesscode]
288
+ end
289
+
290
+ def avs_result_from(response)
291
+ code = case response[:verification_address]
292
+ when "Valid"
293
+ "M"
294
+ when "Invalid"
295
+ "N"
296
+ else
297
+ "I"
298
+ end
299
+ {:code => code}
300
+ end
301
+
302
+ def cvv_result_from(response)
303
+ case response[:verification_cvn]
304
+ when "Valid"
305
+ "M"
306
+ when "Invalid"
307
+ "N"
308
+ else
309
+ "P"
310
+ end
311
+ end
312
+
313
+ class EwayRapidResponse < ActiveMerchant::Billing::Response
314
+ def form_url
315
+ params["formactionurl"]
316
+ end
317
+ end
318
+ end
319
+ end
320
+ end
@@ -0,0 +1,218 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class ExactGateway < Gateway
4
+ self.live_url = self.test_url = 'https://secure2.e-xact.com/vplug-in/transaction/rpc-enc/service.asmx'
5
+
6
+ API_VERSION = "8.5"
7
+
8
+ TEST_LOGINS = [ {:login => "A00049-01", :password => "test1"},
9
+ {:login => "A00427-01", :password => "testus"} ]
10
+
11
+ TRANSACTIONS = { :sale => "00",
12
+ :authorization => "01",
13
+ :capture => "32",
14
+ :credit => "34" }
15
+
16
+
17
+ ENVELOPE_NAMESPACES = { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
18
+ 'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
19
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
20
+ }
21
+
22
+ SEND_AND_COMMIT_ATTRIBUTES = { 'xmlns:n1' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/Request",
23
+ 'env:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'
24
+ }
25
+
26
+ SEND_AND_COMMIT_SOURCE_ATTRIBUTES = { 'xmlns:n2' => 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes',
27
+ 'xsi:type' => 'n2:Transaction'
28
+ }
29
+
30
+ POST_HEADERS = { 'soapAction' => "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/SendAndCommit",
31
+ 'Content-Type' => 'text/xml'
32
+ }
33
+
34
+ SUCCESS = "true"
35
+
36
+ SENSITIVE_FIELDS = [ :verification_str2, :expiry_date, :card_number ]
37
+
38
+ self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover]
39
+ self.supported_countries = ['CA', 'US']
40
+ self.homepage_url = 'http://www.e-xact.com'
41
+ self.display_name = 'E-xact'
42
+
43
+ def initialize(options = {})
44
+ requires!(options, :login, :password)
45
+
46
+ super
47
+ end
48
+
49
+ def authorize(money, credit_card, options = {})
50
+ commit(:authorization, build_sale_or_authorization_request(money, credit_card, options))
51
+ end
52
+
53
+ def purchase(money, credit_card, options = {})
54
+ commit(:sale, build_sale_or_authorization_request(money, credit_card, options))
55
+ end
56
+
57
+ def capture(money, authorization, options = {})
58
+ commit(:capture, build_capture_or_credit_request(money, authorization, options))
59
+ end
60
+
61
+ def credit(money, authorization, options = {})
62
+ deprecated CREDIT_DEPRECATION_MESSAGE
63
+ refund(money, authorization, options)
64
+ end
65
+
66
+ def refund(money, authorization, options = {})
67
+ commit(:credit, build_capture_or_credit_request(money, authorization, options))
68
+ end
69
+
70
+ private
71
+ def build_request(action, body)
72
+ xml = Builder::XmlMarkup.new
73
+
74
+ xml.instruct!
75
+ xml.tag! 'env:Envelope', ENVELOPE_NAMESPACES do
76
+ xml.tag! 'env:Body' do
77
+ xml.tag! 'n1:SendAndCommit', SEND_AND_COMMIT_ATTRIBUTES do
78
+ xml.tag! 'SendAndCommitSource', SEND_AND_COMMIT_SOURCE_ATTRIBUTES do
79
+ add_credentials(xml)
80
+ add_transaction_type(xml, action)
81
+ xml << body
82
+ end
83
+ end
84
+ end
85
+ end
86
+ xml.target!
87
+ end
88
+
89
+ def build_sale_or_authorization_request(money, credit_card, options)
90
+ xml = Builder::XmlMarkup.new
91
+
92
+ add_amount(xml, money)
93
+ add_credit_card(xml, credit_card)
94
+ add_customer_data(xml, options)
95
+ add_invoice(xml, options)
96
+
97
+ xml.target!
98
+ end
99
+
100
+ def build_capture_or_credit_request(money, identification, options)
101
+ xml = Builder::XmlMarkup.new
102
+
103
+ add_identification(xml, identification)
104
+ add_amount(xml, money)
105
+ add_customer_data(xml, options)
106
+
107
+ xml.target!
108
+ end
109
+
110
+ def add_credentials(xml)
111
+ xml.tag! 'ExactID', @options[:login]
112
+ xml.tag! 'Password', @options[:password]
113
+ end
114
+
115
+ def add_transaction_type(xml, action)
116
+ xml.tag! 'Transaction_Type', TRANSACTIONS[action]
117
+ end
118
+
119
+ def add_identification(xml, identification)
120
+ authorization_num, transaction_tag = identification.split(';')
121
+
122
+ xml.tag! 'Authorization_Num', authorization_num
123
+ xml.tag! 'Transaction_Tag', transaction_tag
124
+ end
125
+
126
+ def add_amount(xml, money)
127
+ xml.tag! 'DollarAmount', amount(money)
128
+ end
129
+
130
+ def add_credit_card(xml, credit_card)
131
+ xml.tag! 'Card_Number', credit_card.number
132
+ xml.tag! 'Expiry_Date', expdate(credit_card)
133
+ xml.tag! 'CardHoldersName', credit_card.name
134
+
135
+ if credit_card.verification_value?
136
+ xml.tag! 'CVD_Presence_Ind', '1'
137
+ xml.tag! 'VerificationStr2', credit_card.verification_value
138
+ end
139
+ end
140
+
141
+ def add_customer_data(xml, options)
142
+ xml.tag! 'Customer_Ref', options[:customer]
143
+ xml.tag! 'Client_IP', options[:ip]
144
+ xml.tag! 'Client_Email', options[:email]
145
+ end
146
+
147
+ def add_address(xml, options)
148
+ if address = options[:billing_address] || options[:address]
149
+ xml.tag! 'ZipCode', address[:zip]
150
+ end
151
+ end
152
+
153
+ def add_invoice(xml, options)
154
+ xml.tag! 'Reference_No', options[:order_id]
155
+ xml.tag! 'Reference_3', options[:description]
156
+ end
157
+
158
+ def expdate(credit_card)
159
+ "#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
160
+ end
161
+
162
+ def commit(action, request)
163
+ response = parse(ssl_post(self.live_url, build_request(action, request), POST_HEADERS))
164
+
165
+ Response.new(successful?(response), message_from(response), response,
166
+ :test => test?,
167
+ :authorization => authorization_from(response),
168
+ :avs_result => { :code => response[:avs] },
169
+ :cvv_result => response[:cvv2]
170
+ )
171
+ end
172
+
173
+ def successful?(response)
174
+ response[:transaction_approved] == SUCCESS
175
+ end
176
+
177
+ def authorization_from(response)
178
+ if response[:authorization_num] && response[:transaction_tag]
179
+ "#{response[:authorization_num]};#{response[:transaction_tag]}"
180
+ else
181
+ ''
182
+ end
183
+ end
184
+
185
+ def message_from(response)
186
+ if response[:faultcode] && response[:faultstring]
187
+ response[:faultstring]
188
+ elsif response[:error_number] != '0'
189
+ response[:error_description]
190
+ else
191
+ result = response[:exact_message] || ''
192
+ result << " - #{response[:bank_message]}" unless response[:bank_message].blank?
193
+ result
194
+ end
195
+ end
196
+
197
+ def parse(xml)
198
+ response = {}
199
+ xml = REXML::Document.new(xml)
200
+
201
+ if root = REXML::XPath.first(xml, "//types:TransactionResult")
202
+ parse_elements(response, root)
203
+ elsif root = REXML::XPath.first(xml, "//soap:Fault")
204
+ parse_elements(response, root)
205
+ end
206
+
207
+ response.delete_if{ |k,v| SENSITIVE_FIELDS.include?(k) }
208
+ end
209
+
210
+ def parse_elements(response, root)
211
+ root.elements.to_a.each do |node|
212
+ response[node.name.gsub(/EXact/, 'Exact').underscore.to_sym] = (node.text || '').strip
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
218
+