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
@@ -3,53 +3,150 @@ require 'nokogiri'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class LitleGateway < Gateway
6
- SCHEMA_VERSION = '8.18'
6
+ SCHEMA_VERSION = '9.14'
7
7
 
8
- self.test_url = 'https://www.testlitle.com/sandbox/communicator/online'
9
- self.live_url = 'https://payments.litle.com/vap/communicator/online'
8
+ class_attribute :postlive_url
9
+
10
+ self.test_url = 'https://www.testvantivcnp.com/sandbox/communicator/online'
11
+ self.postlive_url = 'https://payments.vantivpostlive.com/vap/communicator/online'
12
+ self.live_url = 'https://payments.vantivcnp.com/vap/communicator/online'
10
13
 
11
14
  self.supported_countries = ['US']
12
15
  self.default_currency = 'USD'
13
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
14
-
15
- self.homepage_url = 'http://www.litle.com/'
16
- self.display_name = 'Litle & Co.'
17
-
18
- # Public: Create a new Litle gateway.
19
- #
20
- # options - A hash of options:
21
- # :login - The user.
22
- # :password - The password.
23
- # :merchant_id - The merchant id.
24
- def initialize(options={})
16
+ self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
17
+
18
+ self.homepage_url = 'http://www.vantiv.com/'
19
+ self.display_name = 'Vantiv eCommerce'
20
+
21
+ def initialize(options = {})
25
22
  requires!(options, :login, :password, :merchant_id)
26
23
  super
27
24
  end
28
25
 
29
- def purchase(money, payment_method, options={})
26
+ def purchase(money, payment_method, options = {})
30
27
  request = build_xml_request do |doc|
31
28
  add_authentication(doc)
32
- doc.sale(transaction_attributes(options)) do
33
- add_auth_purchase_params(doc, money, payment_method, options)
29
+ if check?(payment_method)
30
+ doc.echeckSale(transaction_attributes(options)) do
31
+ add_echeck_purchase_params(doc, money, payment_method, options)
32
+ end
33
+ else
34
+ doc.sale(transaction_attributes(options)) do
35
+ add_auth_purchase_params(doc, money, payment_method, options)
36
+ end
37
+ end
38
+ end
39
+ check?(payment_method) ? commit(:echeckSales, request, money) : commit(:sale, request, money)
40
+ end
41
+
42
+ def add_level_two_data(doc, payment_method, options = {})
43
+ level_2_data = options[:level_2_data]
44
+ if level_2_data
45
+ doc.enhancedData do
46
+ case payment_method.brand
47
+ when 'visa'
48
+ doc.salesTax(level_2_data[:sales_tax]) if level_2_data[:sales_tax]
49
+ when 'master'
50
+ doc.customerReference(level_2_data[:customer_code]) if level_2_data[:customer_code]
51
+ doc.salesTax(level_2_data[:total_tax_amount]) if level_2_data[:total_tax_amount]
52
+ doc.detailTax do
53
+ doc.taxIncludedInTotal(level_2_data[:tax_included_in_total]) if level_2_data[:tax_included_in_total]
54
+ doc.taxAmount(level_2_data[:tax_amount]) if level_2_data[:tax_amount]
55
+ doc.cardAcceptorTaxId(level_2_data[:card_acceptor_tax_id]) if level_2_data[:card_acceptor_tax_id]
56
+ end
57
+ end
34
58
  end
35
59
  end
60
+ end
36
61
 
37
- commit(:sale, request)
62
+ def add_level_three_data(doc, payment_method, options = {})
63
+ level_3_data = options[:level_3_data]
64
+ if level_3_data
65
+ doc.enhancedData do
66
+ case payment_method.brand
67
+ when 'visa'
68
+ add_level_three_information_tags_visa(doc, payment_method, level_3_data)
69
+ when 'master'
70
+ add_level_three_information_tags_master(doc, payment_method, level_3_data)
71
+ end
72
+ end
73
+ end
38
74
  end
39
75
 
40
- def authorize(money, payment_method, options={})
76
+ def add_level_three_information_tags_visa(doc, payment_method, level_3_data)
77
+ doc.discountAmount(level_3_data[:discount_amount]) if level_3_data[:discount_amount]
78
+ doc.shippingAmount(level_3_data[:shipping_amount]) if level_3_data[:shipping_amount]
79
+ doc.dutyAmount(level_3_data[:duty_amount]) if level_3_data[:duty_amount]
80
+ doc.detailTax do
81
+ doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
82
+ doc.taxAmount(level_3_data[:tax_amount]) if level_3_data[:tax_amount]
83
+ doc.taxRate(level_3_data[:tax_rate]) if level_3_data[:tax_rate]
84
+ doc.taxTypeIdentifier(level_3_data[:tax_type_identifier]) if level_3_data[:tax_type_identifier]
85
+ doc.cardAcceptorTaxId(level_3_data[:card_acceptor_tax_id]) if level_3_data[:card_acceptor_tax_id]
86
+ end
87
+ add_line_item_information_for_level_three_visa(doc, payment_method, level_3_data)
88
+ end
89
+
90
+ def add_level_three_information_tags_master(doc, payment_method, level_3_data)
91
+ doc.customerReference :customerReference, level_3_data[:customer_code] if level_3_data[:customer_code]
92
+ doc.salesTax(level_3_data[:total_tax_amount]) if level_3_data[:total_tax_amount]
93
+ doc.detailTax do
94
+ doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
95
+ doc.taxAmount(level_3_data[:tax_amount]) if level_3_data[:tax_amount]
96
+ doc.cardAcceptorTaxId :cardAcceptorTaxId, level_3_data[:card_acceptor_tax_id] if level_3_data[:card_acceptor_tax_id]
97
+ end
98
+ doc.lineItemData do
99
+ level_3_data[:line_items].each do |line_item|
100
+ doc.itemDescription(line_item[:item_description]) if line_item[:item_description]
101
+ doc.productCode(line_item[:product_code]) if line_item[:product_code]
102
+ doc.quantity(line_item[:quantity]) if line_item[:quantity]
103
+ doc.unitOfMeasure(line_item[:unit_of_measure]) if line_item[:unit_of_measure]
104
+ doc.lineItemTotal(line_item[:line_item_total]) if line_item[:line_item_total]
105
+ end
106
+ end
107
+ end
108
+
109
+ def add_line_item_information_for_level_three_visa(doc, payment_method, level_3_data)
110
+ doc.lineItemData do
111
+ level_3_data[:line_items].each do |line_item|
112
+ doc.itemSequenceNumber(line_item[:item_sequence_number]) if line_item[:item_sequence_number]
113
+ doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
114
+ doc.itemDescription(line_item[:item_description]) if line_item[:item_description]
115
+ doc.productCode(line_item[:product_code]) if line_item[:product_code]
116
+ doc.quantity(line_item[:quantity]) if line_item[:quantity]
117
+ doc.unitOfMeasure(line_item[:unit_of_measure]) if line_item[:unit_of_measure]
118
+ doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
119
+ doc.itemDiscountAmount(line_item[:discount_per_line_item]) unless line_item[:discount_per_line_item] < 0
120
+ doc.unitCost(line_item[:unit_cost]) unless line_item[:unit_cost] < 0
121
+ doc.detailTax do
122
+ doc.taxIncludedInTotal(line_item[:tax_included_in_total]) if line_item[:tax_included_in_total]
123
+ doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
124
+ doc.taxRate(line_item[:tax_rate]) if line_item[:tax_rate]
125
+ doc.taxTypeIdentifier(line_item[:tax_type_identifier]) if line_item[:tax_type_identifier]
126
+ doc.cardAcceptorTaxId(line_item[:card_acceptor_tax_id]) if line_item[:card_acceptor_tax_id]
127
+ end
128
+ end
129
+ end
130
+ end
131
+
132
+ def authorize(money, payment_method, options = {})
41
133
  request = build_xml_request do |doc|
42
134
  add_authentication(doc)
43
- doc.authorization(transaction_attributes(options)) do
44
- add_auth_purchase_params(doc, money, payment_method, options)
135
+ if check?(payment_method)
136
+ doc.echeckVerification(transaction_attributes(options)) do
137
+ add_echeck_purchase_params(doc, money, payment_method, options)
138
+ end
139
+ else
140
+ doc.authorization(transaction_attributes(options)) do
141
+ add_auth_purchase_params(doc, money, payment_method, options)
142
+ end
45
143
  end
46
144
  end
47
-
48
- commit(:authorization, request)
145
+ check?(payment_method) ? commit(:echeckVerification, request, money) : commit(:authorization, request, money)
49
146
  end
50
147
 
51
- def capture(money, authorization, options={})
52
- transaction_id, _ = split_authorization(authorization)
148
+ def capture(money, authorization, options = {})
149
+ transaction_id, = split_authorization(authorization)
53
150
 
54
151
  request = build_xml_request do |doc|
55
152
  add_authentication(doc)
@@ -60,7 +157,7 @@ module ActiveMerchant #:nodoc:
60
157
  end
61
158
  end
62
159
 
63
- commit(:capture, request)
160
+ commit(:capture, request, money)
64
161
  end
65
162
 
66
163
  def credit(money, authorization, options = {})
@@ -68,19 +165,24 @@ module ActiveMerchant #:nodoc:
68
165
  refund(money, authorization, options)
69
166
  end
70
167
 
71
- def refund(money, authorization, options={})
72
- transaction_id, _ = split_authorization(authorization)
73
-
168
+ def refund(money, payment, options = {})
74
169
  request = build_xml_request do |doc|
75
170
  add_authentication(doc)
76
171
  add_descriptor(doc, options)
77
- doc.credit(transaction_attributes(options)) do
78
- doc.litleTxnId(transaction_id)
79
- doc.amount(money) if money
172
+ doc.send(refund_type(payment), transaction_attributes(options)) do
173
+ if payment.is_a?(String)
174
+ transaction_id, = split_authorization(payment)
175
+ doc.litleTxnId(transaction_id)
176
+ doc.amount(money) if money
177
+ elsif check?(payment)
178
+ add_echeck_purchase_params(doc, money, payment, options)
179
+ else
180
+ add_credit_params(doc, money, payment, options)
181
+ end
80
182
  end
81
183
  end
82
184
 
83
- commit(:credit, request)
185
+ commit(refund_type(payment), request)
84
186
  end
85
187
 
86
188
  def verify(creditcard, options = {})
@@ -90,32 +192,61 @@ module ActiveMerchant #:nodoc:
90
192
  end
91
193
  end
92
194
 
93
- def void(authorization, options={})
94
- transaction_id, kind = split_authorization(authorization)
195
+ def void(authorization, options = {})
196
+ transaction_id, kind, money = split_authorization(authorization)
95
197
 
96
198
  request = build_xml_request do |doc|
97
199
  add_authentication(doc)
98
200
  doc.send(void_type(kind), transaction_attributes(options)) do
99
201
  doc.litleTxnId(transaction_id)
202
+ doc.amount(money) if void_type(kind) == :authReversal
100
203
  end
101
204
  end
102
205
 
103
206
  commit(void_type(kind), request)
104
207
  end
105
208
 
106
- def store(creditcard, options = {})
209
+ def store(payment_method, options = {})
107
210
  request = build_xml_request do |doc|
108
211
  add_authentication(doc)
109
212
  doc.registerTokenRequest(transaction_attributes(options)) do
110
- doc.orderId(truncated(options[:order_id]))
111
- doc.accountNumber(creditcard.number)
213
+ doc.orderId(truncate(options[:order_id], 24))
214
+ if payment_method.is_a?(String)
215
+ doc.paypageRegistrationId(payment_method)
216
+ elsif check?(payment_method)
217
+ doc.echeckForToken do
218
+ doc.accNum(payment_method.account_number)
219
+ doc.routingNum(payment_method.routing_number)
220
+ end
221
+ else
222
+ doc.accountNumber(payment_method.number)
223
+ doc.cardValidationNum(payment_method.verification_value) if payment_method.verification_value
224
+ end
112
225
  end
113
226
  end
114
227
 
115
228
  commit(:registerToken, request)
116
229
  end
117
230
 
231
+ def supports_scrubbing?
232
+ true
233
+ end
234
+
235
+ def scrub(transcript)
236
+ transcript.
237
+ gsub(%r((<user>).+(</user>)), '\1[FILTERED]\2').
238
+ gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
239
+ gsub(%r((<number>).+(</number>)), '\1[FILTERED]\2').
240
+ gsub(%r((<accNum>).+(</accNum>)), '\1[FILTERED]\2').
241
+ gsub(%r((<routingNum>).+(</routingNum>)), '\1[FILTERED]\2').
242
+ gsub(%r((<cardValidationNum>).+(</cardValidationNum>)), '\1[FILTERED]\2').
243
+ gsub(%r((<accountNumber>).+(</accountNumber>)), '\1[FILTERED]\2').
244
+ gsub(%r((<paypageRegistrationId>).+(</paypageRegistrationId>)), '\1[FILTERED]\2').
245
+ gsub(%r((<authenticationValue>).+(</authenticationValue>)), '\1[FILTERED]\2')
246
+ end
247
+
118
248
  private
249
+
119
250
  CARD_TYPE = {
120
251
  'visa' => 'VI',
121
252
  'master' => 'MC',
@@ -126,25 +257,46 @@ module ActiveMerchant #:nodoc:
126
257
  }
127
258
 
128
259
  AVS_RESPONSE_CODE = {
129
- '00' => 'Y',
130
- '01' => 'X',
131
- '02' => 'D',
132
- '10' => 'Z',
133
- '11' => 'W',
134
- '12' => 'A',
135
- '13' => 'A',
136
- '14' => 'P',
137
- '20' => 'N',
138
- '30' => 'S',
139
- '31' => 'R',
140
- '32' => 'U',
141
- '33' => 'R',
142
- '34' => 'I',
143
- '40' => 'E'
260
+ '00' => 'Y',
261
+ '01' => 'X',
262
+ '02' => 'D',
263
+ '10' => 'Z',
264
+ '11' => 'W',
265
+ '12' => 'A',
266
+ '13' => 'A',
267
+ '14' => 'P',
268
+ '20' => 'N',
269
+ '30' => 'S',
270
+ '31' => 'R',
271
+ '32' => 'U',
272
+ '33' => 'R',
273
+ '34' => 'I',
274
+ '40' => 'E'
144
275
  }
145
276
 
146
277
  def void_type(kind)
147
- (kind == 'authorization') ? :authReversal : :void
278
+ if kind == 'authorization'
279
+ :authReversal
280
+ elsif kind == 'echeckSales'
281
+ :echeckVoid
282
+ else
283
+ :void
284
+ end
285
+ end
286
+
287
+ def refund_type(payment)
288
+ _, kind, = split_authorization(payment)
289
+ if check?(payment) || kind == 'echeckSales'
290
+ :echeckCredit
291
+ else
292
+ :credit
293
+ end
294
+ end
295
+
296
+ def check?(payment_method)
297
+ return false if payment_method.is_a?(String)
298
+
299
+ card_brand(payment_method) == 'check'
148
300
  end
149
301
 
150
302
  def add_authentication(doc)
@@ -155,14 +307,49 @@ module ActiveMerchant #:nodoc:
155
307
  end
156
308
 
157
309
  def add_auth_purchase_params(doc, money, payment_method, options)
158
- doc.orderId(truncated(options[:order_id]))
310
+ doc.orderId(truncate(options[:order_id], 24))
159
311
  doc.amount(money)
160
- add_order_source(doc, payment_method)
312
+ add_order_source(doc, payment_method, options)
161
313
  add_billing_address(doc, payment_method, options)
162
314
  add_shipping_address(doc, payment_method, options)
163
- add_payment_method(doc, payment_method)
315
+ add_payment_method(doc, payment_method, options)
164
316
  add_pos(doc, payment_method)
165
317
  add_descriptor(doc, options)
318
+ add_level_two_data(doc, payment_method, options)
319
+ add_level_three_data(doc, payment_method, options)
320
+ add_merchant_data(doc, options)
321
+ add_debt_repayment(doc, options)
322
+ add_stored_credential_params(doc, options)
323
+ end
324
+
325
+ def add_credit_params(doc, money, payment_method, options)
326
+ doc.orderId(truncate(options[:order_id], 24))
327
+ doc.amount(money)
328
+ add_order_source(doc, payment_method, options)
329
+ add_billing_address(doc, payment_method, options)
330
+ add_payment_method(doc, payment_method, options)
331
+ add_pos(doc, payment_method)
332
+ add_descriptor(doc, options)
333
+ add_merchant_data(doc, options)
334
+ end
335
+
336
+ def add_merchant_data(doc, options = {})
337
+ if options[:affiliate] || options[:campaign] || options[:merchant_grouping_id]
338
+ doc.merchantData do
339
+ doc.affiliate(options[:affiliate]) if options[:affiliate]
340
+ doc.campaign(options[:campaign]) if options[:campaign]
341
+ doc.merchantGroupingId(options[:merchant_grouping_id]) if options[:merchant_grouping_id]
342
+ end
343
+ end
344
+ end
345
+
346
+ def add_echeck_purchase_params(doc, money, payment_method, options)
347
+ doc.orderId(truncate(options[:order_id], 24))
348
+ doc.amount(money)
349
+ add_order_source(doc, payment_method, options)
350
+ add_billing_address(doc, payment_method, options)
351
+ add_payment_method(doc, payment_method, options)
352
+ add_descriptor(doc, options)
166
353
  end
167
354
 
168
355
  def add_descriptor(doc, options)
@@ -174,15 +361,27 @@ module ActiveMerchant #:nodoc:
174
361
  end
175
362
  end
176
363
 
177
- def add_payment_method(doc, payment_method)
364
+ def add_debt_repayment(doc, options)
365
+ doc.debtRepayment(true) if options[:debt_repayment] == true
366
+ end
367
+
368
+ def add_payment_method(doc, payment_method, options)
178
369
  if payment_method.is_a?(String)
179
370
  doc.token do
180
371
  doc.litleToken(payment_method)
372
+ doc.expDate(format_exp_date(options[:basis_expiration_month], options[:basis_expiration_year])) if options[:basis_expiration_month] && options[:basis_expiration_year]
181
373
  end
182
374
  elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
183
375
  doc.card do
184
376
  doc.track(payment_method.track_data)
185
377
  end
378
+ elsif check?(payment_method)
379
+ doc.echeck do
380
+ doc.accType(payment_method.account_type.capitalize)
381
+ doc.accNum(payment_method.account_number)
382
+ doc.routingNum(payment_method.routing_number)
383
+ doc.checkNum(payment_method.number) if payment_method.number
384
+ end
186
385
  else
187
386
  doc.card do
188
387
  doc.type_(CARD_TYPE[payment_method.brand])
@@ -190,14 +389,62 @@ module ActiveMerchant #:nodoc:
190
389
  doc.expDate(exp_date(payment_method))
191
390
  doc.cardValidationNum(payment_method.verification_value)
192
391
  end
392
+ if payment_method.is_a?(NetworkTokenizationCreditCard)
393
+ doc.cardholderAuthentication do
394
+ doc.authenticationValue(payment_method.payment_cryptogram)
395
+ end
396
+ elsif options[:order_source]&.start_with?('3ds')
397
+ doc.cardholderAuthentication do
398
+ doc.authenticationValue(options[:cavv]) if options[:cavv]
399
+ doc.authenticationTransactionId(options[:xid]) if options[:xid]
400
+ end
401
+ end
402
+ end
403
+ end
404
+
405
+ def add_stored_credential_params(doc, options = {})
406
+ return unless options[:stored_credential]
407
+
408
+ if options[:stored_credential][:initial_transaction]
409
+ add_stored_credential_params_initial(doc, options)
410
+ else
411
+ add_stored_credential_params_used(doc, options)
193
412
  end
194
413
  end
195
414
 
415
+ def add_stored_credential_params_initial(doc, options)
416
+ case options[:stored_credential][:reason_type]
417
+ when 'unscheduled'
418
+ doc.processingType('initialCOF')
419
+ when 'installment'
420
+ doc.processingType('initialInstallment')
421
+ when 'recurring'
422
+ doc.processingType('initialRecurring')
423
+ end
424
+ end
425
+
426
+ def add_stored_credential_params_used(doc, options)
427
+ if options[:stored_credential][:reason_type] == 'unscheduled'
428
+ if options[:stored_credential][:initiator] == 'merchant'
429
+ doc.processingType('merchantInitiatedCOF')
430
+ else
431
+ doc.processingType('cardholderInitiatedCOF')
432
+ end
433
+ end
434
+ doc.originalNetworkTransactionId(options[:stored_credential][:network_transaction_id])
435
+ end
436
+
196
437
  def add_billing_address(doc, payment_method, options)
197
438
  return if payment_method.is_a?(String)
198
439
 
199
440
  doc.billToAddress do
200
- doc.name(payment_method.name)
441
+ if check?(payment_method)
442
+ doc.name(payment_method.name)
443
+ doc.firstName(payment_method.first_name)
444
+ doc.lastName(payment_method.last_name)
445
+ else
446
+ doc.name(payment_method.name)
447
+ end
201
448
  doc.email(options[:email]) if options[:email]
202
449
 
203
450
  add_address(doc, options[:billing_address])
@@ -216,23 +463,55 @@ module ActiveMerchant #:nodoc:
216
463
  return unless address
217
464
 
218
465
  doc.companyName(address[:company]) unless address[:company].blank?
219
- doc.addressLine1(address[:address1]) unless address[:address1].blank?
220
- doc.addressLine2(address[:address2]) unless address[:address2].blank?
221
- doc.city(address[:city]) unless address[:city].blank?
466
+ doc.addressLine1(truncate(address[:address1], 35)) unless address[:address1].blank?
467
+ doc.addressLine2(truncate(address[:address2], 35)) unless address[:address2].blank?
468
+ doc.city(truncate(address[:city], 35)) unless address[:city].blank?
222
469
  doc.state(address[:state]) unless address[:state].blank?
223
470
  doc.zip(address[:zip]) unless address[:zip].blank?
224
471
  doc.country(address[:country]) unless address[:country].blank?
225
472
  doc.phone(address[:phone]) unless address[:phone].blank?
226
473
  end
227
474
 
228
- def add_order_source(doc, payment_method)
229
- if payment_method.respond_to?(:track_data) && payment_method.track_data.present?
475
+ def add_order_source(doc, payment_method, options)
476
+ order_source = order_source(options)
477
+ if order_source
478
+ doc.orderSource(order_source)
479
+ elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :apple_pay
480
+ doc.orderSource('applepay')
481
+ elsif payment_method.is_a?(NetworkTokenizationCreditCard) && %i[google_pay android_pay].include?(payment_method.source)
482
+ doc.orderSource('androidpay')
483
+ elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
230
484
  doc.orderSource('retail')
231
485
  else
232
486
  doc.orderSource('ecommerce')
233
487
  end
234
488
  end
235
489
 
490
+ def order_source(options = {})
491
+ return options[:order_source] unless options[:stored_credential]
492
+
493
+ order_source = nil
494
+
495
+ case options[:stored_credential][:reason_type]
496
+ when 'unscheduled'
497
+ if options[:stored_credential][:initiator] == 'merchant'
498
+ # For merchant-initiated, we should always set order source to
499
+ # 'ecommerce'
500
+ order_source = 'ecommerce'
501
+ else
502
+ # For cardholder-initiated, we rely on #add_order_source's
503
+ # default logic to set orderSource appropriately
504
+ order_source = options[:order_source]
505
+ end
506
+ when 'installment'
507
+ order_source = 'installment'
508
+ when 'recurring'
509
+ order_source = 'recurring'
510
+ end
511
+
512
+ order_source
513
+ end
514
+
236
515
  def add_pos(doc, payment_method)
237
516
  return unless payment_method.respond_to?(:track_data) && payment_method.track_data.present?
238
517
 
@@ -244,7 +523,11 @@ module ActiveMerchant #:nodoc:
244
523
  end
245
524
 
246
525
  def exp_date(payment_method)
247
- "#{format(payment_method.month, :two_digits)}#{format(payment_method.year, :two_digits)}"
526
+ format_exp_date(payment_method.month, payment_method.year)
527
+ end
528
+
529
+ def format_exp_date(month, year)
530
+ "#{format(month, :two_digits)}#{format(year, :two_digits)}"
248
531
  end
249
532
 
250
533
  def parse(kind, xml)
@@ -252,7 +535,7 @@ module ActiveMerchant #:nodoc:
252
535
 
253
536
  doc = Nokogiri::XML(xml).remove_namespaces!
254
537
  doc.xpath("//litleOnlineResponse/#{kind}Response/*").each do |node|
255
- if (node.elements.empty?)
538
+ if node.elements.empty?
256
539
  parsed[node.name.to_sym] = node.text
257
540
  else
258
541
  node.elements.each do |childnode|
@@ -262,17 +545,23 @@ module ActiveMerchant #:nodoc:
262
545
  end
263
546
  end
264
547
 
548
+ if parsed.empty?
549
+ %w(response message).each do |attribute|
550
+ parsed[attribute.to_sym] = doc.xpath('//litleOnlineResponse').attribute(attribute).value
551
+ end
552
+ end
553
+
265
554
  parsed
266
555
  end
267
556
 
268
- def commit(kind, request)
557
+ def commit(kind, request, money = nil)
269
558
  parsed = parse(kind, ssl_post(url, request, headers))
270
559
 
271
560
  options = {
272
- authorization: authorization_from(kind, parsed),
561
+ authorization: authorization_from(kind, parsed, money),
273
562
  test: test?,
274
- :avs_result => { :code => AVS_RESPONSE_CODE[parsed[:fraudResult_avsResult]] },
275
- :cvv_result => parsed[:fraudResult_cardValidationResult]
563
+ avs_result: { code: AVS_RESPONSE_CODE[parsed[:fraudResult_avsResult]] },
564
+ cvv_result: parsed[:fraudResult_cardValidationResult]
276
565
  }
277
566
 
278
567
  Response.new(success_from(kind, parsed), parsed[:message], parsed, options)
@@ -280,24 +569,25 @@ module ActiveMerchant #:nodoc:
280
569
 
281
570
  def success_from(kind, parsed)
282
571
  return (parsed[:response] == '000') unless kind == :registerToken
572
+
283
573
  %w(000 801 802).include?(parsed[:response])
284
574
  end
285
575
 
286
- def authorization_from(kind, parsed)
287
- (kind == :registerToken) ? parsed[:litleToken] : "#{parsed[:litleTxnId]};#{kind}"
576
+ def authorization_from(kind, parsed, money)
577
+ kind == :registerToken ? parsed[:litleToken] : "#{parsed[:litleTxnId]};#{kind};#{money}"
288
578
  end
289
579
 
290
580
  def split_authorization(authorization)
291
- transaction_id, kind = authorization.to_s.split(';')
292
- [transaction_id, kind]
581
+ transaction_id, kind, money = authorization.to_s.split(';')
582
+ [transaction_id, kind, money]
293
583
  end
294
584
 
295
585
  def transaction_attributes(options)
296
586
  attributes = {}
297
- attributes[:id] = truncated(options[:id] || options[:order_id])
587
+ attributes[:id] = truncate(options[:id] || options[:order_id], 24)
298
588
  attributes[:reportGroup] = options[:merchant] || 'Default Report Group'
299
- attributes[:customerId] = options[:customer]
300
- attributes.delete_if { |key, value| value == nil }
589
+ attributes[:customerId] = options[:customer_id]
590
+ attributes.delete_if { |_key, value| value == nil }
301
591
  attributes
302
592
  end
303
593
 
@@ -305,7 +595,7 @@ module ActiveMerchant #:nodoc:
305
595
  {
306
596
  merchantId: @options[:merchant_id],
307
597
  version: SCHEMA_VERSION,
308
- xmlns: "http://www.litle.com/schema"
598
+ xmlns: 'http://www.litle.com/schema'
309
599
  }
310
600
  end
311
601
 
@@ -318,22 +608,9 @@ module ActiveMerchant #:nodoc:
318
608
  end
319
609
 
320
610
  def url
321
- test? ? test_url : live_url
322
- end
323
-
324
- def truncated(value)
325
- return unless value
326
- value[0..24]
327
- end
611
+ return postlive_url if @options[:url_override].to_s == 'postlive'
328
612
 
329
- def truncated_order_id(options)
330
- return unless options[:order_id]
331
- options[:order_id][0..24]
332
- end
333
-
334
- def truncated_id(options)
335
- return unless options[:id]
336
- options[:id][0..24]
613
+ test? ? test_url : live_url
337
614
  end
338
615
 
339
616
  def headers