swiss-crm-activemerchant 1.0.12

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 (287) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +4033 -0
  3. data/CONTRIBUTORS +568 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +252 -0
  6. data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
  7. data/lib/active_merchant/billing/avs_result.rb +95 -0
  8. data/lib/active_merchant/billing/base.rb +48 -0
  9. data/lib/active_merchant/billing/check.rb +112 -0
  10. data/lib/active_merchant/billing/compatibility.rb +118 -0
  11. data/lib/active_merchant/billing/credit_card.rb +451 -0
  12. data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
  13. data/lib/active_merchant/billing/credit_card_methods.rb +512 -0
  14. data/lib/active_merchant/billing/cvv_result.rb +37 -0
  15. data/lib/active_merchant/billing/gateway.rb +332 -0
  16. data/lib/active_merchant/billing/gateways/adyen.rb +774 -0
  17. data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
  18. data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
  19. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  20. data/lib/active_merchant/billing/gateways/authorize_net.rb +1125 -0
  21. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +424 -0
  22. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +977 -0
  23. data/lib/active_merchant/billing/gateways/axcessms.rb +242 -0
  24. data/lib/active_merchant/billing/gateways/balanced.rb +263 -0
  25. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  26. data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
  27. data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
  28. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
  29. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
  30. data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
  31. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +474 -0
  32. data/lib/active_merchant/billing/gateways/beanstream.rb +238 -0
  33. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
  34. data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -0
  35. data/lib/active_merchant/billing/gateways/blue_snap.rb +644 -0
  36. data/lib/active_merchant/billing/gateways/bogus.rb +190 -0
  37. data/lib/active_merchant/billing/gateways/borgun.rb +272 -0
  38. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  39. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +28 -0
  40. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  41. data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
  42. data/lib/active_merchant/billing/gateways/braintree_blue.rb +952 -0
  43. data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
  44. data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
  45. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  46. data/lib/active_merchant/billing/gateways/card_connect.rb +338 -0
  47. data/lib/active_merchant/billing/gateways/card_save.rb +21 -0
  48. data/lib/active_merchant/billing/gateways/card_stream.rb +394 -0
  49. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  50. data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
  51. data/lib/active_merchant/billing/gateways/cashnet.rb +235 -0
  52. data/lib/active_merchant/billing/gateways/cc5.rb +198 -0
  53. data/lib/active_merchant/billing/gateways/cecabank.rb +249 -0
  54. data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
  55. data/lib/active_merchant/billing/gateways/checkout.rb +212 -0
  56. data/lib/active_merchant/billing/gateways/checkout_v2.rb +587 -0
  57. data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
  58. data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
  59. data/lib/active_merchant/billing/gateways/commerce_hub.rb +366 -0
  60. data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
  61. data/lib/active_merchant/billing/gateways/conekta.rb +230 -0
  62. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  63. data/lib/active_merchant/billing/gateways/credorax.rb +526 -0
  64. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  65. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  66. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
  67. data/lib/active_merchant/billing/gateways/cyber_source.rb +1148 -0
  68. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
  69. data/lib/active_merchant/billing/gateways/d_local.rb +343 -0
  70. data/lib/active_merchant/billing/gateways/data_cash.rb +302 -0
  71. data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
  72. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  73. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  74. data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
  75. data/lib/active_merchant/billing/gateways/ebanx.rb +346 -0
  76. data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
  77. data/lib/active_merchant/billing/gateways/elavon.rb +475 -0
  78. data/lib/active_merchant/billing/gateways/element.rb +406 -0
  79. data/lib/active_merchant/billing/gateways/epay.rb +296 -0
  80. data/lib/active_merchant/billing/gateways/evo_ca.rb +307 -0
  81. data/lib/active_merchant/billing/gateways/eway.rb +226 -0
  82. data/lib/active_merchant/billing/gateways/eway_managed.rb +289 -0
  83. data/lib/active_merchant/billing/gateways/eway_rapid.rb +578 -0
  84. data/lib/active_merchant/billing/gateways/exact.rb +219 -0
  85. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  86. data/lib/active_merchant/billing/gateways/fat_zebra.rb +223 -0
  87. data/lib/active_merchant/billing/gateways/federated_canada.rb +158 -0
  88. data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
  89. data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
  90. data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
  91. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +452 -0
  92. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  93. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  94. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  95. data/lib/active_merchant/billing/gateways/fluidpay.rb +275 -0
  96. data/lib/active_merchant/billing/gateways/forte.rb +286 -0
  97. data/lib/active_merchant/billing/gateways/garanti.rb +256 -0
  98. data/lib/active_merchant/billing/gateways/global_collect.rb +580 -0
  99. data/lib/active_merchant/billing/gateways/global_transport.rb +193 -0
  100. data/lib/active_merchant/billing/gateways/hdfc.rb +205 -0
  101. data/lib/active_merchant/billing/gateways/hps.rb +472 -0
  102. data/lib/active_merchant/billing/gateways/iats_payments.rb +312 -0
  103. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  104. data/lib/active_merchant/billing/gateways/inspire.rb +213 -0
  105. data/lib/active_merchant/billing/gateways/instapay.rb +159 -0
  106. data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
  107. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  108. data/lib/active_merchant/billing/gateways/iridium.rb +467 -0
  109. data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
  110. data/lib/active_merchant/billing/gateways/iveri.rb +290 -0
  111. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  112. data/lib/active_merchant/billing/gateways/jetpay.rb +395 -0
  113. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
  114. data/lib/active_merchant/billing/gateways/klarna.rb +317 -0
  115. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  116. data/lib/active_merchant/billing/gateways/kushki.rb +297 -0
  117. data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
  118. data/lib/active_merchant/billing/gateways/linkpoint.rb +448 -0
  119. data/lib/active_merchant/billing/gateways/litle.rb +643 -0
  120. data/lib/active_merchant/billing/gateways/mastercard.rb +286 -0
  121. data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
  122. data/lib/active_merchant/billing/gateways/mercado_pago.rb +348 -0
  123. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +228 -0
  124. data/lib/active_merchant/billing/gateways/merchant_one.rb +110 -0
  125. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  126. data/lib/active_merchant/billing/gateways/merchant_ware.rb +313 -0
  127. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +284 -0
  128. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +248 -0
  129. data/lib/active_merchant/billing/gateways/mercury.rb +352 -0
  130. data/lib/active_merchant/billing/gateways/metrics_global.rb +293 -0
  131. data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
  132. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
  133. data/lib/active_merchant/billing/gateways/migs.rb +329 -0
  134. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  135. data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
  136. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +215 -0
  137. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  138. data/lib/active_merchant/billing/gateways/monei.rb +424 -0
  139. data/lib/active_merchant/billing/gateways/moneris.rb +488 -0
  140. data/lib/active_merchant/billing/gateways/money_movers.rb +150 -0
  141. data/lib/active_merchant/billing/gateways/mundipagg.rb +366 -0
  142. data/lib/active_merchant/billing/gateways/nab_transact.rb +299 -0
  143. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
  144. data/lib/active_merchant/billing/gateways/net_registry.rb +198 -0
  145. data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
  146. data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
  147. data/lib/active_merchant/billing/gateways/netbilling.rb +229 -0
  148. data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
  149. data/lib/active_merchant/billing/gateways/network_merchants.rb +238 -0
  150. data/lib/active_merchant/billing/gateways/nmi.rb +396 -0
  151. data/lib/active_merchant/billing/gateways/ogone.rb +509 -0
  152. data/lib/active_merchant/billing/gateways/omise.rb +323 -0
  153. data/lib/active_merchant/billing/gateways/openpay.rb +246 -0
  154. data/lib/active_merchant/billing/gateways/opp.rb +394 -0
  155. data/lib/active_merchant/billing/gateways/optimal_payment.rb +331 -0
  156. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +45 -0
  157. data/lib/active_merchant/billing/gateways/orbital.rb +1267 -0
  158. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
  159. data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
  160. data/lib/active_merchant/billing/gateways/pago_facil.rb +120 -0
  161. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  162. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  163. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +277 -0
  164. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  165. data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
  166. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
  167. data/lib/active_merchant/billing/gateways/pay_secure.rb +110 -0
  168. data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
  169. data/lib/active_merchant/billing/gateways/paybox_direct.rb +224 -0
  170. data/lib/active_merchant/billing/gateways/payeezy.rb +513 -0
  171. data/lib/active_merchant/billing/gateways/payex.rb +409 -0
  172. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
  173. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +42 -0
  174. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
  175. data/lib/active_merchant/billing/gateways/payflow.rb +473 -0
  176. data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
  177. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
  178. data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
  179. data/lib/active_merchant/billing/gateways/payment_express.rb +373 -0
  180. data/lib/active_merchant/billing/gateways/paymentez.rb +365 -0
  181. data/lib/active_merchant/billing/gateways/paymill.rb +369 -0
  182. data/lib/active_merchant/billing/gateways/paynetworx.rb +228 -0
  183. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +718 -0
  184. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +69 -0
  185. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
  186. data/lib/active_merchant/billing/gateways/paypal.rb +136 -0
  187. data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
  188. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
  189. data/lib/active_merchant/billing/gateways/paypal_express.rb +272 -0
  190. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
  191. data/lib/active_merchant/billing/gateways/paypal_standard.rb +281 -0
  192. data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
  193. data/lib/active_merchant/billing/gateways/payscout.rb +159 -0
  194. data/lib/active_merchant/billing/gateways/paystation.rb +204 -0
  195. data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
  196. data/lib/active_merchant/billing/gateways/payu_latam.rb +482 -0
  197. data/lib/active_merchant/billing/gateways/payway.rb +207 -0
  198. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  199. data/lib/active_merchant/billing/gateways/pin.rb +273 -0
  200. data/lib/active_merchant/billing/gateways/pixxels.rb +263 -0
  201. data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
  202. data/lib/active_merchant/billing/gateways/plugnpay.rb +283 -0
  203. data/lib/active_merchant/billing/gateways/priority.rb +392 -0
  204. data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
  205. data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
  206. data/lib/active_merchant/billing/gateways/psl_card.rb +295 -0
  207. data/lib/active_merchant/billing/gateways/qbms.rb +302 -0
  208. data/lib/active_merchant/billing/gateways/quantum.rb +274 -0
  209. data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
  210. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  211. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
  212. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  213. data/lib/active_merchant/billing/gateways/quickpay.rb +24 -0
  214. data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
  215. data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
  216. data/lib/active_merchant/billing/gateways/reach.rb +277 -0
  217. data/lib/active_merchant/billing/gateways/realex.rb +400 -0
  218. data/lib/active_merchant/billing/gateways/redsys.rb +723 -0
  219. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  220. data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
  221. data/lib/active_merchant/billing/gateways/sage.rb +446 -0
  222. data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
  223. data/lib/active_merchant/billing/gateways/sallie_mae.rb +141 -0
  224. data/lib/active_merchant/billing/gateways/secure_net.rb +260 -0
  225. data/lib/active_merchant/billing/gateways/secure_pay.rb +191 -0
  226. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +290 -0
  227. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +103 -0
  228. data/lib/active_merchant/billing/gateways/securion_pay.rb +305 -0
  229. data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
  230. data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
  231. data/lib/active_merchant/billing/gateways/skip_jack.rb +450 -0
  232. data/lib/active_merchant/billing/gateways/smart_ps.rb +274 -0
  233. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
  234. data/lib/active_merchant/billing/gateways/spreedly_core.rb +354 -0
  235. data/lib/active_merchant/billing/gateways/stripe.rb +866 -0
  236. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +602 -0
  237. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +151 -0
  238. data/lib/active_merchant/billing/gateways/telr.rb +273 -0
  239. data/lib/active_merchant/billing/gateways/tns.rb +23 -0
  240. data/lib/active_merchant/billing/gateways/trans_first.rb +240 -0
  241. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
  242. data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
  243. data/lib/active_merchant/billing/gateways/transax.rb +21 -0
  244. data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
  245. data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
  246. data/lib/active_merchant/billing/gateways/trust_commerce.rb +500 -0
  247. data/lib/active_merchant/billing/gateways/usa_epay.rb +24 -0
  248. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1612 -0
  249. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +367 -0
  250. data/lib/active_merchant/billing/gateways/vanco.rb +303 -0
  251. data/lib/active_merchant/billing/gateways/verifi.rb +224 -0
  252. data/lib/active_merchant/billing/gateways/viaklix.rb +171 -0
  253. data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
  254. data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
  255. data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
  256. data/lib/active_merchant/billing/gateways/wepay.rb +235 -0
  257. data/lib/active_merchant/billing/gateways/wirecard.rb +430 -0
  258. data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
  259. data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
  260. data/lib/active_merchant/billing/gateways/worldpay.rb +1050 -0
  261. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
  262. data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
  263. data/lib/active_merchant/billing/gateways.rb +14 -0
  264. data/lib/active_merchant/billing/model.rb +30 -0
  265. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  266. data/lib/active_merchant/billing/payment_token.rb +21 -0
  267. data/lib/active_merchant/billing/rails.rb +3 -0
  268. data/lib/active_merchant/billing/response.rb +121 -0
  269. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  270. data/lib/active_merchant/billing.rb +16 -0
  271. data/lib/active_merchant/connection.rb +194 -0
  272. data/lib/active_merchant/country.rb +338 -0
  273. data/lib/active_merchant/empty.rb +20 -0
  274. data/lib/active_merchant/errors.rb +38 -0
  275. data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
  276. data/lib/active_merchant/network_connection_retries.rb +78 -0
  277. data/lib/active_merchant/post_data.rb +26 -0
  278. data/lib/active_merchant/posts_data.rb +92 -0
  279. data/lib/active_merchant/version.rb +3 -0
  280. data/lib/active_merchant.rb +63 -0
  281. data/lib/activemerchant.rb +1 -0
  282. data/lib/certs/cacert.pem +3214 -0
  283. data/lib/support/gateway_support.rb +69 -0
  284. data/lib/support/outbound_hosts.rb +28 -0
  285. data/lib/support/ssl_verify.rb +88 -0
  286. data/lib/support/ssl_version.rb +86 -0
  287. metadata +506 -0
@@ -0,0 +1,312 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class IatsPaymentsGateway < Gateway
4
+ class_attribute :live_na_url, :live_uk_url
5
+
6
+ self.live_na_url = 'https://www.iatspayments.com/NetGate'
7
+ self.live_uk_url = 'https://www.uk.iatspayments.com/NetGate'
8
+
9
+ self.supported_countries = %w(AU BR CA CH DE DK ES FI FR GR HK IE IT NL NO PT SE SG TR GB US TH ID PH BE)
10
+ self.default_currency = 'USD'
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
+
13
+ self.homepage_url = 'http://home.iatspayments.com/'
14
+ self.display_name = 'iATS Payments'
15
+
16
+ ACTIONS = {
17
+ purchase: 'ProcessCreditCard',
18
+ purchase_check: 'ProcessACHEFT',
19
+ purchase_customer_code: 'ProcessCreditCardWithCustomerCode',
20
+ refund: 'ProcessCreditCardRefundWithTransactionId',
21
+ refund_check: 'ProcessACHEFTRefundWithTransactionId',
22
+ store: 'CreateCreditCardCustomerCode',
23
+ unstore: 'DeleteCustomerCode'
24
+ }
25
+
26
+ def initialize(options = {})
27
+ if options[:login]
28
+ ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'agent_code' and will be removed in a future version.")
29
+ options[:agent_code] = options[:login]
30
+ end
31
+
32
+ options[:region] = 'na' unless options[:region]
33
+
34
+ requires!(options, :agent_code, :password, :region)
35
+ super
36
+ end
37
+
38
+ def purchase(money, payment, options = {})
39
+ post = {}
40
+ add_invoice(post, money, options)
41
+ add_payment(post, payment)
42
+ add_address(post, options)
43
+ add_ip(post, options)
44
+ add_description(post, options)
45
+ add_customer_details(post, options)
46
+
47
+ commit(determine_purchase_type(payment), post)
48
+ end
49
+
50
+ def refund(money, authorization, options = {})
51
+ post = {}
52
+ transaction_id, payment_type = split_authorization(authorization)
53
+ post[:transaction_id] = transaction_id
54
+ add_invoice(post, -money, options)
55
+ add_ip(post, options)
56
+ add_description(post, options)
57
+
58
+ commit((payment_type == 'check' ? :refund_check : :refund), post)
59
+ end
60
+
61
+ def store(credit_card, options = {})
62
+ post = {}
63
+ add_payment(post, credit_card)
64
+ add_address(post, options)
65
+ add_ip(post, options)
66
+ add_description(post, options)
67
+ add_store_defaults(post)
68
+
69
+ commit(:store, post)
70
+ end
71
+
72
+ def unstore(authorization, options = {})
73
+ post = {}
74
+ post[:customer_code] = authorization
75
+ add_ip(post, options)
76
+
77
+ commit(:unstore, post)
78
+ end
79
+
80
+ def supports_scrubbing?
81
+ true
82
+ end
83
+
84
+ def scrub(transcript)
85
+ transcript.
86
+ gsub(%r((<agentCode>).+(</agentCode>)), '\1[FILTERED]\2').
87
+ gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
88
+ gsub(%r((<creditCardNum>).+(</creditCardNum>)), '\1[FILTERED]\2').
89
+ gsub(%r((<cvv2>).+(</cvv2>)), '\1[FILTERED]\2').
90
+ gsub(%r((<accountNum>).+(</accountNum>)), '\1[FILTERED]\2')
91
+ end
92
+
93
+ private
94
+
95
+ def determine_purchase_type(payment)
96
+ if payment.is_a?(String)
97
+ :purchase_customer_code
98
+ elsif payment.is_a?(Check)
99
+ :purchase_check
100
+ else
101
+ :purchase
102
+ end
103
+ end
104
+
105
+ def add_ip(post, options)
106
+ post[:customer_ip_address] = options[:ip] if options.has_key?(:ip)
107
+ end
108
+
109
+ def add_address(post, options)
110
+ billing_address = options[:billing_address] || options[:address]
111
+ if billing_address
112
+ post[:address] = billing_address[:address1]
113
+ post[:city] = billing_address[:city]
114
+ post[:state] = billing_address[:state]
115
+ post[:zip_code] = billing_address[:zip]
116
+ post[:phone] = billing_address[:phone] if billing_address[:phone]
117
+ post[:email] = billing_address[:email] if billing_address[:email]
118
+ post[:country] = billing_address[:country] if billing_address[:country]
119
+ end
120
+ end
121
+
122
+ def add_invoice(post, money, options)
123
+ post[:invoice_num] = options[:order_id] if options[:order_id]
124
+ post[:total] = amount(money)
125
+ end
126
+
127
+ def add_description(post, options)
128
+ post[:comment] = options[:description] if options[:description]
129
+ end
130
+
131
+ def add_payment(post, payment)
132
+ if payment.is_a?(String)
133
+ post[:customer_code] = payment
134
+ elsif payment.is_a?(Check)
135
+ add_check(post, payment)
136
+ else
137
+ add_credit_card(post, payment)
138
+ end
139
+ end
140
+
141
+ def add_credit_card(post, payment)
142
+ post[:first_name] = payment.first_name
143
+ post[:last_name] = payment.last_name
144
+ post[:credit_card_num] = payment.number
145
+ post[:credit_card_expiry] = expdate(payment)
146
+ post[:cvv2] = payment.verification_value if payment.verification_value?
147
+ post[:mop] = creditcard_brand(payment.brand)
148
+ end
149
+
150
+ def add_check(post, payment)
151
+ post[:first_name] = payment.first_name
152
+ post[:last_name] = payment.last_name
153
+ post[:account_num] = "#{payment.routing_number}#{payment.account_number}"
154
+ post[:account_type] = payment.account_type.upcase
155
+ end
156
+
157
+ def add_store_defaults(post)
158
+ post[:recurring] = false
159
+ post[:begin_date] = Time.now.xmlschema
160
+ post[:end_date] = Time.now.xmlschema
161
+ post[:amount] = 0
162
+ end
163
+
164
+ def add_customer_details(post, options)
165
+ post[:email] = options[:email] if options[:email]
166
+ end
167
+
168
+ def expdate(creditcard)
169
+ year = sprintf('%.4i', creditcard.year)
170
+ month = sprintf('%.2i', creditcard.month)
171
+
172
+ "#{month}/#{year[-2..-1]}"
173
+ end
174
+
175
+ def creditcard_brand(brand)
176
+ case brand
177
+ when 'visa' then 'VISA'
178
+ when 'master' then 'MC'
179
+ when 'discover' then 'DSC'
180
+ when 'american_express' then 'AMX'
181
+ when 'maestro' then 'MAESTR'
182
+ else
183
+ raise "Unhandled credit card brand #{brand}"
184
+ end
185
+ end
186
+
187
+ def commit(action, parameters)
188
+ response = parse(ssl_post(url(action), post_data(action, parameters),
189
+ { 'Content-Type' => 'application/soap+xml; charset=utf-8' }))
190
+
191
+ Response.new(
192
+ success_from(response),
193
+ message_from(response),
194
+ response,
195
+ authorization: authorization_from(action, response),
196
+ test: test?
197
+ )
198
+ end
199
+
200
+ def endpoints
201
+ {
202
+ purchase: 'ProcessLinkv3.asmx',
203
+ purchase_check: 'ProcessLinkv3.asmx',
204
+ purchase_customer_code: 'ProcessLinkv3.asmx',
205
+ refund: 'ProcessLinkv3.asmx',
206
+ refund_check: 'ProcessLinkv3.asmx',
207
+ store: 'CustomerLinkv3.asmx',
208
+ unstore: 'CustomerLinkv3.asmx'
209
+ }
210
+ end
211
+
212
+ def url(action)
213
+ base_url = @options[:region] == 'uk' ? live_uk_url : live_na_url
214
+ "#{base_url}/#{endpoints[action]}?op=#{ACTIONS[action]}"
215
+ end
216
+
217
+ def parse(body)
218
+ response = {}
219
+ hashify_xml!(body, response)
220
+ response
221
+ end
222
+
223
+ def dexmlize_param_name(name)
224
+ names = {
225
+ 'AUTHORIZATIONRESULT' => :authorization_result,
226
+ 'SETTLEMENTBATCHDATE' => :settlement_batch_date,
227
+ 'SETTLEMENTDATE' => :settlement_date,
228
+ 'TRANSACTIONID' => :transaction_id
229
+ }
230
+ names[name] || name.to_s.downcase.intern
231
+ end
232
+
233
+ def hashify_xml!(xml, response)
234
+ xml = REXML::Document.new(xml)
235
+
236
+ xml.elements.each('//IATSRESPONSE/*') do |node|
237
+ recursively_parse_element(node, response)
238
+ end
239
+ end
240
+
241
+ def recursively_parse_element(node, response)
242
+ if node.has_elements?
243
+ node.elements.each { |n| recursively_parse_element(n, response) }
244
+ else
245
+ response[dexmlize_param_name(node.name)] = (node.text ? node.text.strip : nil)
246
+ end
247
+ end
248
+
249
+ def successful_result_message?(response)
250
+ response[:authorization_result] ? response[:authorization_result].start_with?('OK') : false
251
+ end
252
+
253
+ def success_from(response)
254
+ response[:status] == 'Success' && successful_result_message?(response)
255
+ end
256
+
257
+ def message_from(response)
258
+ if !successful_result_message?(response) && response[:authorization_result]
259
+ return response[:authorization_result].strip
260
+ elsif response[:status] == 'Failure'
261
+ return response[:errors]
262
+ else
263
+ response[:status]
264
+ end
265
+ end
266
+
267
+ def authorization_from(action, response)
268
+ if %i[store unstore].include?(action)
269
+ response[:customercode]
270
+ elsif [:purchase_check].include?(action)
271
+ response[:transaction_id] ? "#{response[:transaction_id]}|check" : nil
272
+ else
273
+ response[:transaction_id]
274
+ end
275
+ end
276
+
277
+ def split_authorization(authorization)
278
+ authorization.split('|')
279
+ end
280
+
281
+ def envelope_namespaces
282
+ {
283
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
284
+ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
285
+ 'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope'
286
+ }
287
+ end
288
+
289
+ def post_data(action, parameters = {})
290
+ xml = Builder::XmlMarkup.new
291
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
292
+ xml.tag! 'soap12:Envelope', envelope_namespaces do
293
+ xml.tag! 'soap12:Body' do
294
+ xml.tag! ACTIONS[action], { 'xmlns' => 'https://www.iatspayments.com/NetGate/' } do
295
+ xml.tag!('agentCode', @options[:agent_code])
296
+ xml.tag!('password', @options[:password])
297
+ parameters.each do |name, value|
298
+ xml.tag!(xmlize_param_name(name), value)
299
+ end
300
+ end
301
+ end
302
+ end
303
+ xml.target!
304
+ end
305
+
306
+ def xmlize_param_name(name)
307
+ names = { customer_ip_address: 'customerIPAddress' }
308
+ names[name] || name.to_s.camelcase(:lower)
309
+ end
310
+ end
311
+ end
312
+ end
@@ -0,0 +1,15 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class InContextPaypalExpressGateway < PaypalExpressGateway
4
+ self.test_redirect_url = 'https://www.sandbox.paypal.com/checkoutnow'
5
+ self.live_redirect_url = 'https://www.paypal.com/checkoutnow'
6
+
7
+ def redirect_url_for(token, options = {})
8
+ options = { review: true }.update(options)
9
+ url = "#{redirect_url}?token=#{token}"
10
+ url += '&useraction=commit' unless options[:review]
11
+ url
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,213 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'check.rb')
2
+ module ActiveMerchant #:nodoc:
3
+ module Billing #:nodoc:
4
+ class InspireGateway < Gateway
5
+ self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
6
+
7
+ self.supported_countries = ['US']
8
+ self.supported_cardtypes = %i[visa master american_express]
9
+ self.homepage_url = 'http://www.inspiregateway.com'
10
+ self.display_name = 'Inspire Commerce'
11
+
12
+ # Creates a new InspireGateway
13
+ #
14
+ # The gateway requires that a valid login and password be passed
15
+ # in the +options+ hash.
16
+ #
17
+ # ==== Options
18
+ #
19
+ # * <tt>:login</tt> -- The Inspire Username.
20
+ # * <tt>:password</tt> -- The Inspire Password.
21
+ # See the Inspire Integration Guide for details. (default: +false+)
22
+ def initialize(options = {})
23
+ requires!(options, :login, :password)
24
+ super
25
+ end
26
+
27
+ # Pass :store => true in the options to store the
28
+ # payment info at Inspire Gateway and get a generated
29
+ # customer_vault_id in the response.
30
+ # Pass :store => some_number_or_string to specify the
31
+ # customer_vault_id InspireGateway should use (make sure it's
32
+ # unique).
33
+ def authorize(money, creditcard, options = {})
34
+ post = {}
35
+ add_invoice(post, options)
36
+ add_payment_source(post, creditcard, options)
37
+ add_address(post, creditcard, options)
38
+ add_customer_data(post, options)
39
+
40
+ commit('auth', money, post)
41
+ end
42
+
43
+ def purchase(money, payment_source, options = {})
44
+ post = {}
45
+ add_invoice(post, options)
46
+ add_payment_source(post, payment_source, options)
47
+ add_address(post, payment_source, options)
48
+ add_customer_data(post, options)
49
+
50
+ commit('sale', money, post)
51
+ end
52
+
53
+ def capture(money, authorization, options = {})
54
+ post = {}
55
+ post[:transactionid] = authorization
56
+ commit('capture', money, post)
57
+ end
58
+
59
+ def void(authorization, options = {})
60
+ post = {}
61
+ post[:transactionid] = authorization
62
+ commit('void', nil, post)
63
+ end
64
+
65
+ def refund(money, authorization, options = {})
66
+ post = {}
67
+ post[:transactionid] = authorization
68
+ commit('refund', money, post)
69
+ end
70
+
71
+ # Update the values (such as CC expiration) stored at
72
+ # InspireGateway. The CC number must be supplied in the
73
+ # CreditCard object.
74
+ def update(vault_id, creditcard, options = {})
75
+ post = {}
76
+ post[:customer_vault] = 'update_customer'
77
+ add_customer_vault_id(post, vault_id)
78
+ add_creditcard(post, creditcard, options)
79
+ add_address(post, creditcard, options)
80
+ add_customer_data(post, options)
81
+
82
+ commit(nil, nil, post)
83
+ end
84
+
85
+ def delete(vault_id)
86
+ post = {}
87
+ post[:customer_vault] = 'delete_customer'
88
+ add_customer_vault_id(post, vault_id)
89
+ commit(nil, nil, post)
90
+ end
91
+
92
+ # To match the other stored-value gateways, like TrustCommerce,
93
+ # store and unstore need to be defined
94
+ def store(creditcard, options = {})
95
+ billing_id = options.delete(:billing_id).to_s || true
96
+ authorize(100, creditcard, options.merge(store: billing_id))
97
+ end
98
+
99
+ alias unstore delete
100
+
101
+ private
102
+
103
+ def add_customer_data(post, options)
104
+ post[:email] = options[:email] if options.has_key? :email
105
+
106
+ post[:ipaddress] = options[:ip] if options.has_key? :ip
107
+ end
108
+
109
+ def add_address(post, creditcard, options)
110
+ if address = options[:billing_address] || options[:address]
111
+ post[:address1] = address[:address1].to_s
112
+ post[:address2] = address[:address2].to_s unless address[:address2].blank?
113
+ post[:company] = address[:company].to_s
114
+ post[:phone] = address[:phone].to_s
115
+ post[:zip] = address[:zip].to_s
116
+ post[:city] = address[:city].to_s
117
+ post[:country] = address[:country].to_s
118
+ post[:state] = address[:state].blank? ? 'n/a' : address[:state]
119
+ end
120
+ end
121
+
122
+ def add_invoice(post, options)
123
+ post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
124
+ post[:orderdescription] = options[:description]
125
+ end
126
+
127
+ def add_payment_source(params, source, options = {})
128
+ case determine_funding_source(source)
129
+ when :vault then add_customer_vault_id(params, source)
130
+ when :credit_card then add_creditcard(params, source, options)
131
+ when :check then add_check(params, source)
132
+ end
133
+ end
134
+
135
+ def add_customer_vault_id(params, vault_id)
136
+ params[:customer_vault_id] = vault_id
137
+ end
138
+
139
+ def add_creditcard(post, creditcard, options)
140
+ if options[:store]
141
+ post[:customer_vault] = 'add_customer'
142
+ post[:customer_vault_id] = options[:store] unless options[:store] == true
143
+ end
144
+ post[:ccnumber] = creditcard.number
145
+ post[:cvv] = creditcard.verification_value if creditcard.verification_value?
146
+ post[:ccexp] = expdate(creditcard)
147
+ post[:firstname] = creditcard.first_name
148
+ post[:lastname] = creditcard.last_name
149
+ end
150
+
151
+ def add_check(post, check)
152
+ post[:payment] = 'check' # Set transaction to ACH
153
+ post[:checkname] = check.name # The name on the customer's Checking Account
154
+ post[:checkaba] = check.routing_number # The customer's bank routing number
155
+ post[:checkaccount] = check.account_number # The customer's account number
156
+ post[:account_holder_type] = check.account_holder_type # The customer's type of ACH account
157
+ post[:account_type] = check.account_type # The customer's type of ACH account
158
+ end
159
+
160
+ def parse(body)
161
+ results = {}
162
+ body.split(/&/).each do |pair|
163
+ key, val = pair.split(%r{=})
164
+ results[key] = val
165
+ end
166
+
167
+ results
168
+ end
169
+
170
+ def commit(action, money, parameters)
171
+ parameters[:amount] = amount(money) if money
172
+
173
+ response = parse(ssl_post(self.live_url, post_data(action, parameters)))
174
+
175
+ Response.new(response['response'] == '1', message_from(response), response,
176
+ authorization: response['transactionid'],
177
+ test: test?,
178
+ cvv_result: response['cvvresponse'],
179
+ avs_result: { code: response['avsresponse'] })
180
+ end
181
+
182
+ def message_from(response)
183
+ case response['responsetext']
184
+ when 'SUCCESS', 'Approved'
185
+ 'This transaction has been approved'
186
+ when 'DECLINE'
187
+ 'This transaction has been declined'
188
+ else
189
+ response['responsetext']
190
+ end
191
+ end
192
+
193
+ def post_data(action, parameters = {})
194
+ post = {}
195
+ post[:username] = @options[:login]
196
+ post[:password] = @options[:password]
197
+ post[:type] = action if action
198
+
199
+ request = post.merge(parameters).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
200
+ request
201
+ end
202
+
203
+ def determine_funding_source(source)
204
+ case
205
+ when source.is_a?(String) then :vault
206
+ when CreditCard.card_companies.include?(card_brand(source)) then :credit_card
207
+ when card_brand(source) == 'check' then :check
208
+ else raise ArgumentError, 'Unsupported funding source provided'
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
@@ -0,0 +1,159 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class InstapayGateway < Gateway
4
+ self.live_url = 'https://trans.instapaygateway.com/cgi-bin/process.cgi'
5
+
6
+ # The countries the gateway supports merchants from as 2 digit ISO country codes
7
+ self.supported_countries = ['US']
8
+ self.money_format = :dollars
9
+ self.default_currency = 'USD'
10
+ # The card types supported by the payment gateway
11
+ self.supported_cardtypes = %i[visa master american_express discover]
12
+
13
+ # The homepage URL of the gateway
14
+ self.homepage_url = 'http://www.instapayllc.com'
15
+
16
+ # The name of the gateway
17
+ self.display_name = 'InstaPay'
18
+
19
+ SUCCESS = 'Accepted'
20
+ SUCCESS_MESSAGE = 'The transaction has been approved'
21
+
22
+ def initialize(options = {})
23
+ requires!(options, :login)
24
+ super
25
+ end
26
+
27
+ def authorize(money, creditcard, options = {})
28
+ post = {}
29
+ post[:authonly] = 1
30
+ add_amount(post, money)
31
+ add_invoice(post, options)
32
+ add_creditcard(post, creditcard)
33
+ add_address(post, options)
34
+ add_customer_data(post, options)
35
+
36
+ commit('ns_quicksale_cc', post)
37
+ end
38
+
39
+ def purchase(money, creditcard, options = {})
40
+ post = {}
41
+ add_amount(post, money)
42
+ add_invoice(post, options)
43
+ add_creditcard(post, creditcard)
44
+ add_address(post, options)
45
+ add_customer_data(post, options)
46
+
47
+ commit('ns_quicksale_cc', post)
48
+ end
49
+
50
+ def capture(money, authorization, options = {})
51
+ post = {}
52
+ add_amount(post, money)
53
+ add_reference(post, authorization)
54
+ commit('ns_quicksale_cc', post)
55
+ end
56
+
57
+ private
58
+
59
+ def add_amount(post, money)
60
+ post[:amount] = amount(money)
61
+ end
62
+
63
+ def add_reference(post, reference)
64
+ post[:postonly] = reference
65
+ end
66
+
67
+ def add_customer_data(post, options)
68
+ post[:ci_email] = options[:email]
69
+ post['ci_IP Address'] = options[:ip]
70
+ end
71
+
72
+ def add_address(post, options)
73
+ if address = options[:billing_address] || options[:address]
74
+ post[:ci_billaddr1] = address[:address1]
75
+ post[:ci_billaddr2] = address[:address2]
76
+ post[:ci_billcity] = address[:city]
77
+ post[:ci_billstate] = address[:state]
78
+ post[:ci_billzip] = address[:zip]
79
+ post[:ci_billcountry] = address[:country]
80
+ post[:ci_phone] = address[:phone]
81
+ end
82
+
83
+ if address = options[:shipping_address]
84
+ post[:ci_shipaddr1] = address[:address1]
85
+ post[:ci_shipaddr2] = address[:address2]
86
+ post[:ci_shipcity] = address[:city]
87
+ post[:ci_shipstate] = address[:state]
88
+ post[:ci_shipzip] = address[:zip]
89
+ post[:ci_shipcountry] = address[:country]
90
+ end
91
+ end
92
+
93
+ def add_invoice(post, options)
94
+ post[:merchantordernumber] = options[:order_id]
95
+ post[:ci_memo] = options[:description]
96
+ post[:pocustomerrefid] = options[:invoice]
97
+ end
98
+
99
+ def add_creditcard(post, creditcard)
100
+ post[:ccnum] = creditcard.number
101
+ post[:expmon] = format(creditcard.month, :two_digits)
102
+ post[:cvv2] = creditcard.verification_value if creditcard.verification_value?
103
+ post[:expyear] = creditcard.year
104
+ post[:ccname] = creditcard.name
105
+ end
106
+
107
+ def parse(body)
108
+ results = {}
109
+ fields = body.split("\r\n")
110
+
111
+ response = fields[1].split('=')
112
+ response_data = response[1].split(':')
113
+
114
+ if response[0] == SUCCESS
115
+ results[:success] = true
116
+ results[:message] = SUCCESS_MESSAGE
117
+ results[:transaction_type] = response_data[0]
118
+ results[:authorization_code] = response_data[1]
119
+ results[:reference_number] = response_data[2]
120
+ results[:batch_number] = response_data[3]
121
+ results[:transaction_id] = response_data[4]
122
+ results[:avs_result] = response_data[5]
123
+ results[:authorize_net] = response_data[6]
124
+ results[:cvv_result] = response_data[7]
125
+ else
126
+ results[:success] = false
127
+ results[:result] = response_data[0]
128
+ results[:response_code] = response_data[1]
129
+ results[:message] = response_data[2]
130
+ end
131
+
132
+ fields[1..-1].each do |pair|
133
+ key, value = pair.split('=')
134
+ results[key] = value
135
+ end
136
+ results
137
+ end
138
+
139
+ def commit(action, parameters)
140
+ data = ssl_post self.live_url, post_data(action, parameters)
141
+ response = parse(data)
142
+
143
+ Response.new(response[:success], response[:message], response,
144
+ authorization: response[:transaction_id],
145
+ avs_result: { code: response[:avs_result] },
146
+ cvv_result: response[:cvv_result])
147
+ end
148
+
149
+ def post_data(action, parameters = {})
150
+ post = {}
151
+ post[:acctid] = @options[:login]
152
+ post[:merchantpin] = @options[:password] if @options[:password]
153
+ post[:action] = action
154
+ request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
155
+ request
156
+ end
157
+ end
158
+ end
159
+ end