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,346 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class EbanxGateway < Gateway
|
4
|
+
self.test_url = 'https://sandbox.ebanxpay.com/ws/'
|
5
|
+
self.live_url = 'https://api.ebanxpay.com/ws/'
|
6
|
+
|
7
|
+
self.supported_countries = %w(BR MX CO CL AR PE)
|
8
|
+
self.default_currency = 'USD'
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club elo hipercard]
|
10
|
+
|
11
|
+
self.homepage_url = 'http://www.ebanx.com/'
|
12
|
+
self.display_name = 'EBANX'
|
13
|
+
|
14
|
+
TAGS = ['Spreedly']
|
15
|
+
|
16
|
+
URL_MAP = {
|
17
|
+
purchase: 'direct',
|
18
|
+
authorize: 'direct',
|
19
|
+
capture: 'capture',
|
20
|
+
refund: 'refund',
|
21
|
+
void: 'cancel',
|
22
|
+
store: 'token',
|
23
|
+
inquire: 'query'
|
24
|
+
}
|
25
|
+
|
26
|
+
HTTP_METHOD = {
|
27
|
+
purchase: :post,
|
28
|
+
authorize: :post,
|
29
|
+
capture: :get,
|
30
|
+
refund: :post,
|
31
|
+
void: :get,
|
32
|
+
store: :post,
|
33
|
+
inquire: :get
|
34
|
+
}
|
35
|
+
|
36
|
+
VERIFY_AMOUNT_PER_COUNTRY = {
|
37
|
+
'br' => 100,
|
38
|
+
'ar' => 100,
|
39
|
+
'co' => 50000,
|
40
|
+
'pe' => 300,
|
41
|
+
'mx' => 2000,
|
42
|
+
'cl' => 80000
|
43
|
+
}
|
44
|
+
|
45
|
+
def initialize(options = {})
|
46
|
+
requires!(options, :integration_key)
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
def purchase(money, payment, options = {})
|
51
|
+
post = { payment: {} }
|
52
|
+
add_integration_key(post)
|
53
|
+
add_operation(post)
|
54
|
+
add_invoice(post, money, options)
|
55
|
+
add_customer_data(post, payment, options)
|
56
|
+
add_card_or_token(post, payment, options)
|
57
|
+
add_address(post, options)
|
58
|
+
add_customer_responsible_person(post, payment, options)
|
59
|
+
add_additional_data(post, options)
|
60
|
+
|
61
|
+
commit(:purchase, post)
|
62
|
+
end
|
63
|
+
|
64
|
+
def authorize(money, payment, options = {})
|
65
|
+
post = { payment: {} }
|
66
|
+
add_integration_key(post)
|
67
|
+
add_operation(post)
|
68
|
+
add_invoice(post, money, options)
|
69
|
+
add_customer_data(post, payment, options)
|
70
|
+
add_card_or_token(post, payment, options)
|
71
|
+
add_address(post, options)
|
72
|
+
add_customer_responsible_person(post, payment, options)
|
73
|
+
add_additional_data(post, options)
|
74
|
+
post[:payment][:creditcard][:auto_capture] = false
|
75
|
+
|
76
|
+
commit(:authorize, post)
|
77
|
+
end
|
78
|
+
|
79
|
+
def capture(money, authorization, options = {})
|
80
|
+
post = {}
|
81
|
+
add_integration_key(post)
|
82
|
+
post[:hash] = authorization
|
83
|
+
post[:amount] = amount(money) if options[:include_capture_amount].to_s == 'true'
|
84
|
+
|
85
|
+
commit(:capture, post)
|
86
|
+
end
|
87
|
+
|
88
|
+
def refund(money, authorization, options = {})
|
89
|
+
post = {}
|
90
|
+
add_integration_key(post)
|
91
|
+
add_operation(post)
|
92
|
+
add_authorization(post, authorization)
|
93
|
+
post[:amount] = amount(money)
|
94
|
+
post[:description] = options[:description]
|
95
|
+
|
96
|
+
commit(:refund, post)
|
97
|
+
end
|
98
|
+
|
99
|
+
def void(authorization, options = {})
|
100
|
+
post = {}
|
101
|
+
add_integration_key(post)
|
102
|
+
add_authorization(post, authorization)
|
103
|
+
|
104
|
+
commit(:void, post)
|
105
|
+
end
|
106
|
+
|
107
|
+
def store(credit_card, options = {})
|
108
|
+
post = {}
|
109
|
+
add_integration_key(post)
|
110
|
+
add_payment_details(post, credit_card)
|
111
|
+
post[:country] = customer_country(options)
|
112
|
+
|
113
|
+
commit(:store, post)
|
114
|
+
end
|
115
|
+
|
116
|
+
def verify(credit_card, options = {})
|
117
|
+
MultiResponse.run(:use_first_response) do |r|
|
118
|
+
r.process { authorize(VERIFY_AMOUNT_PER_COUNTRY[customer_country(options)], credit_card, options) }
|
119
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def inquire(authorization, options = {})
|
124
|
+
post = {}
|
125
|
+
add_integration_key(post)
|
126
|
+
add_authorization(post, authorization)
|
127
|
+
|
128
|
+
commit(:inquire, post)
|
129
|
+
end
|
130
|
+
|
131
|
+
def supports_scrubbing?
|
132
|
+
true
|
133
|
+
end
|
134
|
+
|
135
|
+
def scrub(transcript)
|
136
|
+
transcript.
|
137
|
+
gsub(/(integration_key\\?":\\?")(\w*)/, '\1[FILTERED]').
|
138
|
+
gsub(/(card_number\\?":\\?")(\d*)/, '\1[FILTERED]').
|
139
|
+
gsub(/(card_cvv\\?":\\?")(\d*)/, '\1[FILTERED]')
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
def add_integration_key(post)
|
145
|
+
post[:integration_key] = @options[:integration_key].to_s
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_operation(post)
|
149
|
+
post[:operation] = 'request'
|
150
|
+
end
|
151
|
+
|
152
|
+
def add_authorization(post, authorization)
|
153
|
+
post[:hash] = authorization
|
154
|
+
end
|
155
|
+
|
156
|
+
def add_customer_data(post, payment, options)
|
157
|
+
post[:payment][:name] = customer_name(payment, options)
|
158
|
+
post[:payment][:email] = options[:email]
|
159
|
+
post[:payment][:document] = options[:document]
|
160
|
+
post[:payment][:birth_date] = options[:birth_date] if options[:birth_date]
|
161
|
+
end
|
162
|
+
|
163
|
+
def add_customer_responsible_person(post, payment, options)
|
164
|
+
post[:payment][:person_type] = options[:person_type] if options[:person_type]
|
165
|
+
if options[:person_type]&.casecmp('business')&.zero?
|
166
|
+
post[:payment][:responsible] = {}
|
167
|
+
post[:payment][:responsible][:name] = options[:responsible_name] if options[:responsible_name]
|
168
|
+
post[:payment][:responsible][:document] = options[:responsible_document] if options[:responsible_document]
|
169
|
+
post[:payment][:responsible][:birth_date] = options[:responsible_birth_date] if options[:responsible_birth_date]
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def add_address(post, options)
|
174
|
+
if address = options[:billing_address] || options[:address]
|
175
|
+
post[:payment][:address] = address[:address1].split[1..-1].join(' ') if address[:address1]
|
176
|
+
post[:payment][:street_number] = address[:address1].split.first if address[:address1]
|
177
|
+
post[:payment][:city] = address[:city]
|
178
|
+
post[:payment][:state] = address[:state]
|
179
|
+
post[:payment][:zipcode] = address[:zip]
|
180
|
+
post[:payment][:country] = address[:country].downcase
|
181
|
+
post[:payment][:phone_number] = address[:phone]
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def add_invoice(post, money, options)
|
186
|
+
post[:payment][:amount_total] = amount(money)
|
187
|
+
post[:payment][:currency_code] = (options[:currency] || currency(money))
|
188
|
+
post[:payment][:merchant_payment_code] = Digest::MD5.hexdigest(options[:order_id])
|
189
|
+
post[:payment][:instalments] = options[:instalments] || 1
|
190
|
+
post[:payment][:order_number] = options[:order_id][0..39] if options[:order_id]
|
191
|
+
end
|
192
|
+
|
193
|
+
def add_card_or_token(post, payment, options)
|
194
|
+
payment = payment.split('|')[0] if payment.is_a?(String)
|
195
|
+
post[:payment][:payment_type_code] = 'creditcard'
|
196
|
+
post[:payment][:creditcard] = payment_details(payment)
|
197
|
+
post[:payment][:creditcard][:soft_descriptor] = options[:soft_descriptor] if options[:soft_descriptor]
|
198
|
+
end
|
199
|
+
|
200
|
+
def add_payment_details(post, payment)
|
201
|
+
post[:payment_type_code] = 'creditcard'
|
202
|
+
post[:creditcard] = payment_details(payment)
|
203
|
+
end
|
204
|
+
|
205
|
+
def payment_details(payment)
|
206
|
+
if payment.is_a?(String)
|
207
|
+
{ token: payment }
|
208
|
+
else
|
209
|
+
{
|
210
|
+
card_number: payment.number,
|
211
|
+
card_name: payment.name,
|
212
|
+
card_due_date: "#{payment.month}/#{payment.year}",
|
213
|
+
card_cvv: payment.verification_value
|
214
|
+
}
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def add_additional_data(post, options)
|
219
|
+
post[:device_id] = options[:device_id] if options[:device_id]
|
220
|
+
post[:metadata] = options[:metadata] if options[:metadata]
|
221
|
+
post[:metadata] = {} if post[:metadata].nil?
|
222
|
+
post[:metadata][:merchant_payment_code] = options[:order_id] if options[:order_id]
|
223
|
+
post[:processing_type] = options[:processing_type] if options[:processing_type]
|
224
|
+
post[:payment][:tags] = TAGS
|
225
|
+
end
|
226
|
+
|
227
|
+
def parse(body)
|
228
|
+
JSON.parse(body)
|
229
|
+
end
|
230
|
+
|
231
|
+
def commit(action, parameters)
|
232
|
+
url = url_for((test? ? test_url : live_url), action, parameters)
|
233
|
+
|
234
|
+
response = parse(ssl_request(HTTP_METHOD[action], url, post_data(action, parameters), headers(parameters)))
|
235
|
+
|
236
|
+
success = success_from(action, response)
|
237
|
+
|
238
|
+
Response.new(
|
239
|
+
success,
|
240
|
+
message_from(response),
|
241
|
+
response,
|
242
|
+
authorization: authorization_from(action, parameters, response),
|
243
|
+
test: test?,
|
244
|
+
error_code: error_code_from(response, success)
|
245
|
+
)
|
246
|
+
end
|
247
|
+
|
248
|
+
def headers(params)
|
249
|
+
processing_type = params[:processing_type]
|
250
|
+
commit_headers = { 'x-ebanx-client-user-agent': "ActiveMerchant/#{ActiveMerchant::VERSION}" }
|
251
|
+
|
252
|
+
add_processing_type_to_commit_headers(commit_headers, processing_type) if processing_type == 'local'
|
253
|
+
|
254
|
+
commit_headers
|
255
|
+
end
|
256
|
+
|
257
|
+
def add_processing_type_to_commit_headers(commit_headers, processing_type)
|
258
|
+
commit_headers['x-ebanx-api-processing-type'] = processing_type
|
259
|
+
end
|
260
|
+
|
261
|
+
def success_from(action, response)
|
262
|
+
payment_status = response.try(:[], 'payment').try(:[], 'status')
|
263
|
+
|
264
|
+
if %i[purchase capture refund].include?(action)
|
265
|
+
payment_status == 'CO'
|
266
|
+
elsif action == :authorize
|
267
|
+
payment_status == 'PE'
|
268
|
+
elsif action == :void
|
269
|
+
payment_status == 'CA'
|
270
|
+
elsif %i[store inquire].include?(action)
|
271
|
+
response.try(:[], 'status') == 'SUCCESS'
|
272
|
+
else
|
273
|
+
false
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
def message_from(response)
|
278
|
+
return response['status_message'] if response['status'] == 'ERROR'
|
279
|
+
|
280
|
+
response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'description')
|
281
|
+
end
|
282
|
+
|
283
|
+
def authorization_from(action, parameters, response)
|
284
|
+
if action == :store
|
285
|
+
if success_from(action, response)
|
286
|
+
"#{response.try(:[], 'token')}|#{response['payment_type_code']}"
|
287
|
+
else
|
288
|
+
response.try(:[], 'token')
|
289
|
+
end
|
290
|
+
else
|
291
|
+
response.try(:[], 'payment').try(:[], 'hash')
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
def post_data(action, parameters = {})
|
296
|
+
return nil if requires_http_get(action)
|
297
|
+
return convert_to_url_form_encoded(parameters) if action == :refund
|
298
|
+
|
299
|
+
"request_body=#{parameters.to_json}"
|
300
|
+
end
|
301
|
+
|
302
|
+
def url_for(hostname, action, parameters)
|
303
|
+
return "#{hostname}#{URL_MAP[action]}?#{convert_to_url_form_encoded(parameters)}" if requires_http_get(action)
|
304
|
+
|
305
|
+
"#{hostname}#{URL_MAP[action]}"
|
306
|
+
end
|
307
|
+
|
308
|
+
def requires_http_get(action)
|
309
|
+
return true if %i[capture void inquire].include?(action)
|
310
|
+
|
311
|
+
false
|
312
|
+
end
|
313
|
+
|
314
|
+
def convert_to_url_form_encoded(parameters)
|
315
|
+
parameters.map do |key, value|
|
316
|
+
next if value != false && value.blank?
|
317
|
+
|
318
|
+
"#{key}=#{value}"
|
319
|
+
end.compact.join('&')
|
320
|
+
end
|
321
|
+
|
322
|
+
def error_code_from(response, success)
|
323
|
+
unless success
|
324
|
+
return response['status_code'] if response['status'] == 'ERROR'
|
325
|
+
|
326
|
+
response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'code')
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
def customer_country(options)
|
331
|
+
if country = options[:country] || (options[:billing_address][:country] if options[:billing_address])
|
332
|
+
country.downcase
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
def customer_name(payment, options)
|
337
|
+
address_name = options[:billing_address][:name] if options[:billing_address] && options[:billing_address][:name]
|
338
|
+
if payment.is_a?(String)
|
339
|
+
address_name || 'Not Provided'
|
340
|
+
else
|
341
|
+
payment.name
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class EfsnetGateway < Gateway
|
6
|
+
self.supported_countries = ['US']
|
7
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
8
|
+
self.homepage_url = 'http://www.concordefsnet.com/'
|
9
|
+
self.display_name = 'Efsnet'
|
10
|
+
|
11
|
+
self.test_url = 'https://testefsnet.concordebiz.com/efsnet.dll'
|
12
|
+
self.live_url = 'https://efsnet.concordebiz.com/efsnet.dll'
|
13
|
+
|
14
|
+
# login is your Store ID
|
15
|
+
# password is your Store Key
|
16
|
+
def initialize(options = {})
|
17
|
+
requires!(options, :login, :password)
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def authorize(money, creditcard, options = {})
|
22
|
+
request = build_credit_card_request(money, creditcard, options)
|
23
|
+
commit(:credit_card_authorize, request)
|
24
|
+
end
|
25
|
+
|
26
|
+
def purchase(money, creditcard, options = {})
|
27
|
+
request = build_credit_card_request(money, creditcard, options)
|
28
|
+
commit(:credit_card_charge, request)
|
29
|
+
end
|
30
|
+
|
31
|
+
def capture(money, identification, options = {})
|
32
|
+
request = build_refund_or_settle_request(money, identification, options)
|
33
|
+
commit(:credit_card_settle, request)
|
34
|
+
end
|
35
|
+
|
36
|
+
def credit(money, identification_or_credit_card, options = {})
|
37
|
+
if identification_or_credit_card.is_a?(String)
|
38
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
39
|
+
# Perform authorization reversal
|
40
|
+
refund(money, identification_or_credit_card, options)
|
41
|
+
else
|
42
|
+
# Perform credit
|
43
|
+
request = build_credit_card_request(money, identification_or_credit_card, options)
|
44
|
+
commit(:credit_card_credit, request)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def refund(money, reference, options = {})
|
49
|
+
# Perform authorization reversal
|
50
|
+
request = build_refund_or_settle_request(money, reference, options)
|
51
|
+
commit(:credit_card_refund, request)
|
52
|
+
end
|
53
|
+
|
54
|
+
def void(identification, options = {})
|
55
|
+
requires!(options, :order_id)
|
56
|
+
original_transaction_id, = identification.split(';')
|
57
|
+
commit(:void_transaction, { reference_number: format_reference_number(options[:order_id]), transaction_id: original_transaction_id })
|
58
|
+
end
|
59
|
+
|
60
|
+
def voice_authorize(money, authorization_code, creditcard, options = {})
|
61
|
+
options[:authorization_number] = authorization_code
|
62
|
+
request = build_credit_card_request(money, creditcard, options)
|
63
|
+
commit(:credit_card_voice_authorize, request)
|
64
|
+
end
|
65
|
+
|
66
|
+
def force(money, authorization_code, creditcard, options = {})
|
67
|
+
options[:authorization_number] = authorization_code
|
68
|
+
request = build_credit_card_request(money, creditcard, options)
|
69
|
+
commit(:credit_card_capture, request)
|
70
|
+
end
|
71
|
+
|
72
|
+
def system_check
|
73
|
+
commit(:system_check, {})
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def build_refund_or_settle_request(money, identification, options = {})
|
79
|
+
original_transaction_id, original_transaction_amount = identification.split(';')
|
80
|
+
|
81
|
+
requires!(options, :order_id)
|
82
|
+
|
83
|
+
{
|
84
|
+
reference_number: format_reference_number(options[:order_id]),
|
85
|
+
transaction_amount: amount(money),
|
86
|
+
original_transaction_amount: original_transaction_amount,
|
87
|
+
original_transaction_id: original_transaction_id,
|
88
|
+
client_ip_address: options[:ip]
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
def build_credit_card_request(money, creditcard, options = {})
|
93
|
+
requires!(options, :order_id)
|
94
|
+
|
95
|
+
post = {
|
96
|
+
reference_number: format_reference_number(options[:order_id]),
|
97
|
+
authorization_number: options[:authorization_number],
|
98
|
+
transaction_amount: amount(money),
|
99
|
+
client_ip_address: options[:ip]
|
100
|
+
|
101
|
+
}
|
102
|
+
add_creditcard(post, creditcard)
|
103
|
+
add_address(post, options)
|
104
|
+
post
|
105
|
+
end
|
106
|
+
|
107
|
+
def format_reference_number(number)
|
108
|
+
number.to_s.slice(0, 12)
|
109
|
+
end
|
110
|
+
|
111
|
+
def add_address(post, options)
|
112
|
+
if address = options[:billing_address] || options[:address]
|
113
|
+
if address[:address2]
|
114
|
+
post[:billing_address] = address[:address1].to_s << ' ' << address[:address2].to_s
|
115
|
+
else
|
116
|
+
post[:billing_address] = address[:address1].to_s
|
117
|
+
end
|
118
|
+
post[:billing_city] = address[:city].to_s
|
119
|
+
post[:billing_state] = address[:state].blank? ? 'n/a' : address[:state]
|
120
|
+
post[:billing_postal_code] = address[:zip].to_s
|
121
|
+
post[:billing_country] = address[:country].to_s
|
122
|
+
end
|
123
|
+
|
124
|
+
if address = options[:shipping_address]
|
125
|
+
if address[:address2]
|
126
|
+
post[:shipping_address] = address[:address1].to_s << ' ' << address[:address2].to_s
|
127
|
+
else
|
128
|
+
post[:shipping_address] = address[:address1].to_s
|
129
|
+
end
|
130
|
+
post[:shipping_city] = address[:city].to_s
|
131
|
+
post[:shipping_state] = address[:state].blank? ? 'n/a' : address[:state]
|
132
|
+
post[:shipping_postal_code] = address[:zip].to_s
|
133
|
+
post[:shipping_country] = address[:country].to_s
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def add_creditcard(post, creditcard)
|
138
|
+
post[:billing_name] = creditcard.name if creditcard.name
|
139
|
+
post[:account_number] = creditcard.number
|
140
|
+
post[:card_verification_value] = creditcard.verification_value if creditcard.verification_value?
|
141
|
+
post[:expiration_month] = sprintf('%.2i', creditcard.month)
|
142
|
+
post[:expiration_year] = sprintf('%.4i', creditcard.year)[-2..-1]
|
143
|
+
end
|
144
|
+
|
145
|
+
def commit(action, parameters)
|
146
|
+
response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters), 'Content-Type' => 'text/xml'))
|
147
|
+
|
148
|
+
Response.new(success?(response), message_from(response[:result_message]), response,
|
149
|
+
test: test?,
|
150
|
+
authorization: authorization_from(response, parameters),
|
151
|
+
avs_result: { code: response[:avs_response_code] },
|
152
|
+
cvv_result: response[:cvv_response_code])
|
153
|
+
end
|
154
|
+
|
155
|
+
def success?(response)
|
156
|
+
response[:response_code] == '0'
|
157
|
+
end
|
158
|
+
|
159
|
+
def authorization_from(response, params)
|
160
|
+
[response[:transaction_id], params[:transaction_amount]].compact.join(';')
|
161
|
+
end
|
162
|
+
|
163
|
+
def parse(xml)
|
164
|
+
response = {}
|
165
|
+
|
166
|
+
xml = REXML::Document.new(xml)
|
167
|
+
|
168
|
+
xml.elements.each('//Reply//TransactionReply/*') do |node|
|
169
|
+
response[node.name.underscore.to_sym] = normalize(node.text)
|
170
|
+
end unless xml.root.nil?
|
171
|
+
|
172
|
+
response
|
173
|
+
end
|
174
|
+
|
175
|
+
def post_data(action, parameters = {})
|
176
|
+
xml = REXML::Document.new("<?xml version='1.0' encoding='UTF-8'?>")
|
177
|
+
root = xml.add_element('Request')
|
178
|
+
root.attributes['StoreID'] = options[:login]
|
179
|
+
root.attributes['StoreKey'] = options[:password]
|
180
|
+
root.attributes['ApplicationID'] = 'ot 1.0'
|
181
|
+
transaction = root.add_element(action.to_s.camelize)
|
182
|
+
|
183
|
+
actions[action].each do |key|
|
184
|
+
transaction.add_element(key).text = parameters[key.underscore.to_sym] unless parameters[key.underscore.to_sym].blank?
|
185
|
+
end
|
186
|
+
|
187
|
+
xml.to_s
|
188
|
+
end
|
189
|
+
|
190
|
+
def message_from(message)
|
191
|
+
return 'Unspecified error' if message.blank?
|
192
|
+
|
193
|
+
message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
|
194
|
+
end
|
195
|
+
|
196
|
+
def actions
|
197
|
+
ACTIONS
|
198
|
+
end
|
199
|
+
|
200
|
+
CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber)
|
201
|
+
|
202
|
+
ACTIONS = {
|
203
|
+
credit_card_authorize: CREDIT_CARD_FIELDS,
|
204
|
+
credit_card_charge: CREDIT_CARD_FIELDS,
|
205
|
+
credit_card_voice_authorize: CREDIT_CARD_FIELDS,
|
206
|
+
credit_card_capture: CREDIT_CARD_FIELDS,
|
207
|
+
credit_card_credit: CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
|
208
|
+
credit_card_refund: %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
209
|
+
void_transaction: %w(ReferenceNumber TransactionID),
|
210
|
+
credit_card_settle: %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
211
|
+
system_check: %w(SystemCheck)
|
212
|
+
}
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|