aktivemerchant 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1596 -0
- data/CONTRIBUTORS +511 -0
- data/MIT-LICENSE +20 -0
- data/README.md +18 -0
- data/lib/active_merchant.rb +108 -0
- data/lib/active_merchant/billing.rb +13 -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 +352 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +160 -0
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/gateway.rb +268 -0
- data/lib/active_merchant/billing/gateways.rb +17 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +209 -0
- data/lib/active_merchant/billing/gateways/alfabank.rb +117 -0
- data/lib/active_merchant/billing/gateways/app55.rb +176 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +419 -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/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 +188 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +393 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -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 +210 -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 +515 -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 +220 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +191 -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/certo_direct.rb +278 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +213 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +209 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +709 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +600 -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 +275 -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 +524 -0
- data/lib/active_merchant/billing/gateways/exact.rb +218 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +173 -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 +355 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +257 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +183 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/hps.rb +288 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +251 -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 +213 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +163 -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 +346 -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_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 +333 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +303 -0
- data/lib/active_merchant/billing/gateways/migs.rb +265 -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/moneris.rb +309 -0
- data/lib/active_merchant/billing/gateways/moneris_us.rb +291 -0
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +280 -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 +190 -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/openpay.rb +194 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +313 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +803 -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_gate_xml.rb +261 -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/pay_u_latam.rb +462 -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 +304 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +209 -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 +281 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +117 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +670 -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/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/pin.rb +197 -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/quickpay.rb +367 -0
- data/lib/active_merchant/billing/gateways/realex.rb +298 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +391 -0
- data/lib/active_merchant/billing/gateways/sage.rb +175 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +87 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +114 -0
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +149 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +102 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +398 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +143 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +252 -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 +452 -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 +411 -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 +254 -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/vindicia.rb +385 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +189 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +421 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +331 -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/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +91 -0
- data/lib/active_merchant/country.rb +332 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +29 -0
- data/lib/active_merchant/offsite_payments_shim.rb +19 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/support/gateway_support.rb +71 -0
- data/lib/support/outbound_hosts.rb +25 -0
- data/lib/support/ssl_verify.rb +93 -0
- metadata +400 -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,18 @@
|
|
1
|
+
# Active Merchant
|
2
|
+
|
3
|
+
Kill Bill fork of https://github.com/Shopify/active_merchant, with support for new gateways and integrations.
|
4
|
+
|
5
|
+
All changes are reported upstream - we'll be able to get rid of this repo once the open pull requests have been merged upstream.
|
6
|
+
|
7
|
+
## Pull requests
|
8
|
+
|
9
|
+
* :white_check_mark: [PayPal] https://github.com/Shopify/active_merchant/pull/628
|
10
|
+
* :white_check_mark: [Litle] https://github.com/Shopify/active_merchant/pull/740
|
11
|
+
* :white_check_mark: [Stripe] https://github.com/Shopify/active_merchant/pull/895
|
12
|
+
* :x: [Альфа-Банк] https://github.com/Shopify/active_merchant/pull/1163 / https://github.com/Shopify/offsite_payments/issues/35
|
13
|
+
* :x: https://github.com/Shopify/active_merchant/pull/1187
|
14
|
+
* :x: https://github.com/Shopify/active_merchant/pull/1188
|
15
|
+
* :x: [QIWI] https://github.com/Shopify/active_merchant/pull/1164 / https://github.com/Shopify/offsite_payments/issues/33
|
16
|
+
* :x: [Яндекс] https://github.com/Shopify/active_merchant/pull/1165 / https://github.com/Shopify/offsite_payments/issues/34
|
17
|
+
* :x: [CyberSource] https://github.com/Shopify/active_merchant/pull/1413
|
18
|
+
* :x: [PayU Latam] https://github.com/Shopify/active_merchant/pull/1475
|
@@ -0,0 +1,108 @@
|
|
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.rb'
|
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
|
+
begin
|
40
|
+
require 'active_support/base64'
|
41
|
+
|
42
|
+
unless defined?(Base64)
|
43
|
+
Base64 = ActiveSupport::Base64
|
44
|
+
end
|
45
|
+
|
46
|
+
unless Base64.respond_to?(:strict_encode64)
|
47
|
+
def Base64.strict_encode64(v)
|
48
|
+
ActiveSupport::Base64.encode64s(v)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
rescue LoadError
|
52
|
+
require 'base64'
|
53
|
+
end
|
54
|
+
|
55
|
+
require 'securerandom'
|
56
|
+
require 'builder'
|
57
|
+
require 'cgi'
|
58
|
+
require 'rexml/document'
|
59
|
+
require 'timeout'
|
60
|
+
require 'socket'
|
61
|
+
|
62
|
+
require 'active_utils/common/network_connection_retries'
|
63
|
+
silence_warnings{require 'active_utils/common/connection'}
|
64
|
+
require 'active_utils/common/post_data'
|
65
|
+
require 'active_utils/common/posts_data'
|
66
|
+
|
67
|
+
require 'active_merchant/billing'
|
68
|
+
require 'active_merchant/version'
|
69
|
+
require 'active_merchant/country'
|
70
|
+
|
71
|
+
I18n.enforce_available_locales = false
|
72
|
+
|
73
|
+
module ActiveMerchant #:nodoc:
|
74
|
+
OFFSITE_PAYMENT_EXTRACTION_MESSAGE = "Integrations have been extracted into a separate gem (https://github.com/Shopify/offsite_payments) and will no longer be loaded by ActiveMerchant 2.x."
|
75
|
+
|
76
|
+
module Billing #:nodoc:
|
77
|
+
def self.const_missing(name)
|
78
|
+
if name.to_s == "Integrations"
|
79
|
+
ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
|
80
|
+
require "active_merchant/offsite_payments_shim"
|
81
|
+
ActiveMerchant::OffsitePaymentsShim
|
82
|
+
else
|
83
|
+
super
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.included(klass)
|
88
|
+
def klass.const_missing(name)
|
89
|
+
if name.to_s == "Integrations"
|
90
|
+
ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
|
91
|
+
require "active_merchant/offsite_payments_shim"
|
92
|
+
ActiveMerchant::OffsitePaymentsShim
|
93
|
+
else
|
94
|
+
super
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.deprecated(message, caller=Kernel.caller[1])
|
101
|
+
warning = caller + ": " + message
|
102
|
+
if(respond_to?(:logger) && logger.present?)
|
103
|
+
logger.warn(warning)
|
104
|
+
else
|
105
|
+
warn(warning)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,13 @@
|
|
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/base'
|
9
|
+
require 'active_merchant/billing/check'
|
10
|
+
require 'active_merchant/billing/payment_token'
|
11
|
+
require 'active_merchant/billing/apple_pay_payment_token'
|
12
|
+
require 'active_merchant/billing/response'
|
13
|
+
require 'active_merchant/billing/gateways'
|
@@ -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
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Base
|
4
|
+
# Set ActiveMerchant gateways in test mode.
|
5
|
+
#
|
6
|
+
# ActiveMerchant::Billing::Base.gateway_mode = :test
|
7
|
+
mattr_accessor :gateway_mode
|
8
|
+
|
9
|
+
# Set ActiveMerchant integrations in test mode.
|
10
|
+
#
|
11
|
+
# ActiveMerchant::Billing::Base.integration_mode = :test
|
12
|
+
def self.integration_mode=(mode)
|
13
|
+
ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
|
14
|
+
@@integration_mode = mode
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.integration_mode
|
18
|
+
ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
|
19
|
+
@@integration_mode
|
20
|
+
end
|
21
|
+
|
22
|
+
# Set both the mode of both the gateways and integrations
|
23
|
+
# at once
|
24
|
+
mattr_reader :mode
|
25
|
+
|
26
|
+
def self.mode=(mode)
|
27
|
+
@@mode = mode
|
28
|
+
self.gateway_mode = mode
|
29
|
+
@@integration_mode = mode
|
30
|
+
end
|
31
|
+
|
32
|
+
self.mode = :production
|
33
|
+
|
34
|
+
# Return the matching gateway for the provider
|
35
|
+
# * <tt>bogus</tt>: BogusGateway - Does nothing (for testing)
|
36
|
+
# * <tt>moneris</tt>: MonerisGateway
|
37
|
+
# * <tt>authorize_net</tt>: AuthorizeNetGateway
|
38
|
+
# * <tt>trust_commerce</tt>: TrustCommerceGateway
|
39
|
+
#
|
40
|
+
# ActiveMerchant::Billing::Base.gateway('moneris').new
|
41
|
+
def self.gateway(name)
|
42
|
+
name_str = name.to_s.strip.downcase
|
43
|
+
|
44
|
+
raise(ArgumentError, 'A gateway provider must be specified') if name_str.blank?
|
45
|
+
|
46
|
+
begin
|
47
|
+
Billing.const_get("#{name_str}_gateway".camelize)
|
48
|
+
rescue
|
49
|
+
raise ArgumentError, "The specified gateway is not valid (#{name_str})"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Return the matching integration module
|
54
|
+
# You can then get the notification from the module
|
55
|
+
# * <tt>bogus</tt>: Bogus - Does nothing (for testing)
|
56
|
+
# * <tt>chronopay</tt>: Chronopay
|
57
|
+
# * <tt>paypal</tt>: Paypal
|
58
|
+
#
|
59
|
+
# chronopay = ActiveMerchant::Billing::Base.integration('chronopay')
|
60
|
+
# notification = chronopay.notification(raw_post)
|
61
|
+
#
|
62
|
+
def self.integration(name)
|
63
|
+
Billing::Integrations.const_get("#{name.to_s.downcase}".camelize)
|
64
|
+
end
|
65
|
+
|
66
|
+
# A check to see if we're in test mode
|
67
|
+
def self.test?
|
68
|
+
self.gateway_mode == :test
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# The Check object is a plain old Ruby object, similar to CreditCard. It supports validation
|
4
|
+
# of necessary attributes such as checkholder's name, routing and account numbers, but it is
|
5
|
+
# not backed by any database.
|
6
|
+
#
|
7
|
+
# You may use Check in place of CreditCard with any gateway that supports it.
|
8
|
+
class Check < Model
|
9
|
+
attr_accessor :first_name, :last_name,
|
10
|
+
:bank_name, :routing_number, :account_number,
|
11
|
+
:account_holder_type, :account_type, :number
|
12
|
+
|
13
|
+
# Used for Canadian bank accounts
|
14
|
+
attr_accessor :institution_number, :transit_number
|
15
|
+
|
16
|
+
def name
|
17
|
+
@name ||= "#{first_name} #{last_name}".strip
|
18
|
+
end
|
19
|
+
|
20
|
+
def name=(value)
|
21
|
+
return if empty?(value)
|
22
|
+
|
23
|
+
@name = value
|
24
|
+
segments = value.split(' ')
|
25
|
+
@last_name = segments.pop
|
26
|
+
@first_name = segments.join(' ')
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate
|
30
|
+
errors = []
|
31
|
+
|
32
|
+
[:name, :routing_number, :account_number].each do |attr|
|
33
|
+
errors << [attr, "cannot be empty"] if empty?(self.send(attr))
|
34
|
+
end
|
35
|
+
|
36
|
+
errors << [:routing_number, "is invalid"] unless valid_routing_number?
|
37
|
+
|
38
|
+
if(!empty?(account_holder_type) && !%w[business personal].include?(account_holder_type.to_s))
|
39
|
+
errors << [:account_holder_type, "must be personal or business"]
|
40
|
+
end
|
41
|
+
|
42
|
+
if(!empty?(account_type) && !%w[checking savings].include?(account_type.to_s))
|
43
|
+
errors << [:account_type, "must be checking or savings"]
|
44
|
+
end
|
45
|
+
|
46
|
+
errors_hash(errors)
|
47
|
+
end
|
48
|
+
|
49
|
+
def type
|
50
|
+
'check'
|
51
|
+
end
|
52
|
+
|
53
|
+
# Routing numbers may be validated by calculating a checksum and dividing it by 10. The
|
54
|
+
# formula is:
|
55
|
+
# (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
|
56
|
+
# See http://en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
|
57
|
+
def valid_routing_number?
|
58
|
+
digits = routing_number.to_s.split('').map(&:to_i).select{|d| (0..9).include?(d)}
|
59
|
+
case digits.size
|
60
|
+
when 9
|
61
|
+
checksum = ((3 * (digits[0] + digits[3] + digits[6])) +
|
62
|
+
(7 * (digits[1] + digits[4] + digits[7])) +
|
63
|
+
(digits[2] + digits[5] + digits[8])) % 10
|
64
|
+
case checksum
|
65
|
+
when 0
|
66
|
+
true
|
67
|
+
else
|
68
|
+
false
|
69
|
+
end
|
70
|
+
else
|
71
|
+
false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
module Compatibility
|
4
|
+
module Model
|
5
|
+
def valid?
|
6
|
+
Compatibility.deprecated
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def errors
|
11
|
+
Compatibility.deprecated
|
12
|
+
internal_errors
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
@rails_required = false
|
17
|
+
def self.rails_required!
|
18
|
+
@rails_required = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.deprecated
|
22
|
+
ActiveMerchant.deprecated(
|
23
|
+
%(Implicit inclusion of Rails-specific functionality is deprecated.) +
|
24
|
+
%( Explicitly require "active_merchant/billing/rails" if you need it.)
|
25
|
+
) unless @rails_required
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.humanize(lower_case_and_underscored_word)
|
29
|
+
result = lower_case_and_underscored_word.to_s.dup
|
30
|
+
result.gsub!(/_id$/, "")
|
31
|
+
result.gsub!(/_/, ' ')
|
32
|
+
result.gsub(/([a-z\d]*)/i) { |match|
|
33
|
+
match.downcase
|
34
|
+
}.gsub(/^\w/) { $&.upcase }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# This lives in compatibility until we remove the deprecation for implicitly
|
41
|
+
# requiring Rails
|
42
|
+
module ActiveMerchant
|
43
|
+
module Billing
|
44
|
+
module Rails
|
45
|
+
module Model
|
46
|
+
def valid?
|
47
|
+
internal_errors.clear
|
48
|
+
|
49
|
+
validate.each do |attribute, errors|
|
50
|
+
errors.each do |error|
|
51
|
+
internal_errors.add(attribute, error)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
internal_errors.empty?
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def internal_errors
|
61
|
+
@errors ||= Errors.new
|
62
|
+
end
|
63
|
+
|
64
|
+
class Errors < Hash
|
65
|
+
def initialize
|
66
|
+
super(){|h, k| h[k] = []}
|
67
|
+
end
|
68
|
+
|
69
|
+
alias count size
|
70
|
+
|
71
|
+
def [](key)
|
72
|
+
super(key.to_s)
|
73
|
+
end
|
74
|
+
|
75
|
+
def []=(key, value)
|
76
|
+
super(key.to_s, value)
|
77
|
+
end
|
78
|
+
|
79
|
+
def empty?
|
80
|
+
all?{|k, v| v && v.empty?}
|
81
|
+
end
|
82
|
+
|
83
|
+
def on(field)
|
84
|
+
self[field].to_a.first
|
85
|
+
end
|
86
|
+
|
87
|
+
def add(field, error)
|
88
|
+
self[field] << error
|
89
|
+
end
|
90
|
+
|
91
|
+
def add_to_base(error)
|
92
|
+
add(:base, error)
|
93
|
+
end
|
94
|
+
|
95
|
+
def each_full
|
96
|
+
full_messages.each{|msg| yield msg}
|
97
|
+
end
|
98
|
+
|
99
|
+
def full_messages
|
100
|
+
result = []
|
101
|
+
|
102
|
+
self.each do |key, messages|
|
103
|
+
next unless(messages && !messages.empty?)
|
104
|
+
if key == 'base'
|
105
|
+
result << "#{messages.first}"
|
106
|
+
else
|
107
|
+
result << "#{Compatibility.humanize(key)} #{messages.first}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
result
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
Compatibility::Model.send(:include, Rails::Model)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|