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,307 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# === EVO Canada payment gateway.
|
4
|
+
#
|
5
|
+
# EVO returns two different identifiers for most transactions, the
|
6
|
+
# +authcode+ and the +transactionid+. Since +transactionid+ is used more
|
7
|
+
# often (i.e. for {#capture}, {#refund}, {#void} and {#update}) we store it in the
|
8
|
+
# Response#authorization attribute. The +authcode+ from the merchant
|
9
|
+
# account is accessible via {Response#params}.
|
10
|
+
#
|
11
|
+
# Two different but related response messages are also returned from EVO.
|
12
|
+
# The message indicated by EVO's <tt>response_code</tt> parameter is returned as
|
13
|
+
# {Response#message} (Those messages can be seen in the {MESSAGES} hash.)
|
14
|
+
# The other, shorter message is available via {Response#params}.
|
15
|
+
#
|
16
|
+
# It's recommended to save the contents of the {Response#params} in your
|
17
|
+
# transaction log for future reference.
|
18
|
+
#
|
19
|
+
# === Sample Use
|
20
|
+
#
|
21
|
+
# gateway = ActiveMerchant::Billing::EvoCaGateway.new(username: 'demo', password: 'password')
|
22
|
+
#
|
23
|
+
# response = gateway.authorize(1000, credit_card, options)
|
24
|
+
#
|
25
|
+
# puts response.authorization # the transactionid
|
26
|
+
# puts response.params['authcode'] # the authcode from the merchant account
|
27
|
+
# puts response.message # the 'pretty' response message
|
28
|
+
# puts response.params['responsetext'] # the 'terse' response message
|
29
|
+
#
|
30
|
+
# gateway.capture(1000, response.authorization)
|
31
|
+
# gateway.update(response.authorization, shipping_carrier: 'fedex')
|
32
|
+
# gateway.refund(500, response.authorization)
|
33
|
+
#
|
34
|
+
class EvoCaGateway < Gateway
|
35
|
+
self.test_url = 'https://secure.evoepay.com/api/transact.php'
|
36
|
+
self.live_url = 'https://secure.evoepay.com/api/transact.php'
|
37
|
+
|
38
|
+
self.supported_countries = ['CA']
|
39
|
+
self.supported_cardtypes = %i[visa master american_express jcb discover]
|
40
|
+
self.money_format = :dollars
|
41
|
+
self.homepage_url = 'http://www.evocanada.com/'
|
42
|
+
self.display_name = 'EVO Canada'
|
43
|
+
|
44
|
+
APPROVED, DECLINED, ERROR = 1, 2, 3
|
45
|
+
|
46
|
+
MESSAGES = {
|
47
|
+
100 => 'Transaction was approved',
|
48
|
+
200 => 'Transaction was declined by processor',
|
49
|
+
201 => 'Do not honor',
|
50
|
+
202 => 'Insufficient funds',
|
51
|
+
203 => 'Over limit',
|
52
|
+
204 => 'Transaction not allowed',
|
53
|
+
220 => 'Incorrect payment data',
|
54
|
+
221 => 'No such card issuer',
|
55
|
+
222 => 'No card number on file with issuer',
|
56
|
+
223 => 'Expired card',
|
57
|
+
224 => 'Invalid expiration date',
|
58
|
+
225 => 'Invalid card security code',
|
59
|
+
240 => 'Call issuer for futher information',
|
60
|
+
250 => 'Pick up card',
|
61
|
+
251 => 'Lost card',
|
62
|
+
252 => 'Stolen card',
|
63
|
+
253 => 'Fraudulant card',
|
64
|
+
260 => 'Declined with further instructions available',
|
65
|
+
261 => 'Declined - stop all recurring payments',
|
66
|
+
262 => 'Declined - stop this recurring program',
|
67
|
+
263 => 'Declined - updated cardholder data available',
|
68
|
+
264 => 'Declined - retry in a few days',
|
69
|
+
300 => 'Transaction was rejected by gateway',
|
70
|
+
400 => 'Transaction error returned by processor',
|
71
|
+
410 => 'Invalid merchant configuration',
|
72
|
+
411 => 'Merchant account is inactive',
|
73
|
+
420 => 'Communication error',
|
74
|
+
421 => 'Communication error with issuer',
|
75
|
+
430 => 'Duplicate transaction at processor',
|
76
|
+
440 => 'Processor format error',
|
77
|
+
441 => 'Invalid transaction information',
|
78
|
+
460 => 'Processor feature not available',
|
79
|
+
461 => 'Unsupported card type'
|
80
|
+
}
|
81
|
+
|
82
|
+
# This gateway requires that a valid username and password be passed
|
83
|
+
# in the +options+ hash.
|
84
|
+
#
|
85
|
+
# === Required Options
|
86
|
+
#
|
87
|
+
# * <tt>:username</tt>
|
88
|
+
# * <tt>:password</tt>
|
89
|
+
def initialize(options = {})
|
90
|
+
requires!(options, :username, :password)
|
91
|
+
super
|
92
|
+
end
|
93
|
+
|
94
|
+
# Transaction sales are submitted and immediately flagged for settlement.
|
95
|
+
# These transactions will automatically be settled.
|
96
|
+
#
|
97
|
+
# Payment source can be either a {CreditCard} or {Check}.
|
98
|
+
#
|
99
|
+
# === Additional Options
|
100
|
+
# In addition to the standard options, this gateway supports
|
101
|
+
#
|
102
|
+
# * <tt>:tracking_number</tt> - Shipping tracking number
|
103
|
+
# * <tt>:shipping_carrier</tt> - ups/fedex/dhl/usps
|
104
|
+
# * <tt>:po_number</tt> - Purchase order
|
105
|
+
# * <tt>:tax</tt> - Tax amount
|
106
|
+
# * <tt>:shipping</tt> - Shipping cost
|
107
|
+
def purchase(money, credit_card_or_check, options = {})
|
108
|
+
post = {}
|
109
|
+
add_invoice(post, options)
|
110
|
+
add_order(post, options)
|
111
|
+
add_paymentmethod(post, credit_card_or_check)
|
112
|
+
add_address(post, options)
|
113
|
+
add_customer_data(post, options)
|
114
|
+
commit('sale', money, post)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Transaction authorizations are authorized immediately but are not
|
118
|
+
# flagged for settlement. These transactions must be flagged for
|
119
|
+
# settlement using the _capture_ transaction type. Authorizations
|
120
|
+
# typically remain activate for three to seven business days.
|
121
|
+
#
|
122
|
+
# Payment source must be a {CreditCard}.
|
123
|
+
def authorize(money, credit_card, options = {})
|
124
|
+
post = {}
|
125
|
+
add_invoice(post, options)
|
126
|
+
add_order(post, options)
|
127
|
+
add_paymentmethod(post, credit_card)
|
128
|
+
add_address(post, options)
|
129
|
+
add_customer_data(post, options)
|
130
|
+
commit('auth', money, post)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Transaction captures flag existing _authorizations_ for settlement. Only
|
134
|
+
# authorizations can be captured. Captures can be submitted for an amount
|
135
|
+
# equal to or less than the original authorization.
|
136
|
+
#
|
137
|
+
# The <tt>authorization</tt> parameter is the transaction ID, retrieved
|
138
|
+
# from Response#authorization. See EvoCaGateway#purchase for the
|
139
|
+
# <tt>options</tt>.
|
140
|
+
def capture(money, authorization, options = {})
|
141
|
+
post = {
|
142
|
+
amount: amount(money),
|
143
|
+
transactionid: authorization
|
144
|
+
}
|
145
|
+
add_order(post, options)
|
146
|
+
commit('capture', money, post)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Transaction refunds will reverse a previously settled transaction. If
|
150
|
+
# the transaction has not been settled, it must be _voided_ instead of
|
151
|
+
# refunded.
|
152
|
+
#
|
153
|
+
# The <tt>identification</tt> parameter is the transaction ID, retrieved
|
154
|
+
# from {Response#authorization}.
|
155
|
+
def refund(money, identification)
|
156
|
+
post = { transactionid: identification }
|
157
|
+
commit('refund', money, post)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Transaction credits apply a negative amount to the cardholder's card.
|
161
|
+
# In most situations credits are disabled as transaction refunds should
|
162
|
+
# be used instead.
|
163
|
+
#
|
164
|
+
# Note that this is different from a {#refund} (which is usually what
|
165
|
+
# you'll be looking for).
|
166
|
+
def credit(money, credit_card, options = {})
|
167
|
+
post = {}
|
168
|
+
add_invoice(post, options)
|
169
|
+
add_order(post, options)
|
170
|
+
add_paymentmethod(post, credit_card)
|
171
|
+
add_address(post, options)
|
172
|
+
add_customer_data(post, options)
|
173
|
+
commit('credit', money, post)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Transaction voids will cancel an existing sale or captured
|
177
|
+
# authorization. In addition, non-captured authorizations can be voided to
|
178
|
+
# prevent any future capture. Voids can only occur if the transaction has
|
179
|
+
# not been settled.
|
180
|
+
#
|
181
|
+
# The <tt>identification</tt> parameter is the transaction ID, retrieved
|
182
|
+
# from {Response#authorization}.
|
183
|
+
def void(identification)
|
184
|
+
post = { transactionid: identification }
|
185
|
+
commit('void', nil, post)
|
186
|
+
end
|
187
|
+
|
188
|
+
# Transaction updates can be used to update previous transactions with
|
189
|
+
# specific order information, such as a tracking number and shipping
|
190
|
+
# carrier. See EvoCaGateway#purchase for <tt>options</tt>.
|
191
|
+
#
|
192
|
+
# The <tt>identification</tt> parameter is the transaction ID, retrieved
|
193
|
+
# from {Response#authorization}.
|
194
|
+
def update(identification, options)
|
195
|
+
post = { transactionid: identification }
|
196
|
+
add_order(post, options)
|
197
|
+
commit('update', nil, post)
|
198
|
+
end
|
199
|
+
|
200
|
+
private
|
201
|
+
|
202
|
+
def add_customer_data(post, options)
|
203
|
+
post[:email] = options[:email]
|
204
|
+
post[:ipaddress] = options[:ip]
|
205
|
+
end
|
206
|
+
|
207
|
+
def add_address(post, options)
|
208
|
+
if address = options[:billing_address] || options[:address]
|
209
|
+
post[:firstname] = address[:first_name]
|
210
|
+
post[:lastname] = address[:last_name]
|
211
|
+
post[:address1] = address[:address1]
|
212
|
+
post[:address2] = address[:address2]
|
213
|
+
post[:company] = address[:company]
|
214
|
+
post[:phone] = address[:phone]
|
215
|
+
post[:city] = address[:city]
|
216
|
+
post[:state] = address[:state]
|
217
|
+
post[:zip] = address[:zip]
|
218
|
+
post[:country] = address[:country]
|
219
|
+
end
|
220
|
+
|
221
|
+
if address = options[:shipping_address]
|
222
|
+
post[:shipping_firstname] = address[:first_name]
|
223
|
+
post[:shipping_lastname] = address[:last_name]
|
224
|
+
post[:shipping_address1] = address[:address1]
|
225
|
+
post[:shipping_address2] = address[:address2]
|
226
|
+
post[:shipping_company] = address[:company]
|
227
|
+
post[:shipping_zip] = address[:zip]
|
228
|
+
post[:shipping_city] = address[:city]
|
229
|
+
post[:shipping_state] = address[:state]
|
230
|
+
post[:shipping_country] = address[:country]
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def add_order(post, options)
|
235
|
+
post[:orderid] = options[:order_id]
|
236
|
+
post[:tracking_number] = options[:tracking_number]
|
237
|
+
post[:shipping_carrier] = options[:shipping_carrier]
|
238
|
+
end
|
239
|
+
|
240
|
+
def add_invoice(post, options)
|
241
|
+
post[:orderdescription] = options[:description]
|
242
|
+
post[:ponumber] = options[:po_number]
|
243
|
+
post[:shipping] = amount(options[:shipping])
|
244
|
+
post[:tax] = amount(options[:tax])
|
245
|
+
end
|
246
|
+
|
247
|
+
def add_paymentmethod(post, payment)
|
248
|
+
if card_brand(payment) == 'check'
|
249
|
+
post[:payment] = 'check'
|
250
|
+
post[:checkname] = payment.name
|
251
|
+
post[:checkaba] = payment.routing_number
|
252
|
+
post[:checkaccount] = payment.account_number
|
253
|
+
post[:account_holder_type] = payment.account_holder_type
|
254
|
+
post[:account_type] = payment.account_type
|
255
|
+
else
|
256
|
+
post[:payment] = 'creditcard'
|
257
|
+
post[:ccnumber] = payment.number
|
258
|
+
post[:ccexp] = "#{format(payment.month, :two_digits)}#{format(payment.year, :two_digits)}"
|
259
|
+
post[:cvv] = payment.verification_value
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
def parse(body)
|
264
|
+
fields = {}
|
265
|
+
CGI::parse(body).each do |k, v|
|
266
|
+
fields[k.to_s] = v.kind_of?(Array) ? v[0] : v
|
267
|
+
end
|
268
|
+
fields
|
269
|
+
end
|
270
|
+
|
271
|
+
def success?(response)
|
272
|
+
response['response'].to_i == APPROVED
|
273
|
+
end
|
274
|
+
|
275
|
+
def commit(action, money, parameters)
|
276
|
+
parameters[:amount] = amount(money) unless action == 'void'
|
277
|
+
|
278
|
+
data = ssl_post self.live_url, post_data(action, parameters)
|
279
|
+
response = parse(data)
|
280
|
+
message = message_from(response)
|
281
|
+
|
282
|
+
Response.new(success?(response), message, response,
|
283
|
+
test: test?,
|
284
|
+
authorization: response['transactionid'],
|
285
|
+
avs_result: { code: response['avsresponse'] },
|
286
|
+
cvv_result: response['cvvresponse'])
|
287
|
+
end
|
288
|
+
|
289
|
+
def message_from(response)
|
290
|
+
MESSAGES.fetch(response['response_code'].to_i, false) || response['message']
|
291
|
+
end
|
292
|
+
|
293
|
+
def post_data(action, parameters = {})
|
294
|
+
post = { type: action }
|
295
|
+
|
296
|
+
if test?
|
297
|
+
post[:username] = 'demo'
|
298
|
+
post[:password] = 'password'
|
299
|
+
else
|
300
|
+
post[:username] = options[:username]
|
301
|
+
post[:password] = options[:password]
|
302
|
+
end
|
303
|
+
post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" unless value.nil? }.compact.join('&')
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# Public: For more information on the Eway Gateway please visit their
|
6
|
+
# {Developers Area}[http://www.eway.com.au/developers/api/direct-payments]
|
7
|
+
class EwayGateway < Gateway
|
8
|
+
self.live_url = 'https://www.eway.com.au'
|
9
|
+
|
10
|
+
self.money_format = :cents
|
11
|
+
self.supported_countries = ['AU']
|
12
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
13
|
+
self.homepage_url = 'http://www.eway.com.au/'
|
14
|
+
self.display_name = 'eWAY'
|
15
|
+
|
16
|
+
# Public: Create a new Eway Gateway.
|
17
|
+
# options - A hash of options:
|
18
|
+
# :login - Your Customer ID.
|
19
|
+
# :password - Your XML Refund Password that you
|
20
|
+
# specified on the Eway site. (optional)
|
21
|
+
def initialize(options = {})
|
22
|
+
requires!(options, :login)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def purchase(money, creditcard, options = {})
|
27
|
+
requires_address!(options)
|
28
|
+
|
29
|
+
post = {}
|
30
|
+
add_creditcard(post, creditcard)
|
31
|
+
add_address(post, options)
|
32
|
+
add_customer_id(post)
|
33
|
+
add_invoice_data(post, options)
|
34
|
+
add_non_optional_data(post)
|
35
|
+
add_amount(post, money)
|
36
|
+
post[:CustomerEmail] = options[:email]
|
37
|
+
|
38
|
+
commit(purchase_url(post[:CVN]), money, post)
|
39
|
+
end
|
40
|
+
|
41
|
+
def refund(money, authorization, options = {})
|
42
|
+
post = {}
|
43
|
+
|
44
|
+
add_customer_id(post)
|
45
|
+
add_amount(post, money)
|
46
|
+
add_non_optional_data(post)
|
47
|
+
post[:OriginalTrxnNumber] = authorization
|
48
|
+
post[:RefundPassword] = @options[:password]
|
49
|
+
post[:CardExpiryMonth] = nil
|
50
|
+
post[:CardExpiryYear] = nil
|
51
|
+
|
52
|
+
commit(refund_url, money, post)
|
53
|
+
end
|
54
|
+
|
55
|
+
def supports_scrubbing
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
def scrub(transcript)
|
60
|
+
transcript.
|
61
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
62
|
+
gsub(%r((<ewayCardNumber>)\d+(</ewayCardNumber>))i, '\1[FILTERED]\2').
|
63
|
+
gsub(%r((<ewayCVN>)\d+(</ewayCVN>))i, '\1[FILTERED]\2')
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def requires_address!(options)
|
69
|
+
raise ArgumentError.new('Missing eWay required parameters: address or billing_address') unless options.has_key?(:address) || options.has_key?(:billing_address)
|
70
|
+
end
|
71
|
+
|
72
|
+
def add_creditcard(post, creditcard)
|
73
|
+
post[:CardNumber] = creditcard.number
|
74
|
+
post[:CardExpiryMonth] = sprintf('%.2i', creditcard.month)
|
75
|
+
post[:CardExpiryYear] = sprintf('%.4i', creditcard.year)[-2..-1]
|
76
|
+
post[:CustomerFirstName] = creditcard.first_name
|
77
|
+
post[:CustomerLastName] = creditcard.last_name
|
78
|
+
post[:CardHoldersName] = creditcard.name
|
79
|
+
|
80
|
+
post[:CVN] = creditcard.verification_value if creditcard.verification_value?
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_address(post, options)
|
84
|
+
if address = options[:billing_address] || options[:address]
|
85
|
+
post[:CustomerAddress] = [address[:address1], address[:address2], address[:city], address[:state], address[:country]].compact.join(', ')
|
86
|
+
post[:CustomerPostcode] = address[:zip]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def add_customer_id(post)
|
91
|
+
post[:CustomerID] = @options[:login]
|
92
|
+
end
|
93
|
+
|
94
|
+
def add_invoice_data(post, options)
|
95
|
+
post[:CustomerInvoiceRef] = options[:order_id]
|
96
|
+
post[:CustomerInvoiceDescription] = options[:description]
|
97
|
+
end
|
98
|
+
|
99
|
+
def add_amount(post, money)
|
100
|
+
post[:TotalAmount] = amount(money)
|
101
|
+
end
|
102
|
+
|
103
|
+
def add_non_optional_data(post)
|
104
|
+
post[:Option1] = nil
|
105
|
+
post[:Option2] = nil
|
106
|
+
post[:Option3] = nil
|
107
|
+
post[:TrxnNumber] = nil
|
108
|
+
end
|
109
|
+
|
110
|
+
def commit(url, money, parameters)
|
111
|
+
raw_response = ssl_post(url, post_data(parameters))
|
112
|
+
response = parse(raw_response)
|
113
|
+
|
114
|
+
Response.new(success?(response),
|
115
|
+
message_from(response[:ewaytrxnerror]),
|
116
|
+
response,
|
117
|
+
authorization: response[:ewaytrxnnumber],
|
118
|
+
test: test?)
|
119
|
+
end
|
120
|
+
|
121
|
+
def success?(response)
|
122
|
+
response[:ewaytrxnstatus] == 'True'
|
123
|
+
end
|
124
|
+
|
125
|
+
def parse(xml)
|
126
|
+
response = {}
|
127
|
+
xml = REXML::Document.new(xml)
|
128
|
+
xml.elements.each('//ewayResponse/*') do |node|
|
129
|
+
response[node.name.downcase.to_sym] = normalize(node.text)
|
130
|
+
end unless xml.root.nil?
|
131
|
+
|
132
|
+
response
|
133
|
+
end
|
134
|
+
|
135
|
+
def post_data(parameters = {})
|
136
|
+
xml = REXML::Document.new
|
137
|
+
root = xml.add_element('ewaygateway')
|
138
|
+
|
139
|
+
parameters.each do |key, value|
|
140
|
+
root.add_element("eway#{key}").text = value
|
141
|
+
end
|
142
|
+
xml.to_s
|
143
|
+
end
|
144
|
+
|
145
|
+
def message_from(message)
|
146
|
+
return '' if message.blank?
|
147
|
+
|
148
|
+
MESSAGES[message[0, 2]] || message
|
149
|
+
end
|
150
|
+
|
151
|
+
def purchase_url(cvn)
|
152
|
+
suffix = test? ? 'xmltest/testpage.asp' : 'xmlpayment.asp'
|
153
|
+
gateway_part = cvn ? 'gateway_cvn' : 'gateway'
|
154
|
+
"#{live_url}/#{gateway_part}/#{suffix}"
|
155
|
+
end
|
156
|
+
|
157
|
+
def refund_url
|
158
|
+
suffix = test? ? 'xmltest/refund_test.asp' : 'xmlpaymentrefund.asp'
|
159
|
+
"#{live_url}/gateway/#{suffix}"
|
160
|
+
end
|
161
|
+
|
162
|
+
MESSAGES = {
|
163
|
+
'00' => 'Transaction Approved',
|
164
|
+
'01' => 'Refer to Issuer',
|
165
|
+
'02' => 'Refer to Issuer, special',
|
166
|
+
'03' => 'No Merchant',
|
167
|
+
'04' => 'Pick Up Card',
|
168
|
+
'05' => 'Do Not Honour',
|
169
|
+
'06' => 'Error',
|
170
|
+
'07' => 'Pick Up Card, Special',
|
171
|
+
'08' => 'Honour With Identification',
|
172
|
+
'09' => 'Request In Progress',
|
173
|
+
'10' => 'Approved For Partial Amount',
|
174
|
+
'11' => 'Approved, VIP',
|
175
|
+
'12' => 'Invalid Transaction',
|
176
|
+
'13' => 'Invalid Amount',
|
177
|
+
'14' => 'Invalid Card Number',
|
178
|
+
'15' => 'No Issuer',
|
179
|
+
'16' => 'Approved, Update Track 3',
|
180
|
+
'19' => 'Re-enter Last Transaction',
|
181
|
+
'21' => 'No Action Taken',
|
182
|
+
'22' => 'Suspected Malfunction',
|
183
|
+
'23' => 'Unacceptable Transaction Fee',
|
184
|
+
'25' => 'Unable to Locate Record On File',
|
185
|
+
'30' => 'Format Error',
|
186
|
+
'31' => 'Bank Not Supported By Switch',
|
187
|
+
'33' => 'Expired Card, Capture',
|
188
|
+
'34' => 'Suspected Fraud, Retain Card',
|
189
|
+
'35' => 'Card Acceptor, Contact Acquirer, Retain Card',
|
190
|
+
'36' => 'Restricted Card, Retain Card',
|
191
|
+
'37' => 'Contact Acquirer Security Department, Retain Card',
|
192
|
+
'38' => 'PIN Tries Exceeded, Capture',
|
193
|
+
'39' => 'No Credit Account',
|
194
|
+
'40' => 'Function Not Supported',
|
195
|
+
'41' => 'Lost Card',
|
196
|
+
'42' => 'No Universal Account',
|
197
|
+
'43' => 'Stolen Card',
|
198
|
+
'44' => 'No Investment Account',
|
199
|
+
'51' => 'Insufficient Funds',
|
200
|
+
'52' => 'No Cheque Account',
|
201
|
+
'53' => 'No Savings Account',
|
202
|
+
'54' => 'Expired Card',
|
203
|
+
'55' => 'Incorrect PIN',
|
204
|
+
'56' => 'No Card Record',
|
205
|
+
'57' => 'Function Not Permitted to Cardholder',
|
206
|
+
'58' => 'Function Not Permitted to Terminal',
|
207
|
+
'59' => 'Suspected Fraud',
|
208
|
+
'60' => 'Acceptor Contact Acquirer',
|
209
|
+
'61' => 'Exceeds Withdrawal Limit',
|
210
|
+
'62' => 'Restricted Card',
|
211
|
+
'63' => 'Security Violation',
|
212
|
+
'64' => 'Original Amount Incorrect',
|
213
|
+
'66' => 'Acceptor Contact Acquirer, Security',
|
214
|
+
'67' => 'Capture Card',
|
215
|
+
'75' => 'PIN Tries Exceeded',
|
216
|
+
'82' => 'CVV Validation Error',
|
217
|
+
'90' => 'Cutoff In Progress',
|
218
|
+
'91' => 'Card Issuer Unavailable',
|
219
|
+
'92' => 'Unable To Route Transaction',
|
220
|
+
'93' => 'Cannot Complete, Violation Of The Law',
|
221
|
+
'94' => 'Duplicate Transaction',
|
222
|
+
'96' => 'System Error'
|
223
|
+
}
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|