active_accountability_merchant 1.97.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +2948 -0
  3. data/CONTRIBUTORS +568 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +246 -0
  6. data/lib/active_merchant.rb +63 -0
  7. data/lib/active_merchant/billing.rb +15 -0
  8. data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
  9. data/lib/active_merchant/billing/avs_result.rb +96 -0
  10. data/lib/active_merchant/billing/base.rb +61 -0
  11. data/lib/active_merchant/billing/check.rb +80 -0
  12. data/lib/active_merchant/billing/compatibility.rb +117 -0
  13. data/lib/active_merchant/billing/credit_card.rb +406 -0
  14. data/lib/active_merchant/billing/credit_card_formatting.rb +23 -0
  15. data/lib/active_merchant/billing/credit_card_methods.rb +343 -0
  16. data/lib/active_merchant/billing/cvv_result.rb +38 -0
  17. data/lib/active_merchant/billing/gateway.rb +330 -0
  18. data/lib/active_merchant/billing/gateways.rb +14 -0
  19. data/lib/active_merchant/billing/gateways/adyen.rb +503 -0
  20. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  21. data/lib/active_merchant/billing/gateways/authorize_net.rb +1055 -0
  22. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
  23. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +980 -0
  24. data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
  25. data/lib/active_merchant/billing/gateways/balanced.rb +256 -0
  26. data/lib/active_merchant/billing/gateways/bambora_apac.rb +226 -0
  27. data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
  28. data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
  29. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +384 -0
  30. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
  31. data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
  32. data/lib/active_merchant/billing/gateways/beanstream.rb +217 -0
  33. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +473 -0
  34. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
  35. data/lib/active_merchant/billing/gateways/blue_pay.rb +522 -0
  36. data/lib/active_merchant/billing/gateways/blue_snap.rb +522 -0
  37. data/lib/active_merchant/billing/gateways/bogus.rb +186 -0
  38. data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
  39. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  40. data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
  41. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +22 -0
  42. data/lib/active_merchant/billing/gateways/braintree_blue.rb +740 -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 +316 -0
  47. data/lib/active_merchant/billing/gateways/card_save.rb +22 -0
  48. data/lib/active_merchant/billing/gateways/card_stream.rb +367 -0
  49. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  50. data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
  51. data/lib/active_merchant/billing/gateways/cashnet.rb +219 -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 +327 -0
  55. data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
  56. data/lib/active_merchant/billing/gateways/checkout_v2.rb +270 -0
  57. data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
  58. data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
  59. data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
  60. data/lib/active_merchant/billing/gateways/conekta.rb +228 -0
  61. data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
  62. data/lib/active_merchant/billing/gateways/credorax.rb +382 -0
  63. data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
  64. data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
  65. data/lib/active_merchant/billing/gateways/cyber_source.rb +828 -0
  66. data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
  67. data/lib/active_merchant/billing/gateways/data_cash.rb +305 -0
  68. data/lib/active_merchant/billing/gateways/decidir.rb +233 -0
  69. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  70. data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
  71. data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
  72. data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
  73. data/lib/active_merchant/billing/gateways/elavon.rb +320 -0
  74. data/lib/active_merchant/billing/gateways/element.rb +356 -0
  75. data/lib/active_merchant/billing/gateways/epay.rb +285 -0
  76. data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
  77. data/lib/active_merchant/billing/gateways/eway.rb +226 -0
  78. data/lib/active_merchant/billing/gateways/eway_managed.rb +290 -0
  79. data/lib/active_merchant/billing/gateways/eway_rapid.rb +563 -0
  80. data/lib/active_merchant/billing/gateways/exact.rb +224 -0
  81. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  82. data/lib/active_merchant/billing/gateways/fat_zebra.rb +218 -0
  83. data/lib/active_merchant/billing/gateways/federated_canada.rb +159 -0
  84. data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
  85. data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
  86. data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
  87. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +451 -0
  88. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +485 -0
  89. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  90. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  91. data/lib/active_merchant/billing/gateways/forte.rb +270 -0
  92. data/lib/active_merchant/billing/gateways/garanti.rb +259 -0
  93. data/lib/active_merchant/billing/gateways/global_collect.rb +336 -0
  94. data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
  95. data/lib/active_merchant/billing/gateways/hdfc.rb +206 -0
  96. data/lib/active_merchant/billing/gateways/hps.rb +350 -0
  97. data/lib/active_merchant/billing/gateways/iats_payments.rb +290 -0
  98. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  99. data/lib/active_merchant/billing/gateways/inspire.rb +218 -0
  100. data/lib/active_merchant/billing/gateways/instapay.rb +162 -0
  101. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  102. data/lib/active_merchant/billing/gateways/iridium.rb +468 -0
  103. data/lib/active_merchant/billing/gateways/itransact.rb +447 -0
  104. data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +402 -0
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +449 -0
  111. data/lib/active_merchant/billing/gateways/litle.rb +507 -0
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +194 -0
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +113 -0
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +319 -0
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +286 -0
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +210 -0
  121. data/lib/active_merchant/billing/gateways/mercury.rb +356 -0
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +303 -0
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
  124. data/lib/active_merchant/billing/gateways/migs.rb +332 -0
  125. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
  126. data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +217 -0
  128. data/lib/active_merchant/billing/gateways/monei.rb +338 -0
  129. data/lib/active_merchant/billing/gateways/moneris.rb +377 -0
  130. data/lib/active_merchant/billing/gateways/moneris_us.rb +352 -0
  131. data/lib/active_merchant/billing/gateways/money_movers.rb +151 -0
  132. data/lib/active_merchant/billing/gateways/mundipagg.rb +293 -0
  133. data/lib/active_merchant/billing/gateways/nab_transact.rb +301 -0
  134. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
  135. data/lib/active_merchant/billing/gateways/net_registry.rb +199 -0
  136. data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
  137. data/lib/active_merchant/billing/gateways/netbanx.rb +294 -0
  138. data/lib/active_merchant/billing/gateways/netbilling.rb +232 -0
  139. data/lib/active_merchant/billing/gateways/netpay.rb +222 -0
  140. data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
  141. data/lib/active_merchant/billing/gateways/nmi.rb +324 -0
  142. data/lib/active_merchant/billing/gateways/ogone.rb +478 -0
  143. data/lib/active_merchant/billing/gateways/omise.rb +324 -0
  144. data/lib/active_merchant/billing/gateways/openpay.rb +228 -0
  145. data/lib/active_merchant/billing/gateways/opp.rb +388 -0
  146. data/lib/active_merchant/billing/gateways/optimal_payment.rb +332 -0
  147. data/lib/active_merchant/billing/gateways/orbital.rb +1006 -0
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +47 -0
  149. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
  150. data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
  151. data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
  152. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  153. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +280 -0
  154. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  155. data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
  156. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
  157. data/lib/active_merchant/billing/gateways/pay_secure.rb +111 -0
  158. data/lib/active_merchant/billing/gateways/paybox_direct.rb +200 -0
  159. data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
  160. data/lib/active_merchant/billing/gateways/payex.rb +410 -0
  161. data/lib/active_merchant/billing/gateways/payflow.rb +383 -0
  162. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
  163. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +43 -0
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
  165. data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
  166. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
  167. data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
  168. data/lib/active_merchant/billing/gateways/payment_express.rb +369 -0
  169. data/lib/active_merchant/billing/gateways/paymentez.rb +300 -0
  170. data/lib/active_merchant/billing/gateways/paymill.rb +371 -0
  171. data/lib/active_merchant/billing/gateways/paypal.rb +128 -0
  172. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +717 -0
  173. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +65 -0
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
  175. data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
  176. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
  177. data/lib/active_merchant/billing/gateways/paypal_express.rb +269 -0
  178. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
  179. data/lib/active_merchant/billing/gateways/payscout.rb +160 -0
  180. data/lib/active_merchant/billing/gateways/paystation.rb +207 -0
  181. data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
  182. data/lib/active_merchant/billing/gateways/payu_latam.rb +449 -0
  183. data/lib/active_merchant/billing/gateways/payway.rb +207 -0
  184. data/lib/active_merchant/billing/gateways/pin.rb +234 -0
  185. data/lib/active_merchant/billing/gateways/plugnpay.rb +284 -0
  186. data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
  187. data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
  188. data/lib/active_merchant/billing/gateways/psl_card.rb +296 -0
  189. data/lib/active_merchant/billing/gateways/qbms.rb +303 -0
  190. data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
  191. data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
  192. data/lib/active_merchant/billing/gateways/quickpay.rb +25 -0
  193. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  194. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +301 -0
  195. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  196. data/lib/active_merchant/billing/gateways/qvalent.rb +289 -0
  197. data/lib/active_merchant/billing/gateways/realex.rb +374 -0
  198. data/lib/active_merchant/billing/gateways/redsys.rb +534 -0
  199. data/lib/active_merchant/billing/gateways/s5.rb +246 -0
  200. data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
  201. data/lib/active_merchant/billing/gateways/sage.rb +448 -0
  202. data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
  203. data/lib/active_merchant/billing/gateways/sallie_mae.rb +142 -0
  204. data/lib/active_merchant/billing/gateways/secure_net.rb +267 -0
  205. data/lib/active_merchant/billing/gateways/secure_pay.rb +200 -0
  206. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +292 -0
  207. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +104 -0
  208. data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
  209. data/lib/active_merchant/billing/gateways/skip_jack.rb +450 -0
  210. data/lib/active_merchant/billing/gateways/smart_ps.rb +280 -0
  211. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
  212. data/lib/active_merchant/billing/gateways/spreedly_core.rb +306 -0
  213. data/lib/active_merchant/billing/gateways/stripe.rb +790 -0
  214. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +267 -0
  215. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +152 -0
  216. data/lib/active_merchant/billing/gateways/telr.rb +274 -0
  217. data/lib/active_merchant/billing/gateways/tns.rb +22 -0
  218. data/lib/active_merchant/billing/gateways/trans_first.rb +239 -0
  219. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
  220. data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
  221. data/lib/active_merchant/billing/gateways/transax.rb +22 -0
  222. data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
  223. data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
  224. data/lib/active_merchant/billing/gateways/trust_commerce.rb +490 -0
  225. data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
  226. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1620 -0
  227. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +355 -0
  228. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  229. data/lib/active_merchant/billing/gateways/verifi.rb +225 -0
  230. data/lib/active_merchant/billing/gateways/viaklix.rb +176 -0
  231. data/lib/active_merchant/billing/gateways/visanet_peru.rb +245 -0
  232. data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
  233. data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
  234. data/lib/active_merchant/billing/gateways/wirecard.rb +432 -0
  235. data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
  236. data/lib/active_merchant/billing/gateways/worldpay.rb +634 -0
  237. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
  238. data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
  239. data/lib/active_merchant/billing/model.rb +30 -0
  240. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  241. data/lib/active_merchant/billing/payment_token.rb +21 -0
  242. data/lib/active_merchant/billing/rails.rb +3 -0
  243. data/lib/active_merchant/billing/response.rb +92 -0
  244. data/lib/active_merchant/connection.rb +195 -0
  245. data/lib/active_merchant/country.rb +336 -0
  246. data/lib/active_merchant/empty.rb +20 -0
  247. data/lib/active_merchant/errors.rb +35 -0
  248. data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
  249. data/lib/active_merchant/network_connection_retries.rb +80 -0
  250. data/lib/active_merchant/post_data.rb +25 -0
  251. data/lib/active_merchant/posts_data.rb +92 -0
  252. data/lib/active_merchant/version.rb +3 -0
  253. data/lib/activemerchant.rb +1 -0
  254. data/lib/certs/cacert.pem +3988 -0
  255. data/lib/support/gateway_support.rb +69 -0
  256. data/lib/support/outbound_hosts.rb +28 -0
  257. data/lib/support/ssl_verify.rb +92 -0
  258. data/lib/support/ssl_version.rb +87 -0
  259. metadata +435 -0
@@ -0,0 +1,224 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ # For more information visit {Transact Pro Services}[https://www.transactpro.lv/business/]
4
+ #
5
+ # This gateway was formerly associated with www.1stpayments.net
6
+ #
7
+ # Written by Piers Chambers (Varyonic.com)
8
+ class TransactProGateway < Gateway
9
+ self.test_url = 'https://gw2sandbox.tpro.lv:8443/gw2test/gwprocessor2.php'
10
+ self.live_url = 'https://www2.1stpayments.net/gwprocessor2.php'
11
+
12
+ self.supported_countries = ['US']
13
+ self.default_currency = 'USD'
14
+ self.money_format = :cents
15
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
16
+
17
+ self.homepage_url = 'https://www.transactpro.lv/business/online-payments-acceptance'
18
+ self.display_name = 'Transact Pro'
19
+
20
+ def initialize(options={})
21
+ requires!(options, :guid, :password, :terminal)
22
+ super
23
+ end
24
+
25
+ def purchase(amount, payment, options={})
26
+ post = PostData.new
27
+ add_invoice(post, amount, options)
28
+ add_payment(post, payment)
29
+ add_address(post, payment, options)
30
+ add_customer_data(post, options)
31
+ add_credentials(post)
32
+ post[:rs] = @options[:terminal]
33
+
34
+ MultiResponse.run do |r|
35
+ r.process { commit('init', post) }
36
+ r.process do
37
+ post = PostData.new
38
+ post[:init_transaction_id] = r.authorization
39
+ add_payment_cc(post, payment)
40
+ post[:f_extended] = '4'
41
+
42
+ commit('charge', post, amount)
43
+ end
44
+ end
45
+ end
46
+
47
+ def authorize(amount, payment, options={})
48
+ post = PostData.new
49
+ add_invoice(post, amount, options)
50
+ add_payment(post, payment)
51
+ add_address(post, payment, options)
52
+ add_customer_data(post, options)
53
+ add_credentials(post)
54
+ post[:rs] = @options[:terminal]
55
+
56
+ MultiResponse.run do |r|
57
+ r.process { commit('init_dms', post) }
58
+ r.process do
59
+ post = PostData.new
60
+ post[:init_transaction_id] = r.authorization
61
+ add_payment_cc(post, payment)
62
+ post[:f_extended] = '4'
63
+
64
+ commit('make_hold', post, amount)
65
+ end
66
+ end
67
+ end
68
+
69
+ def capture(amount, authorization, options={})
70
+ identifier, original_amount = split_authorization(authorization)
71
+ if amount && (amount != original_amount)
72
+ raise ArgumentError.new("Partial capture is not supported, and #{amount.inspect} != #{original_amount.inspect}")
73
+ end
74
+
75
+ post = PostData.new
76
+ add_credentials(post)
77
+ post[:init_transaction_id] = identifier
78
+ post[:f_extended] = '4'
79
+
80
+ commit('charge_hold', post, original_amount)
81
+ end
82
+
83
+ def refund(amount, authorization, options={})
84
+ identifier, original_amount = split_authorization(authorization)
85
+
86
+ post = PostData.new
87
+ add_credentials(post, :account_guid)
88
+ post[:init_transaction_id] = identifier
89
+ post[:amount_to_refund] = amount(amount || original_amount)
90
+
91
+ commit('refund', post)
92
+ end
93
+
94
+ def void(authorization, options={})
95
+ identifier, amount = split_authorization(authorization)
96
+
97
+ post = PostData.new
98
+ add_credentials(post, :account_guid)
99
+ post[:init_transaction_id] = identifier
100
+ post[:amount_to_refund] = amount(amount)
101
+ commit('cancel_dms', post)
102
+ end
103
+
104
+ def verify(credit_card, options={})
105
+ MultiResponse.run(:use_first_response) do |r|
106
+ r.process { authorize(100, credit_card, options) }
107
+ r.process(:ignore_result) { void(r.authorization, options) }
108
+ end
109
+ end
110
+
111
+ private
112
+
113
+ def add_customer_data(post, options)
114
+ post[:email] = (options[:email] || 'noone@example.com')
115
+ post[:user_ip] = (options[:ip] || '127.0.0.1')
116
+ end
117
+
118
+ def add_address(post, creditcard, options)
119
+ if address = options[:billing_address]
120
+ post[:street] = address[:address1].to_s
121
+ post[:city] = address[:city].to_s
122
+ post[:state] = (address[:state].blank? ? 'NA' : address[:state].to_s)
123
+ post[:zip] = address[:zip].to_s
124
+ post[:country] = address[:country].to_s
125
+ post[:phone] = (address[:phone].to_s.gsub(/[^0-9]/, '') || '0000000')
126
+ end
127
+
128
+ if address = options[:shipping_address]
129
+ post[:shipping_name] = "#{address.first_name} #{address.last_name}"
130
+ post[:shipping_street] = address[:address1].to_s
131
+ post[:shipping_phone] = address[:phone].to_s
132
+ post[:shipping_zip] = address[:zip].to_s
133
+ post[:shipping_city] = address[:city].to_s
134
+ post[:shipping_country] = address[:country].to_s
135
+ post[:shipping_state] = (address[:state].blank? ? 'NA' : address[:state].to_s)
136
+ post[:shipping_email] = (options[:email] || 'noone@example.com')
137
+ end
138
+ end
139
+
140
+ def add_invoice(post, money, options)
141
+ post[:merchant_transaction_id] = options[:order_id] if options[:order_id]
142
+ post[:amount] = amount(money)
143
+ post[:currency] = (options[:currency] || currency(money))
144
+ post[:description] = options[:description]
145
+ post[:merchant_site_url] = options[:merchant]
146
+ end
147
+
148
+ def add_payment(post, payment)
149
+ post[:name_on_card] = "#{payment.first_name} #{payment.last_name}"
150
+ post[:card_bin] = payment.first_digits
151
+ end
152
+
153
+ def add_payment_cc(post, credit_card)
154
+ post[:cc] = credit_card.number
155
+ post[:cvv] = credit_card.verification_value if credit_card.verification_value?
156
+ year = sprintf('%.4i', credit_card.year)
157
+ month = sprintf('%.2i', credit_card.month)
158
+ post[:expire] = "#{month}/#{year[2..3]}"
159
+ end
160
+
161
+ def add_credentials(post, key=:guid)
162
+ post[key] = @options[:guid]
163
+ post[:pwd] = Digest::SHA1.hexdigest(@options[:password])
164
+ end
165
+
166
+ def parse(body)
167
+ if body =~ /^ID:/
168
+ body.split('~').reduce(Hash.new) { |h, v|
169
+ m = v.match('(.*?):(.*)')
170
+ h.merge!(m[1].underscore.to_sym => m[2])
171
+ }
172
+ elsif (m = body.match('(.*?):(.*)'))
173
+ m[1] == 'OK' ?
174
+ { status: 'success', id: m[2] } :
175
+ { status: 'failure', message: m[2] }
176
+ else
177
+ Hash[status: body]
178
+ end
179
+ end
180
+
181
+ def commit(action, parameters, amount=nil)
182
+ url = (test? ? test_url : live_url)
183
+ response = parse(ssl_post(url, post_data(action, parameters)))
184
+
185
+ Response.new(
186
+ success_from(response),
187
+ message_from(response),
188
+ response,
189
+ authorization: authorization_from(parameters, response, amount),
190
+ test: test?
191
+ )
192
+ end
193
+
194
+ def authorization_from(parameters, response, amount)
195
+ identifier = (response[:id] || parameters[:init_transaction_id])
196
+ authorization = [identifier]
197
+ authorization << amount if amount
198
+ authorization.join('|')
199
+ end
200
+
201
+ def split_authorization(authorization)
202
+ if authorization =~ /|/
203
+ identifier, amount = authorization.split('|')
204
+ [identifier, amount.to_i]
205
+ else
206
+ authorization
207
+ end
208
+ end
209
+
210
+ def success_from(response)
211
+ (response[:status] =~ /success/i || response[:status] =~ /ok/i)
212
+ end
213
+
214
+ def message_from(response)
215
+ (response[:message] || response[:status])
216
+ end
217
+
218
+ def post_data(action, parameters = {})
219
+ parameters[:a] = action
220
+ parameters.to_s
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), 'smart_ps.rb')
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ class TransaxGateway < SmartPs
6
+ self.live_url = self.test_url = 'https://secure.nelixtransax.net/api/transact.php'
7
+
8
+ # The countries the gateway supports merchants from as 2 digit ISO country codes
9
+ self.supported_countries = ['US']
10
+
11
+ # The card types supported by the payment gateway
12
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
13
+
14
+ # The homepage URL of the gateway
15
+ self.homepage_url = 'https://www.nelixtransax.com/'
16
+
17
+ # The name of the gateway
18
+ self.display_name = 'NELiX TransaX'
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class TransnationalGateway < NetworkMerchantsGateway
4
+ self.homepage_url = 'http://www.tnbci.com/'
5
+ self.display_name = 'Transnational'
6
+ self.supported_countries = ['US']
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,218 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class TrexleGateway < Gateway
4
+ self.test_url = 'https://core.trexle.com/api/v1'
5
+ self.live_url = 'https://core.trexle.com/api/v1'
6
+
7
+ self.default_currency = 'USD'
8
+ self.money_format = :cents
9
+ self.supported_countries = %w(AD AE AT AU BD BE BG BN CA CH CY CZ DE DK EE EG ES FI FR GB
10
+ GI GR HK HU ID IE IL IM IN IS IT JO KW LB LI LK LT LU LV MC
11
+ MT MU MV MX MY NL NO NZ OM PH PL PT QA RO SA SE SG SI SK SM
12
+ TR TT UM US VA VN ZA)
13
+ self.supported_cardtypes = [:visa, :master, :american_express]
14
+ self.homepage_url = 'https://trexle.com'
15
+ self.display_name = 'Trexle'
16
+
17
+ def initialize(options = {})
18
+ requires!(options, :api_key)
19
+ super
20
+ end
21
+
22
+ # Create a charge using a credit card, card token or customer token
23
+ #
24
+ # To charge a credit card: purchase([money], [creditcard hash], ...)
25
+ # To charge a customer: purchase([money], [token], ...)
26
+ def purchase(money, creditcard, options = {})
27
+ post = {}
28
+
29
+ add_amount(post, money, options)
30
+ add_customer_data(post, options)
31
+ add_invoice(post, options)
32
+ add_creditcard(post, creditcard)
33
+ add_address(post, creditcard, options)
34
+ commit(:post, 'charges', post, options)
35
+ end
36
+
37
+ # Create a customer and associated credit card. The token that is returned
38
+ # can be used instead of a credit card parameter in the purchase method
39
+ def store(creditcard, options = {})
40
+ post = {}
41
+
42
+ add_creditcard(post, creditcard)
43
+ add_customer_data(post, options)
44
+ add_address(post, creditcard, options)
45
+ commit(:post, 'customers', post, options)
46
+ end
47
+
48
+ # Refund a transaction
49
+ def refund(money, token, options = {})
50
+ commit(:post, "charges/#{CGI.escape(token)}/refunds", { amount: amount(money) }, options)
51
+ end
52
+
53
+ # Authorize an amount on a credit card. Once authorized, you can later
54
+ # capture this charge using the charge token that is returned.
55
+ def authorize(money, creditcard, options = {})
56
+ post = {}
57
+
58
+ add_amount(post, money, options)
59
+ add_customer_data(post, options)
60
+ add_invoice(post, options)
61
+ add_creditcard(post, creditcard)
62
+ add_address(post, creditcard, options)
63
+ post[:capture] = false
64
+ commit(:post, 'charges', post, options)
65
+ end
66
+
67
+ # Captures a previously authorized charge. Capturing only part of the original
68
+ # authorization is currently not supported.
69
+ def capture(money, token, options = {})
70
+ commit(:put, "charges/#{CGI.escape(token)}/capture", { amount: amount(money) }, options)
71
+ end
72
+
73
+ # Updates the credit card for the customer.
74
+ def update(token, creditcard, options = {})
75
+ post = {}
76
+
77
+ add_creditcard(post, creditcard)
78
+ add_customer_data(post, options)
79
+ add_address(post, creditcard, options)
80
+ commit(:put, "customers/#{CGI.escape(token)}", post, options)
81
+ end
82
+
83
+ def supports_scrubbing
84
+ true
85
+ end
86
+
87
+ def scrub(transcript)
88
+ transcript.
89
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
90
+ gsub(/(number\\?":\\?")(\d*)/, '\1[FILTERED]').
91
+ gsub(/(cvc\\?":\\?")(\d*)/, '\1[FILTERED]')
92
+ end
93
+
94
+ private
95
+
96
+ def add_amount(post, money, options)
97
+ post[:amount] = amount(money)
98
+ post[:currency] = (options[:currency] || currency(money))
99
+ post[:currency] = post[:currency].upcase if post[:currency]
100
+ end
101
+
102
+ def add_customer_data(post, options)
103
+ post[:email] = options[:email] if options[:email]
104
+ post[:ip_address] = options[:ip] if options[:ip]
105
+ end
106
+
107
+ def add_address(post, creditcard, options)
108
+ return if creditcard.kind_of?(String)
109
+ address = (options[:billing_address] || options[:address])
110
+ return unless address
111
+
112
+ post[:card] ||= {}
113
+ post[:card].merge!(
114
+ address_line1: address[:address1],
115
+ address_line2: address[:address_line2],
116
+ address_city: address[:city],
117
+ address_postcode: address[:zip],
118
+ address_state: address[:state],
119
+ address_country: address[:country]
120
+ )
121
+ end
122
+
123
+ def add_invoice(post, options)
124
+ post[:description] = options[:description] || 'Active Merchant Purchase'
125
+ end
126
+
127
+ def add_creditcard(post, creditcard)
128
+ if creditcard.respond_to?(:number)
129
+ post[:card] ||= {}
130
+
131
+ post[:card].merge!(
132
+ number: creditcard.number,
133
+ expiry_month: creditcard.month,
134
+ expiry_year: creditcard.year,
135
+ cvc: creditcard.verification_value,
136
+ name: creditcard.name
137
+ )
138
+ elsif creditcard.kind_of?(String)
139
+ if creditcard =~ /^token_/
140
+ post[:card_token] = creditcard
141
+ else
142
+ post[:customer_token] = creditcard
143
+ end
144
+ end
145
+ end
146
+
147
+ def headers(params = {})
148
+ result = {
149
+ 'Content-Type' => 'application/json',
150
+ 'Authorization' => "Basic #{Base64.strict_encode64(options[:api_key] + ':').strip}"
151
+ }
152
+
153
+ result['X-Partner-Key'] = params[:partner_key] if params[:partner_key]
154
+ result['X-Safe-Card'] = params[:safe_card] if params[:safe_card]
155
+ result
156
+ end
157
+
158
+ def commit(method, action, params, options)
159
+ url = "#{test? ? test_url : live_url}/#{action}"
160
+ raw_response = ssl_request(method, url, post_data(params), headers(options))
161
+ parsed_response = parse(raw_response)
162
+ success_response(parsed_response)
163
+ rescue ResponseError => e
164
+ error_response(parse(e.response.body))
165
+ rescue JSON::ParserError
166
+ unparsable_response(raw_response)
167
+ end
168
+
169
+ def success_response(body)
170
+ return invalid_response unless body['response']
171
+
172
+ response = body['response']
173
+ Response.new(
174
+ true,
175
+ response['status_message'],
176
+ body,
177
+ authorization: token(response),
178
+ test: test?
179
+ )
180
+ end
181
+
182
+ def error_response(body)
183
+ return invalid_response unless body['error']
184
+ Response.new(
185
+ false,
186
+ body['error'],
187
+ body,
188
+ authorization: nil,
189
+ test: test?
190
+ )
191
+ end
192
+
193
+ def unparsable_response(raw_response)
194
+ message = 'Invalid JSON response received from Trexle. Please contact support@trexle.com if you continue to receive this message.'
195
+ message += " (The raw response returned by the API was #{raw_response.inspect})"
196
+ return Response.new(false, message)
197
+ end
198
+
199
+ def invalid_response
200
+ message = 'Invalid response.'
201
+ return Response.new(false, message)
202
+ end
203
+
204
+ def token(response)
205
+ response['token']
206
+ end
207
+
208
+ def parse(body)
209
+ return {} if body.blank?
210
+ JSON.parse(body)
211
+ end
212
+
213
+ def post_data(parameters = {})
214
+ parameters.to_json
215
+ end
216
+ end
217
+ end
218
+ end