start_activemerchant 1.50.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1769 -0
- data/CONTRIBUTORS +540 -0
- data/MIT-LICENSE +20 -0
- data/README.md +226 -0
- data/lib/active_merchant.rb +67 -0
- data/lib/active_merchant/billing.rb +15 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +98 -0
- data/lib/active_merchant/billing/base.rb +72 -0
- data/lib/active_merchant/billing/check.rb +76 -0
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +404 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +195 -0
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/gateway.rb +291 -0
- data/lib/active_merchant/billing/gateways.rb +14 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +203 -0
- data/lib/active_merchant/billing/gateways/app55.rb +176 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +510 -0
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +976 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +256 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +105 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +314 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +192 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +389 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +58 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +506 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +140 -0
- data/lib/active_merchant/billing/gateways/borgun.rb +211 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +574 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +20 -0
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +189 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +238 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +202 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +201 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +229 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +262 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +278 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +216 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +200 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +210 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +720 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +600 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +206 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +348 -0
- data/lib/active_merchant/billing/gateways/epay.rb +274 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
- data/lib/active_merchant/billing/gateways/eway.rb +214 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +291 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +522 -0
- data/lib/active_merchant/billing/gateways/exact.rb +227 -0
- data/lib/active_merchant/billing/gateways/ezic.rb +206 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +213 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +160 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +23 -0
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +160 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +413 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +261 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +179 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/hps.rb +287 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +277 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +246 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +13 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +29 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +66 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +219 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +163 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +457 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +438 -0
- data/lib/active_merchant/billing/gateways/litle.rb +345 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +197 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +170 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +114 -0
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +319 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +268 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +195 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +326 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +303 -0
- data/lib/active_merchant/billing/gateways/migs.rb +280 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +219 -0
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +309 -0
- data/lib/active_merchant/billing/gateways/moneris_us.rb +298 -0
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +290 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +198 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +181 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +224 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +256 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +435 -0
- data/lib/active_merchant/billing/gateways/omise.rb +319 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +194 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +314 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +834 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +47 -0
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +277 -0
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +112 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +188 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +308 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +220 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +224 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +282 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +129 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +679 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +65 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +264 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +199 -0
- data/lib/active_merchant/billing/gateways/payu_in.rb +247 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/pin.rb +207 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +216 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +303 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +292 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
- data/lib/active_merchant/billing/gateways/quickbooks.rb +280 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +26 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +240 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +179 -0
- data/lib/active_merchant/billing/gateways/realex.rb +298 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +406 -0
- data/lib/active_merchant/billing/gateways/s5.rb +226 -0
- data/lib/active_merchant/billing/gateways/sage.rb +173 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +89 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +115 -0
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +149 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +97 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +399 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +143 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +263 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +201 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +281 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +105 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +451 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +283 -0
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +247 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +489 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +157 -0
- data/lib/active_merchant/billing/gateways/tns.rb +227 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +126 -0
- data/lib/active_merchant/billing/gateways/transax.rb +23 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +10 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +416 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1516 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +259 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +280 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +225 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +183 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +205 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +420 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +331 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +204 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +181 -0
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +24 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +92 -0
- data/lib/active_merchant/connection.rb +172 -0
- data/lib/active_merchant/country.rb +332 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/network_connection_retries.rb +79 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +84 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/certs/cacert.pem +3866 -0
- data/lib/support/gateway_support.rb +71 -0
- data/lib/support/outbound_hosts.rb +28 -0
- data/lib/support/ssl_verify.rb +93 -0
- metadata +387 -0
data/MIT-LICENSE
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -0,0 +1,226 @@
|
|
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
|
+
## Installation
|
21
|
+
|
22
|
+
### From Git
|
23
|
+
|
24
|
+
You can check out the latest source from git:
|
25
|
+
|
26
|
+
git clone git://github.com/activemerchant/active_merchant.git
|
27
|
+
|
28
|
+
### From RubyGems
|
29
|
+
|
30
|
+
Installation from RubyGems:
|
31
|
+
|
32
|
+
gem install activemerchant
|
33
|
+
|
34
|
+
Or, if you're using Bundler, just add the following to your Gemfile:
|
35
|
+
|
36
|
+
gem 'activemerchant'
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
This simple example demonstrates how a purchase can be made using a person's
|
41
|
+
credit card details.
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
require 'active_merchant'
|
45
|
+
|
46
|
+
# Use the TrustCommerce test servers
|
47
|
+
ActiveMerchant::Billing::Base.mode = :test
|
48
|
+
|
49
|
+
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
|
50
|
+
:login => 'TestMerchant',
|
51
|
+
:password => 'password')
|
52
|
+
|
53
|
+
# ActiveMerchant accepts all amounts as Integer values in cents
|
54
|
+
amount = 1000 # $10.00
|
55
|
+
|
56
|
+
# The card verification value is also known as CVV2, CVC2, or CID
|
57
|
+
credit_card = ActiveMerchant::Billing::CreditCard.new(
|
58
|
+
:first_name => 'Bob',
|
59
|
+
:last_name => 'Bobsen',
|
60
|
+
:number => '4242424242424242',
|
61
|
+
:month => '8',
|
62
|
+
:year => Time.now.year+1,
|
63
|
+
:verification_value => '000')
|
64
|
+
|
65
|
+
# Validating the card automatically detects the card type
|
66
|
+
if credit_card.validate.empty?
|
67
|
+
# Capture $10 from the credit card
|
68
|
+
response = gateway.purchase(amount, credit_card)
|
69
|
+
|
70
|
+
if response.success?
|
71
|
+
puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}"
|
72
|
+
else
|
73
|
+
raise StandardError, response.message
|
74
|
+
end
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
For more in-depth documentation and tutorials, see [GettingStarted.md](GettingStarted.md) and the
|
79
|
+
[API documentation](http://www.rubydoc.info/github/activemerchant/active_merchant/).
|
80
|
+
|
81
|
+
## Supported Payment Gateways
|
82
|
+
|
83
|
+
The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis) contains a [table of features supported by each gateway](http://github.com/activemerchant/active_merchant/wikis/gatewayfeaturematrix).
|
84
|
+
|
85
|
+
* [App55](https://www.app55.com/) - AU, BR, CA, CH, CL, CN, CO, CZ, DK, EU, GB, HK, HU, ID, IS, JP, KE, KR, MX, MY, NO, NZ, PH, PL, TH, TW, US, VN, ZA
|
86
|
+
* [Authorize.Net CIM](http://www.authorize.net/) - US
|
87
|
+
* [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
|
88
|
+
* [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
|
89
|
+
* [Balanced](https://www.balancedpayments.com/) - US
|
90
|
+
* [Bank Frick](http://www.bankfrickacquiring.com/) - LI, US
|
91
|
+
* [Banwire](http://www.banwire.com/) - MX
|
92
|
+
* [Barclays ePDQ Extra Plus](http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/) - GB
|
93
|
+
* [Barclays ePDQ MPI](http://www.barclaycard.co.uk/business/accepting-payments/epdq-mpi/) - GB
|
94
|
+
* [Be2Bill](http://www.be2bill.com/) - FR
|
95
|
+
* [Beanstream.com](http://www.beanstream.com/) - CA, US
|
96
|
+
* [BluePay](http://www.bluepay.com/) - US
|
97
|
+
* [Borgun](https://www.borgun.is/) - IS
|
98
|
+
* [Braintree](http://www.braintreepaymentsolutions.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
|
99
|
+
* [BridgePay](http://www.bridgepaynetwork.com/) - CA, US
|
100
|
+
* [CardSave](http://www.cardsave.net/) - GB
|
101
|
+
* [CardStream](http://www.cardstream.com/) - GB
|
102
|
+
* [Cashnet](http://www.higherone.com/) - US
|
103
|
+
* [Cecabank](http://www.ceca.es/es/) - ES
|
104
|
+
* [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
|
105
|
+
* [CertoDirect](http://www.certodirect.com/) - BE, BG, CZ, DK, DE, EE, IE, EL, ES, FR, IT, CY, LV, LT, LU, HU, MT, NL, AT, PL, PT, RO, SI, SK, FI, SE, GB
|
106
|
+
* [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
|
107
|
+
* [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
|
108
|
+
* [Conekta](https://conekta.io) - MX
|
109
|
+
* [CyberSource](http://www.cybersource.com) - US, BR, CA, CN, DK, FI, FR, DE, JP, MX, NO, SE, GB, SG
|
110
|
+
* [DIBS](http://www.dibspayment.com/) - US, FI, NO, SE, GB
|
111
|
+
* [DataCash](http://www.datacash.com/) - GB
|
112
|
+
* [Efsnet](http://www.concordefsnet.com/) - US
|
113
|
+
* [Elavon MyVirtualMerchant](http://www.elavon.com/) - US, CA
|
114
|
+
* [ePay](http://epay.dk/) - DK, SE, NO
|
115
|
+
* [EVO Canada](http://www.evocanada.com/) - CA
|
116
|
+
* [eWAY](http://www.eway.com.au/) - AU, NZ, GB
|
117
|
+
* [eWAY Rapid](http://www.eway.com.au/) - AU, NZ, GB, SG
|
118
|
+
* [E-xact](http://www.e-xact.com) - CA, US
|
119
|
+
* [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
|
120
|
+
* [Fat Zebra](https://www.fatzebra.com.au/) - AU
|
121
|
+
* [Federated Canada](http://www.federatedcanada.com/) - CA
|
122
|
+
* [Finansbank WebPOS](https://www.fbwebpos.com/) - US, TR
|
123
|
+
* [Flo2Cash](http://www.flo2cash.co.nz/) - NZ
|
124
|
+
* [1stPayGateway.Net](http://1stpaygateway.net/) - US
|
125
|
+
* [FirstData Global Gateway e4](http://www.firstdata.com) - CA, US
|
126
|
+
* [FirstGiving](http://www.firstgiving.com/) - US
|
127
|
+
* [Garanti Sanal POS](https://sanalposweb.garanti.com.tr) - US, TR
|
128
|
+
* [Global Transport](https://www.globalpaymentsinc.com) - CA, PR, US
|
129
|
+
* [HDFC](http://www.hdfcbank.com/sme/sme-details/merchant-services/guzh6m0i) - IN
|
130
|
+
* [Heartland Payment Systems](http://developer.heartlandpaymentsystems.com/SecureSubmit/) - US
|
131
|
+
* [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
|
132
|
+
* [Inspire Commerce](http://www.inspiregateway.com) - US
|
133
|
+
* [InstaPay](http://www.instapayllc.com) - US
|
134
|
+
* [IPP](http://www.ippayments.com.au/) - AU
|
135
|
+
* [Iridium](http://www.iridiumcorp.co.uk/) - GB, ES
|
136
|
+
* [iTransact](http://www.itransact.com/) - US
|
137
|
+
* [JetPay](http://www.jetpay.com/) - US
|
138
|
+
* [LinkPoint](http://www.linkpoint.com/) - US
|
139
|
+
* [Litle & Co.](http://www.litle.com/) - US
|
140
|
+
* [maxiPago!](http://www.maxipago.com/) - BR
|
141
|
+
* [Merchant e-Solutions](http://www.merchante-solutions.com/) - US
|
142
|
+
* [Merchant One Gateway](http://merchantone.com/) - US
|
143
|
+
* [MerchantWARE](http://merchantwarehouse.com/merchantware) - US
|
144
|
+
* [MerchantWarrior](http://www.merchantwarrior.com/) - AU
|
145
|
+
* [Mercury](http://www.mercurypay.com) - US, CA
|
146
|
+
* [Metrics Global](http://www.metricsglobal.com) - US
|
147
|
+
* [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
|
148
|
+
* [Modern Payments](http://www.modpay.com) - US
|
149
|
+
* [Moneris](http://www.moneris.com/) - CA
|
150
|
+
* [Moneris (US)](http://www.monerisusa.com/) - US
|
151
|
+
* [MoneyMovers](http://mmoa.us/) - US
|
152
|
+
* [NAB Transact](http://transact.nab.com.au) - AU
|
153
|
+
* [NetRegistry](http://www.netregistry.com.au) - AU
|
154
|
+
* [BBS Netaxept](http://www.betalingsterminal.no/Netthandel-forside/) - NO, DK, SE, FI
|
155
|
+
* [NETbilling](http://www.netbilling.com) - US
|
156
|
+
* [NETPAY Gateway](http://www.netpay.com.mx) - MX
|
157
|
+
* [NMI](http://nmi.com/) - US
|
158
|
+
* [Ogone](http://www.ogone.com/) - BE, DE, FR, NL, AT, CH
|
159
|
+
* [Omise](https://www.omise.co/) - TH
|
160
|
+
* [Openpay](Openpay) - MX
|
161
|
+
* [Optimal Payments](http://www.optimalpayments.com/) - CA, US, GB
|
162
|
+
* [Orbital Paymentech](http://chasepaymentech.com/) - US, CA
|
163
|
+
* [PagoFacil](http://www.pagofacil.net/) - MX
|
164
|
+
* [PayConex](http://www.bluefincommerce.com/) - US, CA
|
165
|
+
* [PayGate PayXML](http://paygate.co.za/) - US, ZA
|
166
|
+
* [PayHub](http://www.payhub.com/) - US
|
167
|
+
* [PayJunction](http://www.payjunction.com/) - US
|
168
|
+
* [PaySecure](http://www.commsecure.com.au/paysecure.shtml) - AU
|
169
|
+
* [Paybox Direct](http://www.paybox.com/) - FR
|
170
|
+
* [Payex](http://payex.com/) - DK, FI, NO, SE
|
171
|
+
* [PaymentExpress](http://www.paymentexpress.com/) - AU, CA, DE, ES, FR, GB, HK, IE, MY, NL, NZ, SG, US, ZA
|
172
|
+
* [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
|
173
|
+
* [PayPal Express Checkout](https://www.paypal.com/webapps/mpp/express-checkout) - US, CA, SG, AU
|
174
|
+
* [PayPal Express Checkout (UK)](https://www.paypal.com/uk/webapps/mpp/express-checkout) - GB
|
175
|
+
* [PayPal Payflow Pro](https://www.paypal.com/webapps/mpp/payflow-payment-gateway) - US, CA, SG, AU
|
176
|
+
* [PayPal Payments Pro (US)](https://www.paypal.com/us/webapps/mpp/paypal-payments-pro) - US
|
177
|
+
* [PayPal Payments Pro (UK)](https://www.paypal.com/uk/webapps/mpp/pro) - GB
|
178
|
+
* [PayPal Website Payments Pro (CA)](https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside) - CA
|
179
|
+
* [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
|
180
|
+
* [Payscout](http://www.payscout.com/) - US
|
181
|
+
* [Paystation](http://paystation.co.nz) - NZ
|
182
|
+
* [Pay Way](http://www.payway.com.au) - AU
|
183
|
+
* [PayU India](https://www.payu.in/) - IN
|
184
|
+
* [Pin Payments](http://www.pin.net.au/) - AU
|
185
|
+
* [Plug'n Pay](http://www.plugnpay.com/) - US
|
186
|
+
* [Psigate](http://www.psigate.com/) - CA
|
187
|
+
* [PSL Payment Solutions](http://www.paymentsolutionsltd.com/) - GB
|
188
|
+
* [QuickBooks Merchant Services](http://payments.intuit.com/) - US
|
189
|
+
* [QuickBooks Payments](http://payments.intuit.com/) - US
|
190
|
+
* [Quantum Gateway](http://www.quantumgateway.com) - US
|
191
|
+
* [QuickPay](http://quickpay.net/) - DE, DK, ES, FI, FR, FO, GB, IS, NO, SE
|
192
|
+
* [Qvalent](https://www.qvalent.com/) - AU
|
193
|
+
* [Raven PacNet](http://www.pacnetservices.com/) - US
|
194
|
+
* [Realex](http://www.realexpayments.com/) - IE, GB, FR, BE, NL, LU, IT
|
195
|
+
* [Redsys](http://www.redsys.es/) - ES
|
196
|
+
* [S5](http://www.s5.dk/) - DK
|
197
|
+
* [SagePay](http://www.sagepay.com) - GB, IE
|
198
|
+
* [Sage Payment Solutions](http://www.sagepayments.com) - US, CA
|
199
|
+
* [Sallie Mae](http://www.salliemae.com/) - US
|
200
|
+
* [SecureNet](http://www.securenet.com/) - US
|
201
|
+
* [SecurePay](http://www.securepay.com/) - US, CA, GB, AU
|
202
|
+
* [SecurePayTech](http://www.securepaytech.com/) - NZ
|
203
|
+
* [SkipJack](http://www.skipjack.com/) - US, CA
|
204
|
+
* [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
|
205
|
+
* [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
|
206
|
+
* [Stripe](https://stripe.com/) - AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IT, LU, NL, NO, SE, US
|
207
|
+
* [Swipe](https://www.swipehq.com/checkout) - CA, NZ
|
208
|
+
* [TransFirst](http://www.transfirst.com/) - US
|
209
|
+
* [TNS](http://www.tnsi.com/) - AR, AU, BR, FR, DE, HK, MX, NZ, SG, GB, US
|
210
|
+
* [NELiX TransaX](https://www.nelixtransax.com/) - US
|
211
|
+
* [Transnational](http://www.tnbci.com/) - US
|
212
|
+
* [TrustCommerce](http://www.trustcommerce.com/) - US
|
213
|
+
* [USA ePay](http://www.usaepay.com/) - US
|
214
|
+
* [Vanco Payment Solutions](http://vancopayments.com/) - US
|
215
|
+
* [Verifi](http://www.verifi.com/) - US
|
216
|
+
* [ViaKLIX](http://viaklix.com) - US
|
217
|
+
* [WebPay](https://webpay.jp/) - JP
|
218
|
+
* [WePay](https://www.wepay.com/) - US
|
219
|
+
* [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
|
220
|
+
* [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
|
221
|
+
* [Worlpay Online](http://www.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
|
222
|
+
* [Worldpay US](http://www.worldpay.com/us) - US
|
223
|
+
|
224
|
+
## API stability policy
|
225
|
+
|
226
|
+
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.
|
@@ -0,0 +1,67 @@
|
|
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
|
+
|
32
|
+
if(!defined?(ActiveSupport::VERSION) || (ActiveSupport::VERSION::STRING < "4.1"))
|
33
|
+
require 'active_support/core_ext/class/attribute_accessors'
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'active_support/core_ext/class/delegating_attributes'
|
37
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
38
|
+
|
39
|
+
require 'base64'
|
40
|
+
require 'securerandom'
|
41
|
+
require 'builder'
|
42
|
+
require 'cgi'
|
43
|
+
require 'rexml/document'
|
44
|
+
require 'timeout'
|
45
|
+
require 'socket'
|
46
|
+
|
47
|
+
require 'active_merchant/network_connection_retries'
|
48
|
+
require 'active_merchant/connection'
|
49
|
+
require 'active_merchant/post_data'
|
50
|
+
require 'active_merchant/posts_data'
|
51
|
+
|
52
|
+
require 'active_merchant/billing'
|
53
|
+
require 'active_merchant/version'
|
54
|
+
require 'active_merchant/country'
|
55
|
+
|
56
|
+
module ActiveMerchant
|
57
|
+
def self.deprecated(message, caller=Kernel.caller[1])
|
58
|
+
warning = caller + ": " + message
|
59
|
+
if(respond_to?(:logger) && logger.present?)
|
60
|
+
logger.warn(warning)
|
61
|
+
else
|
62
|
+
warn(warning)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
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,98 @@
|
|
1
|
+
#!ruby19
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
module ActiveMerchant
|
5
|
+
module Billing
|
6
|
+
# Implements the Address Verification System
|
7
|
+
# https://www.wellsfargo.com/downloads/pdf/biz/merchant/visa_avs.pdf
|
8
|
+
# http://en.wikipedia.org/wiki/Address_Verification_System
|
9
|
+
# http://apps.cybersource.com/library/documentation/dev_guides/CC_Svcs_IG/html/app_avs_cvn_codes.htm#app_AVS_CVN_codes_7891_48375
|
10
|
+
# http://imgserver.skipjack.com/imgServer/5293710/AVS%20and%20CVV2.pdf
|
11
|
+
# http://www.emsecommerce.net/avs_cvv2_response_codes.htm
|
12
|
+
class AVSResult
|
13
|
+
MESSAGES = {
|
14
|
+
'A' => 'Street address matches, but 5-digit and 9-digit postal code do not match.',
|
15
|
+
'B' => 'Street address matches, but postal code not verified.',
|
16
|
+
'C' => 'Street address and postal code do not match.',
|
17
|
+
'D' => 'Street address and postal code match.',
|
18
|
+
'E' => 'AVS data is invalid or AVS is not allowed for this card type.',
|
19
|
+
'F' => 'Card member\'s name does not match, but billing postal code matches.',
|
20
|
+
'G' => 'Non-U.S. issuing bank does not support AVS.',
|
21
|
+
'H' => 'Card member\'s name does not match. Street address and postal code match.',
|
22
|
+
'I' => 'Address not verified.',
|
23
|
+
'J' => 'Card member\'s name, billing address, and postal code match. Shipping information verified and chargeback protection guaranteed through the Fraud Protection Program.',
|
24
|
+
'K' => 'Card member\'s name matches but billing address and billing postal code do not match.',
|
25
|
+
'L' => 'Card member\'s name and billing postal code match, but billing address does not match.',
|
26
|
+
'M' => 'Street address and postal code match.',
|
27
|
+
'N' => 'Street address and postal code do not match.',
|
28
|
+
'O' => 'Card member\'s name and billing address match, but billing postal code does not match.',
|
29
|
+
'P' => 'Postal code matches, but street address not verified.',
|
30
|
+
'Q' => 'Card member\'s name, billing address, and postal code match. Shipping information verified but chargeback protection not guaranteed.',
|
31
|
+
'R' => 'System unavailable.',
|
32
|
+
'S' => 'U.S.-issuing bank does not support AVS.',
|
33
|
+
'T' => 'Card member\'s name does not match, but street address matches.',
|
34
|
+
'U' => 'Address information unavailable.',
|
35
|
+
'V' => 'Card member\'s name, billing address, and billing postal code match.',
|
36
|
+
'W' => 'Street address does not match, but 9-digit postal code matches.',
|
37
|
+
'X' => 'Street address and 9-digit postal code match.',
|
38
|
+
'Y' => 'Street address and 5-digit postal code match.',
|
39
|
+
'Z' => 'Street address does not match, but 5-digit postal code matches.'
|
40
|
+
}
|
41
|
+
|
42
|
+
# Map vendor's AVS result code to a postal match code
|
43
|
+
POSTAL_MATCH_CODE = {
|
44
|
+
'Y' => %w( D H F H J L M P Q V W X Y Z ),
|
45
|
+
'N' => %w( A C K N O ),
|
46
|
+
'X' => %w( G S ),
|
47
|
+
nil => %w( B E I R T U )
|
48
|
+
}.inject({}) do |map, (type, codes)|
|
49
|
+
codes.each { |code| map[code] = type }
|
50
|
+
map
|
51
|
+
end
|
52
|
+
|
53
|
+
# Map vendor's AVS result code to a street match code
|
54
|
+
STREET_MATCH_CODE = {
|
55
|
+
'Y' => %w( A B D H J M O Q T V X Y ),
|
56
|
+
'N' => %w( C K L N W Z ),
|
57
|
+
'X' => %w( G S ),
|
58
|
+
nil => %w( E F I P R U )
|
59
|
+
}.inject({}) do |map, (type, codes)|
|
60
|
+
codes.each { |code| map[code] = type }
|
61
|
+
map
|
62
|
+
end
|
63
|
+
|
64
|
+
attr_reader :code, :message, :street_match, :postal_match
|
65
|
+
|
66
|
+
def self.messages
|
67
|
+
MESSAGES
|
68
|
+
end
|
69
|
+
|
70
|
+
def initialize(attrs)
|
71
|
+
attrs ||= {}
|
72
|
+
|
73
|
+
@code = attrs[:code].upcase unless attrs[:code].blank?
|
74
|
+
@message = self.class.messages[code]
|
75
|
+
|
76
|
+
if attrs[:street_match].blank?
|
77
|
+
@street_match = STREET_MATCH_CODE[code]
|
78
|
+
else
|
79
|
+
@street_match = attrs[:street_match].upcase
|
80
|
+
end
|
81
|
+
|
82
|
+
if attrs[:postal_match].blank?
|
83
|
+
@postal_match = POSTAL_MATCH_CODE[code]
|
84
|
+
else
|
85
|
+
@postal_match = attrs[:postal_match].upcase
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def to_hash
|
90
|
+
{ 'code' => code,
|
91
|
+
'message' => message,
|
92
|
+
'street_match' => street_match,
|
93
|
+
'postal_match' => postal_match
|
94
|
+
}
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|