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
@@ -0,0 +1,448 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# iTransact, Inc. is an authorized reseller of the PaymentClearing gateway. If your merchant service provider uses PaymentClearing.com to process payments, you can use this module.
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# Please note, the username and API Access Key are not what you use to log into the Merchant Control Panel.
|
9
|
+
#
|
10
|
+
# ==== How to get your GatewayID and API Access Key
|
11
|
+
#
|
12
|
+
# 1. If you don't already have a Gateway Account, go to http://www.itransact.com/merchant/test.html to sign up.
|
13
|
+
# 2. Go to http://support.paymentclearing.com and login or register, if necessary.
|
14
|
+
# 3. Click on "Submit a Ticket."
|
15
|
+
# 4. Select "Merchant Support" as the department and click "Next"
|
16
|
+
# 5. Enter *both* your company name and GatewayID. Put "API Access Key" in the subject. In the body, you can request a username, but it may already be in use.
|
17
|
+
#
|
18
|
+
# ==== Initialization
|
19
|
+
#
|
20
|
+
# Once you have the username, API Access Key, and your GatewayId, you're ready
|
21
|
+
# to begin. You initialize the Gateway like so:
|
22
|
+
#
|
23
|
+
# gateway = ActiveMerchant::Billing::ItransactGateway.new(
|
24
|
+
# :login => "#{THE_USERNAME}",
|
25
|
+
# :password => "#{THE_API_ACCESS_KEY}",
|
26
|
+
# :gateway_id => "#{THE_GATEWAY_ID}"
|
27
|
+
# )
|
28
|
+
#
|
29
|
+
# ==== Important Notes
|
30
|
+
# 1. Recurring is not implemented
|
31
|
+
# 1. CreditTransactions are not implemented (these are credits not related to a previously run transaction).
|
32
|
+
# 1. TransactionStatus is not implemented
|
33
|
+
#
|
34
|
+
class ItransactGateway < Gateway
|
35
|
+
self.live_url = self.test_url = 'https://secure.paymentclearing.com/cgi-bin/rc/xmltrans2.cgi'
|
36
|
+
|
37
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
38
|
+
self.supported_countries = ['US']
|
39
|
+
|
40
|
+
# The card types supported by the payment gateway
|
41
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
42
|
+
|
43
|
+
# The homepage URL of the gateway
|
44
|
+
self.homepage_url = 'http://www.itransact.com/'
|
45
|
+
|
46
|
+
# The name of the gateway
|
47
|
+
self.display_name = 'iTransact'
|
48
|
+
|
49
|
+
#
|
50
|
+
# Creates a new instance of the iTransact Gateway.
|
51
|
+
#
|
52
|
+
# ==== Parameters
|
53
|
+
# * <tt>options</tt> - A Hash of options
|
54
|
+
#
|
55
|
+
# ==== Options Hash
|
56
|
+
# * <tt>:login</tt> - A String containing your PaymentClearing assigned API Access Username
|
57
|
+
# * <tt>:password</tt> - A String containing your PaymentClearing assigned API Access Key
|
58
|
+
# * <tt>:gateway_id</tt> - A String containing your PaymentClearing assigned GatewayID
|
59
|
+
# * <tt>:test_mode</tt> - <tt>true</tt> or <tt>false</tt>. Run *all* transactions with the 'TestMode' element set to 'TRUE'.
|
60
|
+
#
|
61
|
+
def initialize(options = {})
|
62
|
+
requires!(options, :login, :password, :gateway_id)
|
63
|
+
super
|
64
|
+
end
|
65
|
+
|
66
|
+
# Performs an authorize transaction. In PaymentClearing's documentation
|
67
|
+
# this is known as a "PreAuth" transaction.
|
68
|
+
#
|
69
|
+
# ==== Parameters
|
70
|
+
# * <tt>money</tt> - The amount to be captured. Should be an Integer amount in cents.
|
71
|
+
# * <tt>creditcard</tt> - The CreditCard details for the transaction
|
72
|
+
# * <tt>options</tt> - A Hash of options
|
73
|
+
#
|
74
|
+
# ==== Options Hash
|
75
|
+
# The standard options apply here (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address), as well as:
|
76
|
+
# * <tt>:order_items</tt> - An Array of Hash objects with the keys <tt>:description</tt>, <tt>:cost</tt> (in cents!), and <tt>:quantity</tt>. If this is provided, <tt>:description</tt> and <tt>money</tt> will be ignored.
|
77
|
+
# * <tt>:vendor_data</tt> - An Array of Hash objects with the keys being the name of the VendorData element and value being the value.
|
78
|
+
# * <tt>:send_customer_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendCustomerEmail' element set to 'TRUE' or 'FALSE'.
|
79
|
+
# * <tt>:send_merchant_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendMerchantEmail' element set to 'TRUE' or 'FALSE'.
|
80
|
+
# * <tt>:email_text</tt> - An Array of (up to ten (10)) String objects to be included in emails
|
81
|
+
# * <tt>:test_mode</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'TestMode' element set to 'TRUE' or 'FALSE'.
|
82
|
+
#
|
83
|
+
# ==== Examples
|
84
|
+
# response = gateway.authorize(1000, creditcard,
|
85
|
+
# :order_id => '1212', :address => {...}, :email => 'test@test.com',
|
86
|
+
# :order_items => [
|
87
|
+
# {:description => 'Line Item 1', :cost => '8.98', :quantity => '6'},
|
88
|
+
# {:description => 'Line Item 2', :cost => '6.99', :quantity => '4'}
|
89
|
+
# ],
|
90
|
+
# :vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
|
91
|
+
# :send_customer_email => true,
|
92
|
+
# :send_merchant_email => true,
|
93
|
+
# :email_text => ['line1', 'line2', 'line3'],
|
94
|
+
# :test_mode => true
|
95
|
+
# )
|
96
|
+
#
|
97
|
+
def authorize(money, payment_source, options = {})
|
98
|
+
payload = Nokogiri::XML::Builder.new do |xml|
|
99
|
+
xml.AuthTransaction {
|
100
|
+
xml.Preauth
|
101
|
+
add_customer_data(xml, payment_source, options)
|
102
|
+
add_invoice(xml, money, options)
|
103
|
+
add_payment_source(xml, payment_source)
|
104
|
+
add_transaction_control(xml, options)
|
105
|
+
add_vendor_data(xml, options)
|
106
|
+
}
|
107
|
+
end.doc
|
108
|
+
|
109
|
+
commit(payload)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Performs an authorize and capture in single transaction. In PaymentClearing's
|
113
|
+
# documentation this is known as an "Auth" or a "Sale" transaction
|
114
|
+
#
|
115
|
+
# ==== Parameters
|
116
|
+
# * <tt>money</tt> - The amount to be captured. Should be <tt>nil</tt> or an Integer amount in cents.
|
117
|
+
# * <tt>creditcard</tt> - The CreditCard details for the transaction
|
118
|
+
# * <tt>options</tt> - A Hash of options
|
119
|
+
#
|
120
|
+
# ==== Options Hash
|
121
|
+
# The standard options apply here (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address), as well as:
|
122
|
+
# * <tt>:order_items</tt> - An Array of Hash objects with the keys <tt>:description</tt>, <tt>:cost</tt> (in cents!), and <tt>:quantity</tt>. If this is provided, <tt>:description</tt> and <tt>money</tt> will be ignored.
|
123
|
+
# * <tt>:vendor_data</tt> - An Array of Hash objects with the keys being the name of the VendorData element and value being the value.
|
124
|
+
# * <tt>:send_customer_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendCustomerEmail' element set to 'TRUE' or 'FALSE'.
|
125
|
+
# * <tt>:send_merchant_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendMerchantEmail' element set to 'TRUE' or 'FALSE'.
|
126
|
+
# * <tt>:email_text</tt> - An Array of (up to ten (10)) String objects to be included in emails
|
127
|
+
# * <tt>:test_mode</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'TestMode' element set to 'TRUE' or 'FALSE'.
|
128
|
+
#
|
129
|
+
# ==== Examples
|
130
|
+
# response = gateway.purchase(1000, creditcard,
|
131
|
+
# :order_id => '1212', :address => {...}, :email => 'test@test.com',
|
132
|
+
# :order_items => [
|
133
|
+
# {:description => 'Line Item 1', :cost => '8.98', :quantity => '6'},
|
134
|
+
# {:description => 'Line Item 2', :cost => '6.99', :quantity => '4'}
|
135
|
+
# ],
|
136
|
+
# :vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
|
137
|
+
# :send_customer_email => true,
|
138
|
+
# :send_merchant_email => true,
|
139
|
+
# :email_text => ['line1', 'line2', 'line3'],
|
140
|
+
# :test_mode => true
|
141
|
+
# )
|
142
|
+
#
|
143
|
+
def purchase(money, payment_source, options = {})
|
144
|
+
payload = Nokogiri::XML::Builder.new do |xml|
|
145
|
+
xml.AuthTransaction {
|
146
|
+
add_customer_data(xml, payment_source, options)
|
147
|
+
add_invoice(xml, money, options)
|
148
|
+
add_payment_source(xml, payment_source)
|
149
|
+
add_transaction_control(xml, options)
|
150
|
+
add_vendor_data(xml, options)
|
151
|
+
}
|
152
|
+
end.doc
|
153
|
+
|
154
|
+
commit(payload)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Captures the funds from an authorize transaction. In PaymentClearing's
|
158
|
+
# documentation this is known as a "PostAuth" transaction.
|
159
|
+
#
|
160
|
+
# ==== Parameters
|
161
|
+
# * <tt>money</tt> - The amount to be captured. Should be an Integer amount in cents
|
162
|
+
# * <tt>authorization</tt> - The authorization returned from the previous capture or purchase request
|
163
|
+
# * <tt>options</tt> - A Hash of options, all are optional.
|
164
|
+
#
|
165
|
+
# ==== Options Hash
|
166
|
+
# The standard options apply here (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address), as well as:
|
167
|
+
# * <tt>:vendor_data</tt> - An Array of Hash objects with the keys being the name of the VendorData element and value being the value.
|
168
|
+
# * <tt>:send_customer_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendCustomerEmail' element set to 'TRUE' or 'FALSE'.
|
169
|
+
# * <tt>:send_merchant_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendMerchantEmail' element set to 'TRUE' or 'FALSE'.
|
170
|
+
# * <tt>:email_text</tt> - An Array of (up to ten (10)) String objects to be included in emails
|
171
|
+
# * <tt>:test_mode</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'TestMode' element set to 'TRUE' or 'FALSE'.
|
172
|
+
#
|
173
|
+
# ==== Examples
|
174
|
+
# response = gateway.capture(1000, creditcard,
|
175
|
+
# :vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
|
176
|
+
# :send_customer_email => true,
|
177
|
+
# :send_merchant_email => true,
|
178
|
+
# :email_text => ['line1', 'line2', 'line3'],
|
179
|
+
# :test_mode => true
|
180
|
+
# )
|
181
|
+
#
|
182
|
+
def capture(money, authorization, options = {})
|
183
|
+
payload = Nokogiri::XML::Builder.new do |xml|
|
184
|
+
xml.PostAuthTransaction {
|
185
|
+
xml.OperationXID(authorization)
|
186
|
+
add_invoice(xml, money, options)
|
187
|
+
add_transaction_control(xml, options)
|
188
|
+
add_vendor_data(xml, options)
|
189
|
+
}
|
190
|
+
end.doc
|
191
|
+
|
192
|
+
commit(payload)
|
193
|
+
end
|
194
|
+
|
195
|
+
# This will reverse a previously run transaction which *has* *not* settled.
|
196
|
+
#
|
197
|
+
# ==== Parameters
|
198
|
+
# * <tt>authorization</tt> - The authorization returned from the previous capture or purchase request
|
199
|
+
# * <tt>options</tt> - A Hash of options, all are optional
|
200
|
+
#
|
201
|
+
# ==== Options Hash
|
202
|
+
# The standard options (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address) are ignored.
|
203
|
+
# * <tt>:vendor_data</tt> - An Array of Hash objects with the keys being the name of the VendorData element and value being the value.
|
204
|
+
# * <tt>:send_customer_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendCustomerEmail' element set to 'TRUE' or 'FALSE'.
|
205
|
+
# * <tt>:send_merchant_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendMerchantEmail' element set to 'TRUE' or 'FALSE'.
|
206
|
+
# * <tt>:email_text</tt> - An Array of (up to ten (10)) String objects to be included in emails
|
207
|
+
# * <tt>:test_mode</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'TestMode' element set to 'TRUE' or 'FALSE'.
|
208
|
+
#
|
209
|
+
# ==== Examples
|
210
|
+
# response = gateway.void('9999999999',
|
211
|
+
# :vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
|
212
|
+
# :send_customer_email => true,
|
213
|
+
# :send_merchant_email => true,
|
214
|
+
# :email_text => ['line1', 'line2', 'line3'],
|
215
|
+
# :test_mode => true
|
216
|
+
# )
|
217
|
+
#
|
218
|
+
def void(authorization, options = {})
|
219
|
+
payload = Nokogiri::XML::Builder.new do |xml|
|
220
|
+
xml.VoidTransaction {
|
221
|
+
xml.OperationXID(authorization)
|
222
|
+
add_transaction_control(xml, options)
|
223
|
+
add_vendor_data(xml, options)
|
224
|
+
}
|
225
|
+
end.doc
|
226
|
+
|
227
|
+
commit(payload)
|
228
|
+
end
|
229
|
+
|
230
|
+
# This will reverse a previously run transaction which *has* settled.
|
231
|
+
#
|
232
|
+
# ==== Parameters
|
233
|
+
# * <tt>money</tt> - The amount to be credited. Should be an Integer amount in cents
|
234
|
+
# * <tt>authorization</tt> - The authorization returned from the previous capture or purchase request
|
235
|
+
# * <tt>options</tt> - A Hash of options, all are optional
|
236
|
+
#
|
237
|
+
# ==== Options Hash
|
238
|
+
# The standard options (:order_id, :ip, :customer, :invoice, :merchant, :description, :email, :currency, :address, :billing_address, :shipping_address) are ignored.
|
239
|
+
# * <tt>:vendor_data</tt> - An Array of Hash objects with the keys being the name of the VendorData element and value being the value.
|
240
|
+
# * <tt>:send_customer_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendCustomerEmail' element set to 'TRUE' or 'FALSE'.
|
241
|
+
# * <tt>:send_merchant_email</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'SendMerchantEmail' element set to 'TRUE' or 'FALSE'.
|
242
|
+
# * <tt>:email_text</tt> - An Array of (up to ten (10)) String objects to be included in emails
|
243
|
+
# * <tt>:test_mode</tt> - <tt>true</tt> or <tt>false</tt>. Runs the transaction with the 'TestMode' element set to 'TRUE' or 'FALSE'.
|
244
|
+
#
|
245
|
+
# ==== Examples
|
246
|
+
# response = gateway.refund(555, '9999999999',
|
247
|
+
# :vendor_data => [{'repId' => '1234567'}, {'customerId' => '9886'}],
|
248
|
+
# :send_customer_email => true,
|
249
|
+
# :send_merchant_email => true,
|
250
|
+
# :email_text => ['line1', 'line2', 'line3'],
|
251
|
+
# :test_mode => true
|
252
|
+
# )
|
253
|
+
#
|
254
|
+
def refund(money, authorization, options = {})
|
255
|
+
payload = Nokogiri::XML::Builder.new do |xml|
|
256
|
+
xml.TranCredTransaction {
|
257
|
+
xml.OperationXID(authorization)
|
258
|
+
add_invoice(xml, money, options)
|
259
|
+
add_transaction_control(xml, options)
|
260
|
+
add_vendor_data(xml, options)
|
261
|
+
}
|
262
|
+
end.doc
|
263
|
+
|
264
|
+
commit(payload)
|
265
|
+
end
|
266
|
+
|
267
|
+
private
|
268
|
+
|
269
|
+
def add_customer_data(xml, payment_source, options)
|
270
|
+
billing_address = options[:billing_address] || options[:address]
|
271
|
+
shipping_address = options[:shipping_address] || options[:address]
|
272
|
+
|
273
|
+
xml.CustomerData {
|
274
|
+
xml.Email(options[:email]) unless options[:email].blank?
|
275
|
+
xml.CustId(options[:order_id]) unless options[:order_id].blank?
|
276
|
+
xml.BillingAddress {
|
277
|
+
xml.FirstName(payment_source.first_name || parse_first_name(billing_address[:name]))
|
278
|
+
xml.LastName(payment_source.last_name || parse_last_name(billing_address[:name]))
|
279
|
+
xml.Address1(billing_address[:address1])
|
280
|
+
xml.Address2(billing_address[:address2]) unless billing_address[:address2].blank?
|
281
|
+
xml.City(billing_address[:city])
|
282
|
+
xml.State(billing_address[:state])
|
283
|
+
xml.Zip(billing_address[:zip])
|
284
|
+
xml.Country(billing_address[:country])
|
285
|
+
xml.Phone(billing_address[:phone])
|
286
|
+
}
|
287
|
+
xml.ShippingAddress {
|
288
|
+
xml.FirstName(payment_source.first_name || parse_first_name(shipping_address[:name]))
|
289
|
+
xml.LastName(payment_source.last_name || parse_last_name(shipping_address[:name]))
|
290
|
+
xml.Address1(shipping_address[:address1])
|
291
|
+
xml.Address2(shipping_address[:address2]) unless shipping_address[:address2].blank?
|
292
|
+
xml.City(shipping_address[:city])
|
293
|
+
xml.State(shipping_address[:state])
|
294
|
+
xml.Zip(shipping_address[:zip])
|
295
|
+
xml.Country(shipping_address[:country])
|
296
|
+
xml.Phone(shipping_address[:phone])
|
297
|
+
} unless shipping_address.blank?
|
298
|
+
}
|
299
|
+
end
|
300
|
+
|
301
|
+
def add_invoice(xml, money, options)
|
302
|
+
xml.AuthCode options[:force] if options[:force]
|
303
|
+
if options[:order_items].blank?
|
304
|
+
xml.Total(amount(money)) unless money.nil? || money < 0.01
|
305
|
+
xml.Description(options[:description]) unless options[:description].blank?
|
306
|
+
else
|
307
|
+
xml.OrderItems {
|
308
|
+
options[:order_items].each do |item|
|
309
|
+
xml.Item {
|
310
|
+
xml.Description(item[:description])
|
311
|
+
xml.Cost(amount(item[:cost]))
|
312
|
+
xml.Qty(item[:quantity].to_s)
|
313
|
+
}
|
314
|
+
end
|
315
|
+
}
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
def add_payment_source(xml, source)
|
320
|
+
case determine_funding_source(source)
|
321
|
+
when :credit_card then add_creditcard(xml, source)
|
322
|
+
when :check then add_check(xml, source)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
def determine_funding_source(payment_source)
|
327
|
+
case payment_source
|
328
|
+
when ActiveMerchant::Billing::CreditCard
|
329
|
+
:credit_card
|
330
|
+
when ActiveMerchant::Billing::Check
|
331
|
+
:check
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
def add_creditcard(xml, creditcard)
|
336
|
+
xml.AccountInfo {
|
337
|
+
xml.CardAccount {
|
338
|
+
xml.AccountNumber(creditcard.number.to_s)
|
339
|
+
xml.ExpirationMonth(creditcard.month.to_s.rjust(2, '0'))
|
340
|
+
xml.ExpirationYear(creditcard.year.to_s)
|
341
|
+
xml.CVVNumber(creditcard.verification_value.to_s) unless creditcard.verification_value.blank?
|
342
|
+
}
|
343
|
+
}
|
344
|
+
end
|
345
|
+
|
346
|
+
def add_check(xml, check)
|
347
|
+
xml.AccountInfo {
|
348
|
+
xml.ABA(check.routing_number.to_s)
|
349
|
+
xml.AccountNumber(check.account_number.to_s)
|
350
|
+
xml.AccountSource(check.account_type.to_s)
|
351
|
+
xml.AccountType(check.account_holder_type.to_s)
|
352
|
+
xml.CheckNumber(check.number.to_s)
|
353
|
+
}
|
354
|
+
end
|
355
|
+
|
356
|
+
def add_transaction_control(xml, options)
|
357
|
+
xml.TransactionControl {
|
358
|
+
# if there was a 'global' option set...
|
359
|
+
xml.TestMode(@options[:test_mode].upcase) if !@options[:test_mode].blank?
|
360
|
+
# allow the global option to be overridden...
|
361
|
+
xml.TestMode(options[:test_mode].upcase) if !options[:test_mode].blank?
|
362
|
+
xml.SendCustomerEmail(options[:send_customer_email].upcase) unless options[:send_customer_email].blank?
|
363
|
+
xml.SendMerchantEmail(options[:send_merchant_email].upcase) unless options[:send_merchant_email].blank?
|
364
|
+
xml.EmailText {
|
365
|
+
options[:email_text].each do |item|
|
366
|
+
xml.EmailTextItem(item)
|
367
|
+
end
|
368
|
+
} if options[:email_text]
|
369
|
+
}
|
370
|
+
end
|
371
|
+
|
372
|
+
def add_vendor_data(xml, options)
|
373
|
+
return if options[:vendor_data].blank?
|
374
|
+
|
375
|
+
xml.VendorData {
|
376
|
+
options[:vendor_data].each do |k, v|
|
377
|
+
xml.Element {
|
378
|
+
xml.Name(k)
|
379
|
+
xml.Key(v)
|
380
|
+
}
|
381
|
+
end
|
382
|
+
}
|
383
|
+
end
|
384
|
+
|
385
|
+
def commit(payload)
|
386
|
+
# Set the Content-Type header -- otherwise the URL decoding messes up
|
387
|
+
# the Base64 encoded payload signature!
|
388
|
+
response = parse(ssl_post(self.live_url, post_data(payload), 'Content-Type' => 'text/xml'))
|
389
|
+
|
390
|
+
Response.new(successful?(response), response[:error_message], response,
|
391
|
+
test: test?,
|
392
|
+
authorization: response[:xid],
|
393
|
+
avs_result: { code: response[:avs_response] },
|
394
|
+
cvv_result: response[:cvv_response])
|
395
|
+
end
|
396
|
+
|
397
|
+
def post_data(payload)
|
398
|
+
payload_xml = payload.root.to_xml(indent: 0)
|
399
|
+
|
400
|
+
payload_signature = sign_payload(payload_xml)
|
401
|
+
|
402
|
+
request = Nokogiri::XML::Builder.new do |xml|
|
403
|
+
xml.GatewayInterface {
|
404
|
+
xml.APICredentials {
|
405
|
+
xml.Username(@options[:login])
|
406
|
+
xml.PayloadSignature(payload_signature)
|
407
|
+
xml.TargetGateway(@options[:gateway_id])
|
408
|
+
}
|
409
|
+
}
|
410
|
+
end.doc
|
411
|
+
|
412
|
+
request.root.children.first.after payload.root
|
413
|
+
request.to_xml(indent: 0)
|
414
|
+
end
|
415
|
+
|
416
|
+
def parse(raw_xml)
|
417
|
+
doc = REXML::Document.new(raw_xml)
|
418
|
+
response = Hash.new
|
419
|
+
transaction_result = doc.root.get_elements('TransactionResponse/TransactionResult/*')
|
420
|
+
transaction_result.each do |e|
|
421
|
+
response[e.name.to_s.underscore.to_sym] = e.text unless e.text.blank?
|
422
|
+
end
|
423
|
+
response
|
424
|
+
end
|
425
|
+
|
426
|
+
def successful?(response)
|
427
|
+
# Turns out the PaymentClearing gateway is not consistent...
|
428
|
+
response[:status].casecmp('ok').zero?
|
429
|
+
end
|
430
|
+
|
431
|
+
def test_mode?(response)
|
432
|
+
# The '1' is a legacy thing; most of the time it should be 'TRUE'...
|
433
|
+
response[:test_mode] == 'TRUE' || response[:test_mode] == '1'
|
434
|
+
end
|
435
|
+
|
436
|
+
def message_from(response)
|
437
|
+
response[:error_message]
|
438
|
+
end
|
439
|
+
|
440
|
+
def sign_payload(payload)
|
441
|
+
key = @options[:password].to_s
|
442
|
+
digest = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new(key), key, payload)
|
443
|
+
signature = Base64.encode64(digest)
|
444
|
+
signature.chomp!
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|