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,260 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class SecureNetGateway < Gateway
|
4
|
+
API_VERSION = '4.0'
|
5
|
+
|
6
|
+
TRANSACTIONS = {
|
7
|
+
auth_only: '0000',
|
8
|
+
auth_capture: '0100',
|
9
|
+
prior_auth_capture: '0200',
|
10
|
+
void: '0400',
|
11
|
+
credit: '0500'
|
12
|
+
}
|
13
|
+
|
14
|
+
XML_ATTRIBUTES = {
|
15
|
+
'xmlns' => 'http://gateway.securenet.com/API/Contracts',
|
16
|
+
'xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance'
|
17
|
+
}
|
18
|
+
NIL_ATTRIBUTE = { 'i:nil' => 'true' }
|
19
|
+
|
20
|
+
self.supported_countries = ['US']
|
21
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
22
|
+
self.homepage_url = 'http://www.securenet.com/'
|
23
|
+
self.display_name = 'SecureNet'
|
24
|
+
|
25
|
+
self.test_url = 'https://certify.securenet.com/API/gateway.svc/webHttp/ProcessTransaction'
|
26
|
+
self.live_url = 'https://gateway.securenet.com/api/Gateway.svc/webHttp/ProcessTransaction'
|
27
|
+
|
28
|
+
APPROVED, DECLINED = 1, 2
|
29
|
+
|
30
|
+
CARD_CODE_ERRORS = %w(N S)
|
31
|
+
AVS_ERRORS = %w(A E N R W Z)
|
32
|
+
|
33
|
+
def initialize(options = {})
|
34
|
+
requires!(options, :login, :password)
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def authorize(money, creditcard, options = {})
|
39
|
+
commit(build_sale_or_authorization(creditcard, options, :auth_only, money))
|
40
|
+
end
|
41
|
+
|
42
|
+
def purchase(money, creditcard, options = {})
|
43
|
+
commit(build_sale_or_authorization(creditcard, options, :auth_capture, money))
|
44
|
+
end
|
45
|
+
|
46
|
+
def capture(money, authorization, options = {})
|
47
|
+
commit(build_capture_refund_void(authorization, options, :prior_auth_capture, money))
|
48
|
+
end
|
49
|
+
|
50
|
+
def void(authorization, options = {})
|
51
|
+
commit(build_capture_refund_void(authorization, options, :void))
|
52
|
+
end
|
53
|
+
|
54
|
+
def refund(money, authorization, options = {})
|
55
|
+
commit(build_capture_refund_void(authorization, options, :credit, money))
|
56
|
+
end
|
57
|
+
|
58
|
+
def credit(money, authorization, options = {})
|
59
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
60
|
+
refund(money, authorization, options)
|
61
|
+
end
|
62
|
+
|
63
|
+
def supports_scrubbing?
|
64
|
+
true
|
65
|
+
end
|
66
|
+
|
67
|
+
def scrub(transcript)
|
68
|
+
transcript.
|
69
|
+
gsub(%r((<CARDNUMBER>)\d+(</CARDNUMBER>))i, '\1[FILTERED]\2').
|
70
|
+
gsub(%r((<CARDCODE>)\d+(</CARDCODE>))i, '\1[FILTERED]\2').
|
71
|
+
gsub(%r((<SECUREKEY>).+(</SECUREKEY>))i, '\1[FILTERED]\2')
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def commit(request)
|
77
|
+
xml = build_request(request)
|
78
|
+
url = test? ? self.test_url : self.live_url
|
79
|
+
data = ssl_post(url, xml, 'Content-Type' => 'text/xml')
|
80
|
+
response = parse(data)
|
81
|
+
|
82
|
+
Response.new(success?(response), message_from(response), response,
|
83
|
+
test: test?,
|
84
|
+
authorization: build_authorization(response),
|
85
|
+
avs_result: { code: response[:avs_result_code] },
|
86
|
+
cvv_result: response[:card_code_response_code])
|
87
|
+
end
|
88
|
+
|
89
|
+
def build_request(request)
|
90
|
+
xml = Builder::XmlMarkup.new
|
91
|
+
|
92
|
+
xml.instruct!
|
93
|
+
xml.tag!('TRANSACTION', XML_ATTRIBUTES) do
|
94
|
+
xml << request
|
95
|
+
end
|
96
|
+
|
97
|
+
xml.target!
|
98
|
+
end
|
99
|
+
|
100
|
+
def build_sale_or_authorization(creditcard, options, action, money)
|
101
|
+
xml = Builder::XmlMarkup.new
|
102
|
+
|
103
|
+
xml.tag! 'AMOUNT', amount(money)
|
104
|
+
add_credit_card(xml, creditcard)
|
105
|
+
add_params_in_required_order(xml, action, creditcard, options)
|
106
|
+
add_more_required_params(xml, options)
|
107
|
+
|
108
|
+
xml.target!
|
109
|
+
end
|
110
|
+
|
111
|
+
def build_capture_refund_void(authorization, options, action, money = nil)
|
112
|
+
xml = Builder::XmlMarkup.new
|
113
|
+
|
114
|
+
transaction_id, amount_in_ref, last_four = split_authorization(authorization)
|
115
|
+
|
116
|
+
xml.tag! 'AMOUNT', amount(money) || amount_in_ref
|
117
|
+
xml.tag!('CARD') do
|
118
|
+
xml.tag! 'CARDNUMBER', last_four
|
119
|
+
end
|
120
|
+
|
121
|
+
add_params_in_required_order(xml, action, nil, options)
|
122
|
+
xml.tag! 'REF_TRANSID', transaction_id
|
123
|
+
add_more_required_params(xml, options)
|
124
|
+
|
125
|
+
xml.target!
|
126
|
+
end
|
127
|
+
|
128
|
+
def add_credit_card(xml, creditcard)
|
129
|
+
xml.tag!('CARD') do
|
130
|
+
xml.tag! 'CARDCODE', creditcard.verification_value if creditcard.verification_value?
|
131
|
+
xml.tag! 'CARDNUMBER', creditcard.number
|
132
|
+
xml.tag! 'EXPDATE', expdate(creditcard)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_customer_data(xml, options)
|
137
|
+
xml.tag! 'CUSTOMERID', options[:customer] if options.has_key? :customer
|
138
|
+
|
139
|
+
xml.tag! 'CUSTOMERIP', options[:ip] if options.has_key? :ip
|
140
|
+
end
|
141
|
+
|
142
|
+
def add_address(xml, creditcard, options)
|
143
|
+
return unless creditcard
|
144
|
+
|
145
|
+
if address = options[:billing_address] || options[:address]
|
146
|
+
xml.tag!('CUSTOMER_BILL') do
|
147
|
+
xml.tag! 'ADDRESS', address[:address1].to_s
|
148
|
+
xml.tag! 'CITY', address[:city].to_s
|
149
|
+
xml.tag! 'COMPANY', address[:company].to_s
|
150
|
+
xml.tag! 'COUNTRY', address[:country].to_s
|
151
|
+
if options.has_key? :email
|
152
|
+
xml.tag! 'EMAIL', options[:email]
|
153
|
+
xml.tag! 'EMAILRECEIPT', 'FALSE'
|
154
|
+
end
|
155
|
+
xml.tag! 'FIRSTNAME', creditcard.first_name
|
156
|
+
xml.tag! 'LASTNAME', creditcard.last_name
|
157
|
+
xml.tag! 'PHONE', address[:phone].to_s
|
158
|
+
xml.tag! 'STATE', address[:state].blank? ? 'n/a' : address[:state]
|
159
|
+
xml.tag! 'ZIP', address[:zip].to_s
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
if address = options[:shipping_address]
|
164
|
+
xml.tag!('CUSTOMER_SHIP') do
|
165
|
+
xml.tag! 'ADDRESS', address[:address1].to_s
|
166
|
+
xml.tag! 'CITY', address[:city].to_s
|
167
|
+
xml.tag! 'COMPANY', address[:company].to_s
|
168
|
+
xml.tag! 'COUNTRY', address[:country].to_s
|
169
|
+
|
170
|
+
if address[:name]
|
171
|
+
first_name, last_name = split_names(address[:name])
|
172
|
+
xml.tag! 'FIRSTNAME', first_name
|
173
|
+
xml.tag! 'LASTNAME', last_name
|
174
|
+
else
|
175
|
+
xml.tag! 'FIRSTNAME', address[:first_name].to_s
|
176
|
+
xml.tag! 'LASTNAME', address[:last_name].to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
xml.tag! 'STATE', address[:state].blank? ? 'n/a' : address[:state]
|
180
|
+
xml.tag! 'ZIP', address[:zip].to_s
|
181
|
+
end
|
182
|
+
else
|
183
|
+
xml.tag!('CUSTOMER_SHIP', NIL_ATTRIBUTE) do
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def add_merchant_key(xml, options)
|
189
|
+
xml.tag!('MERCHANT_KEY') do
|
190
|
+
xml.tag! 'GROUPID', 0
|
191
|
+
xml.tag! 'SECUREKEY', @options[:password]
|
192
|
+
xml.tag! 'SECURENETID', @options[:login]
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# SecureNet requires some of the xml params to be in a certain order. http://cl.ly/image/3K260E0p0a0n/content.png
|
197
|
+
def add_params_in_required_order(xml, action, creditcard, options)
|
198
|
+
xml.tag! 'CODE', TRANSACTIONS[action]
|
199
|
+
add_customer_data(xml, options)
|
200
|
+
add_address(xml, creditcard, options)
|
201
|
+
xml.tag! 'DCI', 0 # No duplicate checking will be done, except for ORDERID
|
202
|
+
xml.tag! 'INSTALLMENT_SEQUENCENUM', 1
|
203
|
+
xml.tag! 'INVOICEDESC', options[:invoice_description] if options[:invoice_description]
|
204
|
+
xml.tag! 'INVOICENUM', options[:invoice_number] if options[:invoice_number]
|
205
|
+
add_merchant_key(xml, options)
|
206
|
+
xml.tag! 'METHOD', 'CC'
|
207
|
+
xml.tag! 'NOTE', options[:description] if options[:description]
|
208
|
+
xml.tag! 'ORDERID', truncate(options[:order_id], 25)
|
209
|
+
xml.tag! 'OVERRIDE_FROM', 0 # Docs say not required, but doesn't work without it
|
210
|
+
end
|
211
|
+
|
212
|
+
def add_more_required_params(xml, options)
|
213
|
+
test_mode = options[:test_mode].nil? ? test? : options[:test_mode]
|
214
|
+
xml.tag! 'RETAIL_LANENUM', '0'
|
215
|
+
xml.tag! 'TEST', test_mode ? 'TRUE' : 'FALSE'
|
216
|
+
xml.tag! 'TOTAL_INSTALLMENTCOUNT', 0
|
217
|
+
xml.tag! 'TRANSACTION_SERVICE', 0
|
218
|
+
xml.tag! 'DEVELOPERID', options[:developer_id] if options[:developer_id]
|
219
|
+
end
|
220
|
+
|
221
|
+
def success?(response)
|
222
|
+
response[:response_code].to_i == APPROVED
|
223
|
+
end
|
224
|
+
|
225
|
+
def message_from(response)
|
226
|
+
return response[:response_reason_text].nil? ? '' : response[:response_reason_text][0..-1]
|
227
|
+
end
|
228
|
+
|
229
|
+
def parse(xml)
|
230
|
+
response = {}
|
231
|
+
xml = REXML::Document.new(xml)
|
232
|
+
root = REXML::XPath.first(xml, '//GATEWAYRESPONSE')
|
233
|
+
if root
|
234
|
+
root.elements.to_a.each do |node|
|
235
|
+
recurring_parse_element(response, node)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
response
|
240
|
+
end
|
241
|
+
|
242
|
+
def recurring_parse_element(response, node)
|
243
|
+
if node.has_elements?
|
244
|
+
node.elements.each { |e| recurring_parse_element(response, e) }
|
245
|
+
else
|
246
|
+
response[node.name.underscore.to_sym] = node.text
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def split_authorization(authorization)
|
251
|
+
transaction_id, amount, last_four = authorization.split('|')
|
252
|
+
[transaction_id, amount, last_four]
|
253
|
+
end
|
254
|
+
|
255
|
+
def build_authorization(response)
|
256
|
+
[response[:transactionid], response[:transactionamount], response[:last4_digits]].join('|')
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/authorize_net'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SecurePayGateway < Gateway
|
6
|
+
API_VERSION = '3.1'
|
7
|
+
|
8
|
+
self.live_url = self.test_url = 'https://www.securepay.com/AuthSpayAdapter/process.aspx'
|
9
|
+
|
10
|
+
class_attribute :duplicate_window
|
11
|
+
|
12
|
+
APPROVED, DECLINED, ERROR, FRAUD_REVIEW = 1, 2, 3, 4
|
13
|
+
|
14
|
+
RESPONSE_CODE, RESPONSE_REASON_CODE, RESPONSE_REASON_TEXT, AUTHORIZATION_CODE = 0, 2, 3, 4
|
15
|
+
AVS_RESULT_CODE, TRANSACTION_ID, CARD_CODE_RESPONSE_CODE, CARDHOLDER_AUTH_CODE = 5, 6, 38, 39
|
16
|
+
|
17
|
+
self.default_currency = 'USD'
|
18
|
+
|
19
|
+
self.supported_countries = %w(US CA GB AU)
|
20
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
21
|
+
self.homepage_url = 'http://www.securepay.com/'
|
22
|
+
self.display_name = 'SecurePay'
|
23
|
+
|
24
|
+
CARD_CODE_ERRORS = %w(N S)
|
25
|
+
AVS_ERRORS = %w(A E N R W Z)
|
26
|
+
AVS_REASON_CODES = %w(27 45)
|
27
|
+
TRANSACTION_ALREADY_ACTIONED = %w(310 311)
|
28
|
+
|
29
|
+
def initialize(options = {})
|
30
|
+
requires!(options, :login, :password)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def purchase(money, paysource, options = {})
|
35
|
+
post = {}
|
36
|
+
add_currency_code(post, money, options)
|
37
|
+
add_invoice(post, options)
|
38
|
+
add_payment_source(post, paysource, options)
|
39
|
+
add_address(post, options)
|
40
|
+
add_customer_data(post, options)
|
41
|
+
add_duplicate_window(post)
|
42
|
+
|
43
|
+
commit('AUTH_CAPTURE', money, post)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def commit(action, money, parameters)
|
49
|
+
parameters[:amount] = amount(money) unless action == 'VOID'
|
50
|
+
|
51
|
+
url = (test? ? self.test_url : self.live_url)
|
52
|
+
data = ssl_post(url, post_data(action, parameters))
|
53
|
+
|
54
|
+
response = parse(data)
|
55
|
+
response[:action] = action
|
56
|
+
|
57
|
+
message = message_from(response)
|
58
|
+
|
59
|
+
Response.new(success?(response), message, response,
|
60
|
+
test: test?,
|
61
|
+
authorization: response[:transaction_id],
|
62
|
+
fraud_review: fraud_review?(response),
|
63
|
+
avs_result: { code: response[:avs_result_code] },
|
64
|
+
cvv_result: response[:card_code])
|
65
|
+
end
|
66
|
+
|
67
|
+
def success?(response)
|
68
|
+
response[:response_code] == APPROVED && TRANSACTION_ALREADY_ACTIONED.exclude?(response[:response_reason_code])
|
69
|
+
end
|
70
|
+
|
71
|
+
def fraud_review?(response)
|
72
|
+
response[:response_code] == FRAUD_REVIEW
|
73
|
+
end
|
74
|
+
|
75
|
+
def parse(body)
|
76
|
+
fields = split(body)
|
77
|
+
|
78
|
+
results = {
|
79
|
+
response_code: fields[RESPONSE_CODE].to_i,
|
80
|
+
response_reason_code: fields[RESPONSE_REASON_CODE],
|
81
|
+
response_reason_text: fields[RESPONSE_REASON_TEXT],
|
82
|
+
avs_result_code: fields[AVS_RESULT_CODE],
|
83
|
+
transaction_id: fields[TRANSACTION_ID],
|
84
|
+
card_code: fields[CARD_CODE_RESPONSE_CODE],
|
85
|
+
authorization_code: fields[AUTHORIZATION_CODE],
|
86
|
+
cardholder_authentication_code: fields[CARDHOLDER_AUTH_CODE]
|
87
|
+
}
|
88
|
+
results
|
89
|
+
end
|
90
|
+
|
91
|
+
def post_data(action, parameters = {})
|
92
|
+
post = {}
|
93
|
+
|
94
|
+
post[:version] = API_VERSION
|
95
|
+
post[:login] = @options[:login]
|
96
|
+
post[:tran_key] = @options[:password]
|
97
|
+
post[:relay_response] = 'FALSE'
|
98
|
+
post[:type] = action
|
99
|
+
post[:delim_data] = 'TRUE'
|
100
|
+
post[:delim_char] = ','
|
101
|
+
post[:encap_char] = '$'
|
102
|
+
post[:solution_ID] = application_id if application_id
|
103
|
+
|
104
|
+
request = post.merge(parameters).collect { |key, value| "x_#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
105
|
+
request
|
106
|
+
end
|
107
|
+
|
108
|
+
def add_currency_code(post, money, options)
|
109
|
+
post[:currency_code] = options[:currency] || currency(money)
|
110
|
+
end
|
111
|
+
|
112
|
+
def add_invoice(post, options)
|
113
|
+
post[:invoice_num] = options[:order_id]
|
114
|
+
post[:description] = options[:description]
|
115
|
+
end
|
116
|
+
|
117
|
+
def add_creditcard(post, creditcard, options = {})
|
118
|
+
post[:card_num] = creditcard.number
|
119
|
+
post[:card_code] = creditcard.verification_value if creditcard.verification_value?
|
120
|
+
post[:exp_date] = expdate(creditcard)
|
121
|
+
post[:first_name] = creditcard.first_name
|
122
|
+
post[:last_name] = creditcard.last_name
|
123
|
+
end
|
124
|
+
|
125
|
+
def add_payment_source(params, source, options = {})
|
126
|
+
add_creditcard(params, source, options)
|
127
|
+
end
|
128
|
+
|
129
|
+
def add_customer_data(post, options)
|
130
|
+
if options.has_key? :email
|
131
|
+
post[:email] = options[:email]
|
132
|
+
post[:email_customer] = false
|
133
|
+
end
|
134
|
+
|
135
|
+
if options.has_key? :customer
|
136
|
+
post[:cust_id] = options[:customer] if Float(options[:customer]) rescue nil
|
137
|
+
end
|
138
|
+
|
139
|
+
post[:customer_ip] = options[:ip] if options.has_key? :ip
|
140
|
+
|
141
|
+
post[:cardholder_authentication_value] = options[:cardholder_authentication_value] if options.has_key? :cardholder_authentication_value
|
142
|
+
|
143
|
+
post[:authentication_indicator] = options[:authentication_indicator] if options.has_key? :authentication_indicator
|
144
|
+
end
|
145
|
+
|
146
|
+
# x_duplicate_window won't be sent by default, because sending it changes the response.
|
147
|
+
# "If this field is present in the request with or without a value, an enhanced duplicate transaction response will be sent."
|
148
|
+
# (as of 2008-12-30) http://www.authorize.net/support/AIM_guide_SCC.pdf
|
149
|
+
def add_duplicate_window(post)
|
150
|
+
post[:duplicate_window] = duplicate_window if duplicate_window
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_address(post, options)
|
154
|
+
if address = options[:billing_address] || options[:address]
|
155
|
+
post[:address] = address[:address1].to_s
|
156
|
+
post[:company] = address[:company].to_s
|
157
|
+
post[:phone] = address[:phone].to_s
|
158
|
+
post[:zip] = address[:zip].to_s
|
159
|
+
post[:city] = address[:city].to_s
|
160
|
+
post[:country] = address[:country].to_s
|
161
|
+
post[:state] = address[:state].blank? ? 'n/a' : address[:state]
|
162
|
+
end
|
163
|
+
|
164
|
+
if address = options[:shipping_address]
|
165
|
+
post[:ship_to_first_name] = address[:first_name].to_s
|
166
|
+
post[:ship_to_last_name] = address[:last_name].to_s
|
167
|
+
post[:ship_to_address] = address[:address1].to_s
|
168
|
+
post[:ship_to_company] = address[:company].to_s
|
169
|
+
post[:ship_to_phone] = address[:phone].to_s
|
170
|
+
post[:ship_to_zip] = address[:zip].to_s
|
171
|
+
post[:ship_to_city] = address[:city].to_s
|
172
|
+
post[:ship_to_country] = address[:country].to_s
|
173
|
+
post[:ship_to_state] = address[:state].blank? ? 'n/a' : address[:state]
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def message_from(results)
|
178
|
+
if results[:response_code] == DECLINED
|
179
|
+
return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
|
180
|
+
return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
|
181
|
+
end
|
182
|
+
|
183
|
+
(results[:response_reason_text] ? results[:response_reason_text].chomp('.') : '')
|
184
|
+
end
|
185
|
+
|
186
|
+
def split(response)
|
187
|
+
response.split(',')
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|