swiss-crm-activemerchant 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +4033 -0
- data/CONTRIBUTORS +568 -0
- data/MIT-LICENSE +20 -0
- data/README.md +252 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +95 -0
- data/lib/active_merchant/billing/base.rb +48 -0
- data/lib/active_merchant/billing/check.rb +112 -0
- data/lib/active_merchant/billing/compatibility.rb +118 -0
- data/lib/active_merchant/billing/credit_card.rb +451 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +512 -0
- data/lib/active_merchant/billing/cvv_result.rb +37 -0
- data/lib/active_merchant/billing/gateway.rb +332 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +774 -0
- data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +1125 -0
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +424 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +977 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +242 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +263 -0
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -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/beanstream_core.rb +474 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +238 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +644 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +190 -0
- data/lib/active_merchant/billing/gateways/borgun.rb +272 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +28 -0
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +952 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +338 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +21 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +394 -0
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +235 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +198 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +249 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +212 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +587 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +366 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +230 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +526 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1148 -0
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +343 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +302 -0
- data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +346 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +475 -0
- data/lib/active_merchant/billing/gateways/element.rb +406 -0
- data/lib/active_merchant/billing/gateways/epay.rb +296 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +307 -0
- data/lib/active_merchant/billing/gateways/eway.rb +226 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +289 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +578 -0
- data/lib/active_merchant/billing/gateways/exact.rb +219 -0
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +223 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +158 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +452 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -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/fluidpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +256 -0
- data/lib/active_merchant/billing/gateways/global_collect.rb +580 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +193 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +205 -0
- data/lib/active_merchant/billing/gateways/hps.rb +472 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +312 -0
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +213 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +159 -0
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +467 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/iveri.rb +290 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +395 -0
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/klarna.rb +317 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +297 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +448 -0
- data/lib/active_merchant/billing/gateways/litle.rb +643 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +286 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +348 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +228 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +110 -0
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +313 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +284 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +248 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +352 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +293 -0
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +329 -0
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +215 -0
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +424 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +488 -0
- data/lib/active_merchant/billing/gateways/money_movers.rb +150 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +366 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +299 -0
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +198 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +229 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/network_merchants.rb +238 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +396 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +509 -0
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +246 -0
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +331 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +45 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +1267 -0
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +120 -0
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -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_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +110 -0
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +224 -0
- data/lib/active_merchant/billing/gateways/payeezy.rb +513 -0
- data/lib/active_merchant/billing/gateways/payex.rb +409 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +42 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +473 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +373 -0
- data/lib/active_merchant/billing/gateways/paymentez.rb +365 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +369 -0
- data/lib/active_merchant/billing/gateways/paynetworx.rb +228 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +718 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +69 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +136 -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 +272 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paypal_standard.rb +281 -0
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +159 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +204 -0
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +482 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +273 -0
- data/lib/active_merchant/billing/gateways/pixxels.rb +263 -0
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +295 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +302 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +274 -0
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +24 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/realex.rb +400 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +723 -0
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +446 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +141 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +260 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +191 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +290 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +103 -0
- data/lib/active_merchant/billing/gateways/securion_pay.rb +305 -0
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +450 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +274 -0
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +354 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +866 -0
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +602 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +151 -0
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +23 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +240 -0
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- data/lib/active_merchant/billing/gateways/transax.rb +21 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +500 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +24 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1612 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +367 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +303 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +224 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +171 -0
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +235 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +430 -0
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +1050 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +14 -0
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -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 +121 -0
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +16 -0
- data/lib/active_merchant/connection.rb +194 -0
- data/lib/active_merchant/country.rb +338 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +38 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +69 -0
- data/lib/support/outbound_hosts.rb +28 -0
- data/lib/support/ssl_verify.rb +88 -0
- data/lib/support/ssl_version.rb +86 -0
- metadata +506 -0
data/README.md
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
# Swiss Active Merchant
|
2
|
+
|
3
|
+
Swiss Active Merchant stands as an expanded iteration of the Active Merchant gem, designed to offer an enriched experience in handling financial transactions within Ruby applications. Serving as an extension to the renowned Active Merchant, Swiss Active Merchant introduces additional payment gateways.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
### From RubyGems
|
8
|
+
|
9
|
+
Installation from RubyGems:
|
10
|
+
|
11
|
+
```console
|
12
|
+
gem install swiss-activemerchant
|
13
|
+
```
|
14
|
+
|
15
|
+
Or, if you're using Bundler, just add the following to your Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'swiss-activemerchant'
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
This simple example demonstrates how a purchase can be made using a person's
|
24
|
+
credit card details.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'active_merchant'
|
28
|
+
|
29
|
+
# Use the TrustCommerce test servers
|
30
|
+
ActiveMerchant::Billing::Base.mode = :test
|
31
|
+
|
32
|
+
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
|
33
|
+
:login => 'TestMerchant',
|
34
|
+
:password => 'password')
|
35
|
+
|
36
|
+
# ActiveMerchant accepts all amounts as Integer values in cents
|
37
|
+
amount = 1000 # $10.00
|
38
|
+
|
39
|
+
# The card verification value is also known as CVV2, CVC2, or CID
|
40
|
+
credit_card = ActiveMerchant::Billing::CreditCard.new(
|
41
|
+
:first_name => 'Bob',
|
42
|
+
:last_name => 'Bobsen',
|
43
|
+
:number => '4242424242424242',
|
44
|
+
:month => '8',
|
45
|
+
:year => Time.now.year+1,
|
46
|
+
:verification_value => '000')
|
47
|
+
|
48
|
+
# Validating the card automatically detects the card type
|
49
|
+
if credit_card.validate.empty?
|
50
|
+
# Capture $10 from the credit card
|
51
|
+
response = gateway.purchase(amount, credit_card)
|
52
|
+
|
53
|
+
if response.success?
|
54
|
+
puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}"
|
55
|
+
else
|
56
|
+
raise StandardError, response.message
|
57
|
+
end
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
## Supported Payment Gateways
|
62
|
+
|
63
|
+
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).
|
64
|
+
|
65
|
+
* [Adyen](https://www.adyen.com/) - US, AT, AU, BE, BG, BR, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GI, GR, HK, HU, IE, IS, IT, LI, LT, LU, LV, MC, MT, MX, NL, NO, PL, PT, RO, SE, SG, SK, SI
|
66
|
+
* [Authorize.Net CIM](http://www.authorize.net/) - US
|
67
|
+
* [Authorize.Net](http://www.authorize.net/) - AU, CA, US
|
68
|
+
* [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
|
69
|
+
* [Balanced](https://www.balancedpayments.com/) - US
|
70
|
+
* [Bambora Asia-Pacific](http://www.bambora.com/) - AU, NZ
|
71
|
+
* [Bank Frick](http://www.bankfrickacquiring.com/) - LI, US
|
72
|
+
* [Banwire](http://www.banwire.com/) - MX
|
73
|
+
* [Barclays ePDQ Extra Plus](http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/) - GB
|
74
|
+
* [Be2Bill](http://www.be2bill.com/) - FR
|
75
|
+
* [Beanstream.com](http://www.beanstream.com/) - CA, US
|
76
|
+
* [BluePay](http://www.bluepay.com/) - US
|
77
|
+
* [Borgun](https://www.borgun.is/) - IS
|
78
|
+
* [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
|
79
|
+
* [BridgePay](http://www.bridgepaynetwork.com/) - CA, US
|
80
|
+
* [Cardknox](https://www.cardknox.com/) - US, CA, GB
|
81
|
+
* [CardSave](http://www.cardsave.net/) - GB
|
82
|
+
* [CardStream](http://www.cardstream.com/) - GB
|
83
|
+
* [Cashnet](http://www.higherone.com/) - US
|
84
|
+
* [Cecabank](http://www.ceca.es/es/) - ES
|
85
|
+
* [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
|
86
|
+
* [CAMS: Central Account Management System](https://www.centralams.com/) - US
|
87
|
+
* [Checkout.com](https://www.checkout.com/) - AD, AE, AR, AT, AU, BE, BG, BH, BR, CH, CL, CN, CO, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GR, HK, HR, HU, IE, IS, IT, JO, JP, KW, LI, LT, LU, LV, MC, MT, MX, MY, NL, NO, NZ, OM, PE, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, US
|
88
|
+
* [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
|
89
|
+
* [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
|
90
|
+
* [Conekta](https://conekta.io) - MX
|
91
|
+
* [CyberSource](http://www.cybersource.com) - US, BR, CA, CN, DK, FI, FR, DE, JP, MX, NO, SE, GB, SG
|
92
|
+
* [DIBS](http://www.dibspayment.com/) - US, FI, NO, SE, GB
|
93
|
+
* [DataCash](http://www.datacash.com/) - GB
|
94
|
+
* [Efsnet](http://www.concordefsnet.com/) - US
|
95
|
+
* [Elavon MyVirtualMerchant](http://www.elavon.com/) - US, CA
|
96
|
+
* [ePay](http://epay.dk/) - DK, SE, NO
|
97
|
+
* [EVO Canada](http://www.evocanada.com/) - CA
|
98
|
+
* [eWAY](http://www.eway.com.au/) - AU, NZ, GB
|
99
|
+
* [eWAY Rapid](http://www.eway.com.au/) - AU, NZ, GB, SG
|
100
|
+
* [E-xact](http://www.e-xact.com) - CA, US
|
101
|
+
* [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
|
102
|
+
* [Fat Zebra](https://www.fatzebra.com.au/) - AU
|
103
|
+
* [Federated Canada](http://www.federatedcanada.com/) - CA
|
104
|
+
* [Finansbank WebPOS](https://www.fbwebpos.com/) - US, TR
|
105
|
+
* [Flo2Cash](http://www.flo2cash.co.nz/) - NZ
|
106
|
+
* [1stPayGateway.Net](http://1stpaygateway.net/) - US
|
107
|
+
* [FirstData Global Gateway e4](http://www.firstdata.com) - CA, US
|
108
|
+
* [FirstGiving](http://www.firstgiving.com/) - US
|
109
|
+
* [Garanti Sanal POS](https://sanalposweb.garanti.com.tr) - US, TR
|
110
|
+
* [Global Transport](https://www.globalpaymentsinc.com) - CA, PR, US
|
111
|
+
* [HDFC](http://www.hdfcbank.com/sme/sme-details/merchant-services/guzh6m0i) - IN
|
112
|
+
* [Heartland Payment Systems](http://developer.heartlandpaymentsystems.com/SecureSubmit/) - US
|
113
|
+
* [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
|
114
|
+
* [Inspire Commerce](http://www.inspiregateway.com) - US
|
115
|
+
* [InstaPay](http://www.instapayllc.com) - US
|
116
|
+
* [IPP](http://www.ippayments.com.au/) - AU
|
117
|
+
* [Iridium](http://www.iridiumcorp.co.uk/) - GB, ES
|
118
|
+
* [iTransact](http://www.itransact.com/) - US
|
119
|
+
* [JetPay](http://www.jetpay.com/) - US
|
120
|
+
* [Komoju](http://www.komoju.com/) - JP
|
121
|
+
* [LinkPoint](http://www.linkpoint.com/) - US
|
122
|
+
* [Litle & Co.](http://www.litle.com/) - US
|
123
|
+
* [maxiPago!](http://www.maxipago.com/) - BR
|
124
|
+
* [Merchant e-Solutions](http://www.merchante-solutions.com/) - US
|
125
|
+
* [Merchant One Gateway](http://merchantone.com/) - US
|
126
|
+
* [MerchantWARE](http://merchantwarehouse.com/merchantware) - US
|
127
|
+
* [MerchantWarrior](http://www.merchantwarrior.com/) - AU
|
128
|
+
* [Mercury](http://www.mercurypay.com) - US, CA
|
129
|
+
* [Metrics Global](http://www.metricsglobal.com) - US
|
130
|
+
* [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
|
131
|
+
* [Modern Payments](http://www.modpay.com) - US
|
132
|
+
* [MONEI](http://www.monei.com/) - 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
|
133
|
+
* [Moneris](http://www.moneris.com/) - CA
|
134
|
+
* [MoneyMovers](http://mmoa.us/) - US
|
135
|
+
* [NAB Transact](http://transact.nab.com.au) - AU
|
136
|
+
* [NELiX TransaX](https://www.nelixtransax.com/) - US
|
137
|
+
* [NetRegistry](http://www.netregistry.com.au) - AU
|
138
|
+
* [BBS Netaxept](http://www.betalingsterminal.no/Netthandel-forside/) - NO, DK, SE, FI
|
139
|
+
* [NETbilling](http://www.netbilling.com) - US
|
140
|
+
* [NETPAY Gateway](http://www.netpay.com.mx) - MX
|
141
|
+
* [NMI](http://nmi.com/) - US
|
142
|
+
* [Ogone](http://www.ogone.com/) - BE, DE, FR, NL, AT, CH
|
143
|
+
* [Omise](https://www.omise.co/) - TH, JP
|
144
|
+
* [Openpay](Openpay) - MX
|
145
|
+
* [Optimal Payments](http://www.optimalpayments.com/) - CA, US, GB
|
146
|
+
* [Orbital Paymentech](http://chasepaymentech.com/) - US, CA
|
147
|
+
* [Pagar.me](https://pagar.me/) - BR
|
148
|
+
* [PagoFacil](http://www.pagofacil.net/) - MX
|
149
|
+
* [PayConex](http://www.bluefincommerce.com/) - US, CA
|
150
|
+
* [PayGate PayXML](http://paygate.co.za/) - US, ZA
|
151
|
+
* [PayHub](http://www.payhub.com/) - US
|
152
|
+
* [PayJunction](http://www.payjunction.com/) - US
|
153
|
+
* [PaySecure](http://www.commsecure.com.au/paysecure.shtml) - AU
|
154
|
+
* [Paybox Direct](http://www.paybox.com/) - FR
|
155
|
+
* [Payeezy](https://developer.payeezy.com/) - CA, US
|
156
|
+
* [Payex](http://payex.com/) - DK, FI, NO, SE
|
157
|
+
* [Windcave (formerly PaymentExpress)](https://www.windcave.com/) - AU, CA, DE, ES, FR, GB, HK, IE, MY, NL, NZ, SG, US, ZA
|
158
|
+
* [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
|
159
|
+
* [PayPal Express Checkout](https://www.paypal.com/webapps/mpp/express-checkout) - US, CA, SG, AU
|
160
|
+
* [PayPal Express Checkout (UK)](https://www.paypal.com/uk/webapps/mpp/express-checkout) - GB
|
161
|
+
* [PayPal Payflow Pro](https://www.paypal.com/webapps/mpp/payflow-payment-gateway) - US, CA, SG, AU
|
162
|
+
* [PayPal Payments Pro (US)](https://www.paypal.com/us/webapps/mpp/paypal-payments-pro) - US
|
163
|
+
* [PayPal Payments Pro (UK)](https://www.paypal.com/uk/webapps/mpp/pro) - GB
|
164
|
+
* [PayPal Website Payments Pro (CA)](https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside) - CA
|
165
|
+
* [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
|
166
|
+
* [Payscout](http://www.payscout.com/) - US
|
167
|
+
* [Paystation](http://paystation.co.nz) - NZ
|
168
|
+
* [Pay Way](http://www.payway.com.au) - AU
|
169
|
+
* [PayU India](https://www.payu.in/) - IN
|
170
|
+
* [Pin Payments](http://www.pinpayments.com/) - AU
|
171
|
+
* [Plug'n Pay](http://www.plugnpay.com/) - US
|
172
|
+
* [Psigate](http://www.psigate.com/) - CA
|
173
|
+
* [PSL Payment Solutions](http://www.paymentsolutionsltd.com/) - GB
|
174
|
+
* [QuickBooks Merchant Services](http://payments.intuit.com/) - US
|
175
|
+
* [QuickBooks Payments](http://payments.intuit.com/) - US
|
176
|
+
* [Quantum Gateway](http://www.quantumgateway.com) - US
|
177
|
+
* [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
|
178
|
+
* [Qvalent](https://www.qvalent.com/) - AU
|
179
|
+
* [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
|
180
|
+
* [Realex](http://www.realexpayments.com/) - IE, GB, FR, BE, NL, LU, IT
|
181
|
+
* [Redsys](http://www.redsys.es/) - ES
|
182
|
+
* [S5](http://www.s5.dk/) - DK
|
183
|
+
* [SagePay](http://www.sagepay.com) - GB, IE
|
184
|
+
* [Sage Payment Solutions](http://www.sagepayments.com) - US, CA
|
185
|
+
* [Sallie Mae](http://www.salliemae.com/) - US
|
186
|
+
* [SecureNet](http://www.securenet.com/) - US
|
187
|
+
* [SecurePay](http://www.securepay.com/) - US, CA, GB, AU
|
188
|
+
* [SecurePayTech](http://www.securepaytech.com/) - NZ
|
189
|
+
* [SecurionPay](https://securionpay.com/) - AD, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GI, GL, GR, GS, GT, HR, HU, IE, IS, IT, LI, LR, LT, LU, LV, MC, MT, MU, MV, MW, NL, NO, PL, RO, SE, SI
|
190
|
+
* [SkipJack](http://www.skipjack.com/) - US, CA
|
191
|
+
* [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
|
192
|
+
* [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
|
193
|
+
* [Stripe](https://stripe.com/) - AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IT, LU, NL, NO, SE, SG, US
|
194
|
+
* [Swipe](https://www.swipehq.com/checkout) - CA, NZ
|
195
|
+
* [TNS](http://www.tnsi.com/) - AR, AU, BR, FR, DE, HK, MX, NZ, SG, GB, US
|
196
|
+
* [Transact Pro](https://www.transactpro.lv/business/online-payments-acceptance) - US
|
197
|
+
* [TransFirst](http://www.transfirst.com/) - US
|
198
|
+
* [Transnational](http://www.tnbci.com/) - US
|
199
|
+
* [Trexle](https://trexle.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
|
200
|
+
* [TrustCommerce](http://www.trustcommerce.com/) - US
|
201
|
+
* [USA ePay](http://www.usaepay.com/) - US
|
202
|
+
* [Vanco Payment Solutions](http://vancopayments.com/) - US
|
203
|
+
* [Verifi](http://www.verifi.com/) - US
|
204
|
+
* [ViaKLIX](http://viaklix.com) - US
|
205
|
+
* [WebPay](https://webpay.jp/) - JP
|
206
|
+
* [WePay](https://www.wepay.com/) - US
|
207
|
+
* [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
|
208
|
+
* [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
|
209
|
+
* [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
|
210
|
+
* [Worldpay US](http://www.worldpay.com/us) - US
|
211
|
+
* [Pixxel](https://pixxles.com/) - GB
|
212
|
+
* [Paynetworx](https://paynetworx.com/) - US
|
213
|
+
* [Klarna](https://www.klarna.com/) - AD, AT, BE, BG, CA, CH, CZ, DE, DK, EE, ES, FI, FR, GB, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, US
|
214
|
+
* [Fluidpay](https://www.fluidpay.com/) - US, CA, GB, AU, DE, FR, ES, IT, JP, SG, HK, BR, MX
|
215
|
+
|
216
|
+
## Publishing Changes to RubyGems
|
217
|
+
|
218
|
+
If you make changes or improvements to this project, we encourage you to share these updates with the community. Follow the steps below to publish your changes to RubyGems:
|
219
|
+
|
220
|
+
1. Increment Version: Update the version number in the lib/your_gem/version.rb file.
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
module YourGem
|
224
|
+
VERSION = 'x.x.x'
|
225
|
+
end
|
226
|
+
```
|
227
|
+
|
228
|
+
2. Build Gem: Build the gem using the following command:
|
229
|
+
|
230
|
+
```console
|
231
|
+
gem build activemerchant.gemspec
|
232
|
+
```
|
233
|
+
|
234
|
+
3. Push to RubyGems: Push the updated gem to RubyGems:
|
235
|
+
|
236
|
+
```console
|
237
|
+
gem push swiss-activemerchant-x.x.x.gem
|
238
|
+
```
|
239
|
+
|
240
|
+
4. Yank Previous Version: If necessary, yank the previous version to prevent installations:
|
241
|
+
|
242
|
+
```console
|
243
|
+
gem yank swiss-activemerchant -v x.x.x
|
244
|
+
```
|
245
|
+
|
246
|
+
## API stability policy
|
247
|
+
|
248
|
+
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.
|
249
|
+
|
250
|
+
## Ruby and Rails compatibility policies
|
251
|
+
|
252
|
+
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.5+ and Rails 5.0+ are supported.
|
@@ -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,95 @@
|
|
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
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module Base
|
4
|
+
GATEWAY_MODE_DEPRECATION_MESSAGE = 'Base#gateway_mode is deprecated in favor of Base#mode and will be removed in a future version'
|
5
|
+
|
6
|
+
# Set ActiveMerchant gateways in test mode.
|
7
|
+
#
|
8
|
+
# ActiveMerchant::Billing::Base.mode = :test
|
9
|
+
mattr_accessor :mode
|
10
|
+
|
11
|
+
def self.gateway_mode=(mode)
|
12
|
+
ActiveMerchant.deprecated(GATEWAY_MODE_DEPRECATION_MESSAGE)
|
13
|
+
@@mode = mode
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.gateway_mode
|
17
|
+
ActiveMerchant.deprecated(GATEWAY_MODE_DEPRECATION_MESSAGE)
|
18
|
+
@@mode
|
19
|
+
end
|
20
|
+
|
21
|
+
self.mode = :production
|
22
|
+
|
23
|
+
# Return the matching gateway for the provider
|
24
|
+
# * <tt>bogus</tt>: BogusGateway - Does nothing (for testing)
|
25
|
+
# * <tt>moneris</tt>: MonerisGateway
|
26
|
+
# * <tt>authorize_net</tt>: AuthorizeNetGateway
|
27
|
+
# * <tt>trust_commerce</tt>: TrustCommerceGateway
|
28
|
+
#
|
29
|
+
# ActiveMerchant::Billing::Base.gateway('moneris').new
|
30
|
+
def self.gateway(name)
|
31
|
+
name_str = name.to_s.strip.downcase
|
32
|
+
|
33
|
+
raise(ArgumentError, 'A gateway provider must be specified') if name_str.blank?
|
34
|
+
|
35
|
+
begin
|
36
|
+
Billing.const_get("#{name_str}_gateway".camelize)
|
37
|
+
rescue
|
38
|
+
raise ArgumentError, "The specified gateway is not valid (#{name_str})"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# A check to see if we're in test mode
|
43
|
+
def self.test?
|
44
|
+
mode == :test
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,112 @@
|
|
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
|
+
# Canadian Institution Numbers
|
17
|
+
# Partial list found here: https://en.wikipedia.org/wiki/Routing_number_(Canada)
|
18
|
+
CAN_INSTITUTION_NUMBERS = %w(
|
19
|
+
001 002 003 004 006 010 016 030 039 117 127 177 219 245 260 269 270 308
|
20
|
+
309 310 315 320 338 340 509 540 608 614 623 809 815 819 828 829 837 839
|
21
|
+
865 879 889 899 241 242 248 250 265 275 277 290 294 301 303 307 311 314
|
22
|
+
321 323 327 328 330 332 334 335 342 343 346 352 355 361 362 366 370 372
|
23
|
+
376 378 807 853 890 618 842
|
24
|
+
)
|
25
|
+
|
26
|
+
def name
|
27
|
+
@name ||= "#{first_name} #{last_name}".strip
|
28
|
+
end
|
29
|
+
|
30
|
+
def name=(value)
|
31
|
+
return if empty?(value)
|
32
|
+
|
33
|
+
@name = value
|
34
|
+
segments = value.split(' ')
|
35
|
+
@last_name = segments.pop
|
36
|
+
@first_name = segments.join(' ')
|
37
|
+
end
|
38
|
+
|
39
|
+
def validate
|
40
|
+
errors = []
|
41
|
+
|
42
|
+
%i[name routing_number account_number].each do |attr|
|
43
|
+
errors << [attr, 'cannot be empty'] if empty?(self.send(attr))
|
44
|
+
end
|
45
|
+
|
46
|
+
errors << [:routing_number, 'is invalid'] unless valid_routing_number?
|
47
|
+
|
48
|
+
errors << [:account_holder_type, 'must be personal or business'] if !empty?(account_holder_type) && !%w[business personal].include?(account_holder_type.to_s)
|
49
|
+
|
50
|
+
errors << [:account_type, 'must be checking or savings'] if !empty?(account_type) && !%w[checking savings].include?(account_type.to_s)
|
51
|
+
|
52
|
+
errors_hash(errors)
|
53
|
+
end
|
54
|
+
|
55
|
+
def type
|
56
|
+
'check'
|
57
|
+
end
|
58
|
+
|
59
|
+
def credit_card?
|
60
|
+
false
|
61
|
+
end
|
62
|
+
|
63
|
+
def valid_routing_number?
|
64
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
65
|
+
case digits.size
|
66
|
+
when 9
|
67
|
+
return checksum(digits) == 0 || CAN_INSTITUTION_NUMBERS.include?(routing_number[1..3])
|
68
|
+
when 8
|
69
|
+
return CAN_INSTITUTION_NUMBERS.include?(routing_number[5..7])
|
70
|
+
end
|
71
|
+
|
72
|
+
false
|
73
|
+
end
|
74
|
+
|
75
|
+
# Routing numbers may be validated by calculating a checksum and dividing it by 10. The
|
76
|
+
# formula is:
|
77
|
+
# (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
|
78
|
+
# See http://en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
|
79
|
+
def checksum(digits)
|
80
|
+
((3 * (digits[0] + digits[3] + digits[6])) +
|
81
|
+
(7 * (digits[1] + digits[4] + digits[7])) +
|
82
|
+
(digits[2] + digits[5] + digits[8])) % 10
|
83
|
+
end
|
84
|
+
|
85
|
+
# Always return MICR-formatted routing number for Canadian routing numbers, US routing numbers unchanged
|
86
|
+
def micr_format_routing_number
|
87
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
88
|
+
case digits.size
|
89
|
+
when 9
|
90
|
+
if checksum(digits) == 0
|
91
|
+
return routing_number
|
92
|
+
else
|
93
|
+
return routing_number[4..8] + routing_number[1..3]
|
94
|
+
end
|
95
|
+
when 8
|
96
|
+
return routing_number
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Always return electronic-formatted routing number for Canadian routing numbers, US routing numbers unchanged
|
101
|
+
def electronic_format_routing_number
|
102
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
103
|
+
case digits.size
|
104
|
+
when 9
|
105
|
+
return routing_number
|
106
|
+
when 8
|
107
|
+
return '0' + routing_number[5..7] + routing_number[0..4]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,118 @@
|
|
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.tr!('_', ' ')
|
32
|
+
result.gsub(/([a-z\d]*)/i, &:downcase).gsub(/^\w/) { $&.upcase }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# This lives in compatibility until we remove the deprecation for implicitly
|
39
|
+
# requiring Rails
|
40
|
+
module ActiveMerchant
|
41
|
+
module Billing
|
42
|
+
module Rails
|
43
|
+
module Model
|
44
|
+
def valid?
|
45
|
+
internal_errors.clear
|
46
|
+
|
47
|
+
validate.each do |attribute, errors|
|
48
|
+
errors.each do |error|
|
49
|
+
internal_errors.add(attribute, error)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
internal_errors.empty?
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def internal_errors
|
59
|
+
@internal_errors ||= Errors.new
|
60
|
+
end
|
61
|
+
|
62
|
+
class Errors < Hash
|
63
|
+
def initialize
|
64
|
+
super() { |h, k| h[k] = [] }
|
65
|
+
end
|
66
|
+
|
67
|
+
alias count size
|
68
|
+
|
69
|
+
def [](key)
|
70
|
+
super(key.to_s)
|
71
|
+
end
|
72
|
+
|
73
|
+
def []=(key, value)
|
74
|
+
super(key.to_s, value)
|
75
|
+
end
|
76
|
+
|
77
|
+
def empty?
|
78
|
+
all? { |_k, v| v&.empty? }
|
79
|
+
end
|
80
|
+
|
81
|
+
def on(field)
|
82
|
+
self[field].to_a.first
|
83
|
+
end
|
84
|
+
|
85
|
+
def add(field, error)
|
86
|
+
self[field] << error
|
87
|
+
end
|
88
|
+
|
89
|
+
def add_to_base(error)
|
90
|
+
add(:base, error)
|
91
|
+
end
|
92
|
+
|
93
|
+
def each_full
|
94
|
+
full_messages.each { |msg| yield msg }
|
95
|
+
end
|
96
|
+
|
97
|
+
def full_messages
|
98
|
+
result = []
|
99
|
+
|
100
|
+
self.each do |key, messages|
|
101
|
+
next unless messages && !messages.empty?
|
102
|
+
|
103
|
+
if key == 'base'
|
104
|
+
result << messages.first.to_s
|
105
|
+
else
|
106
|
+
result << "#{Compatibility.humanize(key)} #{messages.first}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
result
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
Compatibility::Model.send(:include, Rails::Model)
|
117
|
+
end
|
118
|
+
end
|