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
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
52
52
  #
53
53
  # PayGateXML Field ActiveMerchant Use
54
54
  #
55
- # pgid use :login value to gateway instantation
55
+ # pgid use :login value to gateway instantiation
56
56
  # pwd use :password value to gateway instantiation
57
57
  #
58
58
  # cname credit_card.name
@@ -76,10 +76,10 @@ module ActiveMerchant #:nodoc:
76
76
  self.live_url = 'https://www.paygate.co.za/payxml/process.trans'
77
77
 
78
78
  # The countries the gateway supports merchants from as 2 digit ISO country codes
79
- self.supported_countries = ['US', 'ZA']
79
+ self.supported_countries = %w[US ZA]
80
80
 
81
81
  # The card types supported by the payment gateway
82
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
82
+ self.supported_cardtypes = %i[visa master american_express diners_club]
83
83
 
84
84
  # The homepage URL of the gateway
85
85
  self.homepage_url = 'http://paygate.co.za/'
@@ -102,48 +102,48 @@ module ActiveMerchant #:nodoc:
102
102
 
103
103
  DECLINE_CODES = {
104
104
  # Credit Card Errors - These RESULT_CODEs are returned if the transaction cannot be authorized due to a problem with the card. The TRANSACTION_STATUS will be 2
105
- 900001 => "Call for Approval",
106
- 900002 => "Card Expired",
107
- 900003 => "Insufficient Funds",
108
- 900004 => "Invalid Card Number",
109
- 900005 => "Bank Interface Timeout", # indicates a communications failure between the banks systems
110
- 900006 => "Invalid Card",
111
- 900007 => "Declined",
112
- 900009 => "Lost Card",
113
- 900010 => "Invalid Card Length",
114
- 900011 => "Suspected Fraud",
115
- 900012 => "Card Reported As Stolen",
116
- 900013 => "Restricted Card",
117
- 900014 => "Excessive Card Usage",
118
- 900015 => "Card Blacklisted",
119
-
120
- 900207 => "Declined; authentication failed", # indicates the cardholder did not enter their MasterCard SecureCode / Verified by Visa password correctly
121
-
122
- 990020 => "Auth Declined",
123
-
124
- 991001 => "Invalid expiry date",
125
- 991002 => "Invalid amount",
105
+ 900001 => 'Call for Approval',
106
+ 900002 => 'Card Expired',
107
+ 900003 => 'Insufficient Funds',
108
+ 900004 => 'Invalid Card Number',
109
+ 900005 => 'Bank Interface Timeout', # indicates a communications failure between the banks systems
110
+ 900006 => 'Invalid Card',
111
+ 900007 => 'Declined',
112
+ 900009 => 'Lost Card',
113
+ 900010 => 'Invalid Card Length',
114
+ 900011 => 'Suspected Fraud',
115
+ 900012 => 'Card Reported As Stolen',
116
+ 900013 => 'Restricted Card',
117
+ 900014 => 'Excessive Card Usage',
118
+ 900015 => 'Card Blacklisted',
119
+
120
+ 900207 => 'Declined; authentication failed', # indicates the cardholder did not enter their MasterCard SecureCode / Verified by Visa password correctly
121
+
122
+ 990020 => 'Auth Declined',
123
+
124
+ 991001 => 'Invalid expiry date',
125
+ 991002 => 'Invalid amount',
126
126
 
127
127
  # Communication Errors - These RESULT_CODEs are returned if the transaction cannot be completed due to an unexpected error. TRANSACTION_STATUS will be 0.
128
- 900205 => "Unexpected authentication result (phase 1)",
129
- 900206 => "Unexpected authentication result (phase 1)",
128
+ 900205 => 'Unexpected authentication result (phase 1)',
129
+ 900206 => 'Unexpected authentication result (phase 1)',
130
130
 
131
- 990001 => "Could not insert into Database",
131
+ 990001 => 'Could not insert into Database',
132
132
 
133
- 990022 => "Bank not available",
133
+ 990022 => 'Bank not available',
134
134
 
135
- 990053 => "Error processing transaction",
135
+ 990053 => 'Error processing transaction',
136
136
 
137
137
  # Miscellaneous - Unless otherwise noted, the TRANSACTION_STATUS will be 0.
138
- 900209 => "Transaction verification failed (phase 2)", # Indicates the verification data returned from MasterCard SecureCode / Verified by Visa has been altered
139
- 900210 => "Authentication complete; transaction must be restarted", # Indicates that the MasterCard SecuerCode / Verified by Visa transaction has already been completed. Most likely caused by the customer clicking the refresh button
138
+ 900209 => 'Transaction verification failed (phase 2)', # Indicates the verification data returned from MasterCard SecureCode / Verified by Visa has been altered
139
+ 900210 => 'Authentication complete; transaction must be restarted', # Indicates that the MasterCard SecuerCode / Verified by Visa transaction has already been completed. Most likely caused by the customer clicking the refresh button
140
140
 
141
- 990024 => "Duplicate Transaction Detected. Please check before submitting",
141
+ 990024 => 'Duplicate Transaction Detected. Please check before submitting',
142
142
 
143
- 990028 => "Transaction cancelled" # Customer clicks the 'Cancel' button on the payment page
143
+ 990028 => 'Transaction cancelled' # Customer clicks the 'Cancel' button on the payment page
144
144
  }
145
145
 
146
- SUCCESS_CODES = %w( 990004 990005 990017 990012 990018 990031 )
146
+ SUCCESS_CODES = %w(990004 990005 990017 990012 990018 990031)
147
147
 
148
148
  TRANSACTION_CODES = {
149
149
  0 => 'Not Done',
@@ -162,22 +162,32 @@ module ActiveMerchant #:nodoc:
162
162
 
163
163
  def purchase(money, creditcard, options = {})
164
164
  MultiResponse.run do |r|
165
- r.process{authorize(money, creditcard, options)}
166
- r.process{capture(money, r.authorization, options)}
165
+ r.process { authorize(money, creditcard, options) }
166
+ r.process { capture(money, r.authorization, options) }
167
167
  end
168
168
  end
169
169
 
170
170
  def authorize(money, creditcard, options = {})
171
171
  action = 'authtx'
172
172
 
173
- options.merge!(:money => money, :creditcard => creditcard)
173
+ options[:money] = money
174
+ options[:creditcard] = creditcard
174
175
  commit(action, build_request(action, options))
175
176
  end
176
177
 
177
178
  def capture(money, authorization, options = {})
178
179
  action = 'settletx'
179
180
 
180
- options.merge!(:money => money, :authorization => authorization)
181
+ options[:money] = money
182
+ options[:authorization] = authorization
183
+ commit(action, build_request(action, options), authorization)
184
+ end
185
+
186
+ def refund(money, authorization, options = {})
187
+ action = 'refundtx'
188
+
189
+ options[:money] = money
190
+ options[:authorization] = authorization
181
191
  commit(action, build_request(action, options))
182
192
  end
183
193
 
@@ -187,44 +197,54 @@ module ActiveMerchant #:nodoc:
187
197
  SUCCESS_CODES.include?(response[:res])
188
198
  end
189
199
 
190
- def build_request(action, options={})
200
+ def build_request(action, options = {})
191
201
  xml = Builder::XmlMarkup.new
192
202
  xml.instruct!
193
203
 
194
- xml.tag! 'protocol', :ver => API_VERSION, :pgid => (test? ? TEST_ID : @options[:login]), :pwd => @options[:password] do |protocol|
204
+ xml.tag! 'protocol', ver: API_VERSION, pgid: (test? ? TEST_ID : @options[:login]), pwd: @options[:password] do |protocol|
205
+ money = options.delete(:money)
206
+ authorization = options.delete(:authorization)
207
+ creditcard = options.delete(:creditcard)
195
208
  case action
196
- when 'authtx'
197
- money = options.delete(:money)
198
- creditcard = options.delete(:creditcard)
199
- build_authorization(protocol, money, creditcard, options)
200
- when 'settletx'
201
- money = options.delete(:money)
202
- authorization = options.delete(:authorization)
203
- build_capture(protocol, money, authorization, options)
209
+ when 'authtx'
210
+ build_authorization(protocol, money, creditcard, options)
211
+ when 'settletx'
212
+ build_capture(protocol, money, authorization, options)
213
+ when 'refundtx'
214
+ build_refund(protocol, money, authorization, options)
204
215
  else
205
- raise "no action specified for build_request"
216
+ raise 'no action specified for build_request'
206
217
  end
207
218
  end
208
219
 
209
220
  xml.target!
210
221
  end
211
222
 
212
- def build_authorization(xml, money, creditcard, options={})
223
+ def build_authorization(xml, money, creditcard, options = {})
213
224
  xml.tag! 'authtx', {
214
- :cref => options[:order_id],
215
- :cname => creditcard.name,
216
- :cc => creditcard.number,
217
- :exp => "#{format(creditcard.month, :two_digits)}#{format(creditcard.year, :four_digits)}",
218
- :budp => 0,
219
- :amt => amount(money),
220
- :cur => (options[:currency] || currency(money)),
221
- :cvv => creditcard.verification_value
225
+ cref: options[:order_id],
226
+ cname: creditcard.name,
227
+ cc: creditcard.number,
228
+ exp: "#{format(creditcard.month, :two_digits)}#{format(creditcard.year, :four_digits)}",
229
+ budp: 0,
230
+ amt: amount(money),
231
+ cur: (options[:currency] || currency(money)),
232
+ cvv: creditcard.verification_value,
233
+ email: options[:email],
234
+ ip: options[:ip]
222
235
  }
223
236
  end
224
237
 
225
- def build_capture(xml, money, authorization, options={})
238
+ def build_capture(xml, money, authorization, options = {})
226
239
  xml.tag! 'settletx', {
227
- :tid => authorization
240
+ tid: authorization
241
+ }
242
+ end
243
+
244
+ def build_refund(xml, money, authorization, options = {})
245
+ xml.tag! 'refundtx', {
246
+ tid: authorization,
247
+ amt: amount(money)
228
248
  }
229
249
  end
230
250
 
@@ -235,21 +255,18 @@ module ActiveMerchant #:nodoc:
235
255
  response_action = action.gsub(/tx/, 'rx')
236
256
  root = REXML::XPath.first(xml.root, response_action)
237
257
  # we might have gotten an error
238
- if root.nil?
239
- root = REXML::XPath.first(xml.root, 'errorrx')
240
- end
258
+ root = REXML::XPath.first(xml.root, 'errorrx') if root.nil?
241
259
  root.attributes.each do |name, value|
242
260
  hash[name.to_sym] = value
243
261
  end
244
262
  hash
245
263
  end
246
264
 
247
- def commit(action, request)
265
+ def commit(action, request, authorization = nil)
248
266
  response = parse(action, ssl_post(self.live_url, request))
249
267
  Response.new(successful?(response), message_from(response), response,
250
- :test => test?,
251
- :authorization => response[:tid]
252
- )
268
+ test: test?,
269
+ authorization: authorization || response[:tid])
253
270
  end
254
271
 
255
272
  def message_from(response)
@@ -258,4 +275,3 @@ module ActiveMerchant #:nodoc:
258
275
  end
259
276
  end
260
277
  end
261
-
@@ -0,0 +1,213 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class PayHubGateway < Gateway
4
+ self.live_url = 'https://checkout.payhub.com/transaction/api'
5
+
6
+ self.supported_countries = ['US']
7
+ self.default_currency = 'USD'
8
+ self.supported_cardtypes = %i[visa master american_express discover]
9
+
10
+ self.homepage_url = 'http://www.payhub.com/'
11
+ self.display_name = 'PayHub'
12
+
13
+ CVV_CODE_TRANSLATOR = {
14
+ 'M' => 'CVV matches',
15
+ 'N' => 'CVV does not match',
16
+ 'P' => 'CVV not processed',
17
+ 'S' => 'CVV should have been present',
18
+ 'U' => 'CVV request unable to be processed by issuer'
19
+ }
20
+
21
+ AVS_CODE_TRANSLATOR = {
22
+ '0' => 'Approved, Address verification was not requested.',
23
+ 'A' => 'Approved, Address matches only.',
24
+ 'B' => 'Address Match. Street Address math for international transaction Postal Code not verified because of incompatible formats (Acquirer sent both street address and Postal Code)',
25
+ 'C' => 'Serv Unavailable. Street address and Postal Code not verified for international transaction because of incompatible formats (Acquirer sent both street and Postal Code).',
26
+ 'D' => 'Exact Match, Street Address and Postal Code match for international transaction.',
27
+ 'F' => 'Exact Match, Street Address and Postal Code match. Applies to UK only.',
28
+ 'G' => 'Ver Unavailable, Non-U.S. Issuer does not participate.',
29
+ 'I' => 'Ver Unavailable, Address information not verified for international transaction',
30
+ 'M' => 'Exact Match, Street Address and Postal Code match for international transaction',
31
+ 'N' => 'No - Address and ZIP Code does not match',
32
+ 'P' => 'Zip Match, Postal Codes match for international transaction Street address not verified because of incompatible formats (Acquirer sent both street address and Postal Code).',
33
+ 'R' => 'Retry - Issuer system unavailable',
34
+ 'S' => 'Serv Unavailable, Service not supported',
35
+ 'U' => 'Ver Unavailable, Address unavailable.',
36
+ 'W' => 'ZIP match - Nine character numeric ZIP match only.',
37
+ 'X' => 'Exact match, Address and nine-character ZIP match.',
38
+ 'Y' => 'Exact Match, Address and five character ZIP match.',
39
+ 'Z' => 'Zip Match, Five character numeric ZIP match only.',
40
+ '1' => 'Cardholder name and ZIP match AMEX only.',
41
+ '2' => 'Cardholder name, address, and ZIP match AMEX only.',
42
+ '3' => 'Cardholder name and address match AMEX only.',
43
+ '4' => 'Cardholder name match AMEX only.',
44
+ '5' => 'Cardholder name incorrect, ZIP match AMEX only.',
45
+ '6' => 'Cardholder name incorrect, address and ZIP match AMEX only.',
46
+ '7' => 'Cardholder name incorrect, address match AMEX only.',
47
+ '8' => 'Cardholder, all do not match AMEX only.'
48
+ }
49
+
50
+ STANDARD_ERROR_CODE_MAPPING = {
51
+ '14' => STANDARD_ERROR_CODE[:invalid_number],
52
+ '80' => STANDARD_ERROR_CODE[:invalid_expiry_date],
53
+ '82' => STANDARD_ERROR_CODE[:invalid_cvc],
54
+ '54' => STANDARD_ERROR_CODE[:expired_card],
55
+ '51' => STANDARD_ERROR_CODE[:card_declined],
56
+ '05' => STANDARD_ERROR_CODE[:card_declined],
57
+ '61' => STANDARD_ERROR_CODE[:card_declined],
58
+ '62' => STANDARD_ERROR_CODE[:card_declined],
59
+ '65' => STANDARD_ERROR_CODE[:card_declined],
60
+ '93' => STANDARD_ERROR_CODE[:card_declined],
61
+ '01' => STANDARD_ERROR_CODE[:call_issuer],
62
+ '02' => STANDARD_ERROR_CODE[:call_issuer],
63
+ '04' => STANDARD_ERROR_CODE[:pickup_card],
64
+ '07' => STANDARD_ERROR_CODE[:pickup_card],
65
+ '41' => STANDARD_ERROR_CODE[:pickup_card],
66
+ '43' => STANDARD_ERROR_CODE[:pickup_card]
67
+ }
68
+
69
+ def initialize(options = {})
70
+ requires!(options, :orgid, :username, :password, :tid)
71
+
72
+ super
73
+ end
74
+
75
+ def authorize(amount, creditcard, options = {})
76
+ post = setup_post('auth')
77
+ add_creditcard(post, creditcard)
78
+ add_amount(post, amount)
79
+ add_address(post, (options[:address] || options[:billing_address]))
80
+ add_customer_data(post, options)
81
+
82
+ commit(post)
83
+ end
84
+
85
+ def purchase(amount, creditcard, options = {})
86
+ post = setup_post('sale')
87
+ add_creditcard(post, creditcard)
88
+ add_amount(post, amount)
89
+ add_address(post, (options[:address] || options[:billing_address]))
90
+ add_customer_data(post, options)
91
+
92
+ commit(post)
93
+ end
94
+
95
+ def refund(amount, trans_id, options = {})
96
+ # Attempt a void in case the transaction is unsettled
97
+ post = setup_post('void')
98
+ add_reference(post, trans_id)
99
+ response = commit(post)
100
+ return response if response.success?
101
+
102
+ post = setup_post('refund')
103
+ add_reference(post, trans_id)
104
+ commit(post)
105
+ end
106
+
107
+ def capture(amount, trans_id, options = {})
108
+ post = setup_post('capture')
109
+
110
+ add_reference(post, trans_id)
111
+ add_amount(post, amount)
112
+
113
+ commit(post)
114
+ end
115
+
116
+ # No void, as PayHub's void does not work on authorizations
117
+
118
+ def verify(creditcard, options = {})
119
+ authorize(100, creditcard, options)
120
+ end
121
+
122
+ private
123
+
124
+ def setup_post(action)
125
+ post = {}
126
+ post[:orgid] = @options[:orgid]
127
+ post[:tid] = @options[:tid]
128
+ post[:username] = @options[:username]
129
+ post[:password] = @options[:password]
130
+ post[:mode] = (test? ? 'demo' : 'live')
131
+ post[:trans_type] = action
132
+ post
133
+ end
134
+
135
+ def add_reference(post, trans_id)
136
+ post[:trans_id] = trans_id
137
+ end
138
+
139
+ def add_customer_data(post, options = {})
140
+ post[:first_name] = options[:first_name]
141
+ post[:last_name] = options[:last_name]
142
+ post[:phone] = options[:phone]
143
+ post[:email] = options[:email]
144
+ end
145
+
146
+ def add_address(post, address)
147
+ return unless address
148
+
149
+ post[:address1] = address[:address1]
150
+ post[:address2] = address[:address2]
151
+ post[:zip] = address[:zip]
152
+ post[:state] = address[:state]
153
+ post[:city] = address[:city]
154
+ end
155
+
156
+ def add_amount(post, amount)
157
+ post[:amount] = amount(amount)
158
+ end
159
+
160
+ def add_creditcard(post, creditcard)
161
+ post[:cc] = creditcard.number
162
+ post[:month] = creditcard.month.to_s
163
+ post[:year] = creditcard.year.to_s
164
+ post[:cvv] = creditcard.verification_value
165
+ end
166
+
167
+ def parse(body)
168
+ JSON.parse(body)
169
+ end
170
+
171
+ def commit(post)
172
+ success = false
173
+
174
+ begin
175
+ raw_response = ssl_post(live_url, post.to_json, { 'Content-Type' => 'application/json' })
176
+ response = parse(raw_response)
177
+ success = (response['RESPONSE_CODE'] == '00')
178
+ rescue ResponseError => e
179
+ raw_response = e.response.body
180
+ response = response_error(raw_response)
181
+ rescue JSON::ParserError
182
+ response = json_error(raw_response)
183
+ end
184
+
185
+ Response.new(success,
186
+ response_message(response),
187
+ response,
188
+ test: test?,
189
+ avs_result: { code: response['AVS_RESULT_CODE'] },
190
+ cvv_result: response['VERIFICATION_RESULT_CODE'],
191
+ error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['RESPONSE_CODE']]),
192
+ authorization: response['TRANSACTION_ID'])
193
+ end
194
+
195
+ def response_error(raw_response)
196
+ parse(raw_response)
197
+ rescue JSON::ParserError
198
+ json_error(raw_response)
199
+ end
200
+
201
+ def json_error(raw_response)
202
+ {
203
+ error_message: 'Invalid response received from the Payhub API. Please contact wecare@payhub.com if you continue to receive this message.' \
204
+ " (The raw response returned by the API was #{raw_response.inspect})"
205
+ }
206
+ end
207
+
208
+ def response_message(response)
209
+ (response['RESPONSE_TEXT'] || response['RESPONSE_CODE'] || response[:error_message])
210
+ end
211
+ end
212
+ end
213
+ end
@@ -97,23 +97,23 @@ module ActiveMerchant #:nodoc:
97
97
  # See example use above for address AVS fields
98
98
  # See #recurring for periodic transaction fields
99
99
  class PayJunctionGateway < Gateway
100
- API_VERSION = '1.2'
100
+ API_VERSION = '1.2'
101
101
 
102
102
  class_attribute :test_url, :live_url
103
103
 
104
- self.test_url = "https://www.payjunctionlabs.com/quick_link"
105
- self.live_url = "https://payjunction.com/quick_link"
104
+ self.test_url = 'https://www.payjunctionlabs.com/quick_link'
105
+ self.live_url = 'https://payjunction.com/quick_link'
106
106
 
107
107
  TEST_LOGIN = 'pj-ql-01'
108
108
  TEST_PASSWORD = 'pj-ql-01p'
109
109
 
110
- SUCCESS_CODES = ["00", "85"]
110
+ SUCCESS_CODES = %w[00 85]
111
111
  SUCCESS_MESSAGE = 'The transaction was approved.'
112
112
 
113
113
  FAILURE_MESSAGE = 'The transaction was declined.'
114
114
 
115
115
  DECLINE_CODES = {
116
- "AE" => 'Address verification failed because address did not match.',
116
+ 'AE' => 'Address verification failed because address did not match.',
117
117
  'ZE' => 'Address verification failed because zip did not match.',
118
118
  'XE' => 'Address verification failed because zip and address did not match.',
119
119
  'YE' => 'Address verification failed because zip and address did not match.',
@@ -144,13 +144,13 @@ module ActiveMerchant #:nodoc:
144
144
  '96' => 'Declined because of a system error.',
145
145
  'N7' => 'Declined because of a CVV2/CVC2 mismatch.',
146
146
  'M4' => 'Declined.',
147
- "FE" => "There was a format error with your Trinity Gateway Service (API) request.",
148
- "LE" => "Could not log you in (problem with dc_logon and/or dc_password).",
147
+ 'FE' => 'There was a format error with your Trinity Gateway Service (API) request.',
148
+ 'LE' => 'Could not log you in (problem with dc_logon and/or dc_password).',
149
149
  'NL' => 'Aborted because of a system error, please try again later. ',
150
150
  'AB' => 'Aborted because of an upstream system error, please try again later.'
151
151
  }
152
152
 
153
- self.supported_cardtypes = [:visa, :master, :american_express, :discover]
153
+ self.supported_cardtypes = %i[visa master american_express discover]
154
154
  self.supported_countries = ['US']
155
155
  self.homepage_url = 'http://www.payjunction.com/'
156
156
  self.display_name = 'PayJunction'
@@ -165,7 +165,7 @@ module ActiveMerchant #:nodoc:
165
165
  # transaction_id that can be used later to postauthorize (capture) the funds.
166
166
  def authorize(money, payment_source, options = {})
167
167
  parameters = {
168
- :transaction_amount => amount(money),
168
+ transaction_amount: amount(money)
169
169
  }
170
170
 
171
171
  add_payment_source(parameters, payment_source)
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
  # Execute authorization and capture in a single step.
179
179
  def purchase(money, payment_source, options = {})
180
180
  parameters = {
181
- :transaction_amount => amount(money),
181
+ transaction_amount: amount(money)
182
182
  }
183
183
 
184
184
  add_payment_source(parameters, payment_source)
@@ -191,8 +191,8 @@ module ActiveMerchant #:nodoc:
191
191
  # Retrieve funds that have been previously authorized with _authorization_
192
192
  def capture(money, authorization, options = {})
193
193
  parameters = {
194
- :transaction_id => authorization,
195
- :posture => 'capture'
194
+ transaction_id: authorization,
195
+ posture: 'capture'
196
196
  }
197
197
 
198
198
  add_optional_fields(parameters, options)
@@ -203,8 +203,8 @@ module ActiveMerchant #:nodoc:
203
203
  # _authorization_ should be the transaction id of the transaction we are returning.
204
204
  def refund(money, authorization, options = {})
205
205
  parameters = {
206
- :transaction_amount => amount(money),
207
- :transaction_id => authorization
206
+ transaction_amount: amount(money),
207
+ transaction_id: authorization
208
208
  }
209
209
 
210
210
  commit('CREDIT', parameters)
@@ -219,8 +219,8 @@ module ActiveMerchant #:nodoc:
219
219
  # through the batch process.
220
220
  def void(authorization, options = {})
221
221
  parameters = {
222
- :transaction_id => authorization,
223
- :posture => 'void'
222
+ transaction_id: authorization,
223
+ posture: 'void'
224
224
  }
225
225
 
226
226
  add_optional_fields(parameters, options)
@@ -241,16 +241,17 @@ module ActiveMerchant #:nodoc:
241
241
  def recurring(money, payment_source, options = {})
242
242
  ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
243
243
 
244
- requires!(options, [:periodicity, :monthly, :weekly, :daily], :payments)
244
+ requires!(options, %i[periodicity monthly weekly daily], :payments)
245
245
 
246
- periodic_type = case options[:periodicity]
247
- when :monthly
248
- 'month'
249
- when :weekly
250
- 'week'
251
- when :daily
252
- 'day'
253
- end
246
+ periodic_type =
247
+ case options[:periodicity]
248
+ when :monthly
249
+ 'month'
250
+ when :weekly
251
+ 'week'
252
+ when :daily
253
+ 'day'
254
+ end
254
255
 
255
256
  if options[:starting_at].nil?
256
257
  start_date = Time.now.strftime('%Y-%m-%d')
@@ -262,12 +263,12 @@ module ActiveMerchant #:nodoc:
262
263
  end
263
264
 
264
265
  parameters = {
265
- :transaction_amount => amount(money),
266
- :schedule_periodic_type => periodic_type,
267
- :schedule_create => 'true',
268
- :schedule_limit => options[:payments].to_i > 1 ? options[:payments] : 1,
269
- :schedule_periodic_number => 1,
270
- :schedule_start => start_date
266
+ transaction_amount: amount(money),
267
+ schedule_periodic_type: periodic_type,
268
+ schedule_create: 'true',
269
+ schedule_limit: options[:payments].to_i > 1 ? options[:payments] : 1,
270
+ schedule_periodic_number: 1,
271
+ schedule_start: start_date
271
272
  }
272
273
 
273
274
  add_payment_source(parameters, payment_source)
@@ -318,7 +319,7 @@ module ActiveMerchant #:nodoc:
318
319
  address = options[:billing_address] || options[:address]
319
320
 
320
321
  if address
321
- params[:address] = address[:address1] unless address[:address1].blank?
322
+ params[:address] = address[:address1] unless address[:address1].blank?
322
323
  params[:city] = address[:city] unless address[:city].blank?
323
324
  params[:state] = address[:state] unless address[:state].blank?
324
325
  params[:zipcode] = address[:zip] unless address[:zip].blank?
@@ -334,12 +335,11 @@ module ActiveMerchant #:nodoc:
334
335
  def commit(action, parameters)
335
336
  url = test? ? self.test_url : self.live_url
336
337
 
337
- response = parse( ssl_post(url, post_data(action, parameters)) )
338
+ response = parse(ssl_post(url, post_data(action, parameters)))
338
339
 
339
340
  Response.new(successful?(response), message_from(response), response,
340
- :test => test?,
341
- :authorization => response[:transaction_id] || parameters[:transaction_id]
342
- )
341
+ test: test?,
342
+ authorization: response[:transaction_id] || parameters[:transaction_id])
343
343
  end
344
344
 
345
345
  def successful?(response)
@@ -366,7 +366,7 @@ module ActiveMerchant #:nodoc:
366
366
  params[:version] = API_VERSION
367
367
  params[:transaction_type] = action
368
368
 
369
- params.reject{|k,v| v.blank?}.collect{ |k, v| "dc_#{k.to_s}=#{CGI.escape(v.to_s)}" }.join("&")
369
+ params.reject { |_k, v| v.blank? }.collect { |k, v| "dc_#{k}=#{CGI.escape(v.to_s)}" }.join('&')
370
370
  end
371
371
 
372
372
  def parse(body)