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,295 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
#
|
4
|
+
# ActiveMerchant PSL Card Gateway
|
5
|
+
#
|
6
|
+
# Notes:
|
7
|
+
# -To be able to use the capture function, the IP address of the machine must be
|
8
|
+
# registered with PSL
|
9
|
+
# -ESALE_KEYED should only be used in situations where the cardholder perceives the
|
10
|
+
# transaction to be Internet-based, such as purchasing from a web site/on-line store.
|
11
|
+
# If the Internet is used purely for the transport of information from the merchant
|
12
|
+
# directly to the gateway then the appropriate cardholder present or not present message
|
13
|
+
# type should be used rather than the ‘E’ equivalent.
|
14
|
+
# -The CV2 / AVS policies are set up with the account settings when signing up for an account
|
15
|
+
class PslCardGateway < Gateway
|
16
|
+
self.money_format = :cents
|
17
|
+
self.default_currency = 'GBP'
|
18
|
+
|
19
|
+
self.supported_countries = ['GB']
|
20
|
+
# Visa Credit, Visa Debit, Mastercard, Maestro, Electron,
|
21
|
+
# American Express, Diners Club, JCB, International Maestro,
|
22
|
+
# Style, Clydesdale Financial Services, Other
|
23
|
+
|
24
|
+
self.supported_cardtypes = %i[visa master american_express diners_club jcb maestro]
|
25
|
+
self.homepage_url = 'http://www.paymentsolutionsltd.com/'
|
26
|
+
self.display_name = 'PSL Payment Solutions'
|
27
|
+
|
28
|
+
# Default ISO 3166 country code (GB)
|
29
|
+
cattr_accessor :location
|
30
|
+
self.location = 826
|
31
|
+
|
32
|
+
# PslCard server self.live_url - The url is the same whether testing or live - use
|
33
|
+
# the test account when testing...
|
34
|
+
self.live_url = self.test_url = 'https://pslcard3.paymentsolutionsltd.com/secure/transact.asp?'
|
35
|
+
|
36
|
+
# eCommerce sale transaction, details keyed by merchant or cardholder
|
37
|
+
MESSAGE_TYPE = 'ESALE_KEYED'
|
38
|
+
|
39
|
+
# The type of response that we want to get from PSL, options are HTML, XML or REDIRECT
|
40
|
+
RESPONSE_ACTION = 'HTML'
|
41
|
+
|
42
|
+
# Currency Codes
|
43
|
+
CURRENCY_CODES = {
|
44
|
+
'AUD' => 036,
|
45
|
+
'GBP' => 826,
|
46
|
+
'USD' => 840
|
47
|
+
}
|
48
|
+
|
49
|
+
# The terminal used - only for swipe transactions, so hard coded to 32 for online
|
50
|
+
EMV_TERMINAL_TYPE = 32
|
51
|
+
|
52
|
+
# Different Dispatch types
|
53
|
+
DISPATCH_LATER = 'LATER'
|
54
|
+
DISPATCH_NOW = 'NOW'
|
55
|
+
|
56
|
+
# Return codes
|
57
|
+
APPROVED = '00'
|
58
|
+
|
59
|
+
# Nominal amount to authorize for a 'dispatch later' type
|
60
|
+
# The nominal amount is held straight away, when the goods are ready
|
61
|
+
# to be dispatched, PSL is informed and the full amount is the
|
62
|
+
# taken.
|
63
|
+
NOMINAL_AMOUNT = 101
|
64
|
+
|
65
|
+
AVS_CODE = {
|
66
|
+
'ALL MATCH' => 'Y',
|
67
|
+
'SECURITY CODE MATCH ONLY' => 'N',
|
68
|
+
'ADDRESS MATCH ONLY' => 'Y',
|
69
|
+
'NO DATA MATCHES' => 'N',
|
70
|
+
'DATA NOT CHECKED' => 'R',
|
71
|
+
'SECURITY CHECKS NOT SUPPORTED' => 'X'
|
72
|
+
}
|
73
|
+
|
74
|
+
CVV_CODE = {
|
75
|
+
'ALL MATCH' => 'M',
|
76
|
+
'SECURITY CODE MATCH ONLY' => 'M',
|
77
|
+
'ADDRESS MATCH ONLY' => 'N',
|
78
|
+
'NO DATA MATCHES' => 'N',
|
79
|
+
'DATA NOT CHECKED' => 'P',
|
80
|
+
'SECURITY CHECKS NOT SUPPORTED' => 'X'
|
81
|
+
}
|
82
|
+
|
83
|
+
# Create a new PslCardGateway
|
84
|
+
#
|
85
|
+
# The gateway requires that a valid :login be passed in the options hash
|
86
|
+
#
|
87
|
+
# Paramaters:
|
88
|
+
# -options:
|
89
|
+
# :login - the PslCard account login (required)
|
90
|
+
def initialize(options = {})
|
91
|
+
requires!(options, :login)
|
92
|
+
|
93
|
+
super
|
94
|
+
end
|
95
|
+
|
96
|
+
# Purchase the item straight away
|
97
|
+
#
|
98
|
+
# Parameters:
|
99
|
+
# -money: Amount to be charged as an Integer value in cents
|
100
|
+
# -authorization: the PSL cross reference from the previous authorization
|
101
|
+
# -options:
|
102
|
+
#
|
103
|
+
# Returns:
|
104
|
+
# -ActiveMerchant::Billing::Response object
|
105
|
+
#
|
106
|
+
def purchase(money, credit_card, options = {})
|
107
|
+
post = {}
|
108
|
+
|
109
|
+
add_amount(post, money, DISPATCH_NOW, options)
|
110
|
+
add_credit_card(post, credit_card)
|
111
|
+
add_address(post, options)
|
112
|
+
add_invoice(post, options)
|
113
|
+
add_purchase_details(post)
|
114
|
+
|
115
|
+
commit(post)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Authorize the transaction
|
119
|
+
#
|
120
|
+
# Reserves the funds on the customer's credit card, but does not
|
121
|
+
# charge the card.
|
122
|
+
#
|
123
|
+
# This implementation does not authorize the full amount, rather it checks that the full amount
|
124
|
+
# is available and only 'reserves' the nominal amount (currently a pound and a penny)
|
125
|
+
#
|
126
|
+
# Parameters:
|
127
|
+
# -money: Amount to be charged as an Integer value in cents
|
128
|
+
# -authorization: the PSL cross reference from the previous authorization
|
129
|
+
# -options:
|
130
|
+
#
|
131
|
+
# Returns:
|
132
|
+
# -ActiveMerchant::Billing::Response object
|
133
|
+
#
|
134
|
+
def authorize(money, credit_card, options = {})
|
135
|
+
post = {}
|
136
|
+
|
137
|
+
add_amount(post, money, DISPATCH_LATER, options)
|
138
|
+
add_credit_card(post, credit_card)
|
139
|
+
add_address(post, options)
|
140
|
+
add_invoice(post, options)
|
141
|
+
add_purchase_details(post)
|
142
|
+
|
143
|
+
commit(post)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Post an authorization.
|
147
|
+
#
|
148
|
+
# Captures the funds from an authorized transaction.
|
149
|
+
#
|
150
|
+
# Parameters:
|
151
|
+
# -money: Amount to be charged as an Integer value in cents
|
152
|
+
# -authorization: The PSL Cross Reference
|
153
|
+
# -options:
|
154
|
+
#
|
155
|
+
# Returns:
|
156
|
+
# -ActiveMerchant::Billing::Response object
|
157
|
+
#
|
158
|
+
def capture(money, authorization, options = {})
|
159
|
+
post = {}
|
160
|
+
|
161
|
+
add_amount(post, money, DISPATCH_NOW, options)
|
162
|
+
add_reference(post, authorization)
|
163
|
+
add_purchase_details(post)
|
164
|
+
|
165
|
+
commit(post)
|
166
|
+
end
|
167
|
+
|
168
|
+
private
|
169
|
+
|
170
|
+
def add_credit_card(post, credit_card)
|
171
|
+
post[:QAName] = credit_card.name
|
172
|
+
post[:CardNumber] = credit_card.number
|
173
|
+
post[:EMVTerminalType] = EMV_TERMINAL_TYPE
|
174
|
+
post[:ExpMonth] = credit_card.month
|
175
|
+
post[:ExpYear] = credit_card.year
|
176
|
+
|
177
|
+
# CV2 check
|
178
|
+
post[:AVSCV2Check] = credit_card.verification_value? ? 'YES' : 'NO'
|
179
|
+
post[:CV2] = credit_card.verification_value if credit_card.verification_value?
|
180
|
+
end
|
181
|
+
|
182
|
+
def add_address(post, options)
|
183
|
+
address = options[:billing_address] || options[:address]
|
184
|
+
return if address.nil?
|
185
|
+
|
186
|
+
post[:QAAddress] = %i[address1 address2 city state].collect { |a| address[a] }.reject(&:blank?).join(' ')
|
187
|
+
post[:QAPostcode] = address[:zip]
|
188
|
+
end
|
189
|
+
|
190
|
+
def add_invoice(post, options)
|
191
|
+
post[:MerchantName] = options[:merchant] || 'Merchant Name' # May use this as the order_id field
|
192
|
+
post[:OrderID] = options[:order_id] unless options[:order_id].blank?
|
193
|
+
end
|
194
|
+
|
195
|
+
def add_reference(post, authorization)
|
196
|
+
post[:CrossReference] = authorization
|
197
|
+
end
|
198
|
+
|
199
|
+
def add_amount(post, money, dispatch_type, options)
|
200
|
+
post[:CurrencyCode] = currency_code(options[:currency] || currency(money))
|
201
|
+
|
202
|
+
if dispatch_type == DISPATCH_LATER
|
203
|
+
post[:amount] = amount(NOMINAL_AMOUNT)
|
204
|
+
post[:DispatchLaterAmount] = amount(money)
|
205
|
+
else
|
206
|
+
post[:amount] = amount(money)
|
207
|
+
end
|
208
|
+
|
209
|
+
post[:Dispatch] = dispatch_type
|
210
|
+
end
|
211
|
+
|
212
|
+
def add_purchase_details(post)
|
213
|
+
post[:EchoAmount] = 'YES'
|
214
|
+
post[:SCBI] = 'YES' # Return information about the transaction
|
215
|
+
post[:MessageType] = MESSAGE_TYPE
|
216
|
+
end
|
217
|
+
|
218
|
+
# Get the currency code for the passed money object
|
219
|
+
#
|
220
|
+
# The money class stores the currency as an ISO 4217:2001 Alphanumeric,
|
221
|
+
# however PSL requires the ISO 4217:2001 Numeric code.
|
222
|
+
#
|
223
|
+
# Parameters:
|
224
|
+
# -money: Integer value in cents
|
225
|
+
#
|
226
|
+
# Returns:
|
227
|
+
# -the ISO 4217:2001 Numberic currency code
|
228
|
+
#
|
229
|
+
def currency_code(currency)
|
230
|
+
CURRENCY_CODES[currency]
|
231
|
+
end
|
232
|
+
|
233
|
+
# Parse the PSL response and create a Response object
|
234
|
+
#
|
235
|
+
# Parameters:
|
236
|
+
# -body: The response string returned from PSL, Formatted:
|
237
|
+
# Key=value&key=value...
|
238
|
+
#
|
239
|
+
# Returns:
|
240
|
+
# -a hash with all of the values returned in the PSL response
|
241
|
+
#
|
242
|
+
def parse(body)
|
243
|
+
fields = {}
|
244
|
+
for line in body.split('&')
|
245
|
+
key, value = *line.scan(%r{^(\w+)\=(.*)$}).flatten
|
246
|
+
fields[key] = CGI.unescape(value)
|
247
|
+
end
|
248
|
+
fields.symbolize_keys
|
249
|
+
end
|
250
|
+
|
251
|
+
# Send the passed data to PSL for processing
|
252
|
+
#
|
253
|
+
# Parameters:
|
254
|
+
# -request: The data that is to be sent to PSL
|
255
|
+
#
|
256
|
+
# Returns:
|
257
|
+
# - ActiveMerchant::Billing::Response object
|
258
|
+
#
|
259
|
+
def commit(request)
|
260
|
+
response = parse(ssl_post(self.live_url, post_data(request)))
|
261
|
+
|
262
|
+
Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
|
263
|
+
test: test?,
|
264
|
+
authorization: response[:CrossReference],
|
265
|
+
cvv_result: CVV_CODE[response[:AVSCV2Check]],
|
266
|
+
avs_result: { code: AVS_CODE[response[:AVSCV2Check]] })
|
267
|
+
end
|
268
|
+
|
269
|
+
# Put the passed data into a format that can be submitted to PSL
|
270
|
+
# Key=Value&Key=Value...
|
271
|
+
#
|
272
|
+
# Any ampersands and equal signs are removed from the data being posted
|
273
|
+
# as PSL puts them back into the response string which then cannot be parsed.
|
274
|
+
# This is after escaping before sending the request to PSL - this is a work
|
275
|
+
# around for the time being
|
276
|
+
#
|
277
|
+
# Parameters:
|
278
|
+
# -post: Hash of all the data to be sent
|
279
|
+
#
|
280
|
+
# Returns:
|
281
|
+
# -String: the data to be sent
|
282
|
+
#
|
283
|
+
def post_data(post)
|
284
|
+
post[:CountryCode] = self.location
|
285
|
+
post[:MerchantID] = @options[:login]
|
286
|
+
post[:ValidityID] = @options[:password]
|
287
|
+
post[:ResponseAction] = RESPONSE_ACTION
|
288
|
+
|
289
|
+
post.collect { |key, value|
|
290
|
+
"#{key}=#{CGI.escape(value.to_s.tr('&=', ' '))}"
|
291
|
+
}.join('&')
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
@@ -0,0 +1,302 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class QbmsGateway < Gateway
|
4
|
+
API_VERSION = '4.0'
|
5
|
+
|
6
|
+
class_attribute :test_url, :live_url
|
7
|
+
|
8
|
+
self.test_url = 'https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway'
|
9
|
+
self.live_url = 'https://webmerchantaccount.quickbooks.com/j/AppGateway'
|
10
|
+
|
11
|
+
self.homepage_url = 'http://payments.intuit.com/'
|
12
|
+
self.display_name = 'QuickBooks Merchant Services'
|
13
|
+
self.default_currency = 'USD'
|
14
|
+
self.supported_cardtypes = %i[visa master discover american_express diners_club jcb]
|
15
|
+
self.supported_countries = ['US']
|
16
|
+
|
17
|
+
TYPES = {
|
18
|
+
authorize: 'CustomerCreditCardAuth',
|
19
|
+
capture: 'CustomerCreditCardCapture',
|
20
|
+
purchase: 'CustomerCreditCardCharge',
|
21
|
+
refund: 'CustomerCreditCardTxnVoidOrRefund',
|
22
|
+
void: 'CustomerCreditCardTxnVoid',
|
23
|
+
query: 'MerchantAccountQuery'
|
24
|
+
}
|
25
|
+
|
26
|
+
# Creates a new QbmsGateway
|
27
|
+
#
|
28
|
+
# The gateway requires that a valid app id, app login, and ticket be passed
|
29
|
+
# in the +options+ hash.
|
30
|
+
#
|
31
|
+
# ==== Options
|
32
|
+
#
|
33
|
+
# * <tt>:login</tt> -- The App Login (REQUIRED)
|
34
|
+
# * <tt>:ticket</tt> -- The Connection Ticket. (REQUIRED)
|
35
|
+
# * <tt>:pem</tt> -- The PEM-encoded SSL client key and certificate. (REQUIRED)
|
36
|
+
# * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
|
37
|
+
# Otherwise, perform transactions against the production server.
|
38
|
+
#
|
39
|
+
def initialize(options = {})
|
40
|
+
requires!(options, :login, :ticket)
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
44
|
+
# Performs an authorization, which reserves the funds on the customer's credit card, but does not
|
45
|
+
# charge the card.
|
46
|
+
#
|
47
|
+
# ==== Parameters
|
48
|
+
#
|
49
|
+
# * <tt>money</tt> -- The amount to be authorized as an Integer value in cents.
|
50
|
+
# * <tt>creditcard</tt> -- The CreditCard details for the transaction.
|
51
|
+
# * <tt>options</tt> -- A hash of optional parameters.
|
52
|
+
#
|
53
|
+
def authorize(money, creditcard, options = {})
|
54
|
+
commit(:authorize, money, options.merge(credit_card: creditcard))
|
55
|
+
end
|
56
|
+
|
57
|
+
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
58
|
+
#
|
59
|
+
# ==== Parameters
|
60
|
+
#
|
61
|
+
# * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
|
62
|
+
# * <tt>creditcard</tt> -- The CreditCard details for the transaction.
|
63
|
+
# * <tt>options</tt> -- A hash of optional parameters.
|
64
|
+
#
|
65
|
+
def purchase(money, creditcard, options = {})
|
66
|
+
commit(:purchase, money, options.merge(credit_card: creditcard))
|
67
|
+
end
|
68
|
+
|
69
|
+
# Captures the funds from an authorized transaction.
|
70
|
+
#
|
71
|
+
# ==== Parameters
|
72
|
+
#
|
73
|
+
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
74
|
+
# * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
|
75
|
+
#
|
76
|
+
def capture(money, authorization, options = {})
|
77
|
+
commit(:capture, money, options.merge(transaction_id: authorization))
|
78
|
+
end
|
79
|
+
|
80
|
+
# Void a previous transaction
|
81
|
+
#
|
82
|
+
# ==== Parameters
|
83
|
+
#
|
84
|
+
# * <tt>authorization</tt> - The authorization returned from the previous authorize request.
|
85
|
+
#
|
86
|
+
def void(authorization, options = {})
|
87
|
+
commit(:void, nil, options.merge(transaction_id: authorization))
|
88
|
+
end
|
89
|
+
|
90
|
+
# Credit an account.
|
91
|
+
#
|
92
|
+
# This transaction is also referred to as a Refund and indicates to the gateway that
|
93
|
+
# money should flow from the merchant to the customer.
|
94
|
+
#
|
95
|
+
# ==== Parameters
|
96
|
+
#
|
97
|
+
# * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
|
98
|
+
# * <tt>identification</tt> -- The ID of the original transaction against which the credit is being issued.
|
99
|
+
# * <tt>options</tt> -- A hash of parameters.
|
100
|
+
#
|
101
|
+
#
|
102
|
+
def credit(money, identification, options = {})
|
103
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
104
|
+
refund(money, identification, {})
|
105
|
+
end
|
106
|
+
|
107
|
+
def refund(money, identification, options = {})
|
108
|
+
commit(:refund, money, options.merge(transaction_id: identification))
|
109
|
+
end
|
110
|
+
|
111
|
+
# Query the merchant account status
|
112
|
+
def query
|
113
|
+
commit(:query, nil, {})
|
114
|
+
end
|
115
|
+
|
116
|
+
def supports_scrubbing?
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
def scrub(transcript)
|
121
|
+
transcript.
|
122
|
+
gsub(%r((<ConnectionTicket>)[^<]*(</ConnectionTicket>))i, '\1[FILTERED]\2').
|
123
|
+
gsub(%r((<CreditCardNumber>)[^<]*(</CreditCardNumber>))i, '\1[FILTERED]\2').
|
124
|
+
gsub(%r((<CardSecurityCode>)[^<]*(</CardSecurityCode>))i, '\1[FILTERED]\2')
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def hosted?
|
130
|
+
@options[:pem]
|
131
|
+
end
|
132
|
+
|
133
|
+
def commit(action, money, parameters)
|
134
|
+
url = test? ? self.test_url : self.live_url
|
135
|
+
|
136
|
+
type = TYPES[action]
|
137
|
+
parameters[:trans_request_id] ||= SecureRandom.hex(10)
|
138
|
+
|
139
|
+
req = build_request(type, money, parameters)
|
140
|
+
|
141
|
+
data = ssl_post(url, req, 'Content-Type' => 'application/x-qbmsxml')
|
142
|
+
response = parse(type, data)
|
143
|
+
message = (response[:status_message] || '').strip
|
144
|
+
|
145
|
+
Response.new(success?(response), message, response,
|
146
|
+
test: test?,
|
147
|
+
authorization: response[:credit_card_trans_id],
|
148
|
+
fraud_review: fraud_review?(response),
|
149
|
+
avs_result: { code: avs_result(response) },
|
150
|
+
cvv_result: cvv_result(response))
|
151
|
+
end
|
152
|
+
|
153
|
+
def success?(response)
|
154
|
+
response[:status_code] == 0
|
155
|
+
end
|
156
|
+
|
157
|
+
def fraud_review?(response)
|
158
|
+
[10100, 10101].member? response[:status_code]
|
159
|
+
end
|
160
|
+
|
161
|
+
def parse(type, body)
|
162
|
+
xml = REXML::Document.new(body)
|
163
|
+
|
164
|
+
signon = REXML::XPath.first(xml, "//SignonMsgsRs/#{hosted? ? 'SignonAppCertRs' : 'SignonDesktopRs'}")
|
165
|
+
status_code = signon.attributes['statusCode'].to_i
|
166
|
+
|
167
|
+
if status_code != 0
|
168
|
+
return {
|
169
|
+
status_code: status_code,
|
170
|
+
status_message: signon.attributes['statusMessage']
|
171
|
+
}
|
172
|
+
end
|
173
|
+
|
174
|
+
response = REXML::XPath.first(xml, "//QBMSXMLMsgsRs/#{type}Rs")
|
175
|
+
|
176
|
+
results = {
|
177
|
+
status_code: response.attributes['statusCode'].to_i,
|
178
|
+
status_message: response.attributes['statusMessage']
|
179
|
+
}
|
180
|
+
|
181
|
+
response.elements.each do |e|
|
182
|
+
name = e.name.underscore.to_sym
|
183
|
+
value = e.text()
|
184
|
+
|
185
|
+
if old_value = results[name]
|
186
|
+
results[name] = [old_value] if !old_value.kind_of?(Array)
|
187
|
+
results[name] << value
|
188
|
+
else
|
189
|
+
results[name] = value
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
results
|
194
|
+
end
|
195
|
+
|
196
|
+
def build_request(type, money, parameters = {})
|
197
|
+
xml = Builder::XmlMarkup.new(indent: 0)
|
198
|
+
|
199
|
+
xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
200
|
+
xml.instruct!(:qbmsxml, version: API_VERSION)
|
201
|
+
|
202
|
+
xml.tag!('QBMSXML') do
|
203
|
+
xml.tag!('SignonMsgsRq') do
|
204
|
+
xml.tag!(hosted? ? 'SignonAppCertRq' : 'SignonDesktopRq') do
|
205
|
+
xml.tag!('ClientDateTime', Time.now.xmlschema)
|
206
|
+
xml.tag!('ApplicationLogin', @options[:login])
|
207
|
+
xml.tag!('ConnectionTicket', @options[:ticket])
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
xml.tag!('QBMSXMLMsgsRq') do
|
212
|
+
xml.tag!("#{type}Rq") do
|
213
|
+
method("build_#{type}").call(xml, money, parameters)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
xml.target!
|
219
|
+
end
|
220
|
+
|
221
|
+
def build_CustomerCreditCardAuth(xml, money, parameters)
|
222
|
+
cc = parameters[:credit_card]
|
223
|
+
name = "#{cc.first_name} #{cc.last_name}"[0...30]
|
224
|
+
|
225
|
+
xml.tag!('TransRequestID', parameters[:trans_request_id])
|
226
|
+
xml.tag!('CreditCardNumber', cc.number)
|
227
|
+
xml.tag!('ExpirationMonth', cc.month)
|
228
|
+
xml.tag!('ExpirationYear', cc.year)
|
229
|
+
xml.tag!('IsECommerce', 'true')
|
230
|
+
xml.tag!('Amount', amount(money))
|
231
|
+
xml.tag!('NameOnCard', name)
|
232
|
+
add_address(xml, parameters)
|
233
|
+
xml.tag!('CardSecurityCode', cc.verification_value) if cc.verification_value?
|
234
|
+
end
|
235
|
+
|
236
|
+
def build_CustomerCreditCardCapture(xml, money, parameters)
|
237
|
+
xml.tag!('TransRequestID', parameters[:trans_request_id])
|
238
|
+
xml.tag!('CreditCardTransID', parameters[:transaction_id])
|
239
|
+
xml.tag!('Amount', amount(money))
|
240
|
+
end
|
241
|
+
|
242
|
+
def build_CustomerCreditCardCharge(xml, money, parameters)
|
243
|
+
cc = parameters[:credit_card]
|
244
|
+
name = "#{cc.first_name} #{cc.last_name}"[0...30]
|
245
|
+
|
246
|
+
xml.tag!('TransRequestID', parameters[:trans_request_id])
|
247
|
+
xml.tag!('CreditCardNumber', cc.number)
|
248
|
+
xml.tag!('ExpirationMonth', cc.month)
|
249
|
+
xml.tag!('ExpirationYear', cc.year)
|
250
|
+
xml.tag!('IsECommerce', 'true')
|
251
|
+
xml.tag!('Amount', amount(money))
|
252
|
+
xml.tag!('NameOnCard', name)
|
253
|
+
add_address(xml, parameters)
|
254
|
+
xml.tag!('CardSecurityCode', cc.verification_value) if cc.verification_value?
|
255
|
+
end
|
256
|
+
|
257
|
+
def build_CustomerCreditCardTxnVoidOrRefund(xml, money, parameters)
|
258
|
+
xml.tag!('TransRequestID', parameters[:trans_request_id])
|
259
|
+
xml.tag!('CreditCardTransID', parameters[:transaction_id])
|
260
|
+
xml.tag!('Amount', amount(money))
|
261
|
+
end
|
262
|
+
|
263
|
+
def build_CustomerCreditCardTxnVoid(xml, money, parameters)
|
264
|
+
xml.tag!('TransRequestID', parameters[:trans_request_id])
|
265
|
+
xml.tag!('CreditCardTransID', parameters[:transaction_id])
|
266
|
+
end
|
267
|
+
|
268
|
+
# Called reflectively by build_request
|
269
|
+
def build_MerchantAccountQuery(xml, money, parameters)
|
270
|
+
end
|
271
|
+
|
272
|
+
def add_address(xml, parameters)
|
273
|
+
if address = parameters[:billing_address] || parameters[:address]
|
274
|
+
xml.tag!('CreditCardAddress', (address[:address1] || '')[0...30])
|
275
|
+
xml.tag!('CreditCardPostalCode', (address[:zip] || '')[0...9])
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def cvv_result(response)
|
280
|
+
case response[:card_security_code_match]
|
281
|
+
when 'Pass' then 'M'
|
282
|
+
when 'Fail' then 'N'
|
283
|
+
when 'NotAvailable' then 'P'
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def avs_result(response)
|
288
|
+
case "#{response[:avs_street]}|#{response[:avs_zip]}"
|
289
|
+
when 'Pass|Pass' then 'D'
|
290
|
+
when 'Pass|Fail' then 'A'
|
291
|
+
when 'Pass|NotAvailable' then 'B'
|
292
|
+
when 'Fail|Pass' then 'Z'
|
293
|
+
when 'Fail|Fail' then 'C'
|
294
|
+
when 'Fail|NotAvailable' then 'N'
|
295
|
+
when 'NotAvailable|Pass' then 'P'
|
296
|
+
when 'NotAvailable|Fail' then 'N'
|
297
|
+
when 'NotAvailable|NotAvailable' then 'U'
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|