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,311 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ # The Mercury gateway integration by default requires that the Mercury
4
+ # account being used has tokenization turned. This enables the use of
5
+ # capture/refund/void without having to pass the credit card back in each
6
+ # time. Only the "OneTime" tokenization is used; there is no use of
7
+ # "Recurring" tokenization.
8
+ #
9
+ # If you don't wish to enable Mercury tokenization, you can pass
10
+ # <code>:tokenization => false</code> as an option when creating the
11
+ # gateway. If you do so, then passing a +:credit_card+ option to +capture+
12
+ # and +refund+ will become mandatory.
13
+ class MercuryGateway < Gateway
14
+ URLS = {
15
+ :test => 'https://w1.mercurydev.net/ws/ws.asmx',
16
+ :live => 'https://w1.mercurypay.com/ws/ws.asmx'
17
+ }
18
+
19
+ self.homepage_url = 'http://www.mercurypay.com'
20
+ self.display_name = 'Mercury'
21
+ self.supported_countries = ['US']
22
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
23
+ self.default_currency = 'USD'
24
+
25
+ def initialize(options = {})
26
+ requires!(options, :login, :password)
27
+ @use_tokenization = (!options.has_key?(:tokenization) || options[:tokenization])
28
+ super
29
+ end
30
+
31
+ def purchase(money, credit_card, options = {})
32
+ requires!(options, :order_id)
33
+
34
+ request = build_non_authorized_request('Sale', money, credit_card, options)
35
+ commit('Sale', request)
36
+ end
37
+
38
+ def credit(money, credit_card, options = {})
39
+ requires!(options, :order_id)
40
+
41
+ request = build_non_authorized_request('Return', money, credit_card, options)
42
+ commit('Return', request)
43
+ end
44
+
45
+ def authorize(money, credit_card, options = {})
46
+ requires!(options, :order_id)
47
+
48
+ request = build_non_authorized_request('PreAuth', money, credit_card, options.merge(:authorized => money))
49
+ commit('PreAuth', request)
50
+ end
51
+
52
+ def capture(money, authorization, options = {})
53
+ requires!(options, :credit_card) unless @use_tokenization
54
+
55
+ request = build_authorized_request('PreAuthCapture', money, authorization, options[:credit_card], options.merge(:authorized => money))
56
+ commit('PreAuthCapture', request)
57
+ end
58
+
59
+ def refund(money, authorization, options = {})
60
+ requires!(options, :credit_card) unless @use_tokenization
61
+
62
+ request = build_authorized_request('Return', money, authorization, options[:credit_card], options)
63
+ commit('Return', request)
64
+ end
65
+
66
+ def void(authorization, options={})
67
+ requires!(options, :credit_card) unless @use_tokenization
68
+
69
+ if options[:try_reversal]
70
+ request = build_authorized_request('VoidSale', nil, authorization, options[:credit_card], options.merge(:reversal => true))
71
+ response = commit('VoidSale', request)
72
+
73
+ return response if response.success?
74
+ end
75
+
76
+ request = build_authorized_request('VoidSale', nil, authorization, options[:credit_card], options)
77
+ commit('VoidSale', request)
78
+ end
79
+
80
+ private
81
+
82
+ def build_non_authorized_request(action, money, credit_card, options)
83
+ xml = Builder::XmlMarkup.new
84
+
85
+ xml.tag! "TStream" do
86
+ xml.tag! "Transaction" do
87
+ xml.tag! 'TranType', 'Credit'
88
+ xml.tag! 'TranCode', action
89
+ if action == 'PreAuth' || action == 'Sale'
90
+ xml.tag! "PartialAuth", "Allow"
91
+ end
92
+ add_invoice(xml, options[:order_id], nil, options)
93
+ add_reference(xml, "RecordNumberRequested")
94
+ add_customer_data(xml, options)
95
+ add_amount(xml, money, options)
96
+ add_credit_card(xml, credit_card, action)
97
+ add_address(xml, options)
98
+ end
99
+ end
100
+ xml = xml.target!
101
+ end
102
+
103
+ def build_authorized_request(action, money, authorization, credit_card, options)
104
+ xml = Builder::XmlMarkup.new
105
+
106
+ invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = split_authorization(authorization)
107
+ ref_no = invoice_no if options[:reversal]
108
+
109
+ xml.tag! "TStream" do
110
+ xml.tag! "Transaction" do
111
+ xml.tag! 'TranType', 'Credit'
112
+ if action == 'PreAuthCapture'
113
+ xml.tag! "PartialAuth", "Allow"
114
+ end
115
+ xml.tag! 'TranCode', (@use_tokenization ? (action + "ByRecordNo") : action)
116
+ add_invoice(xml, invoice_no, ref_no, options)
117
+ add_reference(xml, record_no)
118
+ add_customer_data(xml, options)
119
+ add_amount(xml, (money || amount.to_i), options)
120
+ add_credit_card(xml, credit_card, action) if credit_card
121
+ add_address(xml, options)
122
+ xml.tag! 'TranInfo' do
123
+ xml.tag! "AuthCode", auth_code
124
+ xml.tag! "AcqRefData", acq_ref_data if options[:reversal]
125
+ xml.tag! "ProcessData", process_data if options[:reversal]
126
+ end
127
+ end
128
+ end
129
+ xml = xml.target!
130
+ end
131
+
132
+ def add_invoice(xml, invoice_no, ref_no, options)
133
+ if /^\d+$/ !~ invoice_no.to_s
134
+ raise ArgumentError.new("order_id '#{invoice_no}' is not numeric as required by Mercury")
135
+ end
136
+
137
+ xml.tag! 'InvoiceNo', invoice_no
138
+ xml.tag! 'RefNo', (ref_no || invoice_no)
139
+ xml.tag! 'OperatorID', options[:merchant] if options[:merchant]
140
+ xml.tag! 'Memo', options[:description] if options[:description]
141
+ end
142
+
143
+ def add_reference(xml, record_no)
144
+ if @use_tokenization
145
+ xml.tag! "Frequency", "OneTime"
146
+ xml.tag! "RecordNo", record_no
147
+ end
148
+ end
149
+
150
+ def add_customer_data(xml, options)
151
+ xml.tag! 'IpAddress', options[:ip] if options[:ip]
152
+ if options[:customer]
153
+ xml.tag! "TranInfo" do
154
+ xml.tag! 'CustomerCode', options[:customer]
155
+ end
156
+ end
157
+ xml.tag! 'MerchantID', @options[:login]
158
+ end
159
+
160
+ def add_amount(xml, money, options = {})
161
+ xml.tag! 'Amount' do
162
+ xml.tag! 'Purchase', amount(money)
163
+ xml.tag! 'Tax', options[:tax] if options[:tax]
164
+ xml.tag! 'Authorize', amount(options[:authorized]) if options[:authorized]
165
+ xml.tag! 'Gratuity', amount(options[:tip]) if options[:tip]
166
+ end
167
+ end
168
+
169
+ CARD_CODES = {
170
+ 'visa' => 'VISA',
171
+ 'master' => 'M/C',
172
+ 'american_express' => 'AMEX',
173
+ 'discover' => 'DCVR',
174
+ 'diners_club' => 'DCLB',
175
+ 'jcb' => 'JCB'
176
+ }
177
+
178
+ def add_credit_card(xml, credit_card, action)
179
+ xml.tag! 'Account' do
180
+ xml.tag! 'AcctNo', credit_card.number
181
+ xml.tag! 'ExpDate', expdate(credit_card)
182
+ end
183
+ xml.tag! 'CardType', CARD_CODES[credit_card.brand] if credit_card.brand
184
+
185
+ include_cvv = !%w(Return PreAuthCapture).include?(action)
186
+ xml.tag! 'CVVData', credit_card.verification_value if(include_cvv && credit_card.verification_value)
187
+ end
188
+
189
+ def expdate(credit_card)
190
+ year = sprintf("%.4i", credit_card.year)
191
+ month = sprintf("%.2i", credit_card.month)
192
+
193
+ "#{month}#{year[-2..-1]}"
194
+ end
195
+
196
+ def add_address(xml, options)
197
+ if billing_address = options[:billing_address] || options[:address]
198
+ xml.tag! 'AVS' do
199
+ xml.tag! 'Address', billing_address[:address1]
200
+ xml.tag! 'Zip', billing_address[:zip]
201
+ end
202
+ end
203
+ end
204
+
205
+ def parse(action, body)
206
+ response = {}
207
+ hashify_xml!(unescape_xml(body), response)
208
+ response
209
+ end
210
+
211
+ def hashify_xml!(xml, response)
212
+ xml = REXML::Document.new(xml)
213
+
214
+ xml.elements.each("//CmdResponse/*") do |node|
215
+ response[node.name.underscore.to_sym] = node.text
216
+ end
217
+
218
+ xml.elements.each("//TranResponse/*") do |node|
219
+ if node.name.to_s == "Amount"
220
+ node.elements.each do |amt|
221
+ response[amt.name.underscore.to_sym] = amt.text
222
+ end
223
+ else
224
+ response[node.name.underscore.to_sym] = node.text
225
+ end
226
+ end
227
+ end
228
+
229
+ def endpoint_url
230
+ URLS[test? ? :test : :live]
231
+ end
232
+
233
+ def build_soap_request(body)
234
+ xml = Builder::XmlMarkup.new
235
+
236
+ xml.instruct!
237
+ xml.tag! 'soap:Envelope', ENVELOPE_NAMESPACES do
238
+ xml.tag! 'soap:Body' do
239
+ xml.tag! 'CreditTransaction', 'xmlns' => homepage_url do
240
+ xml.tag! 'tran' do
241
+ xml << escape_xml(body)
242
+ end
243
+ xml.tag! 'pw', @options[:password]
244
+ end
245
+ end
246
+ end
247
+ xml.target!
248
+ end
249
+
250
+ def build_header
251
+ {
252
+ "SOAPAction" => "http://www.mercurypay.com/CreditTransaction",
253
+ "Content-Type" => "text/xml; charset=utf-8"
254
+ }
255
+ end
256
+
257
+ SUCCESS_CODES = [ 'Approved', 'Success' ]
258
+
259
+ def commit(action, request)
260
+ response = parse(action, ssl_post(endpoint_url, build_soap_request(request), build_header))
261
+
262
+ success = SUCCESS_CODES.include?(response[:cmd_status])
263
+ message = success ? 'Success' : message_from(response)
264
+
265
+ Response.new(success, message, response,
266
+ :test => test?,
267
+ :authorization => authorization_from(response),
268
+ :avs_result => { :code => response[:avs_result] },
269
+ :cvv_result => response[:cvv_result])
270
+ end
271
+
272
+ def message_from(response)
273
+ response[:text_response]
274
+ end
275
+
276
+ def authorization_from(response)
277
+ dollars, cents = (response[:purchase] || "").split(".").collect{|e| e.to_i}
278
+ dollars ||= 0
279
+ cents ||= 0
280
+ [
281
+ response[:invoice_no],
282
+ response[:ref_no],
283
+ response[:auth_code],
284
+ response[:acq_ref_data],
285
+ response[:process_data],
286
+ response[:record_no],
287
+ ((dollars * 100) + cents).to_s
288
+ ].join(";")
289
+ end
290
+
291
+ def split_authorization(authorization)
292
+ invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = authorization.split(";")
293
+ [invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount]
294
+ end
295
+
296
+ ENVELOPE_NAMESPACES = {
297
+ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
298
+ 'xmlns:soap' => "http://schemas.xmlsoap.org/soap/envelope/",
299
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
300
+ }
301
+
302
+ def escape_xml(xml)
303
+ "\n<![CDATA[\n#{xml}\n]]>\n"
304
+ end
305
+
306
+ def unescape_xml(escaped_xml)
307
+ escaped_xml.gsub(/\&gt;/,'>').gsub(/\&lt;/,'<')
308
+ end
309
+ end
310
+ end
311
+ end
@@ -0,0 +1,322 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ # For more information on the Metrics Global Payment Gateway, visit the {Metrics Global website}[www.metricsglobal.com].
4
+ # Further documentation on AVS and CVV response codes are available under the support section of the Metrics Global
5
+ # control panel.
6
+ #
7
+ # === Metrics Global Payment Gateway Authentication
8
+ #
9
+ # The login and password for the gateway are the same as the username and password used to log in to the Metrics Global
10
+ # control panel. Contact Metrics Global support to receive credentials for the control panel.
11
+ #
12
+ # === Demo Account
13
+ #
14
+ # There is a public demo account available with the following credentials:
15
+ #
16
+ # Login: demo
17
+ # Password: password
18
+ class MetricsGlobalGateway < Gateway
19
+ API_VERSION = '3.1'
20
+
21
+ class_attribute :test_url, :live_url
22
+
23
+ self.test_url = "https://secure.metricsglobalgateway.com/gateway/transact.dll?testing=true"
24
+ self.live_url = "https://secure.metricsglobalgateway.com/gateway/transact.dll"
25
+
26
+ class_attribute :duplicate_window
27
+
28
+ APPROVED, DECLINED, ERROR, FRAUD_REVIEW = 1, 2, 3, 4
29
+
30
+ RESPONSE_CODE, RESPONSE_REASON_CODE, RESPONSE_REASON_TEXT = 0, 2, 3
31
+ AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE = 5, 6, 38
32
+
33
+ self.supported_countries = ['US']
34
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
35
+ self.homepage_url = 'http://www.metricsglobal.com'
36
+ self.display_name = 'Metrics Global'
37
+
38
+ CARD_CODE_ERRORS = %w( N S )
39
+ AVS_ERRORS = %w( A E N R W Z )
40
+ AVS_REASON_CODES = %w(27 45)
41
+
42
+ # Creates a new MetricsGlobalGateway
43
+ #
44
+ # The gateway requires that a valid login and password be passed
45
+ # in the +options+ hash.
46
+ #
47
+ # ==== Options
48
+ #
49
+ # * <tt>:login</tt> -- The username required to access the Metrics Global control panel. (REQUIRED)
50
+ # * <tt>:password</tt> -- The password required to access the Metrics Global control panel. (REQUIRED)
51
+ # * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
52
+ # Otherwise, perform transactions against the production server.
53
+ def initialize(options = {})
54
+ requires!(options, :login, :password)
55
+ super
56
+ end
57
+
58
+ # Performs an authorization, which reserves the funds on the customer's credit card, but does not
59
+ # charge the card.
60
+ #
61
+ # ==== Parameters
62
+ #
63
+ # * <tt>money</tt> -- The amount to be authorized as an Integer value in cents.
64
+ # * <tt>creditcard</tt> -- The CreditCard details for the transaction.
65
+ # * <tt>options</tt> -- A hash of optional parameters.
66
+ def authorize(money, creditcard, options = {})
67
+ post = {}
68
+ add_invoice(post, options)
69
+ add_creditcard(post, creditcard)
70
+ add_address(post, options)
71
+ add_customer_data(post, options)
72
+ add_duplicate_window(post)
73
+
74
+ commit('AUTH_ONLY', money, post)
75
+ end
76
+
77
+ # Perform a purchase, which is essentially an authorization and capture in a single operation.
78
+ #
79
+ # ==== Parameters
80
+ #
81
+ # * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
82
+ # * <tt>creditcard</tt> -- The CreditCard details for the transaction.
83
+ # * <tt>options</tt> -- A hash of optional parameters.
84
+ def purchase(money, creditcard, options = {})
85
+ post = {}
86
+ add_invoice(post, options)
87
+ add_creditcard(post, creditcard)
88
+ add_address(post, options)
89
+ add_customer_data(post, options)
90
+ add_duplicate_window(post)
91
+
92
+ commit('AUTH_CAPTURE', money, post)
93
+ end
94
+
95
+ # Captures the funds from an authorized transaction.
96
+ #
97
+ # ==== Parameters
98
+ #
99
+ # * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
100
+ # * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
101
+ def capture(money, authorization, options = {})
102
+ post = {:trans_id => authorization}
103
+ add_customer_data(post, options)
104
+ commit('PRIOR_AUTH_CAPTURE', money, post)
105
+ end
106
+
107
+ # Void a previous transaction
108
+ #
109
+ # ==== Parameters
110
+ #
111
+ # * <tt>authorization</tt> - The authorization returned from the previous authorize request.
112
+ def void(authorization, options = {})
113
+ post = {:trans_id => authorization}
114
+ add_duplicate_window(post)
115
+ commit('VOID', nil, post)
116
+ end
117
+
118
+ # Refund a transaction.
119
+ #
120
+ # This transaction indicates to the gateway that
121
+ # money should flow from the merchant to the customer.
122
+ #
123
+ # ==== Parameters
124
+ #
125
+ # * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
126
+ # * <tt>identification</tt> -- The ID of the original transaction against which the refund is being issued.
127
+ # * <tt>options</tt> -- A hash of parameters.
128
+ #
129
+ # ==== Options
130
+ #
131
+ # * <tt>:card_number</tt> -- The credit card number the refund is being issued to. (REQUIRED)
132
+ # * <tt>:first_name</tt> -- The first name of the account being refunded.
133
+ # * <tt>:last_name</tt> -- The last name of the account being refunded.
134
+ # * <tt>:zip</tt> -- The postal code of the account being refunded.
135
+ def refund(money, identification, options = {})
136
+ requires!(options, :card_number)
137
+
138
+ post = { :trans_id => identification,
139
+ :card_num => options[:card_number]
140
+ }
141
+
142
+ post[:first_name] = options[:first_name] if options[:first_name]
143
+ post[:last_name] = options[:last_name] if options[:last_name]
144
+ post[:zip] = options[:zip] if options[:zip]
145
+
146
+ add_invoice(post, options)
147
+ add_duplicate_window(post)
148
+
149
+ commit('CREDIT', money, post)
150
+ end
151
+
152
+ def credit(money, identification, options = {})
153
+ deprecated CREDIT_DEPRECATION_MESSAGE
154
+ refund(money, identification, options)
155
+ end
156
+
157
+ private
158
+
159
+ def commit(action, money, parameters)
160
+ parameters[:amount] = amount(money) unless action == 'VOID'
161
+
162
+ # Only activate the test_request when the :test option is passed in
163
+ parameters[:test_request] = @options[:test] ? 'TRUE' : 'FALSE'
164
+
165
+ url = test? ? self.test_url : self.live_url
166
+ data = ssl_post url, post_data(action, parameters)
167
+
168
+ response = parse(data)
169
+
170
+ message = message_from(response)
171
+
172
+ # Return the response. The authorization can be taken out of the transaction_id
173
+ # Test Mode on/off is something we have to parse from the response text.
174
+ # It usually looks something like this
175
+ #
176
+ # (TESTMODE) Successful Sale
177
+ test_mode = test? || message =~ /TESTMODE/
178
+
179
+ Response.new(success?(response), message, response,
180
+ :test => test_mode,
181
+ :authorization => response[:transaction_id],
182
+ :fraud_review => fraud_review?(response),
183
+ :avs_result => { :code => response[:avs_result_code] },
184
+ :cvv_result => response[:card_code]
185
+ )
186
+ end
187
+
188
+ def success?(response)
189
+ response[:response_code] == APPROVED
190
+ end
191
+
192
+ def fraud_review?(response)
193
+ response[:response_code] == FRAUD_REVIEW
194
+ end
195
+
196
+ def parse(body)
197
+ fields = split(body)
198
+
199
+ results = {
200
+ :response_code => fields[RESPONSE_CODE].to_i,
201
+ :response_reason_code => fields[RESPONSE_REASON_CODE],
202
+ :response_reason_text => fields[RESPONSE_REASON_TEXT],
203
+ :avs_result_code => fields[AVS_RESULT_CODE],
204
+ :transaction_id => fields[TRANSACTION_ID],
205
+ :card_code => fields[CARD_CODE_RESPONSE_CODE]
206
+ }
207
+ results
208
+ end
209
+
210
+ def post_data(action, parameters = {})
211
+ post = {}
212
+
213
+ post[:version] = API_VERSION
214
+ post[:login] = @options[:login]
215
+ post[:tran_key] = @options[:password]
216
+ post[:relay_response] = "FALSE"
217
+ post[:type] = action
218
+ post[:delim_data] = "TRUE"
219
+ post[:delim_char] = ","
220
+ post[:encap_char] = "$"
221
+ post[:solution_ID] = application_id if application_id.present? && application_id != "ActiveMerchant"
222
+
223
+ request = post.merge(parameters).collect { |key, value| "x_#{key}=#{CGI.escape(value.to_s)}" }.join("&")
224
+ request
225
+ end
226
+
227
+ def add_invoice(post, options)
228
+ post[:invoice_num] = options[:order_id]
229
+ post[:description] = options[:description]
230
+ end
231
+
232
+ def add_creditcard(post, creditcard)
233
+ post[:card_num] = creditcard.number
234
+ post[:card_code] = creditcard.verification_value if creditcard.verification_value?
235
+ post[:exp_date] = expdate(creditcard)
236
+ post[:first_name] = creditcard.first_name
237
+ post[:last_name] = creditcard.last_name
238
+ end
239
+
240
+ def add_customer_data(post, options)
241
+ if options.has_key? :email
242
+ post[:email] = options[:email]
243
+ post[:email_customer] = false
244
+ end
245
+
246
+ if options.has_key? :customer
247
+ post[:cust_id] = options[:customer]
248
+ end
249
+
250
+ if options.has_key? :ip
251
+ post[:customer_ip] = options[:ip]
252
+ end
253
+ end
254
+
255
+ # x_duplicate_window won't be sent by default, because sending it changes the response.
256
+ # "If this field is present in the request with or without a value, an enhanced duplicate transaction response will be sent."
257
+ def add_duplicate_window(post)
258
+ unless duplicate_window.nil?
259
+ post[:duplicate_window] = duplicate_window
260
+ end
261
+ end
262
+
263
+ def add_address(post, options)
264
+ if address = options[:billing_address] || options[:address]
265
+ post[:address] = address[:address1].to_s
266
+ post[:company] = address[:company].to_s
267
+ post[:phone] = address[:phone].to_s
268
+ post[:zip] = address[:zip].to_s
269
+ post[:city] = address[:city].to_s
270
+ post[:country] = address[:country].to_s
271
+ post[:state] = address[:state].blank? ? 'n/a' : address[:state]
272
+ end
273
+
274
+ if address = options[:shipping_address]
275
+ post[:ship_to_first_name] = address[:first_name].to_s
276
+ post[:ship_to_last_name] = address[:last_name].to_s
277
+ post[:ship_to_address] = address[:address1].to_s
278
+ post[:ship_to_company] = address[:company].to_s
279
+ post[:ship_to_phone] = address[:phone].to_s
280
+ post[:ship_to_zip] = address[:zip].to_s
281
+ post[:ship_to_city] = address[:city].to_s
282
+ post[:ship_to_country] = address[:country].to_s
283
+ post[:ship_to_state] = address[:state].blank? ? 'n/a' : address[:state]
284
+ end
285
+ end
286
+
287
+ # Make a ruby type out of the response string
288
+ def normalize(field)
289
+ case field
290
+ when "true" then true
291
+ when "false" then false
292
+ when "" then nil
293
+ when "null" then nil
294
+ else field
295
+ end
296
+ end
297
+
298
+ def message_from(results)
299
+ if results[:response_code] == DECLINED
300
+ return CVVResult.messages[ results[:card_code] ] if CARD_CODE_ERRORS.include?(results[:card_code])
301
+ if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
302
+ return AVSResult.messages[ results[:avs_result_code] ]
303
+ end
304
+ end
305
+
306
+ (results[:response_reason_text] ? results[:response_reason_text].chomp('.') : '')
307
+ end
308
+
309
+ def expdate(creditcard)
310
+ year = sprintf("%.4i", creditcard.year)
311
+ month = sprintf("%.2i", creditcard.month)
312
+
313
+ "#{month}#{year[-2..-1]}"
314
+ end
315
+
316
+ def split(response)
317
+ response[1..-2].split(/\$,\$/)
318
+ end
319
+
320
+ end
321
+ end
322
+ end