activemerchant 1.45.0 → 1.126.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +2167 -2
  3. data/CONTRIBUTORS +57 -0
  4. data/README.md +62 -41
  5. data/lib/active_merchant/billing/avs_result.rb +25 -28
  6. data/lib/active_merchant/billing/base.rb +11 -35
  7. data/lib/active_merchant/billing/check.rb +28 -24
  8. data/lib/active_merchant/billing/compatibility.rb +10 -12
  9. data/lib/active_merchant/billing/credit_card.rb +141 -69
  10. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  11. data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
  12. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  13. data/lib/active_merchant/billing/gateway.rb +125 -61
  14. data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
  15. data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
  21. data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
  24. data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
  33. data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
  34. data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
  42. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
  52. data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  57. data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  59. data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  61. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  62. data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
  63. data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
  64. data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
  65. data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
  66. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  67. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  68. data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
  69. data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
  70. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  71. data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
  72. data/lib/active_merchant/billing/gateways/element.rb +386 -0
  73. data/lib/active_merchant/billing/gateways/epay.rb +92 -71
  74. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  75. data/lib/active_merchant/billing/gateways/eway.rb +85 -73
  76. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  77. data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
  78. data/lib/active_merchant/billing/gateways/exact.rb +37 -36
  79. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  80. data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
  81. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  82. data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
  83. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  84. data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
  85. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
  86. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  87. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  88. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  89. data/lib/active_merchant/billing/gateways/forte.rb +286 -0
  90. data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
  91. data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
  92. data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
  93. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  94. data/lib/active_merchant/billing/gateways/hps.rb +252 -68
  95. data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
  96. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  97. data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
  98. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  99. data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
  100. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  101. data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
  102. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  103. data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
  104. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
  111. data/lib/active_merchant/billing/gateways/litle.rb +371 -94
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
  121. data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
  124. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  125. data/lib/active_merchant/billing/gateways/migs.rb +101 -37
  126. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
  128. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
  129. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  130. data/lib/active_merchant/billing/gateways/monei.rb +422 -0
  131. data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
  132. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  133. data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
  134. data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
  135. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
  136. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  137. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  138. data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
  139. data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
  140. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  141. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  142. data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
  143. data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
  144. data/lib/active_merchant/billing/gateways/omise.rb +323 -0
  145. data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
  146. data/lib/active_merchant/billing/gateways/opp.rb +394 -0
  147. data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  149. data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
  150. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
  151. data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
  152. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  153. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  154. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  155. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
  156. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  157. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  158. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
  159. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  160. data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
  161. data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
  162. data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
  163. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  167. data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
  169. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
  170. data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
  172. data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
  173. data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
  175. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
  177. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  178. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
  179. data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
  180. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
  182. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  183. data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
  184. data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
  185. data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
  186. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  187. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  188. data/lib/active_merchant/billing/gateways/pin.rb +113 -37
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  190. data/lib/active_merchant/billing/gateways/priority.rb +369 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
  192. data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
  194. data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
  195. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
  203. data/lib/active_merchant/billing/gateways/realex.rb +154 -52
  204. data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
  205. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  206. data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
  207. data/lib/active_merchant/billing/gateways/sage.rb +404 -133
  208. data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
  209. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  210. data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
  211. data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
  212. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
  213. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  214. data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
  215. data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
  216. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
  217. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  218. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  219. data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
  220. data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
  221. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
  222. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
  223. data/lib/active_merchant/billing/gateways/telr.rb +273 -0
  224. data/lib/active_merchant/billing/gateways/tns.rb +16 -217
  225. data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
  226. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
  227. data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
  228. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  229. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  230. data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
  231. data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
  232. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  233. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
  234. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
  235. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  236. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  237. data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
  238. data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
  239. data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
  240. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  241. data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
  242. data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
  243. data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
  244. data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
  245. data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
  246. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
  247. data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
  248. data/lib/active_merchant/billing/gateways.rb +8 -11
  249. data/lib/active_merchant/billing/model.rb +2 -2
  250. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  251. data/lib/active_merchant/billing/payment_token.rb +1 -1
  252. data/lib/active_merchant/billing/rails.rb +1 -1
  253. data/lib/active_merchant/billing/response.rb +19 -13
  254. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  255. data/lib/active_merchant/billing.rb +3 -0
  256. data/lib/active_merchant/connection.rb +196 -0
  257. data/lib/active_merchant/country.rb +13 -8
  258. data/lib/active_merchant/errors.rb +6 -0
  259. data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
  260. data/lib/active_merchant/network_connection_retries.rb +78 -0
  261. data/lib/active_merchant/post_data.rb +26 -0
  262. data/lib/active_merchant/posts_data.rb +92 -0
  263. data/lib/active_merchant/version.rb +1 -1
  264. data/lib/active_merchant.rb +14 -59
  265. data/lib/activemerchant.rb +1 -1
  266. data/lib/certs/cacert.pem +3214 -0
  267. data/lib/support/gateway_support.rb +8 -10
  268. data/lib/support/outbound_hosts.rb +13 -10
  269. data/lib/support/ssl_verify.rb +9 -14
  270. data/lib/support/ssl_version.rb +86 -0
  271. metadata +136 -94
  272. checksums.yaml.gz.sig +0 -1
  273. data/lib/active_merchant/billing/gateways/app55.rb +0 -176
  274. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  275. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  278. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  279. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  280. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
  281. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
  282. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  283. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  284. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  285. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
  286. data/lib/active_merchant/offsite_payments_shim.rb +0 -19
  287. data.tar.gz.sig +0 -0
  288. metadata.gz.sig +0 -0
@@ -1,246 +0,0 @@
1
- require File.dirname(__FILE__) + '/ideal_response'
2
-
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
5
- # Implementation contains some simplifications
6
- # - does not support multiple subID per merchant
7
- # - language is fixed to 'nl'
8
- class IdealBaseGateway < Gateway
9
- class_attribute :server_pem, :pem_password, :default_expiration_period
10
- self.default_expiration_period = 'PT10M'
11
- self.default_currency = 'EUR'
12
- self.pem_password = true
13
-
14
- self.abstract_class = true
15
-
16
- # These constants will never change for most users
17
- AUTHENTICATION_TYPE = 'SHA1_RSA'
18
- LANGUAGE = 'nl'
19
- SUB_ID = '0'
20
- API_VERSION = '1.1.0'
21
-
22
- def initialize(options = {})
23
- requires!(options, :login, :password, :pem)
24
-
25
- options[:pem_password] = options[:password]
26
- super
27
- end
28
-
29
- # Setup transaction. Get redirect_url from response.service_url
30
- def setup_purchase(money, options = {})
31
- requires!(options, :issuer_id, :return_url, :order_id, :currency, :description, :entrance_code)
32
-
33
- commit(build_transaction_request(money, options))
34
- end
35
-
36
- # Check status of transaction and confirm payment
37
- # transaction_id must be a valid transaction_id from a prior setup.
38
- def capture(transaction, options = {})
39
- options[:transaction_id] = transaction
40
- commit(build_status_request(options))
41
- end
42
-
43
- # Get list of issuers from response.issuer_list
44
- def issuers
45
- commit(build_directory_request)
46
- end
47
-
48
- private
49
-
50
- def url
51
- (test? ? test_url : live_url)
52
- end
53
-
54
- def token
55
- @token ||= create_fingerprint(@options[:pem])
56
- end
57
-
58
- # <?xml version="1.0" encoding="UTF-8"?>
59
- # <AcquirerTrxReq xmlns="http://www.idealdesk.com/Message" version="1.1.0">
60
- # <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
61
- # <Issuer>
62
- # <issuerID>1003</issuerID>
63
- # </Issuer>
64
- # <Merchant>
65
- # <merchantID>000123456</merchantID>
66
- # <subID>0</subID>
67
- # <authentication>passkey</authentication>
68
- # <token>1</token>
69
- # <tokenCode>3823ad872eff23</tokenCode>
70
- # <merchantReturnURL>https://www.mijnwinkel.nl/betaalafhandeling
71
- # </merchantReturnURL>
72
- # </Merchant>
73
- # <Transaction>
74
- # <purchaseID>iDEAL-aankoop 21</purchaseID>
75
- # <amount>5999</amount>
76
- # <currency>EUR</currency>
77
- # <expirationPeriod>PT3M30S</expirationPeriod>
78
- # <language>nl</language>
79
- # <description>Documentensuite</description>
80
- # <entranceCode>D67tyx6rw9IhY71</entranceCode>
81
- # </Transaction>
82
- # </AcquirerTrxReq>
83
- def build_transaction_request(money, options)
84
- date_time_stamp = create_time_stamp
85
- message = date_time_stamp +
86
- options[:issuer_id] +
87
- @options[:login] +
88
- SUB_ID +
89
- options[:return_url] +
90
- options[:order_id] +
91
- money.to_s +
92
- (options[:currency] || currency(money)) +
93
- LANGUAGE +
94
- options[:description] +
95
- options[:entrance_code]
96
- token_code = sign_message(@options[:pem], @options[:password], message)
97
-
98
- xml = Builder::XmlMarkup.new(:indent => 2)
99
- xml.instruct!
100
- xml.tag! 'AcquirerTrxReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do
101
- xml.tag! 'createDateTimeStamp', date_time_stamp
102
- xml.tag! 'Issuer' do
103
- xml.tag! 'issuerID', options[:issuer_id]
104
- end
105
- xml.tag! 'Merchant' do
106
- xml.tag! 'merchantID', @options[:login]
107
- xml.tag! 'subID', SUB_ID
108
- xml.tag! 'authentication', AUTHENTICATION_TYPE
109
- xml.tag! 'token', token
110
- xml.tag! 'tokenCode', token_code
111
- xml.tag! 'merchantReturnURL', options[:return_url]
112
- end
113
- xml.tag! 'Transaction' do
114
- xml.tag! 'purchaseID', options[:order_id]
115
- xml.tag! 'amount', money
116
- xml.tag! 'currency', options[:currency]
117
- xml.tag! 'expirationPeriod', options[:expiration_period] || default_expiration_period
118
- xml.tag! 'language', LANGUAGE
119
- xml.tag! 'description', options[:description]
120
- xml.tag! 'entranceCode', options[:entrance_code]
121
- end
122
- xml.target!
123
- end
124
- end
125
-
126
- # <?xml version="1.0" encoding="UTF-8"?>
127
- # <AcquirerStatusReq xmlns="http://www.idealdesk.com/Message" version="1.1.0">
128
- # <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
129
- # <Merchant>
130
- # <merchantID>000123456</merchantID>
131
- # <subID>0</subID>
132
- # <authentication>keyed hash</authentication>
133
- # <token>1</token>
134
- # <tokenCode>3823ad872eff23</tokenCode>
135
- # </Merchant>
136
- # <Transaction>
137
- # <transactionID>0001023456789112</transactionID>
138
- # </Transaction>
139
- # </AcquirerStatusReq>
140
- def build_status_request(options)
141
- datetimestamp = create_time_stamp
142
- message = datetimestamp + @options[:login] + SUB_ID + options[:transaction_id]
143
- tokenCode = sign_message(@options[:pem], @options[:password], message)
144
-
145
- xml = Builder::XmlMarkup.new(:indent => 2)
146
- xml.instruct!
147
- xml.tag! 'AcquirerStatusReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do
148
- xml.tag! 'createDateTimeStamp', datetimestamp
149
- xml.tag! 'Merchant' do
150
- xml.tag! 'merchantID', @options[:login]
151
- xml.tag! 'subID', SUB_ID
152
- xml.tag! 'authentication' , AUTHENTICATION_TYPE
153
- xml.tag! 'token', token
154
- xml.tag! 'tokenCode', tokenCode
155
- end
156
- xml.tag! 'Transaction' do
157
- xml.tag! 'transactionID', options[:transaction_id]
158
- end
159
- end
160
- xml.target!
161
- end
162
-
163
- # <?xml version="1.0" encoding="UTF-8"?>
164
- # <DirectoryReq xmlns="http://www.idealdesk.com/Message" version="1.1.0">
165
- # <createDateTimeStamp>2001-12-17T09:30:47.0Z</createDateTimeStamp>
166
- # <Merchant>
167
- # <merchantID>000000001</merchantID>
168
- # <subID>0</subID>
169
- # <authentication>1</authentication>
170
- # <token>hashkey</token>
171
- # <tokenCode>WajqV1a3nDen0be2r196g9FGFF=</tokenCode>
172
- # </Merchant>
173
- # </DirectoryReq>
174
- def build_directory_request
175
- datetimestamp = create_time_stamp
176
- message = datetimestamp + @options[:login] + SUB_ID
177
- tokenCode = sign_message(@options[:pem], @options[:password], message)
178
-
179
- xml = Builder::XmlMarkup.new(:indent => 2)
180
- xml.instruct!
181
- xml.tag! 'DirectoryReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do
182
- xml.tag! 'createDateTimeStamp', datetimestamp
183
- xml.tag! 'Merchant' do
184
- xml.tag! 'merchantID', @options[:login]
185
- xml.tag! 'subID', SUB_ID
186
- xml.tag! 'authentication', AUTHENTICATION_TYPE
187
- xml.tag! 'token', token
188
- xml.tag! 'tokenCode', tokenCode
189
- end
190
- end
191
- xml.target!
192
- end
193
-
194
- def commit(request)
195
- raw_response = ssl_post(url, request)
196
- response = Hash.from_xml(raw_response.to_s)
197
- response_type = response.keys[0]
198
-
199
- case response_type
200
- when 'AcquirerTrxRes', 'DirectoryRes'
201
- success = true
202
- when 'ErrorRes'
203
- success = false
204
- when 'AcquirerStatusRes'
205
- raise SecurityError, "Message verification failed.", caller unless status_response_verified?(response)
206
- success = (response['AcquirerStatusRes']['Transaction']['status'] == 'Success')
207
- else
208
- raise ArgumentError, "Unknown response type.", caller
209
- end
210
-
211
- return IdealResponse.new(success, response.keys[0], response, :test => test?)
212
- end
213
-
214
- def create_fingerprint(cert_file)
215
- cert_data = OpenSSL::X509::Certificate.new(cert_file).to_s
216
- cert_data = cert_data.sub(/-----BEGIN CERTIFICATE-----/, '')
217
- cert_data = cert_data.sub(/-----END CERTIFICATE-----/, '')
218
- fingerprint = Base64.decode64(cert_data)
219
- fingerprint = Digest::SHA1.hexdigest(fingerprint)
220
- return fingerprint.upcase
221
- end
222
-
223
- def sign_message(private_key_data, password, data)
224
- private_key = OpenSSL::PKey::RSA.new(private_key_data, password)
225
- signature = private_key.sign(OpenSSL::Digest::SHA1.new, data.gsub('\s', ''))
226
- return Base64.encode64(signature).gsub(/\n/, '')
227
- end
228
-
229
- def verify_message(cert_file, data, signature)
230
- public_key = OpenSSL::X509::Certificate.new(cert_file).public_key
231
- return public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), data)
232
- end
233
-
234
- def status_response_verified?(response)
235
- transaction = response['AcquirerStatusRes']['Transaction']
236
- message = response['AcquirerStatusRes']['createDateTimeStamp'] + transaction['transactionID' ] + transaction['status']
237
- message << transaction['consumerAccountNumber'].to_s
238
- verify_message(server_pem, message, response['AcquirerStatusRes']['Signature']['signatureValue'])
239
- end
240
-
241
- def create_time_stamp
242
- Time.now.gmtime.strftime('%Y-%m-%dT%H:%M:%S.000Z')
243
- end
244
- end
245
- end
246
- end
@@ -1,13 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIICQDCCAakCBELvbPYwDQYJKoZIhvcNAQEEBQAwZzELMAkGA1UEBhMCREUxDzANBgNVBAgTBkhl
3
- c3NlbjESMBAGA1UEBxMJRnJhbmtmdXJ0MQ4wDAYDVQQKEwVpREVBTDEOMAwGA1UECxMFaURFQUwx
4
- EzARBgNVBAMTCmlERUFMIFJhYm8wHhcNMDUwODAyMTI1NDE0WhcNMTUwNzMxMTI1NDE0WjBnMQsw
5
- CQYDVQQGEwJERTEPMA0GA1UECBMGSGVzc2VuMRIwEAYDVQQHEwlGcmFua2Z1cnQxDjAMBgNVBAoT
6
- BWlERUFMMQ4wDAYDVQQLEwVpREVBTDETMBEGA1UEAxMKaURFQUwgUmFibzCBnzANBgkqhkiG9w0B
7
- AQEFAAOBjQAwgYkCgYEA486iIKVhr8RNjxH+PZ3yTWx/8k2fqDFm8XU8I1Z5esRmPFnXmlgA8cG7
8
- e9AaBPaLoP7Dc8dRQoUO66KMakzGI/WAVdHIJiiKrz8xOcioIgrzPSqec7aqse3J28UraEHkGESJ
9
- 7dAW7Pw/shrmpmkzKsunLt6AkXss4W3JUndZUN0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQCGy/FK
10
- Lotp2ZOTtuLMgvDy74eicq/Znv4bLfpglzAPHycRHcHsXuer/lNHyvpKf2gdYe+IFalUW3OJZWIM
11
- jpm4UniJ16RPdgwWVRJEdPr/P7JXMIqD2IEOgujuuTQ7x0VgCf9XrsPsP9ZR5DIPcDDhbrpSE0yF
12
- Do77nwG61xMaGA==
13
- -----END CERTIFICATE-----
@@ -1,29 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- class IdealResponse < Response
4
-
5
- def issuer_list
6
- list = @params.values[0]['Directory']['Issuer']
7
- case list
8
- when Hash
9
- return [list]
10
- when Array
11
- return list
12
- end
13
- end
14
-
15
- def service_url
16
- @params.values[0]['Issuer']['issuerAuthenticationURL']
17
- end
18
-
19
- def transaction
20
- @params.values[0]['Transaction']
21
- end
22
-
23
- def error
24
- @params.values[0]['Error']
25
- end
26
-
27
- end
28
- end
29
- end
@@ -1,66 +0,0 @@
1
- require File.dirname(__FILE__) + '/ideal/ideal_base'
2
-
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
5
- # First, make sure you have everything setup correctly and all of your dependencies in place with:
6
- #
7
- # require 'rubygems'
8
- # require 'active_merchant'
9
- #
10
- # ActiveMerchant expects the amounts to be given as an Integer in cents. In this case, 10 EUR becomes 1000.
11
- #
12
- # Create certificates for authentication:
13
- #
14
- # The PEM file expected should contain both the certificate and the generated PEM file.
15
- # Some sample shell commands to generate the certificates:
16
- #
17
- # openssl genrsa -aes128 -out priv.pem -passout pass:[YOUR PASSWORD] 1024
18
- # openssl req -x509 -new -key priv.pem -passin pass:[YOUR PASSWORD] -days 3000 -out cert.cer
19
- # cat cert.cer priv.pem > ideal.pem
20
- #
21
- # Following the steps above, upload cert.cer to the ideal web interface and pass the path of ideal.pem to the :pem option.
22
- #
23
- # Configure the gateway using your iDEAL bank account info and security settings:
24
- #
25
- # Create gateway:
26
- # gateway = ActiveMerchant::Billing::IdealRabobankGateway.new(
27
- # :login => '123456789', # 9 digit merchant number
28
- # :pem => File.read(Rails.root + 'config/ideal.pem'),
29
- # :password => 'password' # password for the PEM key
30
- # )
31
- #
32
- # Get list of issuers to fill selection list on your payment form:
33
- # response = gateway.issuers
34
- # list = response.issuer_list
35
- #
36
- # Request transaction:
37
- #
38
- # options = {
39
- # :issuer_id => '0001',
40
- # :expiration_period => 'PT10M',
41
- # :return_url => 'http://www.return.url',
42
- # :order_id => '1234567890123456',
43
- # :currency => 'EUR',
44
- # :description => 'Een omschrijving',
45
- # :entrance_code => '1234'
46
- # }
47
- #
48
- # response = gateway.setup_purchase(amount, options)
49
- # transaction_id = response.transaction['transactionID']
50
- # redirect_url = response.service_url
51
- #
52
- # Mandatory status request will confirm transaction:
53
- # response = gateway.capture(transaction_id)
54
- #
55
- # Implementation contains some simplifications
56
- # - does not support multiple subID per merchant
57
- # - language is fixed to 'nl'
58
- class IdealRabobankGateway < IdealBaseGateway
59
- class_attribute :test_url, :live_url
60
-
61
- self.test_url = 'https://idealtest.rabobank.nl/ideal/iDeal'
62
- self.live_url = 'https://ideal.rabobank.nl/ideal/iDeal'
63
- self.server_pem = File.read(File.dirname(__FILE__) + '/ideal/ideal_rabobank.pem')
64
- end
65
- end
66
- end
@@ -1,291 +0,0 @@
1
- require 'rexml/document'
2
-
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
5
-
6
- # To learn more about the Moneris (US) gateway, please contact
7
- # ussales@moneris.com for a copy of their integration guide. For
8
- # information on remote testing, please see "Test Environment Penny Value
9
- # Response Table", and "Test Environment eFraud (AVS and CVD) Penny
10
- # Response Values", available at Moneris' {eSelect Plus Documentation
11
- # Centre}[https://www3.moneris.com/connect/en/documents/index.html].
12
- class MonerisUsGateway < Gateway
13
- self.test_url = 'https://esplusqa.moneris.com/gateway_us/servlet/MpgRequest'
14
- self.live_url = 'https://esplus.moneris.com/gateway_us/servlet/MpgRequest'
15
-
16
- self.supported_countries = ['US']
17
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover]
18
- self.homepage_url = 'http://www.monerisusa.com/'
19
- self.display_name = 'Moneris (US)'
20
-
21
- # Initialize the Gateway
22
- #
23
- # The gateway requires that a valid login and password be passed
24
- # in the +options+ hash.
25
- #
26
- # ==== Options
27
- #
28
- # * <tt>:login</tt> -- Your Store ID
29
- # * <tt>:password</tt> -- Your API Token
30
- # * <tt>:cvv_enabled</tt> -- Specify that you would like the CVV passed to the gateway.
31
- # Only particular account types at Moneris will allow this.
32
- # Defaults to false. (optional)
33
- def initialize(options = {})
34
- requires!(options, :login, :password)
35
- @cvv_enabled = options[:cvv_enabled]
36
- @avs_enabled = options[:avs_enabled]
37
- options = { :crypt_type => 7 }.merge(options)
38
- super
39
- end
40
-
41
- # Referred to as "PreAuth" in the Moneris integration guide, this action
42
- # verifies and locks funds on a customer's card, which then must be
43
- # captured at a later date.
44
- #
45
- # Pass in +order_id+ and optionally a +customer+ parameter.
46
- def authorize(money, creditcard_or_datakey, options = {})
47
- requires!(options, :order_id)
48
- post = {}
49
- add_payment_source(post, creditcard_or_datakey, options)
50
- post[:amount] = amount(money)
51
- post[:order_id] = options[:order_id]
52
- post[:address] = options[:billing_address] || options[:address]
53
- post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
54
- action = (post[:data_key].blank?) ? 'us_preauth' : 'us_res_preauth_cc'
55
- commit(action, post)
56
- end
57
-
58
- # This action verifies funding on a customer's card and readies them for
59
- # deposit in a merchant's account.
60
- #
61
- # Pass in <tt>order_id</tt> and optionally a <tt>customer</tt> parameter
62
- def purchase(money, creditcard_or_datakey, options = {})
63
- requires!(options, :order_id)
64
- post = {}
65
- add_payment_source(post, creditcard_or_datakey, options)
66
- post[:amount] = amount(money)
67
- post[:order_id] = options[:order_id]
68
- post[:address] = options[:billing_address] || options[:address]
69
- post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
70
- action = (post[:data_key].blank?) ? 'us_purchase' : 'us_res_purchase_cc'
71
- commit(action, post)
72
- end
73
-
74
- # This method retrieves locked funds from a customer's account (from a
75
- # PreAuth) and prepares them for deposit in a merchant's account.
76
- #
77
- # Note: Moneris requires both the order_id and the transaction number of
78
- # the original authorization. To maintain the same interface as the other
79
- # gateways the two numbers are concatenated together with a ; separator as
80
- # the authorization number returned by authorization
81
- def capture(money, authorization, options = {})
82
- commit 'us_completion', crediting_params(authorization, :comp_amount => amount(money))
83
- end
84
-
85
- # Voiding requires the original transaction ID and order ID of some open
86
- # transaction. Closed transactions must be refunded. Note that the only
87
- # methods which may be voided are +capture+ and +purchase+.
88
- #
89
- # Concatenate your transaction number and order_id by using a semicolon
90
- # (';'). This is to keep the Moneris interface consistent with other
91
- # gateways. (See +capture+ for details.)
92
- def void(authorization, options = {})
93
- commit 'us_purchasecorrection', crediting_params(authorization)
94
- end
95
-
96
- # Performs a refund. This method requires that the original transaction
97
- # number and order number be included. Concatenate your transaction
98
- # number and order_id by using a semicolon (';'). This is to keep the
99
- # Moneris interface consistent with other gateways. (See +capture+ for
100
- # details.)
101
- def credit(money, authorization, options = {})
102
- ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
103
- refund(money, authorization, options)
104
- end
105
-
106
- def refund(money, authorization, options = {})
107
- commit 'us_refund', crediting_params(authorization, :amount => amount(money))
108
- end
109
-
110
- def store(credit_card, options = {})
111
- post = {}
112
- post[:pan] = credit_card.number
113
- post[:expdate] = expdate(credit_card)
114
- post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
115
- commit('us_res_add_cc', post)
116
- end
117
-
118
- def unstore(data_key, options = {})
119
- post = {}
120
- post[:data_key] = data_key
121
- commit('us_res_delete', post)
122
- end
123
-
124
- def update(data_key, credit_card, options = {})
125
- post = {}
126
- post[:pan] = credit_card.number
127
- post[:expdate] = expdate(credit_card)
128
- post[:data_key] = data_key
129
- post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
130
- commit('us_res_update_cc', post)
131
- end
132
-
133
- private # :nodoc: all
134
-
135
- def expdate(creditcard)
136
- sprintf("%.4i", creditcard.year)[-2..-1] + sprintf("%.2i", creditcard.month)
137
- end
138
-
139
- def add_payment_source(post, source, options)
140
- if source.is_a?(String)
141
- post[:data_key] = source
142
- post[:cust_id] = options[:customer]
143
- else
144
- post[:pan] = source.number
145
- post[:expdate] = expdate(source)
146
- post[:cvd_value] = source.verification_value if source.verification_value?
147
- post[:cust_id] = options[:customer] || source.name
148
- end
149
- end
150
-
151
- # Common params used amongst the +credit+, +void+ and +capture+ methods
152
- def crediting_params(authorization, options = {})
153
- {
154
- :txn_number => split_authorization(authorization).first,
155
- :order_id => split_authorization(authorization).last,
156
- :crypt_type => options[:crypt_type] || @options[:crypt_type]
157
- }.merge(options)
158
- end
159
-
160
- # Splits an +authorization+ param and retrieves the order id and
161
- # transaction number in that order.
162
- def split_authorization(authorization)
163
- if authorization.nil? || authorization.empty? || authorization !~ /;/
164
- raise ArgumentError, 'You must include a valid authorization code (e.g. "1234;567")'
165
- else
166
- authorization.split(';')
167
- end
168
- end
169
-
170
- def commit(action, parameters = {})
171
- data = post_data(action, parameters)
172
- url = test? ? self.test_url : self.live_url
173
- raw = ssl_post(url, data)
174
- response = parse(raw)
175
-
176
- Response.new(successful?(response), message_from(response[:message]), response,
177
- :test => test?,
178
- :avs_result => { :code => response[:avs_result_code] },
179
- :cvv_result => response[:cvd_result_code] && response[:cvd_result_code][-1,1],
180
- :authorization => authorization_from(response)
181
- )
182
- end
183
-
184
- # Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
185
- def authorization_from(response = {})
186
- if response[:trans_id] && response[:receipt_id]
187
- "#{response[:trans_id]};#{response[:receipt_id]}"
188
- end
189
- end
190
-
191
- # Tests for a successful response from Moneris' servers
192
- def successful?(response)
193
- response[:response_code] &&
194
- response[:complete] &&
195
- (0..49).include?(response[:response_code].to_i)
196
- end
197
-
198
- def parse(xml)
199
- response = { :message => "Global Error Receipt", :complete => false }
200
- hashify_xml!(xml, response)
201
- response
202
- end
203
-
204
- def hashify_xml!(xml, response)
205
- xml = REXML::Document.new(xml)
206
- return if xml.root.nil?
207
- xml.elements.each('//receipt/*') do |node|
208
- response[node.name.underscore.to_sym] = normalize(node.text)
209
- end
210
- end
211
-
212
- def post_data(action, parameters = {})
213
- xml = REXML::Document.new
214
- root = xml.add_element("request")
215
- root.add_element("store_id").text = options[:login]
216
- root.add_element("api_token").text = options[:password]
217
- root.add_element(transaction_element(action, parameters))
218
-
219
- xml.to_s
220
- end
221
-
222
- def transaction_element(action, parameters)
223
- transaction = REXML::Element.new(action)
224
-
225
- # Must add the elements in the correct order
226
- actions[action].each do |key|
227
- case key
228
- when :avs_info
229
- transaction.add_element(avs_element(parameters[:address])) if @avs_enabled && parameters[:address]
230
- when :cvd_info
231
- transaction.add_element(cvd_element(parameters[:cvd_value])) if @cvv_enabled
232
- else
233
- transaction.add_element(key.to_s).text = parameters[key] unless parameters[key].blank?
234
- end
235
- end
236
-
237
- transaction
238
- end
239
-
240
- def avs_element(address)
241
- full_address = "#{address[:address1]} #{address[:address2]}"
242
- tokens = full_address.split(/\s+/)
243
-
244
- element = REXML::Element.new('avs_info')
245
- element.add_element('avs_street_number').text = tokens.select{|x| x =~ /\d/}.join(' ')
246
- element.add_element('avs_street_name').text = tokens.reject{|x| x =~ /\d/}.join(' ')
247
- element.add_element('avs_zipcode').text = address[:zip]
248
- element
249
- end
250
-
251
- def cvd_element(cvd_value)
252
- element = REXML::Element.new('cvd_info')
253
- if cvd_value
254
- element.add_element('cvd_indicator').text = "1"
255
- element.add_element('cvd_value').text = cvd_value
256
- else
257
- element.add_element('cvd_indicator').text = "0"
258
- end
259
- element
260
- end
261
-
262
- def message_from(message)
263
- return 'Unspecified error' if message.blank?
264
- message.gsub(/[^\w]/, ' ').split.join(" ").capitalize
265
- end
266
-
267
- def actions
268
- {
269
- "us_purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
270
- "us_preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
271
- "us_command" => [:order_id],
272
- "us_refund" => [:order_id, :amount, :txn_number, :crypt_type],
273
- "us_indrefund" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
274
- "us_completion" => [:order_id, :comp_amount, :txn_number, :crypt_type],
275
- "us_purchasecorrection" => [:order_id, :txn_number, :crypt_type],
276
- "us_cavvpurcha" => [:order_id, :cust_id, :amount, :pan, :expdate, :cav],
277
- "us_cavvpreaut" => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv],
278
- "us_transact" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
279
- "us_Batchcloseall" => [],
280
- "us_opentotals" => [:ecr_number],
281
- "us_batchclose" => [:ecr_number],
282
- "us_res_add_cc" => [:pan, :expdate, :crypt_type],
283
- "us_res_delete" => [:data_key],
284
- "us_res_update_cc" => [:data_key, :pan, :expdate, :crypt_type],
285
- "us_res_purchase_cc" => [:data_key, :order_id, :cust_id, :amount, :crypt_type],
286
- "us_res_preauth_cc" => [:data_key, :order_id, :cust_id, :amount, :crypt_type]
287
- }
288
- end
289
- end
290
- end
291
- end