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,20 @@
1
+ Copyright (c) 2005-2010 Tobias Luetke
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,246 @@
1
+ # Active Merchant
2
+ [![Build Status](https://travis-ci.org/activemerchant/active_merchant.png?branch=master)](https://travis-ci.org/activemerchant/active_merchant)
3
+ [![Code Climate](https://codeclimate.com/github/activemerchant/active_merchant.png)](https://codeclimate.com/github/activemerchant/active_merchant)
4
+
5
+ Active Merchant is an extraction from the ecommerce system [Shopify](http://www.shopify.com).
6
+ Shopify's requirements for a simple and unified API to access dozens of different payment
7
+ gateways with very different internal APIs was the chief principle in designing the library.
8
+
9
+ It was developed for usage in Ruby on Rails web applications and integrates seamlessly
10
+ as a Rails plugin, but it also works excellently as a stand alone Ruby library.
11
+
12
+ Active Merchant has been in production use since June 2006 and is now used in most modern
13
+ Ruby applications which deal with financial transactions. It is maintained by the
14
+ [Shopify](http://www.shopify.com) and [Spreedly](https://spreedly.com) teams, with much help
15
+ from an ever-growing set of contributors.
16
+
17
+ See [GettingStarted.md](GettingStarted.md) if you want to learn more about using Active Merchant in your
18
+ applications.
19
+
20
+ If you'd like to contribute to Active Merchant, please start with our [contribution guide](CONTRIBUTING.md).
21
+
22
+ ## Installation
23
+
24
+ ### From Git
25
+
26
+ You can check out the latest source from git:
27
+
28
+ git clone git://github.com/activemerchant/active_merchant.git
29
+
30
+ ### From RubyGems
31
+
32
+ Installation from RubyGems:
33
+
34
+ ```console
35
+ gem install activemerchant
36
+ ```
37
+
38
+ Or, if you're using Bundler, just add the following to your Gemfile:
39
+
40
+ ```ruby
41
+ gem 'activemerchant'
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ This simple example demonstrates how a purchase can be made using a person's
47
+ credit card details.
48
+
49
+ ```ruby
50
+ require 'active_merchant'
51
+
52
+ # Use the TrustCommerce test servers
53
+ ActiveMerchant::Billing::Base.mode = :test
54
+
55
+ gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
56
+ :login => 'TestMerchant',
57
+ :password => 'password')
58
+
59
+ # ActiveMerchant accepts all amounts as Integer values in cents
60
+ amount = 1000 # $10.00
61
+
62
+ # The card verification value is also known as CVV2, CVC2, or CID
63
+ credit_card = ActiveMerchant::Billing::CreditCard.new(
64
+ :first_name => 'Bob',
65
+ :last_name => 'Bobsen',
66
+ :number => '4242424242424242',
67
+ :month => '8',
68
+ :year => Time.now.year+1,
69
+ :verification_value => '000')
70
+
71
+ # Validating the card automatically detects the card type
72
+ if credit_card.validate.empty?
73
+ # Capture $10 from the credit card
74
+ response = gateway.purchase(amount, credit_card)
75
+
76
+ if response.success?
77
+ puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}"
78
+ else
79
+ raise StandardError, response.message
80
+ end
81
+ end
82
+ ```
83
+
84
+ For more in-depth documentation and tutorials, see [GettingStarted.md](GettingStarted.md) and the
85
+ [API documentation](http://www.rubydoc.info/github/activemerchant/active_merchant/).
86
+
87
+ Emerging ActiveMerchant 3DS conventions are documented in the [Contributing](https://github.com/activemerchant/active_merchant/wiki/Contributing#3ds-options)
88
+ guide and [Standardized 3DS Fields](https://github.com/activemerchant/active_merchant/wiki/Standardized-3DS-Fields) guide of the wiki.
89
+
90
+ ## Supported Payment Gateways
91
+
92
+ The [ActiveMerchant Wiki](https://github.com/activemerchant/active_merchant/wikis) contains a [table of features supported by each gateway](https://github.com/activemerchant/active_merchant/wiki/Gateway-Feature-Matrix).
93
+
94
+ * [Authorize.Net CIM](http://www.authorize.net/) - US
95
+ * [Authorize.Net](http://www.authorize.net/) - AD, AT, AU, BE, BG, CA, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GB, GI, GR, HU, IE, IT, LI, LU, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM, TR, US, VA
96
+ * [Axcess MS](http://www.axcessms.com/) - AD, AT, BE, BG, BR, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HR, HU, IE, IL, IM, IS, IT, LI, LT, LU, LV, MC, MT, MX, NL, NO, PL, PT, RO, RU, SE, SI, SK, TR, US, VA
97
+ * [Balanced](https://www.balancedpayments.com/) - US
98
+ * [Bambora Asia-Pacific](http://www.bambora.com/) - AU, NZ
99
+ * [Bank Frick](http://www.bankfrickacquiring.com/) - LI, US
100
+ * [Banwire](http://www.banwire.com/) - MX
101
+ * [Barclays ePDQ Extra Plus](http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/) - GB
102
+ * [Be2Bill](http://www.be2bill.com/) - FR
103
+ * [Beanstream.com](http://www.beanstream.com/) - CA, US
104
+ * [BluePay](http://www.bluepay.com/) - US
105
+ * [Borgun](https://www.borgun.is/) - IS
106
+ * [Braintree](https://www.braintreepayments.com) - US, CA, AU, AD, AT, BE, BG, CY, CZ, DK, EE, FI, FR, GI, DE, GR, HU, IS, IM, IE, IT, LV, LI, LT, LU, MT, MC, NL, NO, PL, PT, RO, SM, SK, SI, ES, SE, CH, TR, GB
107
+ * [BridgePay](http://www.bridgepaynetwork.com/) - CA, US
108
+ * [Cardknox](https://www.cardknox.com/) - US, CA, GB
109
+ * [CardSave](http://www.cardsave.net/) - GB
110
+ * [CardStream](http://www.cardstream.com/) - GB
111
+ * [Cashnet](http://www.higherone.com/) - US
112
+ * [Cecabank](http://www.ceca.es/es/) - ES
113
+ * [Cenpos](https://www.cenpos.com/) - AD, AI, AG, AR, AU, AT, BS, BB, BE, BZ, BM, BR, BN, BG, CA, HR, CY, CZ, DK, DM, EE, FI, FR, DE, GR, GD, GY, HK, HU, IS, IN, IL, IT, JP, LV, LI, LT, LU, MY, MT, MX, MC, MS, NL, PA, PL, PT, KN, LC, MF, VC, SM, SG, SK, SI, ZA, ES, SR, SE, CH, TR, GB, US, UY
114
+ * [CAMS: Central Account Management System](https://www.centralams.com/) - US
115
+ * [Checkout.com](https://www.checkout.com/) - AT, BE, BG, CY, CZ, DE, DK, EE, ES, FI, FR, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, MU, NL, NO, PL, PT, RO, SE, SI, SK, US
116
+ * [Clearhaus](https://www.clearhaus.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GL, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK
117
+ * [Commercegate](http://www.commercegate.com/) - AD, AT, AX, BE, BG, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GG, GI, GR, HR, HU, IE, IM, IS, IT, JE, LI, LT, LU, LV, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, VA
118
+ * [Conekta](https://conekta.io) - MX
119
+ * [CyberSource](http://www.cybersource.com) - US, BR, CA, CN, DK, FI, FR, DE, JP, MX, NO, SE, GB, SG
120
+ * [DIBS](http://www.dibspayment.com/) - US, FI, NO, SE, GB
121
+ * [DataCash](http://www.datacash.com/) - GB
122
+ * [Efsnet](http://www.concordefsnet.com/) - US
123
+ * [Elavon MyVirtualMerchant](http://www.elavon.com/) - US, CA
124
+ * [ePay](http://epay.dk/) - DK, SE, NO
125
+ * [EVO Canada](http://www.evocanada.com/) - CA
126
+ * [eWAY](http://www.eway.com.au/) - AU, NZ, GB
127
+ * [eWAY Rapid](http://www.eway.com.au/) - AU, NZ, GB, SG
128
+ * [E-xact](http://www.e-xact.com) - CA, US
129
+ * [Ezic](http://www.ezic.com/) - AU, CA, CN, FR, DE, GI, IL, MT, MU, MX, NL, NZ, PA, PH, RU, SG, KR, ES, KN, GB
130
+ * [Fat Zebra](https://www.fatzebra.com.au/) - AU
131
+ * [Federated Canada](http://www.federatedcanada.com/) - CA
132
+ * [Finansbank WebPOS](https://www.fbwebpos.com/) - US, TR
133
+ * [Flo2Cash](http://www.flo2cash.co.nz/) - NZ
134
+ * [1stPayGateway.Net](http://1stpaygateway.net/) - US
135
+ * [FirstData Global Gateway e4](http://www.firstdata.com) - CA, US
136
+ * [FirstGiving](http://www.firstgiving.com/) - US
137
+ * [Garanti Sanal POS](https://sanalposweb.garanti.com.tr) - US, TR
138
+ * [Global Transport](https://www.globalpaymentsinc.com) - CA, PR, US
139
+ * [HDFC](http://www.hdfcbank.com/sme/sme-details/merchant-services/guzh6m0i) - IN
140
+ * [Heartland Payment Systems](http://developer.heartlandpaymentsystems.com/SecureSubmit/) - US
141
+ * [iATS Payments](http://home.iatspayments.com/) - AU, BR, CA, CH, DE, DK, ES, FI, FR, GR, HK, IE, IT, NL, NO, PT, SE, SG, TR, UK, US
142
+ * [Inspire Commerce](http://www.inspiregateway.com) - US
143
+ * [InstaPay](http://www.instapayllc.com) - US
144
+ * [IPP](http://www.ippayments.com.au/) - AU
145
+ * [Iridium](http://www.iridiumcorp.co.uk/) - GB, ES
146
+ * [iTransact](http://www.itransact.com/) - US
147
+ * [JetPay](http://www.jetpay.com/) - US
148
+ * [Komoju](http://www.komoju.com/) - JP
149
+ * [LinkPoint](http://www.linkpoint.com/) - US
150
+ * [Litle & Co.](http://www.litle.com/) - US
151
+ * [maxiPago!](http://www.maxipago.com/) - BR
152
+ * [Merchant e-Solutions](http://www.merchante-solutions.com/) - US
153
+ * [Merchant One Gateway](http://merchantone.com/) - US
154
+ * [MerchantWARE](http://merchantwarehouse.com/merchantware) - US
155
+ * [MerchantWarrior](http://www.merchantwarrior.com/) - AU
156
+ * [Mercury](http://www.mercurypay.com) - US, CA
157
+ * [Metrics Global](http://www.metricsglobal.com) - US
158
+ * [MasterCard Internet Gateway Service (MiGS)](http://mastercard.com/mastercardsps) - AU, AE, BD, BN, EG, HK, ID, IN, JO, KW, LB, LK, MU, MV, MY, NZ, OM, PH, QA, SA, SG, TT, VN
159
+ * [Modern Payments](http://www.modpay.com) - US
160
+ * [MONEI](http://www.monei.net/) - AD, AT, BE, BG, CA, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, US, VA
161
+ * [Moneris](http://www.moneris.com/) - CA
162
+ * [Moneris (US)](http://www.monerisusa.com/) - US
163
+ * [MoneyMovers](http://mmoa.us/) - US
164
+ * [NAB Transact](http://transact.nab.com.au) - AU
165
+ * [NELiX TransaX](https://www.nelixtransax.com/) - US
166
+ * [NetRegistry](http://www.netregistry.com.au) - AU
167
+ * [BBS Netaxept](http://www.betalingsterminal.no/Netthandel-forside/) - NO, DK, SE, FI
168
+ * [NETbilling](http://www.netbilling.com) - US
169
+ * [NETPAY Gateway](http://www.netpay.com.mx) - MX
170
+ * [NMI](http://nmi.com/) - US
171
+ * [Ogone](http://www.ogone.com/) - BE, DE, FR, NL, AT, CH
172
+ * [Omise](https://www.omise.co/) - TH, JP
173
+ * [Openpay](Openpay) - MX
174
+ * [Optimal Payments](http://www.optimalpayments.com/) - CA, US, GB
175
+ * [Orbital Paymentech](http://chasepaymentech.com/) - US, CA
176
+ * [Pagar.me](https://pagar.me/) - BR
177
+ * [PagoFacil](http://www.pagofacil.net/) - MX
178
+ * [PayConex](http://www.bluefincommerce.com/) - US, CA
179
+ * [PayGate PayXML](http://paygate.co.za/) - US, ZA
180
+ * [PayHub](http://www.payhub.com/) - US
181
+ * [PayJunction](http://www.payjunction.com/) - US
182
+ * [PaySecure](http://www.commsecure.com.au/paysecure.shtml) - AU
183
+ * [Paybox Direct](http://www.paybox.com/) - FR
184
+ * [Payeezy](https://developer.payeezy.com/) - CA, US
185
+ * [Payex](http://payex.com/) - DK, FI, NO, SE
186
+ * [PaymentExpress](http://www.paymentexpress.com/) - AU, CA, DE, ES, FR, GB, HK, IE, MY, NL, NZ, SG, US, ZA
187
+ * [PAYMILL](https://paymill.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, VA
188
+ * [PayPal Express Checkout](https://www.paypal.com/webapps/mpp/express-checkout) - US, CA, SG, AU
189
+ * [PayPal Express Checkout (UK)](https://www.paypal.com/uk/webapps/mpp/express-checkout) - GB
190
+ * [PayPal Payflow Pro](https://www.paypal.com/webapps/mpp/payflow-payment-gateway) - US, CA, SG, AU
191
+ * [PayPal Payments Pro (US)](https://www.paypal.com/us/webapps/mpp/paypal-payments-pro) - US
192
+ * [PayPal Payments Pro (UK)](https://www.paypal.com/uk/webapps/mpp/pro) - GB
193
+ * [PayPal Website Payments Pro (CA)](https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside) - CA
194
+ * [PayPal Express Checkout for Digital Goods](https://www.x.com/community/ppx/xspaces/digital_goods) - AU, CA, CN, FI, GB, ID, IN, IT, MY, NO, NZ, PH, PL, SE, SG, TH, VN
195
+ * [Payscout](http://www.payscout.com/) - US
196
+ * [Paystation](http://paystation.co.nz) - NZ
197
+ * [Pay Way](http://www.payway.com.au) - AU
198
+ * [PayU India](https://www.payu.in/) - IN
199
+ * [Pin Payments](http://www.pinpayments.com/) - AU
200
+ * [Plug'n Pay](http://www.plugnpay.com/) - US
201
+ * [Psigate](http://www.psigate.com/) - CA
202
+ * [PSL Payment Solutions](http://www.paymentsolutionsltd.com/) - GB
203
+ * [QuickBooks Merchant Services](http://payments.intuit.com/) - US
204
+ * [QuickBooks Payments](http://payments.intuit.com/) - US
205
+ * [Quantum Gateway](http://www.quantumgateway.com) - US
206
+ * [QuickPay](http://quickpay.net/) - AT, BE, BG, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE SI, SK
207
+ * [Qvalent](https://www.qvalent.com/) - AU
208
+ * [Raven](http://www.deepcovelabs.com/raven) - AI, AN, AT, AU, BE, BG, BS, BZ, CA, CH, CR, CY, CZ, DE, DK, DM, DO, EE, EL, ES, FI, FR, GB, GG, GI, HK, HR, HU, IE, IL, IM, IN, IT, JE, KN, LI, LT, LU, LV, MH, MT, MY, NL, NO, NZ, PA, PE, PH, PL, PT, RO, RS, SC, SE, SG, SI, SK, UK, US, VG, ZA
209
+ * [Realex](http://www.realexpayments.com/) - IE, GB, FR, BE, NL, LU, IT
210
+ * [Redsys](http://www.redsys.es/) - ES
211
+ * [S5](http://www.s5.dk/) - DK
212
+ * [SagePay](http://www.sagepay.com) - GB, IE
213
+ * [Sage Payment Solutions](http://www.sagepayments.com) - US, CA
214
+ * [Sallie Mae](http://www.salliemae.com/) - US
215
+ * [SecureNet](http://www.securenet.com/) - US
216
+ * [SecurePay](http://www.securepay.com/) - US, CA, GB, AU
217
+ * [SecurePayTech](http://www.securepaytech.com/) - NZ
218
+ * [SecurionPay](https://securionpay.com/) - AD, AE, AF, AG, AI, AL, AM, AO, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, ST, SV, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, ZA, ZM, ZW
219
+ * [SkipJack](http://www.skipjack.com/) - US, CA
220
+ * [SoEasyPay](http://www.soeasypay.com/) - US, CA, AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE, GB, IS, NO, CH
221
+ * [Spreedly](https://spreedly.com) - AD, AE, AT, AU, BD, BE, BG, BN, CA, CH, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GI, GR, HK, HU, ID, IE, IL, IM, IN, IS, IT, JO, KW, LB, LI, LK, LT, LU, LV, MC, MT, MU, MV, MX, MY, NL, NO, NZ, OM, PH, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, TT, UM, US, VA, VN, ZA
222
+ * [Stripe](https://stripe.com/) - AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IT, LU, NL, NO, SE, SG, US
223
+ * [Swipe](https://www.swipehq.com/checkout) - CA, NZ
224
+ * [TNS](http://www.tnsi.com/) - AR, AU, BR, FR, DE, HK, MX, NZ, SG, GB, US
225
+ * [Transact Pro](https://www.transactpro.lv/business/online-payments-acceptance) - US
226
+ * [TransFirst](http://www.transfirst.com/) - US
227
+ * [Transnational](http://www.tnbci.com/) - US
228
+ * [TrustCommerce](http://www.trustcommerce.com/) - US
229
+ * [USA ePay](http://www.usaepay.com/) - US
230
+ * [Vanco Payment Solutions](http://vancopayments.com/) - US
231
+ * [Verifi](http://www.verifi.com/) - US
232
+ * [ViaKLIX](http://viaklix.com) - US
233
+ * [WebPay](https://webpay.jp/) - JP
234
+ * [WePay](https://www.wepay.com/) - US
235
+ * [Wirecard](http://www.wirecard.com) - AD, CY, GI, IM, MT, RO, CH, AT, DK, GR, IT, MC, SM, TR, BE, EE, HU, LV, NL, SK, GB, BG, FI, IS, LI, NO, SI, VA, FR, IL, LT, PL, ES, CZ, DE, IE, LU, PT, SE
236
+ * [Worldpay Global](http://www.worldpay.com/) - HK, GB, AU, AD, BE, CH, CY, CZ, DE, DK, ES, FI, FR, GI, GR, HU, IE, IL, IT, LI, LU, MC, MT, NL, NO, NZ, PL, PT, SE, SG, SI, SM, TR, UM, VA
237
+ * [Worldpay Online](https://online.worldpay.com/) - HK, US, GB, AU, AD, BE, CH, CY, CZ, DE, DK, ES, FI, FR, GI, GR, HU, IE, IL, IT, LI, LU, MC, MT, NL, NO, NZ, PL, PT, SE, SG, SI, SM, TR, UM, VA
238
+ * [Worldpay US](http://www.worldpay.com/us) - US
239
+
240
+ ## API stability policy
241
+
242
+ Functionality or APIs that are deprecated will be marked as such. Deprecated functionality is removed on major version changes - for example, deprecations from 2.x are removed in 3.x.
243
+
244
+ ## Ruby and Rails compatibility policies
245
+
246
+ Because Active Merchant is a payment library, it needs to take security seriously. For this reason, Active Merchant guarantees compatibility only with actively supported versions of Ruby and Rails. At the time of this writing, that means that Ruby 2.3+ and Rails 4.2+ are supported.
@@ -0,0 +1,63 @@
1
+ #--
2
+ # Copyright (c) 2005-2010 Tobias Luetke
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ require 'active_support'
25
+ require 'active_support/core_ext/string/inflections'
26
+ require 'active_support/core_ext/hash/indifferent_access'
27
+ require 'active_support/core_ext/hash/conversions'
28
+ require 'active_support/core_ext/object/conversions'
29
+ require 'active_support/core_ext/class/attribute'
30
+ require 'active_support/core_ext/enumerable'
31
+ require 'active_support/core_ext/module/attribute_accessors'
32
+
33
+ require 'base64'
34
+ require 'securerandom'
35
+ require 'builder'
36
+ require 'cgi'
37
+ require 'rexml/document'
38
+ require 'timeout'
39
+ require 'socket'
40
+ require 'openssl'
41
+
42
+ require 'active_merchant/network_connection_retries'
43
+ require 'active_merchant/net_http_ssl_connection'
44
+ require 'active_merchant/connection'
45
+ require 'active_merchant/post_data'
46
+ require 'active_merchant/posts_data'
47
+
48
+ require 'active_merchant/billing'
49
+ require 'active_merchant/version'
50
+ require 'active_merchant/country'
51
+
52
+ module ActiveMerchant
53
+ def self.deprecated(message, caller=Kernel.caller[1])
54
+ warning = caller + ': ' + message
55
+ if(respond_to?(:logger) && logger.present?)
56
+ logger.warn(warning)
57
+ else
58
+ warn(warning)
59
+ end
60
+ end
61
+ end
62
+
63
+ I18n.enforce_available_locales = false
@@ -0,0 +1,15 @@
1
+ require 'active_merchant/errors'
2
+
3
+ require 'active_merchant/billing/avs_result'
4
+ require 'active_merchant/billing/cvv_result'
5
+ require 'active_merchant/billing/credit_card_methods'
6
+ require 'active_merchant/billing/credit_card_formatting'
7
+ require 'active_merchant/billing/credit_card'
8
+ require 'active_merchant/billing/network_tokenization_credit_card'
9
+ require 'active_merchant/billing/base'
10
+ require 'active_merchant/billing/check'
11
+ require 'active_merchant/billing/payment_token'
12
+ require 'active_merchant/billing/apple_pay_payment_token'
13
+ require 'active_merchant/billing/response'
14
+ require 'active_merchant/billing/gateways'
15
+ require 'active_merchant/billing/gateway'
@@ -0,0 +1,22 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class ApplePayPaymentToken < PaymentToken
4
+ # This is a representation of the token object specified here:
5
+ # https://developer.apple.com/library/ios/documentation/PassKit/Reference/PKPaymentToken_Ref/
6
+ # https://developer.apple.com/library/IOs//documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html
7
+
8
+ attr_reader :payment_instrument_name, :payment_network
9
+ attr_accessor :transaction_identifier
10
+
11
+ def initialize(payment_data, options = {})
12
+ super
13
+ @payment_instrument_name = @metadata[:payment_instrument_name]
14
+ @payment_network = @metadata[:payment_network]
15
+ end
16
+
17
+ def type
18
+ 'apple_pay'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,96 @@
1
+ # encoding: utf-8
2
+
3
+ module ActiveMerchant
4
+ module Billing
5
+ # Implements the Address Verification System
6
+ # https://www.cybersource.com/developers/other_resources/quick_references/avs_results/.
7
+ # http://en.wikipedia.org/wiki/Address_Verification_System
8
+ # http://www.emsecommerce.net/avs_cvv2_response_codes.htm
9
+ # https://www.cardfellow.com/blog/address-verification-service-avs/
10
+ class AVSResult
11
+ MESSAGES = {
12
+ 'A' => 'Street address matches, but postal code does not match.',
13
+ 'B' => 'Street address matches, but postal code not verified.',
14
+ 'C' => 'Street address and postal code do not match.',
15
+ 'D' => 'Street address and postal code match.',
16
+ 'E' => 'AVS data is invalid or AVS is not allowed for this card type.',
17
+ 'F' => 'Card member\'s name does not match, but billing postal code matches.',
18
+ 'G' => 'Non-U.S. issuing bank does not support AVS.',
19
+ 'H' => 'Card member\'s name does not match. Street address and postal code match.',
20
+ 'I' => 'Address not verified.',
21
+ 'J' => 'Card member\'s name, billing address, and postal code match. Shipping information verified and chargeback protection guaranteed through the Fraud Protection Program.',
22
+ 'K' => 'Card member\'s name matches but billing address and billing postal code do not match.',
23
+ 'L' => 'Card member\'s name and billing postal code match, but billing address does not match.',
24
+ 'M' => 'Street address and postal code match.',
25
+ 'N' => 'Street address and postal code do not match. For American Express: Card member\'s name, street address and postal code do not match.',
26
+ 'O' => 'Card member\'s name and billing address match, but billing postal code does not match.',
27
+ 'P' => 'Postal code matches, but street address not verified.',
28
+ 'Q' => 'Card member\'s name, billing address, and postal code match. Shipping information verified but chargeback protection not guaranteed.',
29
+ 'R' => 'System unavailable.',
30
+ 'S' => 'U.S.-issuing bank does not support AVS.',
31
+ 'T' => 'Card member\'s name does not match, but street address matches.',
32
+ 'U' => 'Address information unavailable.',
33
+ 'V' => 'Card member\'s name, billing address, and billing postal code match.',
34
+ 'W' => 'Street address does not match, but 9-digit postal code matches.',
35
+ 'X' => 'Street address and 9-digit postal code match.',
36
+ 'Y' => 'Street address and 5-digit postal code match.',
37
+ 'Z' => 'Street address does not match, but 5-digit postal code matches.'
38
+ }
39
+
40
+ # Map vendor's AVS result code to a postal match code
41
+ POSTAL_MATCH_CODE = {
42
+ 'Y' => %w( D H F H J L M P Q V W X Y Z ),
43
+ 'N' => %w( A C K N O ),
44
+ 'X' => %w( G S ),
45
+ nil => %w( B E I R T U )
46
+ }.inject({}) do |map, (type, codes)|
47
+ codes.each { |code| map[code] = type }
48
+ map
49
+ end
50
+
51
+ # Map vendor's AVS result code to a street match code
52
+ STREET_MATCH_CODE = {
53
+ 'Y' => %w( A B D H J M O Q T V X Y ),
54
+ 'N' => %w( C K L N W Z ),
55
+ 'X' => %w( G S ),
56
+ nil => %w( E F I P R U )
57
+ }.inject({}) do |map, (type, codes)|
58
+ codes.each { |code| map[code] = type }
59
+ map
60
+ end
61
+
62
+ attr_reader :code, :message, :street_match, :postal_match
63
+
64
+ def self.messages
65
+ MESSAGES
66
+ end
67
+
68
+ def initialize(attrs)
69
+ attrs ||= {}
70
+
71
+ @code = attrs[:code].upcase unless attrs[:code].blank?
72
+ @message = self.class.messages[code]
73
+
74
+ if attrs[:street_match].blank?
75
+ @street_match = STREET_MATCH_CODE[code]
76
+ else
77
+ @street_match = attrs[:street_match].upcase
78
+ end
79
+
80
+ if attrs[:postal_match].blank?
81
+ @postal_match = POSTAL_MATCH_CODE[code]
82
+ else
83
+ @postal_match = attrs[:postal_match].upcase
84
+ end
85
+ end
86
+
87
+ def to_hash
88
+ { 'code' => code,
89
+ 'message' => message,
90
+ 'street_match' => street_match,
91
+ 'postal_match' => postal_match
92
+ }
93
+ end
94
+ end
95
+ end
96
+ end