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,353 @@
1
+ require 'rexml/document'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+
6
+ # In NZ DPS supports ANZ, Westpac, National Bank, ASB and BNZ.
7
+ # In Australia DPS supports ANZ, NAB, Westpac, CBA, St George and Bank of South Australia.
8
+ # The Maybank in Malaysia is supported and the Citibank for Singapore.
9
+ class PaymentExpressGateway < Gateway
10
+ self.default_currency = 'NZD'
11
+ # PS supports all major credit cards; Visa, Mastercard, Amex, Diners, BankCard & JCB.
12
+ # Various white label cards can be accepted as well; Farmers, AirNZCard and Elders etc.
13
+ # Please note that not all acquirers and Eftpos networks can support some of these card types.
14
+ # VISA, Mastercard, Diners Club and Farmers cards are supported
15
+ #
16
+ # However, regular accounts with DPS only support VISA and Mastercard
17
+ self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club, :jcb ]
18
+
19
+ self.supported_countries = %w[ AU CA DE ES FR GB HK IE MY NL NZ SG US ZA ]
20
+
21
+ self.homepage_url = 'http://www.paymentexpress.com/'
22
+ self.display_name = 'PaymentExpress'
23
+
24
+ self.live_url = self.test_url = 'https://sec.paymentexpress.com/pxpost.aspx'
25
+
26
+ APPROVED = '1'
27
+
28
+ TRANSACTIONS = {
29
+ :purchase => 'Purchase',
30
+ :credit => 'Refund',
31
+ :authorization => 'Auth',
32
+ :capture => 'Complete',
33
+ :validate => 'Validate'
34
+ }
35
+
36
+ # We require the DPS gateway username and password when the object is created.
37
+ #
38
+ # The PaymentExpress gateway also supports a :use_custom_payment_token boolean option.
39
+ # If set to true the gateway will use BillingId for the Token type. If set to false,
40
+ # then the token will be sent as the DPS specified "DpsBillingId". This is per the documentation at
41
+ # http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#Tokenbilling
42
+ def initialize(options = {})
43
+ requires!(options, :login, :password)
44
+ super
45
+ end
46
+
47
+ # Funds are transferred immediately.
48
+ #
49
+ # `payment_source` can be a usual ActiveMerchant credit_card object, or can also
50
+ # be a string of the `DpsBillingId` or `BillingId` which can be gotten through the
51
+ # store method. If you are using a `BillingId` instead of `DpsBillingId` you must
52
+ # also set the instance method `#use_billing_id_for_token` to true, see the `#store`
53
+ # method for an example of how to do this.
54
+ def purchase(money, payment_source, options = {})
55
+ request = build_purchase_or_authorization_request(money, payment_source, options)
56
+ commit(:purchase, request)
57
+ end
58
+
59
+ # NOTE: Perhaps in options we allow a transaction note to be inserted
60
+ # Verifies that funds are available for the requested card and amount and reserves the specified amount.
61
+ # See: http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#Authcomplete
62
+ #
63
+ # `payment_source` can be a usual ActiveMerchant credit_card object or a token, see #purchased method
64
+ def authorize(money, payment_source, options = {})
65
+ request = build_purchase_or_authorization_request(money, payment_source, options)
66
+ commit(:authorization, request)
67
+ end
68
+
69
+ # Transfer pre-authorized funds immediately
70
+ # See: http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#Authcomplete
71
+ def capture(money, identification, options = {})
72
+ request = build_capture_or_credit_request(money, identification, options)
73
+ commit(:capture, request)
74
+ end
75
+
76
+ # Refund funds to the card holder
77
+ def refund(money, identification, options = {})
78
+ requires!(options, :description)
79
+
80
+ request = build_capture_or_credit_request(money, identification, options)
81
+ commit(:credit, request)
82
+ end
83
+
84
+ def credit(money, identification, options = {})
85
+ deprecated CREDIT_DEPRECATION_MESSAGE
86
+ refund(money, identification, options)
87
+ end
88
+
89
+ # Token Based Billing
90
+ #
91
+ # Instead of storing the credit card details locally, you can store them inside the
92
+ # Payment Express system and instead bill future transactions against a token.
93
+ #
94
+ # This token can either be specified by your code or autogenerated by the PaymentExpress
95
+ # system. The default is to let PaymentExpress generate the token for you and so use
96
+ # the `DpsBillingId`. If you do not pass in any option of the `billing_id`, then the store
97
+ # method will ask PaymentExpress to create a token for you. Additionally, if you are
98
+ # using the default `DpsBillingId`, you do not have to do anything extra in the
99
+ # initialization of your gateway object.
100
+ #
101
+ # To specify and use your own token, you need to do two things.
102
+ #
103
+ # Firstly, pass in a `:billing_id` as an option in the hash of this store method. No
104
+ # validation is done on this BillingId by PaymentExpress so you must ensure that it is unique.
105
+ #
106
+ # gateway.store(credit_card, {:billing_id => 'YourUniqueBillingId'})
107
+ #
108
+ # Secondly, you will need to pass in the option `{:use_custom_payment_token => true}` when
109
+ # initializing your gateway instance, like so:
110
+ #
111
+ # gateway = ActiveMerchant::Billing::PaymentExpressGateway.new(
112
+ # :login => 'USERNAME',
113
+ # :password => 'PASSWORD',
114
+ # :use_custom_payment_token => true
115
+ # )
116
+ #
117
+ # see: http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#Tokenbilling
118
+ #
119
+ # Note, once stored, PaymentExpress does not support unstoring a stored card.
120
+ def store(credit_card, options = {})
121
+ request = build_token_request(credit_card, options)
122
+ commit(:validate, request)
123
+ end
124
+
125
+ private
126
+
127
+ def use_custom_payment_token?
128
+ @options[:use_custom_payment_token]
129
+ end
130
+
131
+ def build_purchase_or_authorization_request(money, payment_source, options)
132
+ result = new_transaction
133
+
134
+ if payment_source.is_a?(String)
135
+ add_billing_token(result, payment_source)
136
+ else
137
+ add_credit_card(result, payment_source)
138
+ end
139
+
140
+ add_amount(result, money, options)
141
+ add_invoice(result, options)
142
+ add_address_verification_data(result, options)
143
+ add_optional_elements(result, options)
144
+ result
145
+ end
146
+
147
+ def build_capture_or_credit_request(money, identification, options)
148
+ result = new_transaction
149
+
150
+ add_amount(result, money, options)
151
+ add_invoice(result, options)
152
+ add_reference(result, identification)
153
+ add_optional_elements(result, options)
154
+ result
155
+ end
156
+
157
+ def build_token_request(credit_card, options)
158
+ result = new_transaction
159
+ add_credit_card(result, credit_card)
160
+ add_amount(result, 100, options) #need to make an auth request for $1
161
+ add_token_request(result, options)
162
+ add_optional_elements(result, options)
163
+ result
164
+ end
165
+
166
+ def add_credentials(xml)
167
+ xml.add_element("PostUsername").text = @options[:login]
168
+ xml.add_element("PostPassword").text = @options[:password]
169
+ end
170
+
171
+ def add_reference(xml, identification)
172
+ xml.add_element("DpsTxnRef").text = identification
173
+ end
174
+
175
+ def add_credit_card(xml, credit_card)
176
+ xml.add_element("CardHolderName").text = credit_card.name
177
+ xml.add_element("CardNumber").text = credit_card.number
178
+ xml.add_element("DateExpiry").text = format_date(credit_card.month, credit_card.year)
179
+
180
+ if credit_card.verification_value?
181
+ xml.add_element("Cvc2").text = credit_card.verification_value
182
+ xml.add_element("Cvc2Presence").text = "1"
183
+ end
184
+
185
+ if requires_start_date_or_issue_number?(credit_card)
186
+ xml.add_element("DateStart").text = format_date(credit_card.start_month, credit_card.start_year) unless credit_card.start_month.blank? || credit_card.start_year.blank?
187
+ xml.add_element("IssueNumber").text = credit_card.issue_number unless credit_card.issue_number.blank?
188
+ end
189
+ end
190
+
191
+ def add_billing_token(xml, token)
192
+ if use_custom_payment_token?
193
+ xml.add_element("BillingId").text = token
194
+ else
195
+ xml.add_element("DpsBillingId").text = token
196
+ end
197
+ end
198
+
199
+ def add_token_request(xml, options)
200
+ xml.add_element("BillingId").text = options[:billing_id] if options[:billing_id]
201
+ xml.add_element("EnableAddBillCard").text = 1
202
+ end
203
+
204
+ def add_amount(xml, money, options)
205
+ xml.add_element("Amount").text = amount(money)
206
+ xml.add_element("InputCurrency").text = options[:currency] || currency(money)
207
+ end
208
+
209
+ def add_transaction_type(xml, action)
210
+ xml.add_element("TxnType").text = TRANSACTIONS[action]
211
+ end
212
+
213
+ def add_invoice(xml, options)
214
+ xml.add_element("TxnId").text = options[:order_id].to_s.slice(0, 16) unless options[:order_id].blank?
215
+ xml.add_element("MerchantReference").text = options[:description].to_s.slice(0, 50) unless options[:description].blank?
216
+ end
217
+
218
+ def add_address_verification_data(xml, options)
219
+ address = options[:billing_address] || options[:address]
220
+ return if address.nil?
221
+
222
+ xml.add_element("EnableAvsData").text = 1
223
+ xml.add_element("AvsAction").text = 1
224
+
225
+ xml.add_element("AvsStreetAddress").text = address[:address1]
226
+ xml.add_element("AvsPostCode").text = address[:zip]
227
+ end
228
+
229
+ # The options hash may contain optional data which will be passed
230
+ # through the the specialized optional fields at PaymentExpress
231
+ # as follows:
232
+ #
233
+ # {
234
+ # :client_type => :web, # Possible values are: :web, :ivr, :moto, :unattended, :internet, or :recurring
235
+ # :txn_data1 => "String up to 255 characters",
236
+ # :txn_data2 => "String up to 255 characters",
237
+ # :txn_data3 => "String up to 255 characters"
238
+ # }
239
+ #
240
+ # +:client_type+, while not documented for PxPost, will be sent as
241
+ # the +ClientType+ XML element as described in the documentation for
242
+ # the PaymentExpress WebService: http://www.paymentexpress.com/Technical_Resources/Ecommerce_NonHosted/WebService#clientType
243
+ # (PaymentExpress have confirmed that this value works the same in PxPost).
244
+ # The value sent for +:client_type+ will be normalized and sent
245
+ # as one of the explicit values allowed by PxPost:
246
+ #
247
+ # :web => "Web"
248
+ # :ivr => "IVR"
249
+ # :moto => "MOTO"
250
+ # :unattended => "Unattended"
251
+ # :internet => "Internet"
252
+ # :recurring => "Recurring"
253
+ #
254
+ # If you set the +:client_type+ to any value not listed above,
255
+ # the ClientType element WILL NOT BE INCLUDED at all in the
256
+ # POST data.
257
+ #
258
+ # +:txn_data1+, +:txn_data2+, and +:txn_data3+ will be sent as
259
+ # +TxnData1+, +TxnData2+, and +TxnData3+, respectively, and are
260
+ # free form fields of the merchant's choosing, as documented here:
261
+ # http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#txndata
262
+ #
263
+ # These optional elements are added to all transaction types:
264
+ # +purchase+, +authorize+, +capture+, +refund+, +store+
265
+ def add_optional_elements(xml, options)
266
+ if client_type = normalized_client_type(options[:client_type])
267
+ xml.add_element("ClientType").text = client_type
268
+ end
269
+
270
+ xml.add_element("TxnData1").text = options[:txn_data1].to_s.slice(0,255) unless options[:txn_data1].blank?
271
+ xml.add_element("TxnData2").text = options[:txn_data2].to_s.slice(0,255) unless options[:txn_data2].blank?
272
+ xml.add_element("TxnData3").text = options[:txn_data3].to_s.slice(0,255) unless options[:txn_data3].blank?
273
+ end
274
+
275
+ def new_transaction
276
+ REXML::Document.new.add_element("Txn")
277
+ end
278
+
279
+ # Take in the request and post it to DPS
280
+ def commit(action, request)
281
+ add_credentials(request)
282
+ add_transaction_type(request, action)
283
+
284
+ # Parse the XML response
285
+ response = parse( ssl_post(self.live_url, request.to_s) )
286
+
287
+ # Return a response
288
+ PaymentExpressResponse.new(response[:success] == APPROVED, message_from(response), response,
289
+ :test => response[:test_mode] == '1',
290
+ :authorization => authorization_from(action, response)
291
+ )
292
+ end
293
+
294
+ # Response XML documentation: http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#XMLTxnOutput
295
+ def parse(xml_string)
296
+ response = {}
297
+
298
+ xml = REXML::Document.new(xml_string)
299
+
300
+ # Gather all root elements such as HelpText
301
+ xml.elements.each('Txn/*') do |element|
302
+ response[element.name.underscore.to_sym] = element.text unless element.name == 'Transaction'
303
+ end
304
+
305
+ # Gather all transaction elements and prefix with "account_"
306
+ # So we could access the MerchantResponseText by going
307
+ # response[account_merchant_response_text]
308
+ xml.elements.each('Txn/Transaction/*') do |element|
309
+ response[element.name.underscore.to_sym] = element.text
310
+ end
311
+
312
+ response
313
+ end
314
+
315
+ def message_from(response)
316
+ (response[:card_holder_help_text] || response[:response_text])
317
+ end
318
+
319
+ def authorization_from(action, response)
320
+ case action
321
+ when :validate
322
+ (response[:billing_id] || response[:dps_billing_id])
323
+ else
324
+ response[:dps_txn_ref]
325
+ end
326
+ end
327
+
328
+ def format_date(month, year)
329
+ "#{format(month, :two_digits)}#{format(year, :two_digits)}"
330
+ end
331
+
332
+ def normalized_client_type(client_type_from_options)
333
+ case client_type_from_options.to_s.downcase
334
+ when 'web' then "Web"
335
+ when 'ivr' then "IVR"
336
+ when 'moto' then "MOTO"
337
+ when 'unattended' then "Unattended"
338
+ when 'internet' then "Internet"
339
+ when 'recurring' then "Recurring"
340
+ else nil
341
+ end
342
+ end
343
+ end
344
+
345
+ class PaymentExpressResponse < Response
346
+ # add a method to response so we can easily get the token
347
+ # for Validate transactions
348
+ def token
349
+ @params["billing_id"] || @params["dps_billing_id"]
350
+ end
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,179 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class PaymillGateway < Gateway
4
+ self.supported_countries = %w(AD AT BE BG CH CY CZ DE DK EE ES FI FO FR GB
5
+ GI GR HU IE IL IS IT LI LT LU LV MT NL NO PL
6
+ PT RO SE SI SK TR VA)
7
+
8
+ self.supported_cardtypes = [:visa, :master]
9
+ self.homepage_url = 'https://paymill.com'
10
+ self.display_name = 'PAYMILL'
11
+ self.money_format = :cents
12
+ self.default_currency = 'EUR'
13
+
14
+ def initialize(options = {})
15
+ requires!(options, :public_key, :private_key)
16
+ super
17
+ end
18
+
19
+ def purchase(money, payment_method, options = {})
20
+ case payment_method
21
+ when String
22
+ purchase_with_token(money, payment_method, options)
23
+ else
24
+ MultiResponse.run do |r|
25
+ r.process { save_card(payment_method) }
26
+ r.process { purchase_with_token(money, r.authorization, options) }
27
+ end
28
+ end
29
+ end
30
+
31
+ def authorize(money, payment_method, options = {})
32
+ case payment_method
33
+ when String
34
+ authorize_with_token(money, payment_method, options)
35
+ else
36
+ MultiResponse.run do |r|
37
+ r.process { save_card(payment_method) }
38
+ r.process { authorize_with_token(money, r.authorization, options) }
39
+ end
40
+ end
41
+ end
42
+
43
+ def capture(money, authorization, options = {})
44
+ post = {}
45
+
46
+ add_amount(post, money, options)
47
+ post[:preauthorization] = preauth(authorization)
48
+ post[:description] = options[:description]
49
+ commit(:post, 'transactions', post)
50
+ end
51
+
52
+ def refund(money, authorization, options={})
53
+ post = {}
54
+
55
+ post[:amount] = amount(money)
56
+ post[:description] = options[:description]
57
+ commit(:post, "refunds/#{transaction_id(authorization)}", post)
58
+ end
59
+
60
+ def store(credit_card, options={})
61
+ save_card(credit_card)
62
+ end
63
+
64
+ private
65
+
66
+ def add_credit_card(post, credit_card)
67
+ post['account.number'] = credit_card.number
68
+ post['account.expiry.month'] = sprintf("%.2i", credit_card.month)
69
+ post['account.expiry.year'] = sprintf("%.4i", credit_card.year)
70
+ post['account.verification'] = credit_card.verification_value
71
+ end
72
+
73
+ def headers
74
+ { 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:private_key]}:X").chomp) }
75
+ end
76
+
77
+ def commit(method, url, parameters=nil)
78
+ begin
79
+ raw_response = ssl_request(method, "https://api.paymill.com/v2/#{url}", post_data(parameters), headers)
80
+ rescue ResponseError => e
81
+ parsed = JSON.parse(e.response.body)
82
+ return Response.new(false, parsed['error'], parsed, {})
83
+ end
84
+
85
+ response_from(raw_response)
86
+ end
87
+
88
+ def response_from(raw_response)
89
+ parsed = JSON.parse(raw_response)
90
+
91
+ options = {
92
+ :authorization => authorization_from(parsed),
93
+ :test => (parsed['mode'] == 'test'),
94
+ }
95
+
96
+ Response.new(true, 'Transaction approved', parsed, options)
97
+ end
98
+
99
+ def authorization_from(parsed_response)
100
+ [
101
+ parsed_response['data']['id'],
102
+ parsed_response['data']['preauthorization'].try(:[], 'id')
103
+ ].join(";")
104
+ end
105
+
106
+ def purchase_with_token(money, card_token, options)
107
+ post = {}
108
+
109
+ add_amount(post, money, options)
110
+ post[:token] = card_token
111
+ post[:description] = options[:description]
112
+ commit(:post, 'transactions', post)
113
+ end
114
+
115
+ def authorize_with_token(money, card_token, options)
116
+ post = {}
117
+
118
+ add_amount(post, money, options)
119
+ post[:token] = card_token
120
+ commit(:post, 'preauthorizations', post)
121
+ end
122
+
123
+ def save_card(credit_card)
124
+ post = {}
125
+
126
+ add_credit_card(post, credit_card)
127
+ post['channel.id'] = @options[:public_key]
128
+ post['jsonPFunction'] = 'jsonPFunction'
129
+ post['transaction.mode'] = (test? ? 'CONNECTOR_TEST' : 'LIVE')
130
+
131
+ begin
132
+ raw_response = ssl_request(:get, "#{save_card_url}?#{post_data(post)}", nil, {})
133
+ rescue ResponseError => e
134
+ return Response.new(false, e.response.body, e.response.body, {})
135
+ end
136
+
137
+ response_for_save_from(raw_response)
138
+ end
139
+
140
+ def response_for_save_from(raw_response)
141
+ options = { :test => test? }
142
+
143
+ parsed = JSON.parse(raw_response.sub(/jsonPFunction\(/, '').sub(/\)\z/, ''))
144
+ if parsed['error']
145
+ succeeded = false
146
+ message = parsed['error']['message']
147
+ else
148
+ succeeded = parsed['transaction']['processing']['result'] == 'ACK'
149
+ message = parsed['transaction']['processing']['return']['message']
150
+ options[:authorization] = parsed['transaction']['identification']['uniqueId'] if succeeded
151
+ end
152
+
153
+ Response.new(succeeded, message, parsed, options)
154
+ end
155
+
156
+ def save_card_url
157
+ (test? ? 'https://test-token.paymill.com' : 'https://token-v2.paymill.de')
158
+ end
159
+
160
+ def post_data(params)
161
+ no_blanks = params.reject { |key, value| value.blank? }
162
+ no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
163
+ end
164
+
165
+ def add_amount(post, money, options)
166
+ post[:amount] = amount(money)
167
+ post[:currency] = (options[:currency] || currency(money))
168
+ end
169
+
170
+ def preauth(authorization)
171
+ authorization.split(";").last
172
+ end
173
+
174
+ def transaction_id(authorization)
175
+ authorization.split(';').first
176
+ end
177
+ end
178
+ end
179
+ end