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,159 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class FederatedCanadaGateway < Gateway
4
+ # Same URL for both test and live, testing is done by using the test username (demo) and password (password).
5
+ self.live_url = self.test_url = 'https://secure.federatedgateway.com/api/transact.php'
6
+
7
+ APPROVED, DECLINED, ERROR = 1, 2, 3
8
+
9
+ # The countries the gateway supports merchants from as 2 digit ISO country codes
10
+ self.supported_countries = ['CA']
11
+
12
+ self.default_currency = 'CAD'
13
+
14
+ # The card types supported by the payment gateway
15
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
16
+
17
+ # The homepage URL of the gateway
18
+ self.homepage_url = 'http://www.federatedcanada.com/'
19
+
20
+ # The name of the gateway
21
+ self.display_name = 'Federated Canada'
22
+
23
+ def initialize(options = {})
24
+ requires!(options, :login, :password)
25
+ super
26
+ end
27
+
28
+ def purchase(money, creditcard, options = {})
29
+ post = {}
30
+ add_invoice(post, options)
31
+ add_creditcard(post, creditcard)
32
+ add_address(post, options)
33
+ add_customer_data(post, options)
34
+ commit('sale', money, post)
35
+ end
36
+
37
+ def authorize(money, creditcard, options = {})
38
+ post = {}
39
+ add_invoice(post, options)
40
+ add_creditcard(post, creditcard)
41
+ add_address(post, options)
42
+ add_customer_data(post, options)
43
+ commit('auth', money, post)
44
+ end
45
+
46
+ def capture(money, authorization, options = {})
47
+ options[:transactionid] = authorization
48
+ commit('capture', money, options)
49
+ end
50
+
51
+ def void(authorization, options = {})
52
+ options[:transactionid] = authorization
53
+ commit('void', nil, options)
54
+ end
55
+
56
+ def refund(money, authorization, options = {})
57
+ commit('refund', money, options.merge(:transactionid => authorization))
58
+ end
59
+
60
+ def credit(money, authorization, options = {})
61
+ ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
62
+ refund(money, authorization, options)
63
+ end
64
+
65
+ private
66
+
67
+ def add_customer_data(post, options)
68
+ post[:firstname] = options[:first_name]
69
+ post[:lastname] = options[:last_name]
70
+
71
+ post[:email] = options[:email]
72
+ end
73
+
74
+ def add_address(post, options)
75
+ if address = (options[:billing_address] || options[:address])
76
+ post[:company] = address[:company]
77
+ post[:address1] = address[:address1]
78
+ post[:address2] = address[:address2]
79
+ post[:city] = address[:city]
80
+ post[:state] = address[:state]
81
+ post[:zip] = address[:zip]
82
+ post[:country] = address[:country]
83
+ post[:phone] = address[:phone]
84
+ end
85
+ if address = options[:shipping_address]
86
+ post[:shipping_firstname] = address[:first_name]
87
+ post[:shipping_lastname] = address[:last_name]
88
+ post[:shipping_company] = address[:company]
89
+ post[:shipping_address1] = address[:address1]
90
+ post[:shipping_address2] = address[:address2]
91
+ post[:shipping_city] = address[:city]
92
+ post[:shipping_state] = address[:state]
93
+ post[:shipping_zip] = address[:zip]
94
+ post[:shipping_country] = address[:country]
95
+ post[:shipping_email] = address[:email]
96
+ end
97
+ end
98
+
99
+ def add_invoice(post, options)
100
+ post[:orderid] = options[:order_id]
101
+ post[:orderdescription] = options[:description]
102
+ end
103
+
104
+ def add_creditcard(post, creditcard)
105
+ post[:ccnumber] = creditcard.number
106
+ post[:ccexp] = expdate(creditcard)
107
+ post[:cvv] = creditcard.verification_value
108
+ end
109
+
110
+ def parse(body)
111
+ body.split('&').inject({}) do |memo, x|
112
+ k, v = x.split('=')
113
+ memo[k] = v
114
+ memo
115
+ end
116
+ end
117
+
118
+ def commit(action, money, parameters)
119
+ parameters[:amount] = amount(money)
120
+ data = ssl_post(self.live_url, post_data(action, parameters))
121
+ response = parse(data)
122
+ message = message_from(response)
123
+
124
+ Response.new(success?(response), message, response,
125
+ :test => test?,
126
+ :authorization => response['transactionid'],
127
+ :avs_result => {:code => response['avsresponse']},
128
+ :cvv_result => response['cvvresponse']
129
+ )
130
+ end
131
+
132
+ def success?(response)
133
+ response['response'] == '1'
134
+ end
135
+
136
+ def test?
137
+ @options[:login].eql?('demo') && @options[:password].eql?('password')
138
+ end
139
+
140
+ def message_from(response)
141
+ case response['response'].to_i
142
+ when APPROVED
143
+ 'Transaction Approved'
144
+ when DECLINED
145
+ 'Transaction Declined'
146
+ else
147
+ 'Error in transaction data or system error'
148
+ end
149
+ end
150
+
151
+ def post_data(action, parameters = {})
152
+ parameters[:type] = action
153
+ parameters[:username] = @options[:login]
154
+ parameters[:password] = @options[:password]
155
+ parameters.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,22 @@
1
+ require 'active_merchant/billing/gateways/cc5'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ class FinansbankGateway < CC5Gateway
6
+ self.live_url = 'https://www.fbwebpos.com/servlet/cc5ApiServer'
7
+ self.test_url = 'https://entegrasyon.asseco-see.com.tr/fim/api'
8
+
9
+ # The countries the gateway supports merchants from as 2 digit ISO country codes
10
+ self.supported_countries = ['US', 'TR']
11
+
12
+ # The card types supported by the payment gateway
13
+ self.supported_cardtypes = [:visa, :master]
14
+
15
+ # The homepage URL of the gateway
16
+ self.homepage_url = 'https://www.fbwebpos.com/'
17
+
18
+ # The name of the gateway
19
+ self.display_name = 'Finansbank WebPOS'
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,142 @@
1
+ require 'nokogiri'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ class FirstGivingGateway < Gateway
6
+ self.test_url = 'http://usapisandbox.fgdev.net'
7
+ self.live_url = 'https://api.firstgiving.com'
8
+
9
+ self.supported_countries = ['US']
10
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
11
+ self.homepage_url = 'http://www.firstgiving.com/'
12
+ self.default_currency = 'USD'
13
+ self.display_name = 'FirstGiving'
14
+
15
+ def initialize(options = {})
16
+ requires!(options, :application_key, :security_token, :charity_id)
17
+ super
18
+ end
19
+
20
+ def purchase(money, creditcard, options = {})
21
+ post = {}
22
+ add_invoice(post, options)
23
+ add_creditcard(post, creditcard)
24
+ add_address(post, options)
25
+ add_customer_data(post, options)
26
+ add_donation_data(post, money, options)
27
+ commit('/donation/creditcard', post)
28
+ end
29
+
30
+ def refund(money, identifier, options = {})
31
+ get = {}
32
+ get[:transactionId] = identifier
33
+ get[:tranType] = 'REFUNDREQUEST'
34
+ commit('/transaction/refundrequest?' + encode(get))
35
+ end
36
+
37
+ private
38
+
39
+ def add_donation_data(post, money, options)
40
+ post[:amount] = amount(money)
41
+ post[:charityId] = @options[:charity_id]
42
+ post[:description] = (options[:description] || 'Purchase')
43
+ post[:currencyCode] = (options[:currency] || currency(money))
44
+ end
45
+
46
+ def add_customer_data(post, options)
47
+ post[:billToEmail] = (options[:email] || 'activemerchant@example.com')
48
+ post[:remoteAddr] = (options[:ip] || '127.0.0.1')
49
+ end
50
+
51
+ def add_address(post, options)
52
+ if(billing_address = (options[:billing_address] || options[:address]))
53
+ post[:billToAddressLine1] = billing_address[:address1]
54
+ post[:billToCity] = billing_address[:city]
55
+ post[:billToState] = billing_address[:state]
56
+ post[:billToZip] = billing_address[:zip]
57
+ post[:billToCountry] = billing_address[:country]
58
+ end
59
+ end
60
+
61
+ def add_invoice(post, options)
62
+ post[:orderId] = options[:order_id]
63
+ end
64
+
65
+ def add_creditcard(post, creditcard)
66
+ post[:billToFirstName] = creditcard.first_name
67
+ post[:billToLastName] = creditcard.last_name
68
+ post[:ccNumber] = creditcard.number
69
+ post[:ccType] = creditcard_brand(creditcard.brand)
70
+ post[:ccExpDateMonth] = creditcard.month
71
+ post[:ccExpDateYear] = creditcard.year
72
+ post[:ccCardValidationNum] = creditcard.verification_value
73
+ end
74
+
75
+ def parse(body)
76
+ response = {}
77
+
78
+ xml = Nokogiri::XML(body)
79
+ element = xml.xpath('//firstGivingDonationApi/firstGivingResponse').first
80
+
81
+ element.attributes.each do |name, attribute|
82
+ response[name] = attribute.content
83
+ end
84
+ element.children.each do |child|
85
+ next if child.text?
86
+ response[child.name] = child.text
87
+ end
88
+
89
+ response
90
+ end
91
+
92
+ def commit(action, post=nil)
93
+ url = (test? ? self.test_url : self.live_url) + action
94
+
95
+ begin
96
+ if post
97
+ response = parse(ssl_post(url, post_data(post), headers))
98
+ else
99
+ response = parse(ssl_get(url, headers))
100
+ end
101
+ rescue ResponseError => e
102
+ response = parse(e.response.body)
103
+ end
104
+
105
+ Response.new(
106
+ (response['acknowledgement'] == 'Success'),
107
+ (response['friendlyErrorMessage'] || response['verboseErrorMessage'] || response['acknowledgement']),
108
+ response,
109
+ authorization: response['transactionId'],
110
+ test: test?
111
+ )
112
+ end
113
+
114
+ def post_data(post)
115
+ post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
116
+ end
117
+
118
+ def encode(hash)
119
+ hash.collect { |(k, v)| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&')
120
+ end
121
+
122
+ def creditcard_brand(brand)
123
+ case brand
124
+ when 'visa' then 'VI'
125
+ when 'master' then 'MC'
126
+ when 'discover' then 'DI'
127
+ when 'american_express' then 'AX'
128
+ else
129
+ raise "Unhandled credit card brand #{brand}"
130
+ end
131
+ end
132
+
133
+ def headers
134
+ {
135
+ 'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
136
+ 'JG_APPLICATIONKEY' => @options[:application_key].to_s,
137
+ 'JG_SECURITYTOKEN' => @options[:security_token].to_s
138
+ }
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,182 @@
1
+ require 'nokogiri'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ class FirstPayGateway < Gateway
6
+ self.live_url = 'https://secure.goemerchant.com/secure/gateway/xmlgateway.aspx'
7
+
8
+ self.supported_countries = ['US']
9
+ self.default_currency = 'USD'
10
+ self.money_format = :dollars
11
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
+
13
+ self.homepage_url = 'http://1stpaygateway.net/'
14
+ self.display_name = '1stPayGateway.Net'
15
+
16
+ def initialize(options={})
17
+ requires!(options, :transaction_center_id, :gateway_id)
18
+ super
19
+ end
20
+
21
+ def purchase(money, payment, options={})
22
+ post = {}
23
+ add_invoice(post, money, options)
24
+ add_payment(post, payment, options)
25
+ add_address(post, payment, options)
26
+ add_customer_data(post, options)
27
+
28
+ commit('sale', post)
29
+ end
30
+
31
+ def authorize(money, payment, options={})
32
+ post = {}
33
+ add_invoice(post, money, options)
34
+ add_payment(post, payment, options)
35
+ add_address(post, payment, options)
36
+ add_customer_data(post, options)
37
+
38
+ commit('auth', post)
39
+ end
40
+
41
+ def capture(money, authorization, options={})
42
+ post = {}
43
+ add_reference(post, 'settle', money, authorization)
44
+ commit('settle', post)
45
+ end
46
+
47
+ def refund(money, authorization, options={})
48
+ post = {}
49
+ add_reference(post, 'credit', money, authorization)
50
+ commit('credit', post)
51
+ end
52
+
53
+ def void(authorization, options={})
54
+ post = {}
55
+ add_reference(post, 'void', nil, authorization)
56
+ commit('void', post)
57
+ end
58
+
59
+ def supports_scrubbing?
60
+ true
61
+ end
62
+
63
+ def scrub(transcript)
64
+ transcript.
65
+ gsub(%r((gateway_id)[^<]*(</FIELD>))i, '\1[FILTERED]\2').
66
+ gsub(%r((card_number)[^<]*(</FIELD>))i, '\1[FILTERED]\2').
67
+ gsub(%r((cvv2)[^<]*(</FIELD>))i, '\1[FILTERED]\2')
68
+ end
69
+
70
+ private
71
+
72
+ def add_authentication(post, options)
73
+ post[:transaction_center_id] = options[:transaction_center_id]
74
+ post[:gateway_id] = options[:gateway_id]
75
+ end
76
+
77
+ def add_customer_data(post, options)
78
+ post[:owner_email] = options[:email] if options[:email]
79
+ post[:remote_ip_address] = options[:ip] if options[:ip]
80
+ post[:processor_id] = options[:processor_id] if options[:processor_id]
81
+ end
82
+
83
+ def add_address(post, creditcard, options)
84
+ if address = options[:billing_address] || options[:address]
85
+ post[:owner_name] = address[:name]
86
+ post[:owner_street] = address[:address1]
87
+ post[:owner_street2] = address[:address2] if address[:address2]
88
+ post[:owner_city] = address[:city]
89
+ post[:owner_state] = address[:state]
90
+ post[:owner_zip] = address[:zip]
91
+ post[:owner_country] = address[:country]
92
+ post[:owner_phone] = address[:phone] if address[:phone]
93
+ end
94
+ end
95
+
96
+ def add_invoice(post, money, options)
97
+ post[:order_id] = options[:order_id]
98
+ post[:total] = amount(money)
99
+ end
100
+
101
+ def add_payment(post, payment, options)
102
+ post[:card_name] = payment.brand # Unclear if need to map to known names or open text field??
103
+ post[:card_number] = payment.number
104
+ post[:card_exp] = expdate(payment)
105
+ post[:cvv2] = payment.verification_value
106
+ post[:recurring] = options[:recurring] if options[:recurring]
107
+ post[:recurring_start_date] = options[:recurring_start_date] if options[:recurring_start_date]
108
+ post[:recurring_end_date] = options[:recurring_end_date] if options[:recurring_end_date]
109
+ post[:recurring_type] = options[:recurring_type] if options[:recurring_type]
110
+ end
111
+
112
+ def add_reference(post, action, money, authorization)
113
+ post[:"#{action}_amount1"] = amount(money) if money
114
+ post[:total_number_transactions] = 1
115
+ post[:reference_number1] = authorization
116
+ end
117
+
118
+ def parse(xml)
119
+ response = {}
120
+
121
+ doc = Nokogiri::XML(xml)
122
+ doc.root&.xpath('//RESPONSE/FIELDS/FIELD')&.each do |field|
123
+ response[field['KEY']] = field.text
124
+ end
125
+
126
+ response
127
+ end
128
+
129
+ def commit(action, parameters)
130
+ response = parse(ssl_post(live_url, post_data(action, parameters)))
131
+
132
+ Response.new(
133
+ success_from(response),
134
+ message_from(response),
135
+ response,
136
+ authorization: authorization_from(response),
137
+ error_code: error_code_from(response),
138
+ test: test?
139
+ )
140
+ end
141
+
142
+ def success_from(response)
143
+ (
144
+ (response['status'] == '1') ||
145
+ (response['status1'] == '1')
146
+ )
147
+ end
148
+
149
+ def message_from(response)
150
+ # Silly inconsistent gateway. Always make capitalized (but not all caps)
151
+ msg = (response['auth_response'] || response['response1'])
152
+ msg&.downcase&.capitalize
153
+ end
154
+
155
+ def error_code_from(response)
156
+ response['error']
157
+ end
158
+
159
+ def authorization_from(response)
160
+ response['reference_number'] || response['reference_number1']
161
+ end
162
+
163
+ def post_data(action, parameters = {})
164
+ parameters[:transaction_center_id] = @options[:transaction_center_id]
165
+ parameters[:gateway_id] = @options[:gateway_id]
166
+
167
+ parameters[:operation_type] = action
168
+
169
+ xml = Builder::XmlMarkup.new
170
+ xml.instruct!
171
+ xml.tag! 'TRANSACTION' do
172
+ xml.tag! 'FIELDS' do
173
+ parameters.each do |key, value|
174
+ xml.tag! 'FIELD', value, { 'KEY' => key }
175
+ end
176
+ end
177
+ end
178
+ xml.target!
179
+ end
180
+ end
181
+ end
182
+ end