activemerchant 1.133.0 → 1.138.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +450 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/lib/active_merchant/billing/apple_pay_payment_token.rb +2 -2
  5. data/lib/active_merchant/billing/base.rb +2 -2
  6. data/lib/active_merchant/billing/check.rb +16 -4
  7. data/lib/active_merchant/billing/compatibility.rb +4 -4
  8. data/lib/active_merchant/billing/credit_card.rb +35 -16
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +13 -2
  10. data/lib/active_merchant/billing/credit_card_methods.rb +74 -19
  11. data/lib/active_merchant/billing/gateway.rb +22 -2
  12. data/lib/active_merchant/billing/gateways/adyen.rb +282 -87
  13. data/lib/active_merchant/billing/gateways/airwallex.rb +46 -25
  14. data/lib/active_merchant/billing/gateways/alelo.rb +29 -11
  15. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/authorize_net.rb +49 -41
  17. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +14 -10
  18. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -5
  19. data/lib/active_merchant/billing/gateways/axcessms.rb +9 -5
  20. data/lib/active_merchant/billing/gateways/balanced.rb +2 -2
  21. data/lib/active_merchant/billing/gateways/bambora_apac.rb +2 -2
  22. data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/banwire.rb +6 -4
  24. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +8 -8
  25. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +2 -2
  26. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  27. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +12 -8
  28. data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
  29. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +2 -2
  30. data/lib/active_merchant/billing/gateways/blue_pay.rb +15 -7
  31. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
  32. data/lib/active_merchant/billing/gateways/bogus.rb +2 -2
  33. data/lib/active_merchant/billing/gateways/borgun.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/bpoint.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +3 -1
  36. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +68 -23
  37. data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
  38. data/lib/active_merchant/billing/gateways/braintree_blue.rb +266 -89
  39. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -3
  40. data/lib/active_merchant/billing/gateways/bridge_pay.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/cams.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/card_connect.rb +7 -4
  43. data/lib/active_merchant/billing/gateways/card_save.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/card_stream.rb +12 -13
  45. data/lib/active_merchant/billing/gateways/cardknox.rb +2 -2
  46. data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -2
  47. data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
  48. data/lib/active_merchant/billing/gateways/cc5.rb +2 -2
  49. data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
  50. data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +331 -0
  51. data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
  52. data/lib/active_merchant/billing/gateways/cecabank.rb +9 -242
  53. data/lib/active_merchant/billing/gateways/cenpos.rb +9 -3
  54. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/checkout_v2.rb +362 -50
  56. data/lib/active_merchant/billing/gateways/clearhaus.rb +2 -2
  57. data/lib/active_merchant/billing/gateways/commerce_hub.rb +117 -35
  58. data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
  59. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  60. data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
  61. data/lib/active_merchant/billing/gateways/credorax.rb +109 -20
  62. data/lib/active_merchant/billing/gateways/ct_payment.rb +6 -6
  63. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  64. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +2 -2
  65. data/lib/active_merchant/billing/gateways/cyber_source.rb +379 -100
  66. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +147 -76
  67. data/lib/active_merchant/billing/gateways/d_local.rb +45 -22
  68. data/lib/active_merchant/billing/gateways/data_cash.rb +22 -18
  69. data/lib/active_merchant/billing/gateways/datatrans.rb +284 -0
  70. data/lib/active_merchant/billing/gateways/decidir.rb +82 -46
  71. data/lib/active_merchant/billing/gateways/decidir_plus.rb +31 -35
  72. data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
  73. data/lib/active_merchant/billing/gateways/dibs.rb +3 -3
  74. data/lib/active_merchant/billing/gateways/digitzs.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/ebanx.rb +116 -68
  76. data/lib/active_merchant/billing/gateways/efsnet.rb +13 -8
  77. data/lib/active_merchant/billing/gateways/elavon.rb +80 -47
  78. data/lib/active_merchant/billing/gateways/element.rb +39 -10
  79. data/lib/active_merchant/billing/gateways/epay.rb +8 -4
  80. data/lib/active_merchant/billing/gateways/evo_ca.rb +8 -4
  81. data/lib/active_merchant/billing/gateways/eway.rb +6 -4
  82. data/lib/active_merchant/billing/gateways/eway_managed.rb +8 -4
  83. data/lib/active_merchant/billing/gateways/eway_rapid.rb +3 -3
  84. data/lib/active_merchant/billing/gateways/exact.rb +8 -4
  85. data/lib/active_merchant/billing/gateways/fat_zebra.rb +37 -7
  86. data/lib/active_merchant/billing/gateways/federated_canada.rb +8 -4
  87. data/lib/active_merchant/billing/gateways/finansbank.rb +2 -2
  88. data/lib/active_merchant/billing/gateways/first_giving.rb +2 -2
  89. data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
  90. data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
  91. data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
  92. data/lib/active_merchant/billing/gateways/first_pay.rb +8 -174
  93. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +8 -4
  94. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +9 -5
  95. data/lib/active_merchant/billing/gateways/flex_charge.rb +359 -0
  96. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -2
  97. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
  98. data/lib/active_merchant/billing/gateways/forte.rb +6 -4
  99. data/lib/active_merchant/billing/gateways/fortis.rb +347 -0
  100. data/lib/active_merchant/billing/gateways/garanti.rb +6 -4
  101. data/lib/active_merchant/billing/gateways/global_collect.rb +69 -50
  102. data/lib/active_merchant/billing/gateways/global_transport.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/hdfc.rb +2 -2
  104. data/lib/active_merchant/billing/gateways/hi_pay.rb +287 -0
  105. data/lib/active_merchant/billing/gateways/hps.rb +40 -47
  106. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  107. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +2 -2
  108. data/lib/active_merchant/billing/gateways/inspire.rb +8 -6
  109. data/lib/active_merchant/billing/gateways/instapay.rb +9 -6
  110. data/lib/active_merchant/billing/gateways/ipg.rb +14 -10
  111. data/lib/active_merchant/billing/gateways/ipp.rb +2 -2
  112. data/lib/active_merchant/billing/gateways/iridium.rb +18 -8
  113. data/lib/active_merchant/billing/gateways/itransact.rb +8 -4
  114. data/lib/active_merchant/billing/gateways/iveri.rb +12 -9
  115. data/lib/active_merchant/billing/gateways/ixopay.rb +4 -4
  116. data/lib/active_merchant/billing/gateways/jetpay.rb +6 -4
  117. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +9 -6
  118. data/lib/active_merchant/billing/gateways/komoju.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/kushki.rb +79 -16
  120. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/linkpoint.rb +8 -4
  122. data/lib/active_merchant/billing/gateways/litle.rb +37 -54
  123. data/lib/active_merchant/billing/gateways/loan_payment_pro.rb +267 -0
  124. data/lib/active_merchant/billing/gateways/loan_payment_pro_ach.rb +93 -0
  125. data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/maxipago.rb +4 -4
  127. data/lib/active_merchant/billing/gateways/mercado_pago.rb +32 -11
  128. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +10 -7
  129. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  130. data/lib/active_merchant/billing/gateways/merchant_partners.rb +2 -2
  131. data/lib/active_merchant/billing/gateways/merchant_ware.rb +13 -6
  132. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +13 -6
  133. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -5
  134. data/lib/active_merchant/billing/gateways/mercury.rb +11 -5
  135. data/lib/active_merchant/billing/gateways/metrics_global.rb +10 -8
  136. data/lib/active_merchant/billing/gateways/micropayment.rb +2 -2
  137. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -6
  138. data/lib/active_merchant/billing/gateways/migs.rb +8 -4
  139. data/lib/active_merchant/billing/gateways/mit.rb +10 -5
  140. data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +21 -13
  142. data/lib/active_merchant/billing/gateways/moka.rb +2 -2
  143. data/lib/active_merchant/billing/gateways/monei.rb +3 -3
  144. data/lib/active_merchant/billing/gateways/moneris.rb +11 -5
  145. data/lib/active_merchant/billing/gateways/money_movers.rb +8 -4
  146. data/lib/active_merchant/billing/gateways/multi_pay.rb +267 -0
  147. data/lib/active_merchant/billing/gateways/mundipagg.rb +5 -3
  148. data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -10
  149. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +2 -2
  150. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
  151. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  152. data/lib/active_merchant/billing/gateways/netbanx.rb +4 -6
  153. data/lib/active_merchant/billing/gateways/netbilling.rb +8 -4
  154. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/network_merchants.rb +9 -5
  156. data/lib/active_merchant/billing/gateways/nmi.rb +29 -8
  157. data/lib/active_merchant/billing/gateways/nuvei.rb +573 -0
  158. data/lib/active_merchant/billing/gateways/ogone.rb +8 -4
  159. data/lib/active_merchant/billing/gateways/omise.rb +2 -2
  160. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  161. data/lib/active_merchant/billing/gateways/opp.rb +3 -4
  162. data/lib/active_merchant/billing/gateways/optimal_payment.rb +12 -6
  163. data/lib/active_merchant/billing/gateways/orbital/orbital_codes.rb +273 -0
  164. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
  165. data/lib/active_merchant/billing/gateways/orbital.rb +114 -94
  166. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +9 -6
  167. data/lib/active_merchant/billing/gateways/pagarme.rb +2 -2
  168. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  169. data/lib/active_merchant/billing/gateways/pay_arc.rb +9 -7
  170. data/lib/active_merchant/billing/gateways/pay_conex.rb +6 -4
  171. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +8 -4
  172. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -5
  173. data/lib/active_merchant/billing/gateways/pay_junction.rb +8 -4
  174. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +2 -2
  175. data/lib/active_merchant/billing/gateways/pay_secure.rb +8 -4
  176. data/lib/active_merchant/billing/gateways/pay_trace.rb +36 -22
  177. data/lib/active_merchant/billing/gateways/paybox_direct.rb +14 -14
  178. data/lib/active_merchant/billing/gateways/payeezy.rb +26 -13
  179. data/lib/active_merchant/billing/gateways/payex.rb +8 -6
  180. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
  182. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
  183. data/lib/active_merchant/billing/gateways/payflow.rb +12 -11
  184. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  185. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
  186. data/lib/active_merchant/billing/gateways/payflow_uk.rb +2 -2
  187. data/lib/active_merchant/billing/gateways/payment_express.rb +10 -6
  188. data/lib/active_merchant/billing/gateways/paymentez.rb +30 -16
  189. data/lib/active_merchant/billing/gateways/paymill.rb +6 -4
  190. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +17 -12
  191. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +2 -2
  192. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +2 -2
  193. data/lib/active_merchant/billing/gateways/paypal.rb +4 -2
  194. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  195. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
  196. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -2
  197. data/lib/active_merchant/billing/gateways/paysafe.rb +48 -24
  198. data/lib/active_merchant/billing/gateways/payscout.rb +9 -6
  199. data/lib/active_merchant/billing/gateways/paystation.rb +9 -5
  200. data/lib/active_merchant/billing/gateways/payu_in.rb +2 -2
  201. data/lib/active_merchant/billing/gateways/payu_latam.rb +7 -5
  202. data/lib/active_merchant/billing/gateways/payway.rb +6 -2
  203. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +6 -6
  204. data/lib/active_merchant/billing/gateways/pin.rb +126 -41
  205. data/lib/active_merchant/billing/gateways/plexo.rb +71 -20
  206. data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
  207. data/lib/active_merchant/billing/gateways/priority.rb +29 -24
  208. data/lib/active_merchant/billing/gateways/pro_pay.rb +2 -2
  209. data/lib/active_merchant/billing/gateways/psigate.rb +8 -4
  210. data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
  211. data/lib/active_merchant/billing/gateways/qbms.rb +9 -5
  212. data/lib/active_merchant/billing/gateways/quantum.rb +9 -5
  213. data/lib/active_merchant/billing/gateways/quickbooks.rb +27 -17
  214. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
  215. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +8 -4
  216. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -2
  217. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -2
  218. data/lib/active_merchant/billing/gateways/rapyd.rb +172 -53
  219. data/lib/active_merchant/billing/gateways/reach.rb +16 -9
  220. data/lib/active_merchant/billing/gateways/redsys.rb +7 -15
  221. data/lib/active_merchant/billing/gateways/redsys_rest.rb +545 -0
  222. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  223. data/lib/active_merchant/billing/gateways/safe_charge.rb +47 -24
  224. data/lib/active_merchant/billing/gateways/sage.rb +14 -6
  225. data/lib/active_merchant/billing/gateways/sage_pay.rb +81 -7
  226. data/lib/active_merchant/billing/gateways/sallie_mae.rb +8 -4
  227. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -5
  228. data/lib/active_merchant/billing/gateways/secure_pay.rb +10 -8
  229. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -15
  230. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +8 -4
  231. data/lib/active_merchant/billing/gateways/securion_pay.rb +26 -12
  232. data/lib/active_merchant/billing/gateways/shift4.rb +34 -26
  233. data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
  234. data/lib/active_merchant/billing/gateways/simetrik.rb +26 -17
  235. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -4
  236. data/lib/active_merchant/billing/gateways/smart_ps.rb +10 -7
  237. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -4
  238. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -6
  239. data/lib/active_merchant/billing/gateways/stripe.rb +88 -84
  240. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +388 -77
  241. data/lib/active_merchant/billing/gateways/sum_up.rb +224 -0
  242. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +6 -4
  243. data/lib/active_merchant/billing/gateways/telr.rb +6 -7
  244. data/lib/active_merchant/billing/gateways/trans_first.rb +6 -4
  245. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +10 -18
  246. data/lib/active_merchant/billing/gateways/transact_pro.rb +3 -3
  247. data/lib/active_merchant/billing/gateways/transax.rb +2 -2
  248. data/lib/active_merchant/billing/gateways/transnational.rb +2 -2
  249. data/lib/active_merchant/billing/gateways/trexle.rb +2 -2
  250. data/lib/active_merchant/billing/gateways/trust_commerce.rb +9 -5
  251. data/lib/active_merchant/billing/gateways/usa_epay.rb +2 -2
  252. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -31
  253. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +8 -4
  254. data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
  255. data/lib/active_merchant/billing/gateways/vantiv_express.rb +668 -0
  256. data/lib/active_merchant/billing/gateways/verifi.rb +12 -8
  257. data/lib/active_merchant/billing/gateways/versa_pay.rb +307 -0
  258. data/lib/active_merchant/billing/gateways/viaklix.rb +8 -4
  259. data/lib/active_merchant/billing/gateways/visanet_peru.rb +5 -5
  260. data/lib/active_merchant/billing/gateways/vpos.rb +25 -13
  261. data/lib/active_merchant/billing/gateways/webpay.rb +3 -3
  262. data/lib/active_merchant/billing/gateways/wepay.rb +6 -4
  263. data/lib/active_merchant/billing/gateways/wirecard.rb +10 -6
  264. data/lib/active_merchant/billing/gateways/wompi.rb +14 -7
  265. data/lib/active_merchant/billing/gateways/world_net.rb +2 -2
  266. data/lib/active_merchant/billing/gateways/worldpay.rb +297 -113
  267. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +16 -13
  268. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  269. data/lib/active_merchant/billing/gateways/xpay.rb +244 -0
  270. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -3
  271. data/lib/active_merchant/billing/payment_token.rb +2 -2
  272. data/lib/active_merchant/billing/response.rb +7 -6
  273. data/lib/active_merchant/billing.rb +1 -0
  274. data/lib/active_merchant/connection.rb +8 -20
  275. data/lib/active_merchant/country.rb +3 -1
  276. data/lib/active_merchant/errors.rb +12 -2
  277. data/lib/active_merchant/net_http_ssl_connection.rb +35 -0
  278. data/lib/active_merchant/posts_data.rb +19 -4
  279. data/lib/active_merchant/version.rb +1 -1
  280. data/lib/active_merchant/versionable.rb +29 -0
  281. data/lib/certs/cacert.pem +1326 -1491
  282. data/lib/support/gateway_support.rb +3 -3
  283. data/lib/support/ssl_verify.rb +6 -6
  284. data/lib/support/ssl_version.rb +8 -8
  285. metadata +35 -9
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  # For more information on the Iridium Gateway please download the
4
4
  # documentation from their Merchant Management System.
5
5
  #
@@ -376,22 +376,32 @@ module ActiveMerchant #:nodoc:
376
376
 
377
377
  def commit(request, options)
378
378
  requires!(options, :action)
379
- response = parse(ssl_post(test? ? self.test_url : self.live_url, request,
380
- { 'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action],
381
- 'Content-Type' => 'text/xml; charset=utf-8' }))
379
+ response = parse(
380
+ ssl_post(
381
+ test? ? self.test_url : self.live_url, request,
382
+ {
383
+ 'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action],
384
+ 'Content-Type' => 'text/xml; charset=utf-8'
385
+ }
386
+ )
387
+ )
382
388
 
383
389
  success = response[:transaction_result][:status_code] == '0'
384
390
  message = response[:transaction_result][:message]
385
391
  authorization = success ? [options[:order_id], response[:transaction_output_data][:cross_reference], response[:transaction_output_data][:auth_code]].compact.join(';') : nil
386
392
 
387
- Response.new(success, message, response,
393
+ Response.new(
394
+ success,
395
+ message,
396
+ response,
388
397
  test: test?,
389
- authorization: authorization,
398
+ authorization:,
390
399
  avs_result: {
391
400
  street_match: AVS_CODE[ response[:transaction_output_data][:address_numeric_check_result] ],
392
401
  postal_match: AVS_CODE[ response[:transaction_output_data][:post_code_check_result] ]
393
402
  },
394
- cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ])
403
+ cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ]
404
+ )
395
405
  end
396
406
 
397
407
  def parse(xml)
@@ -1,7 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  # iTransact, Inc. is an authorized reseller of the PaymentClearing gateway. If your merchant service provider uses PaymentClearing.com to process payments, you can use this module.
6
6
  #
7
7
  #
@@ -387,11 +387,15 @@ module ActiveMerchant #:nodoc:
387
387
  # the Base64 encoded payload signature!
388
388
  response = parse(ssl_post(self.live_url, post_data(payload), 'Content-Type' => 'text/xml'))
389
389
 
390
- Response.new(successful?(response), response[:error_message], response,
390
+ Response.new(
391
+ successful?(response),
392
+ response[:error_message],
393
+ response,
391
394
  test: test?,
392
395
  authorization: response[:xid],
393
396
  avs_result: { code: response[:avs_response] },
394
- cvv_result: response[:cvv_response])
397
+ cvv_result: response[:cvv_response]
398
+ )
395
399
  end
396
400
 
397
401
  def post_data(payload)
@@ -1,9 +1,11 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class IveriGateway < Gateway
6
6
  class_attribute :iveri_url
7
+ # Define the API version using the Versionable module
8
+ version '2.0'
7
9
 
8
10
  self.live_url = self.test_url = 'https://portal.nedsecure.co.za/iVeriWebService/Service.asmx'
9
11
  self.iveri_url = 'https://portal.host.iveri.com/iVeriWebService/Service.asmx'
@@ -55,7 +57,8 @@ module ActiveMerchant #:nodoc:
55
57
  end
56
58
 
57
59
  def void(authorization, options = {})
58
- post = build_vxml_request('Void', options) do |xml|
60
+ txn_type = options[:reference_type] == :authorize ? 'AuthorisationReversal' : 'Void'
61
+ post = build_vxml_request(txn_type, options) do |xml|
59
62
  add_authorization(xml, authorization, options)
60
63
  end
61
64
 
@@ -65,7 +68,7 @@ module ActiveMerchant #:nodoc:
65
68
  def verify(credit_card, options = {})
66
69
  MultiResponse.run(:use_first_response) do |r|
67
70
  r.process { authorize(100, credit_card, options) }
68
- r.process(:ignore_result) { void(r.authorization, options) }
71
+ r.process(:ignore_result) { void(r.authorization, options.merge(reference_type: :authorize)) }
69
72
  end
70
73
  end
71
74
 
@@ -96,7 +99,7 @@ module ActiveMerchant #:nodoc:
96
99
  xml.Execute 'xmlns' => 'http://iveri.com/' do
97
100
  xml.validateRequest('false')
98
101
  xml.protocol 'V_XML'
99
- xml.protocolVersion '2.0'
102
+ xml.protocolVersion fetch_version # Fetch the version dynamically
100
103
  xml.request vxml
101
104
  end
102
105
  end
@@ -108,7 +111,7 @@ module ActiveMerchant #:nodoc:
108
111
 
109
112
  def build_vxml_request(action, options)
110
113
  builder = Nokogiri::XML::Builder.new do |xml|
111
- xml.V_XML('Version' => '2.0', 'CertificateID' => @options[:cert_id], 'Direction' => 'Request') do
114
+ xml.V_XML('Version' => fetch_version, 'CertificateID' => @options[:cert_id], 'Direction' => 'Request') do
112
115
  xml.Transaction('ApplicationID' => @options[:app_id], 'Command' => action, 'Mode' => mode) do
113
116
  yield(xml)
114
117
  end
@@ -218,10 +221,10 @@ module ActiveMerchant #:nodoc:
218
221
  end
219
222
  end
220
223
 
221
- if !node.elements.empty?
222
- node.elements.each { |e| parse_element(parsed, e) }
223
- else
224
+ if node.elements.empty?
224
225
  parsed[underscore(node.name)] = node.text
226
+ else
227
+ node.elements.each { |e| parse_element(parsed, e) }
225
228
  end
226
229
  end
227
230
 
@@ -1,7 +1,7 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class IxopayGateway < Gateway
6
6
  self.test_url = 'https://secure.ixopay.com/transaction'
7
7
  self.live_url = 'https://secure.ixopay.com/transaction'
@@ -286,8 +286,8 @@ module ActiveMerchant #:nodoc:
286
286
  response =
287
287
  begin
288
288
  parse(ssl_post(url, request, headers(request)))
289
- rescue StandardError => error
290
- parse(error.response.body)
289
+ rescue StandardError => e
290
+ parse(e.response.body)
291
291
  end
292
292
 
293
293
  Response.new(
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class JetpayGateway < Gateway
4
4
  class_attribute :live_us_url, :live_ca_url
5
5
 
@@ -284,13 +284,15 @@ module ActiveMerchant #:nodoc:
284
284
  response = parse(ssl_post(url, request))
285
285
 
286
286
  success = success?(response)
287
- Response.new(success,
287
+ Response.new(
288
+ success,
288
289
  success ? 'APPROVED' : message_from(response),
289
290
  response,
290
291
  test: test?,
291
292
  authorization: authorization_from(response, money, token),
292
293
  avs_result: { code: response[:avs] },
293
- cvv_result: response[:cvv2])
294
+ cvv_result: response[:cvv2]
295
+ )
294
296
  end
295
297
 
296
298
  def url
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class JetpayV2Gateway < Gateway
4
4
  self.test_url = 'https://test1.jetpay.com/jetpay'
5
5
  self.live_url = 'https://gateway20.jetpay.com/jetpay'
@@ -12,7 +12,8 @@ module ActiveMerchant #:nodoc:
12
12
  self.homepage_url = 'http://www.jetpay.com'
13
13
  self.display_name = 'JetPay'
14
14
 
15
- API_VERSION = '2.2'
15
+ # Define the API version using the Versionable module
16
+ version '2.2'
16
17
 
17
18
  ACTION_CODE_MESSAGES = {
18
19
  '000' => 'Approved.',
@@ -203,7 +204,7 @@ module ActiveMerchant #:nodoc:
203
204
 
204
205
  def build_xml_request(transaction_type, options = {}, transaction_id = nil, &block)
205
206
  xml = Builder::XmlMarkup.new
206
- xml.tag! 'JetPay', 'Version' => API_VERSION do
207
+ xml.tag! 'JetPay', 'Version' => fetch_version do # Use normalized version
207
208
  # Basic values needed for any request
208
209
  xml.tag! 'TerminalID', @options[:login]
209
210
  xml.tag! 'TransactionType', transaction_type
@@ -295,14 +296,16 @@ module ActiveMerchant #:nodoc:
295
296
  response = parse(ssl_post(url, request))
296
297
 
297
298
  success = success?(response)
298
- Response.new(success,
299
+ Response.new(
300
+ success,
299
301
  success ? 'APPROVED' : message_from(response),
300
302
  response,
301
303
  test: test?,
302
304
  authorization: authorization_from(response, money, token),
303
305
  avs_result: AVSResult.new(code: response[:avs]),
304
306
  cvv_result: CVVResult.new(response[:cvv2]),
305
- error_code: success ? nil : error_code_from(response))
307
+ error_code: success ? nil : error_code_from(response)
308
+ )
306
309
  end
307
310
 
308
311
  def url
@@ -1,7 +1,7 @@
1
1
  require 'json'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class KomojuGateway < Gateway
6
6
  self.test_url = 'https://komoju.com/api/v1'
7
7
  self.live_url = 'https://komoju.com/api/v1'
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class KushkiGateway < Gateway
4
4
  self.display_name = 'Kushki'
5
5
  self.homepage_url = 'https://www.kushkipagos.com'
@@ -12,6 +12,9 @@ module ActiveMerchant #:nodoc:
12
12
  self.money_format = :dollars
13
13
  self.supported_cardtypes = %i[visa master american_express discover diners_club alia]
14
14
 
15
+ # Define the API version using the Versionable module
16
+ version 'v1'
17
+
15
18
  def initialize(options = {})
16
19
  requires!(options, :public_merchant_id, :private_merchant_id)
17
20
  super
@@ -20,14 +23,14 @@ module ActiveMerchant #:nodoc:
20
23
  def purchase(amount, payment_method, options = {})
21
24
  MultiResponse.run() do |r|
22
25
  r.process { tokenize(amount, payment_method, options) }
23
- r.process { charge(amount, r.authorization, options) }
26
+ r.process { charge(amount, r.authorization, options, payment_method) }
24
27
  end
25
28
  end
26
29
 
27
30
  def authorize(amount, payment_method, options = {})
28
31
  MultiResponse.run() do |r|
29
32
  r.process { tokenize(amount, payment_method, options) }
30
- r.process { preauthorize(amount, r.authorization, options) }
33
+ r.process { preauthorize(amount, r.authorization, options, payment_method) }
31
34
  end
32
35
  end
33
36
 
@@ -48,8 +51,9 @@ module ActiveMerchant #:nodoc:
48
51
  post = {}
49
52
  post[:ticketNumber] = authorization
50
53
  add_full_response(post, options)
54
+ add_invoice(action, post, amount, options)
51
55
 
52
- commit(action, post)
56
+ commit(action, post, options)
53
57
  end
54
58
 
55
59
  def void(authorization, options = {})
@@ -89,7 +93,7 @@ module ActiveMerchant #:nodoc:
89
93
  commit(action, post)
90
94
  end
91
95
 
92
- def charge(amount, authorization, options)
96
+ def charge(amount, authorization, options, payment_method = {})
93
97
  action = 'charge'
94
98
 
95
99
  post = {}
@@ -100,11 +104,13 @@ module ActiveMerchant #:nodoc:
100
104
  add_metadata(post, options)
101
105
  add_months(post, options)
102
106
  add_deferred(post, options)
107
+ add_three_d_secure(post, payment_method, options)
108
+ add_product_details(post, options)
103
109
 
104
110
  commit(action, post)
105
111
  end
106
112
 
107
- def preauthorize(amount, authorization, options)
113
+ def preauthorize(amount, authorization, options, payment_method = {})
108
114
  action = 'preAuthorization'
109
115
 
110
116
  post = {}
@@ -114,6 +120,7 @@ module ActiveMerchant #:nodoc:
114
120
  add_metadata(post, options)
115
121
  add_months(post, options)
116
122
  add_deferred(post, options)
123
+ add_three_d_secure(post, payment_method, options)
117
124
 
118
125
  commit(action, post)
119
126
  end
@@ -133,9 +140,9 @@ module ActiveMerchant #:nodoc:
133
140
  end
134
141
 
135
142
  def add_amount_defaults(sum, money, options)
136
- sum[:subtotalIva] = amount(money).to_f
143
+ sum[:subtotalIva] = 0
137
144
  sum[:iva] = 0
138
- sum[:subtotalIva0] = 0
145
+ sum[:subtotalIva0] = amount(money).to_f
139
146
 
140
147
  sum[:ice] = 0 if sum[:currency] != 'COP'
141
148
  end
@@ -183,7 +190,8 @@ module ActiveMerchant #:nodoc:
183
190
  end
184
191
 
185
192
  def add_full_response(post, options)
186
- post[:fullResponse] = options[:full_response].to_s.casecmp('true').zero? if options[:full_response]
193
+ # this is the only currently accepted value for this field, previously it was 'true'
194
+ post[:fullResponse] = 'v2' unless options[:full_response] == 'false' || options[:full_response].blank?
187
195
  end
188
196
 
189
197
  def add_metadata(post, options)
@@ -204,6 +212,59 @@ module ActiveMerchant #:nodoc:
204
212
  }
205
213
  end
206
214
 
215
+ def add_product_details(post, options)
216
+ return unless options[:product_details]
217
+
218
+ product_items_array = []
219
+ options[:product_details].each do |item|
220
+ product_items_obj = {}
221
+
222
+ product_items_obj[:id] = item[:id] if item[:id]
223
+ product_items_obj[:title] = item[:title] if item[:title]
224
+ product_items_obj[:price] = item[:price].to_i if item[:price]
225
+ product_items_obj[:sku] = item[:sku] if item[:sku]
226
+ product_items_obj[:quantity] = item[:quantity].to_i if item[:quantity]
227
+
228
+ product_items_array << product_items_obj
229
+ end
230
+
231
+ product_items = {
232
+ product: product_items_array
233
+ }
234
+
235
+ post[:productDetails] = product_items
236
+ end
237
+
238
+ def add_three_d_secure(post, payment_method, options)
239
+ three_d_secure = options[:three_d_secure]
240
+ return unless three_d_secure.present?
241
+
242
+ post[:threeDomainSecure] = {
243
+ eci: three_d_secure[:eci],
244
+ specificationVersion: three_d_secure[:version]
245
+ }
246
+
247
+ if payment_method.brand == 'master'
248
+ post[:threeDomainSecure][:acceptRisk] = three_d_secure[:eci] == '00'
249
+ post[:threeDomainSecure][:ucaf] = three_d_secure[:cavv]
250
+ post[:threeDomainSecure][:directoryServerTransactionID] = three_d_secure[:ds_transaction_id]
251
+ case three_d_secure[:eci]
252
+ when '07'
253
+ post[:threeDomainSecure][:collectionIndicator] = '0'
254
+ when '06'
255
+ post[:threeDomainSecure][:collectionIndicator] = '1'
256
+ else
257
+ post[:threeDomainSecure][:collectionIndicator] = '2'
258
+ end
259
+ elsif payment_method.brand == 'visa'
260
+ post[:threeDomainSecure][:acceptRisk] = three_d_secure[:eci] == '07'
261
+ post[:threeDomainSecure][:cavv] = three_d_secure[:cavv]
262
+ post[:threeDomainSecure][:xid] = three_d_secure[:xid] if three_d_secure[:xid].present?
263
+ else
264
+ raise ArgumentError.new 'Kushki supports 3ds2 authentication for only Visa and Mastercard brands.'
265
+ end
266
+ end
267
+
207
268
  ENDPOINT = {
208
269
  'tokenize' => 'tokens',
209
270
  'charge' => 'charges',
@@ -213,10 +274,10 @@ module ActiveMerchant #:nodoc:
213
274
  'capture' => 'capture'
214
275
  }
215
276
 
216
- def commit(action, params)
277
+ def commit(action, params, options = {})
217
278
  response =
218
279
  begin
219
- parse(ssl_invoke(action, params))
280
+ parse(ssl_invoke(action, params, options))
220
281
  rescue ResponseError => e
221
282
  parse(e.response.body)
222
283
  end
@@ -233,9 +294,11 @@ module ActiveMerchant #:nodoc:
233
294
  )
234
295
  end
235
296
 
236
- def ssl_invoke(action, params)
297
+ def ssl_invoke(action, params, options)
237
298
  if %w[void refund].include?(action)
238
- ssl_request(:delete, url(action, params), nil, headers(action))
299
+ # removes ticketNumber from request for partial refunds because gateway will reject if included in request body
300
+ data = options[:partial_refund] == true ? post_data(params.except(:ticketNumber)) : nil
301
+ ssl_request(:delete, url(action, params), data, headers(action))
239
302
  else
240
303
  ssl_post(url(action, params), post_data(params), headers(action))
241
304
  end
@@ -257,9 +320,9 @@ module ActiveMerchant #:nodoc:
257
320
  base_url = test? ? test_url : live_url
258
321
 
259
322
  if %w[void refund].include?(action)
260
- base_url + 'v1/' + ENDPOINT[action] + '/' + params[:ticketNumber].to_s
323
+ base_url + "#{fetch_version}/" + ENDPOINT[action] + '/' + params[:ticketNumber].to_s
261
324
  else
262
- base_url + 'card/v1/' + ENDPOINT[action]
325
+ base_url + "card/#{fetch_version}/" + ENDPOINT[action]
263
326
  end
264
327
  end
265
328
 
@@ -1,5 +1,5 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
1
+ module ActiveMerchant # :nodoc:
2
+ module Billing # :nodoc:
3
3
  class Latitude19Gateway < Gateway
4
4
  self.display_name = 'Latitude19 Gateway'
5
5
  self.homepage_url = 'http://www.l19tech.com'
@@ -1,7 +1,7 @@
1
1
  require 'rexml/document'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  # Initialization Options
6
6
  # :login Your store number
7
7
  # :pem The text of your linkpoint PEM file. Note
@@ -263,11 +263,15 @@ module ActiveMerchant #:nodoc:
263
263
  def commit(money, creditcard, options = {})
264
264
  response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(money, creditcard, options)))
265
265
 
266
- Response.new(successful?(response), response[:message], response,
266
+ Response.new(
267
+ successful?(response),
268
+ response[:message],
269
+ response,
267
270
  test: test?,
268
271
  authorization: response[:ordernum],
269
272
  avs_result: { code: response[:avs].to_s[2, 1] },
270
- cvv_result: response[:avs].to_s[3, 1])
273
+ cvv_result: response[:avs].to_s[3, 1]
274
+ )
271
275
  end
272
276
 
273
277
  def successful?(response)
@@ -1,9 +1,9 @@
1
1
  require 'nokogiri'
2
2
 
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
3
+ module ActiveMerchant # :nodoc:
4
+ module Billing # :nodoc:
5
5
  class LitleGateway < Gateway
6
- SCHEMA_VERSION = '9.14'
6
+ version '9.14'
7
7
 
8
8
  class_attribute :postlive_url, :prelive_url
9
9
 
@@ -111,14 +111,15 @@ module ActiveMerchant #:nodoc:
111
111
  doc.lineItemData do
112
112
  level_3_data[:line_items].each do |line_item|
113
113
  doc.itemSequenceNumber(line_item[:item_sequence_number]) if line_item[:item_sequence_number]
114
- doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
115
114
  doc.itemDescription(line_item[:item_description]) if line_item[:item_description]
116
115
  doc.productCode(line_item[:product_code]) if line_item[:product_code]
117
116
  doc.quantity(line_item[:quantity]) if line_item[:quantity]
118
117
  doc.unitOfMeasure(line_item[:unit_of_measure]) if line_item[:unit_of_measure]
119
118
  doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
120
- doc.itemDiscountAmount(line_item[:discount_per_line_item]) unless line_item[:discount_per_line_item] < 0
121
- doc.unitCost(line_item[:unit_cost]) unless line_item[:unit_cost] < 0
119
+ doc.lineItemTotal(line_item[:line_item_total]) if line_item[:line_item_total]
120
+ doc.itemDiscountAmount(line_item[:discount_per_line_item].to_i) unless line_item[:discount_per_line_item].to_i < 0
121
+ doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
122
+ doc.unitCost(line_item[:unit_cost].to_i) unless line_item[:unit_cost].to_i < 0
122
123
  doc.detailTax do
123
124
  doc.taxIncludedInTotal(line_item[:tax_included_in_total]) if line_item[:tax_included_in_total]
124
125
  doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
@@ -310,7 +311,15 @@ module ActiveMerchant #:nodoc:
310
311
  def add_auth_purchase_params(doc, money, payment_method, options)
311
312
  doc.orderId(truncate(options[:order_id], 24))
312
313
  doc.amount(money)
313
- add_order_source(doc, payment_method, options)
314
+
315
+ if options.dig(:stored_credential, :initial_transaction) == false
316
+ # orderSource needs to be added at the top of doc and
317
+ # processingType near the end
318
+ source_for_subsequent_stored_credential_txns(doc, options)
319
+ else
320
+ add_order_source(doc, payment_method, options)
321
+ end
322
+
314
323
  add_billing_address(doc, payment_method, options)
315
324
  add_shipping_address(doc, payment_method, options)
316
325
  add_payment_method(doc, payment_method, options)
@@ -382,8 +391,9 @@ module ActiveMerchant #:nodoc:
382
391
  doc.track(payment_method.track_data)
383
392
  end
384
393
  elsif check?(payment_method)
394
+ account_type = payment_method.account_type || payment_method.account_holder_type
385
395
  doc.echeck do
386
- doc.accType(payment_method.account_type.capitalize)
396
+ doc.accType(account_type&.capitalize)
387
397
  doc.accNum(payment_method.account_number)
388
398
  doc.routingNum(payment_method.routing_number)
389
399
  doc.checkNum(payment_method.number) if payment_method.number
@@ -409,16 +419,17 @@ module ActiveMerchant #:nodoc:
409
419
  end
410
420
 
411
421
  def add_stored_credential_params(doc, options = {})
412
- return unless options[:stored_credential]
422
+ return unless stored_credential = options[:stored_credential]
413
423
 
414
- if options[:stored_credential][:initial_transaction]
415
- add_stored_credential_params_initial(doc, options)
424
+ if stored_credential[:initial_transaction]
425
+ add_stored_credential_for_initial_txn(doc, options)
416
426
  else
417
- add_stored_credential_params_used(doc, options)
427
+ doc.processingType("#{stored_credential[:initiator]}InitiatedCOF") if stored_credential[:reason_type] == 'unscheduled'
428
+ doc.originalNetworkTransactionId(stored_credential[:network_transaction_id]) if stored_credential[:initiator] == 'merchant'
418
429
  end
419
430
  end
420
431
 
421
- def add_stored_credential_params_initial(doc, options)
432
+ def add_stored_credential_for_initial_txn(doc, options)
422
433
  case options[:stored_credential][:reason_type]
423
434
  when 'unscheduled'
424
435
  doc.processingType('initialCOF')
@@ -429,15 +440,15 @@ module ActiveMerchant #:nodoc:
429
440
  end
430
441
  end
431
442
 
432
- def add_stored_credential_params_used(doc, options)
433
- if options[:stored_credential][:reason_type] == 'unscheduled'
434
- if options[:stored_credential][:initiator] == 'merchant'
435
- doc.processingType('merchantInitiatedCOF')
436
- else
437
- doc.processingType('cardholderInitiatedCOF')
438
- end
443
+ def source_for_subsequent_stored_credential_txns(doc, options)
444
+ case options[:stored_credential][:reason_type]
445
+ when 'unscheduled'
446
+ doc.orderSource('ecommerce')
447
+ when 'installment'
448
+ doc.orderSource('installment')
449
+ when 'recurring'
450
+ doc.orderSource('recurring')
439
451
  end
440
- doc.originalNetworkTransactionId(options[:stored_credential][:network_transaction_id])
441
452
  end
442
453
 
443
454
  def add_billing_address(doc, payment_method, options)
@@ -479,8 +490,7 @@ module ActiveMerchant #:nodoc:
479
490
  end
480
491
 
481
492
  def add_order_source(doc, payment_method, options)
482
- order_source = order_source(options)
483
- if order_source
493
+ if order_source = options[:order_source]
484
494
  doc.orderSource(order_source)
485
495
  elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :apple_pay
486
496
  doc.orderSource('applepay')
@@ -493,31 +503,6 @@ module ActiveMerchant #:nodoc:
493
503
  end
494
504
  end
495
505
 
496
- def order_source(options = {})
497
- return options[:order_source] unless options[:stored_credential]
498
-
499
- order_source = nil
500
-
501
- case options[:stored_credential][:reason_type]
502
- when 'unscheduled'
503
- if options[:stored_credential][:initiator] == 'merchant'
504
- # For merchant-initiated, we should always set order source to
505
- # 'ecommerce'
506
- order_source = 'ecommerce'
507
- else
508
- # For cardholder-initiated, we rely on #add_order_source's
509
- # default logic to set orderSource appropriately
510
- order_source = options[:order_source]
511
- end
512
- when 'installment'
513
- order_source = 'installment'
514
- when 'recurring'
515
- order_source = 'recurring'
516
- end
517
-
518
- order_source
519
- end
520
-
521
506
  def add_pos(doc, payment_method)
522
507
  return unless payment_method.respond_to?(:track_data) && payment_method.track_data.present?
523
508
 
@@ -576,7 +561,7 @@ module ActiveMerchant #:nodoc:
576
561
  end
577
562
 
578
563
  def success_from(kind, parsed)
579
- return %w(000 001 010).any?(parsed[:response]) unless kind == :registerToken
564
+ return %w(000 001 010 136 470 473).any?(parsed[:response]) unless kind == :registerToken
580
565
 
581
566
  %w(000 801 802).include?(parsed[:response])
582
567
  end
@@ -613,16 +598,14 @@ module ActiveMerchant #:nodoc:
613
598
  def root_attributes
614
599
  {
615
600
  merchantId: @options[:merchant_id],
616
- version: SCHEMA_VERSION,
601
+ version: fetch_version,
617
602
  xmlns: 'http://www.litle.com/schema'
618
603
  }
619
604
  end
620
605
 
621
- def build_xml_request
606
+ def build_xml_request(&block)
622
607
  builder = Nokogiri::XML::Builder.new
623
- builder.__send__('litleOnlineRequest', root_attributes) do |doc|
624
- yield(doc)
625
- end
608
+ builder.__send__('litleOnlineRequest', root_attributes, &block)
626
609
  builder.doc.root.to_xml
627
610
  end
628
611