swiss-activemerchant 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +4033 -0
- data/CONTRIBUTORS +568 -0
- data/MIT-LICENSE +20 -0
- data/README.md +249 -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 +243 -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 +227 -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 +312 -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 +120 -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
@@ -0,0 +1,500 @@
|
|
1
|
+
begin
|
2
|
+
require 'tclink'
|
3
|
+
rescue LoadError
|
4
|
+
# Falls back to an SSL post to TrustCommerce
|
5
|
+
end
|
6
|
+
|
7
|
+
module ActiveMerchant #:nodoc:
|
8
|
+
module Billing #:nodoc:
|
9
|
+
# TO USE:
|
10
|
+
# First, make sure you have everything setup correctly and all of your dependencies in place with:
|
11
|
+
#
|
12
|
+
# require 'rubygems'
|
13
|
+
# require 'active_merchant'
|
14
|
+
#
|
15
|
+
# ActiveMerchant expects amounts to be Integer values in cents
|
16
|
+
#
|
17
|
+
# tendollar = 1000
|
18
|
+
#
|
19
|
+
# Next, create a credit card object using a TC approved test card.
|
20
|
+
#
|
21
|
+
# creditcard = ActiveMerchant::Billing::CreditCard.new(
|
22
|
+
# :number => '4111111111111111',
|
23
|
+
# :month => 8,
|
24
|
+
# :year => 2006,
|
25
|
+
# :first_name => 'Longbob',
|
26
|
+
# :last_name => 'Longsen'
|
27
|
+
# )
|
28
|
+
#
|
29
|
+
# To finish setting up, create the active_merchant object you will be using, with the TrustCommerce gateway. If you have a
|
30
|
+
# functional TrustCommerce account, replace login and password with your account info. Otherwise the defaults will work for
|
31
|
+
# testing.
|
32
|
+
#
|
33
|
+
# gateway = ActiveMerchant::Billing::Base.gateway(:trust_commerce).new(:login => "TestMerchant", :password => "password")
|
34
|
+
#
|
35
|
+
# Now we are ready to process our transaction
|
36
|
+
#
|
37
|
+
# response = gateway.purchase(tendollar, creditcard)
|
38
|
+
#
|
39
|
+
# Sending a transaction to TrustCommerce with active_merchant returns a Response object, which consistently allows you to:
|
40
|
+
#
|
41
|
+
# 1) Check whether the transaction was successful
|
42
|
+
#
|
43
|
+
# response.success?
|
44
|
+
#
|
45
|
+
# 2) Retrieve any message returned by TrustCommerce, either a "transaction was successful" note or an explanation of why the
|
46
|
+
# transaction was rejected.
|
47
|
+
#
|
48
|
+
# response.message
|
49
|
+
#
|
50
|
+
# 3) Retrieve and store the unique transaction ID returned by Trust Commerece, for use in referencing the transaction in the future.
|
51
|
+
#
|
52
|
+
# response.params["transid"]
|
53
|
+
#
|
54
|
+
# For higher performance and failover with the TrustCommerceGateway you can install the TCLink library from http://www.trustcommerce.com/tclink.html.
|
55
|
+
# Follow the instructions available there to get it working on your system. ActiveMerchant will automatically use tclink if available.
|
56
|
+
#
|
57
|
+
# The TCLink library has the following added benefits:
|
58
|
+
# * Good transaction times. Transaction duration under 1.2 seconds are common.
|
59
|
+
# * Fail-over to geographically distributed servers for extreme reliability
|
60
|
+
#
|
61
|
+
# Once it is installed, you should be able to make sure
|
62
|
+
# that it is visible to your ruby install by opening irb and typing "require 'tclink'", which should return "true".
|
63
|
+
#
|
64
|
+
# This should be enough to get you started with Trust Commerce and active_merchant. For further information, review the methods
|
65
|
+
# below and the rest of active_merchant's documentation, as well as Trust Commerce's user and developer documentation.
|
66
|
+
|
67
|
+
class TrustCommerceGateway < Gateway
|
68
|
+
self.live_url = self.test_url = 'https://vault.trustcommerce.com/trans/'
|
69
|
+
|
70
|
+
SUCCESS_TYPES = %w[approved accepted]
|
71
|
+
|
72
|
+
DECLINE_CODES = {
|
73
|
+
'decline' => 'The credit card was declined',
|
74
|
+
'avs' => 'AVS failed; the address entered does not match the billing address on file at the bank',
|
75
|
+
'cvv' => 'CVV failed; the number provided is not the correct verification number for the card',
|
76
|
+
'call' => 'The card must be authorized manually over the phone',
|
77
|
+
'expiredcard' => 'Issuer was not certified for card verification',
|
78
|
+
'carderror' => 'Card number is invalid',
|
79
|
+
'authexpired' => 'Attempt to postauth an expired (more than 14 days old) preauth',
|
80
|
+
'fraud' => 'CrediGuard fraud score was below requested threshold',
|
81
|
+
'blacklist' => 'CrediGuard blacklist value was triggered',
|
82
|
+
'velocity' => 'CrediGuard velocity control value was triggered',
|
83
|
+
'dailylimit' => 'Daily limit in transaction count or amount as been reached',
|
84
|
+
'weeklylimit' => 'Weekly limit in transaction count or amount as been reached',
|
85
|
+
'monthlylimit' => 'Monthly limit in transaction count or amount as been reached'
|
86
|
+
}
|
87
|
+
|
88
|
+
BADDATA_CODES = {
|
89
|
+
'missingfields' => 'One or more parameters required for this transaction type were not sent',
|
90
|
+
'extrafields' => 'Parameters not allowed for this transaction type were sent',
|
91
|
+
'badformat' => 'A field was improperly formatted, such as non-digit characters in a number field',
|
92
|
+
'badlength' => 'A field was longer or shorter than the server allows',
|
93
|
+
'merchantcantaccept' => "The merchant can't accept data passed in this field",
|
94
|
+
'mismatch' => 'Data in one of the offending fields did not cross-check with the other offending field'
|
95
|
+
}
|
96
|
+
|
97
|
+
ERROR_CODES = {
|
98
|
+
'cantconnect' => "Couldn't connect to the TrustCommerce gateway",
|
99
|
+
'dnsfailure' => 'The TCLink software was unable to resolve DNS hostnames',
|
100
|
+
'linkfailure' => 'The connection was established, but was severed before the transaction could complete',
|
101
|
+
'failtoprocess' => 'The bank servers are offline and unable to authorize transactions'
|
102
|
+
}
|
103
|
+
|
104
|
+
TEST_LOGIN = 'TestMerchant'
|
105
|
+
TEST_PASSWORD = 'password'
|
106
|
+
|
107
|
+
VOIDABLE_ACTIONS = %w(preauth sale postauth credit)
|
108
|
+
|
109
|
+
self.money_format = :cents
|
110
|
+
self.supported_cardtypes = %i[visa master discover american_express diners_club jcb]
|
111
|
+
self.supported_countries = ['US']
|
112
|
+
self.homepage_url = 'http://www.trustcommerce.com/'
|
113
|
+
self.display_name = 'TrustCommerce'
|
114
|
+
|
115
|
+
def self.tclink?
|
116
|
+
defined?(TCLink)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Creates a new TrustCommerceGateway
|
120
|
+
#
|
121
|
+
# The gateway requires that a valid login and password be passed
|
122
|
+
# in the +options+ hash.
|
123
|
+
#
|
124
|
+
# ==== Options
|
125
|
+
#
|
126
|
+
# * <tt>:login</tt> -- The TrustCommerce account login.
|
127
|
+
# * <tt>:password</tt> -- The TrustCommerce account password.
|
128
|
+
# * <tt>:test => +true+ or +false+</tt> -- Perform test transactions
|
129
|
+
#
|
130
|
+
# ==== Test Account Credentials
|
131
|
+
# * <tt>:login</tt> -- TestMerchant
|
132
|
+
# * <tt>:password</tt> -- password
|
133
|
+
def initialize(options = {})
|
134
|
+
requires!(options, :login, :password)
|
135
|
+
|
136
|
+
super
|
137
|
+
end
|
138
|
+
|
139
|
+
def tclink?
|
140
|
+
self.class.tclink?
|
141
|
+
end
|
142
|
+
|
143
|
+
def test?
|
144
|
+
((@options[:login] == TEST_LOGIN && @options[:password] == TEST_PASSWORD) || super)
|
145
|
+
end
|
146
|
+
|
147
|
+
# authorize() is the first half of the preauth(authorize)/postauth(capture) model. The TC API docs call this
|
148
|
+
# preauth, we preserve active_merchant's nomenclature of authorize() for consistency with the rest of the library. This
|
149
|
+
# method simply checks to make sure funds are available for a transaction, and returns a transid that can be used later to
|
150
|
+
# postauthorize (capture) the funds.
|
151
|
+
|
152
|
+
def authorize(money, creditcard_or_billing_id, options = {})
|
153
|
+
parameters = {
|
154
|
+
amount: amount(money)
|
155
|
+
}
|
156
|
+
|
157
|
+
add_order_id(parameters, options)
|
158
|
+
add_aggregator(parameters, options)
|
159
|
+
add_customer_data(parameters, options)
|
160
|
+
add_payment_source(parameters, creditcard_or_billing_id)
|
161
|
+
add_addresses(parameters, options)
|
162
|
+
add_custom_fields(parameters, options)
|
163
|
+
|
164
|
+
commit('preauth', parameters)
|
165
|
+
end
|
166
|
+
|
167
|
+
# purchase() is a simple sale. This is one of the most common types of transactions, and is extremely simple. All that you need
|
168
|
+
# to process a purchase are an amount in cents or a money object and a creditcard object or billingid string.
|
169
|
+
def purchase(money, creditcard_or_billing_id, options = {})
|
170
|
+
parameters = {
|
171
|
+
amount: amount(money)
|
172
|
+
}
|
173
|
+
|
174
|
+
add_order_id(parameters, options)
|
175
|
+
add_aggregator(parameters, options)
|
176
|
+
add_customer_data(parameters, options)
|
177
|
+
add_payment_source(parameters, creditcard_or_billing_id)
|
178
|
+
add_addresses(parameters, options)
|
179
|
+
add_custom_fields(parameters, options)
|
180
|
+
|
181
|
+
commit('sale', parameters)
|
182
|
+
end
|
183
|
+
|
184
|
+
# capture() is the second half of the preauth(authorize)/postauth(capture) model. The TC API docs call this
|
185
|
+
# postauth, we preserve active_merchant's nomenclature of capture() for consistency with the rest of the library. To process
|
186
|
+
# a postauthorization with TC, you need an amount in cents or a money object, and a TC transid.
|
187
|
+
def capture(money, authorization, options = {})
|
188
|
+
transaction_id, = split_authorization(authorization)
|
189
|
+
parameters = {
|
190
|
+
amount: amount(money),
|
191
|
+
transid: transaction_id
|
192
|
+
}
|
193
|
+
add_aggregator(parameters, options)
|
194
|
+
add_custom_fields(parameters, options)
|
195
|
+
|
196
|
+
commit('postauth', parameters)
|
197
|
+
end
|
198
|
+
|
199
|
+
# refund() allows you to return money to a card that was previously billed. You need to supply the amount, in cents or a money object,
|
200
|
+
# that you want to refund, and a TC transid for the transaction that you are refunding.
|
201
|
+
def refund(money, identification, options = {})
|
202
|
+
transaction_id, = split_authorization(identification)
|
203
|
+
|
204
|
+
parameters = {
|
205
|
+
amount: amount(money),
|
206
|
+
transid: transaction_id
|
207
|
+
}
|
208
|
+
|
209
|
+
add_aggregator(parameters, options)
|
210
|
+
add_custom_fields(parameters, options)
|
211
|
+
|
212
|
+
commit('credit', parameters)
|
213
|
+
end
|
214
|
+
|
215
|
+
def credit(money, identification, options = {})
|
216
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
217
|
+
refund(money, identification, options)
|
218
|
+
end
|
219
|
+
|
220
|
+
# void() clears an existing authorization and releases the reserved fund
|
221
|
+
# s back to the cardholder. The TC API refers to this transaction as a
|
222
|
+
# reversal. After voiding, you will no longer be able to capture funds
|
223
|
+
# from this authorization. TrustCommerce seems to always return a status
|
224
|
+
# of "accepted" even if the transid you are trying to deauthorize has
|
225
|
+
# already been captured. Note: Your account needs to be configured by
|
226
|
+
# TrustCommerce to allow for reversal transactions before you can use this
|
227
|
+
# method.
|
228
|
+
#
|
229
|
+
# void() is also used to to cancel a capture (postauth), purchase (sale),
|
230
|
+
# or refund (credit) or a before it is sent for settlement.
|
231
|
+
#
|
232
|
+
# NOTE: AMEX preauth's cannot be reversed. If you want to clear it more
|
233
|
+
# quickly than the automatic expiration (7-10 days), you will have to
|
234
|
+
# capture it and then immediately issue a credit for the same amount
|
235
|
+
# which should clear the customers credit card with 48 hours according to
|
236
|
+
# TC.
|
237
|
+
def void(authorization, options = {})
|
238
|
+
transaction_id, original_action = split_authorization(authorization)
|
239
|
+
action = (VOIDABLE_ACTIONS - ['preauth']).include?(original_action) ? 'void' : 'reversal'
|
240
|
+
|
241
|
+
parameters = {
|
242
|
+
transid: transaction_id
|
243
|
+
}
|
244
|
+
|
245
|
+
add_aggregator(parameters, options)
|
246
|
+
add_custom_fields(parameters, options)
|
247
|
+
|
248
|
+
commit(action, parameters)
|
249
|
+
end
|
250
|
+
|
251
|
+
def verify(credit_card, options = {})
|
252
|
+
parameters = {}
|
253
|
+
add_creditcard(parameters, credit_card)
|
254
|
+
commit('verify', parameters)
|
255
|
+
end
|
256
|
+
|
257
|
+
# recurring() a TrustCommerce account that is activated for Citadel, TrustCommerce's
|
258
|
+
# hosted customer billing info database.
|
259
|
+
#
|
260
|
+
# Recurring billing uses the same TC action as a plain-vanilla 'store', but we have a separate method for clarity. It can be called
|
261
|
+
# like store, with the addition of a required 'periodicity' parameter:
|
262
|
+
#
|
263
|
+
# The parameter :periodicity should be specified as either :bimonthly, :monthly, :biweekly, :weekly, :yearly or :daily
|
264
|
+
#
|
265
|
+
# gateway.recurring(tendollar, creditcard, :periodicity => :weekly)
|
266
|
+
#
|
267
|
+
# You can optionally specify how long you want payments to continue using 'payments'
|
268
|
+
def recurring(money, creditcard, options = {})
|
269
|
+
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
|
270
|
+
|
271
|
+
requires!(options, %i[periodicity bimonthly monthly biweekly weekly yearly daily])
|
272
|
+
|
273
|
+
cycle =
|
274
|
+
case options[:periodicity]
|
275
|
+
when :monthly
|
276
|
+
'1m'
|
277
|
+
when :bimonthly
|
278
|
+
'2m'
|
279
|
+
when :weekly
|
280
|
+
'1w'
|
281
|
+
when :biweekly
|
282
|
+
'2w'
|
283
|
+
when :yearly
|
284
|
+
'1y'
|
285
|
+
when :daily
|
286
|
+
'1d'
|
287
|
+
end
|
288
|
+
|
289
|
+
parameters = {
|
290
|
+
amount: amount(money),
|
291
|
+
cycle: cycle,
|
292
|
+
verify: options[:verify] || 'y',
|
293
|
+
billingid: options[:billingid] || nil,
|
294
|
+
payments: options[:payments] || nil
|
295
|
+
}
|
296
|
+
|
297
|
+
add_creditcard(parameters, creditcard)
|
298
|
+
|
299
|
+
commit('store', parameters)
|
300
|
+
end
|
301
|
+
|
302
|
+
# store() requires a TrustCommerce account that is activated for Citadel. You can call it with a credit card and a billing ID
|
303
|
+
# you would like to use to reference the stored credit card info for future captures. Use 'verify' to specify whether you want
|
304
|
+
# to simply store the card in the DB, or you want TC to verify the data first.
|
305
|
+
|
306
|
+
def store(creditcard, options = {})
|
307
|
+
parameters = {
|
308
|
+
verify: options[:verify] || 'y',
|
309
|
+
billingid: options[:billingid] || options[:billing_id] || nil
|
310
|
+
}
|
311
|
+
|
312
|
+
add_creditcard(parameters, creditcard)
|
313
|
+
add_addresses(parameters, options)
|
314
|
+
add_custom_fields(parameters, options)
|
315
|
+
|
316
|
+
commit('store', parameters)
|
317
|
+
end
|
318
|
+
|
319
|
+
# To unstore a creditcard stored in Citadel using store() or recurring(), all that is required is the billing id. When you run
|
320
|
+
# unstore() the information will be removed and a Response object will be returned indicating the success of the action.
|
321
|
+
def unstore(identification, options = {})
|
322
|
+
parameters = {
|
323
|
+
billingid: identification
|
324
|
+
}
|
325
|
+
|
326
|
+
add_custom_fields(parameters, options)
|
327
|
+
|
328
|
+
commit('unstore', parameters)
|
329
|
+
end
|
330
|
+
|
331
|
+
def supports_scrubbing
|
332
|
+
true
|
333
|
+
end
|
334
|
+
|
335
|
+
def scrub(transcript)
|
336
|
+
transcript.
|
337
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
338
|
+
gsub(%r((&?cc=)\d*(&?)), '\1[FILTERED]\2').
|
339
|
+
gsub(%r((&?password=)[^&]+(&?)), '\1[FILTERED]\2').
|
340
|
+
gsub(%r((&?cvv=)\d*(&?)), '\1[FILTERED]\2').
|
341
|
+
gsub(%r((&?account=)\d*(&?)), '\1[FILTERED]\2')
|
342
|
+
end
|
343
|
+
|
344
|
+
private
|
345
|
+
|
346
|
+
def add_custom_fields(params, options)
|
347
|
+
options[:custom_fields]&.each do |key, value|
|
348
|
+
params[key.to_sym] = value
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
def add_aggregator(params, options)
|
353
|
+
if @options[:aggregator_id] || application_id != Gateway.application_id
|
354
|
+
params[:aggregators] = 1
|
355
|
+
params[:aggregator1] = @options[:aggregator_id] || application_id
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
def add_payment_source(params, source)
|
360
|
+
if source.is_a?(String)
|
361
|
+
add_billing_id(params, source)
|
362
|
+
elsif card_brand(source) == 'check'
|
363
|
+
add_check(params, source)
|
364
|
+
else
|
365
|
+
add_creditcard(params, source)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
def add_check(params, check)
|
370
|
+
params[:media] = 'ach'
|
371
|
+
params[:routing] = check.routing_number
|
372
|
+
params[:account] = check.account_number
|
373
|
+
params[:savings] = 'y' if check.account_type == 'savings'
|
374
|
+
params[:name] = check.name
|
375
|
+
end
|
376
|
+
|
377
|
+
def add_creditcard(params, creditcard)
|
378
|
+
params[:media] = 'cc'
|
379
|
+
params[:name] = creditcard.name
|
380
|
+
params[:cc] = creditcard.number
|
381
|
+
params[:exp] = expdate(creditcard)
|
382
|
+
params[:cvv] = creditcard.verification_value if creditcard.verification_value?
|
383
|
+
end
|
384
|
+
|
385
|
+
def add_order_id(params, options)
|
386
|
+
params[:ticket] = options[:order_id] unless options[:order_id].blank?
|
387
|
+
end
|
388
|
+
|
389
|
+
def add_billing_id(params, billingid)
|
390
|
+
params[:billingid] = billingid
|
391
|
+
end
|
392
|
+
|
393
|
+
def add_customer_data(params, options)
|
394
|
+
params[:email] = options[:email] unless options[:email].blank?
|
395
|
+
params[:ip] = options[:ip] unless options[:ip].blank?
|
396
|
+
end
|
397
|
+
|
398
|
+
def add_addresses(params, options)
|
399
|
+
address = options[:billing_address] || options[:address]
|
400
|
+
|
401
|
+
if address
|
402
|
+
params[:address1] = address[:address1] unless address[:address1].blank?
|
403
|
+
params[:address2] = address[:address2] unless address[:address2].blank?
|
404
|
+
params[:city] = address[:city] unless address[:city].blank?
|
405
|
+
params[:state] = address[:state] unless address[:state].blank?
|
406
|
+
params[:zip] = address[:zip] unless address[:zip].blank?
|
407
|
+
params[:country] = address[:country] unless address[:country].blank?
|
408
|
+
params[:avs] = 'n'
|
409
|
+
end
|
410
|
+
|
411
|
+
if shipping_address = options[:shipping_address]
|
412
|
+
params[:shipto_name] = shipping_address[:name] unless shipping_address[:name].blank?
|
413
|
+
params[:shipto_address1] = shipping_address[:address1] unless shipping_address[:address1].blank?
|
414
|
+
params[:shipto_address2] = shipping_address[:address2] unless shipping_address[:address2].blank?
|
415
|
+
params[:shipto_city] = shipping_address[:city] unless shipping_address[:city].blank?
|
416
|
+
params[:shipto_state] = shipping_address[:state] unless shipping_address[:state].blank?
|
417
|
+
params[:shipto_zip] = shipping_address[:zip] unless shipping_address[:zip].blank?
|
418
|
+
params[:shipto_country] = shipping_address[:country] unless shipping_address[:country].blank?
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
def clean_and_stringify_params(parameters)
|
423
|
+
# TCLink wants us to send a hash with string keys, and activemerchant pushes everything around with
|
424
|
+
# symbol keys. Before sending our input to TCLink, we convert all our keys to strings and dump the symbol keys.
|
425
|
+
# We also remove any pairs with nil values, as these confuse TCLink.
|
426
|
+
parameters.keys.reverse_each do |key|
|
427
|
+
parameters[key.to_s] = parameters[key] if parameters[key]
|
428
|
+
parameters.delete(key)
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
def post_data(parameters)
|
433
|
+
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
434
|
+
end
|
435
|
+
|
436
|
+
def commit(action, parameters)
|
437
|
+
parameters[:custid] = @options[:login]
|
438
|
+
parameters[:password] = @options[:password]
|
439
|
+
parameters[:demo] = test? ? 'y' : 'n'
|
440
|
+
parameters[:action] = action
|
441
|
+
|
442
|
+
clean_and_stringify_params(parameters)
|
443
|
+
|
444
|
+
data = if tclink?
|
445
|
+
TCLink.send(parameters)
|
446
|
+
else
|
447
|
+
parse(ssl_post(self.live_url, post_data(parameters)))
|
448
|
+
end
|
449
|
+
|
450
|
+
# to be considered successful, transaction status must be either "approved" or "accepted"
|
451
|
+
success = SUCCESS_TYPES.include?(data['status'])
|
452
|
+
message = message_from(data)
|
453
|
+
Response.new(success, message, data,
|
454
|
+
test: test?,
|
455
|
+
authorization: authorization_from(action, data),
|
456
|
+
cvv_result: data['cvv'],
|
457
|
+
avs_result: { code: data['avs'] })
|
458
|
+
end
|
459
|
+
|
460
|
+
def parse(body)
|
461
|
+
results = {}
|
462
|
+
|
463
|
+
body.split(/\n/).each do |pair|
|
464
|
+
key, val = pair.split(/=/)
|
465
|
+
results[key] = val
|
466
|
+
end
|
467
|
+
|
468
|
+
results
|
469
|
+
end
|
470
|
+
|
471
|
+
def message_from(data)
|
472
|
+
case data['status']
|
473
|
+
when 'decline'
|
474
|
+
return DECLINE_CODES[data['declinetype']]
|
475
|
+
when 'baddata'
|
476
|
+
return BADDATA_CODES[data['error']]
|
477
|
+
when 'error'
|
478
|
+
return ERROR_CODES[data['errortype']]
|
479
|
+
else
|
480
|
+
return 'The transaction was successful'
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
def authorization_from(action, data)
|
485
|
+
case action
|
486
|
+
when 'store'
|
487
|
+
data['billingid']
|
488
|
+
when *VOIDABLE_ACTIONS
|
489
|
+
"#{data['transid']}|#{action}"
|
490
|
+
else
|
491
|
+
data['transid']
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
def split_authorization(authorization)
|
496
|
+
authorization&.split('|')
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
##
|
4
|
+
# Delegates to the appropriate gateway, either the Transaction or Advanced
|
5
|
+
# depending on options passed to new.
|
6
|
+
#
|
7
|
+
class UsaEpayGateway < Gateway
|
8
|
+
self.abstract_class = true
|
9
|
+
|
10
|
+
##
|
11
|
+
# Creates an instance of UsaEpayTransactionGateway by default, but if
|
12
|
+
# :software id or :live_url are passed in the options hash it will
|
13
|
+
# create an instance of UsaEpayAdvancedGateway.
|
14
|
+
#
|
15
|
+
def self.new(options = {})
|
16
|
+
if options.has_key?(:software_id) || options.has_key?(:live_url)
|
17
|
+
UsaEpayAdvancedGateway.new(options)
|
18
|
+
else
|
19
|
+
UsaEpayTransactionGateway.new(options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|