activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- 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 +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -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/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -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.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -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 +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- 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/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- 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 +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- 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 +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- 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 +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- 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 +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -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 +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,386 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
module ActiveMerchant #:nodoc:
|
5
|
+
module Billing #:nodoc:
|
6
|
+
class ElementGateway < Gateway
|
7
|
+
self.test_url = 'https://certtransaction.elementexpress.com/express.asmx'
|
8
|
+
self.live_url = 'https://transaction.elementexpress.com/express.asmx'
|
9
|
+
|
10
|
+
self.supported_countries = ['US']
|
11
|
+
self.default_currency = 'USD'
|
12
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
13
|
+
|
14
|
+
self.homepage_url = 'http://www.elementps.com'
|
15
|
+
self.display_name = 'Element'
|
16
|
+
|
17
|
+
SERVICE_TEST_URL = 'https://certservices.elementexpress.com/express.asmx'
|
18
|
+
SERVICE_LIVE_URL = 'https://services.elementexpress.com/express.asmx'
|
19
|
+
|
20
|
+
def initialize(options = {})
|
21
|
+
requires!(options, :account_id, :account_token, :application_id, :acceptor_id, :application_name, :application_version)
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def purchase(money, payment, options = {})
|
26
|
+
action = payment.is_a?(Check) ? 'CheckSale' : 'CreditCardSale'
|
27
|
+
|
28
|
+
request = build_soap_request do |xml|
|
29
|
+
xml.send(action, xmlns: 'https://transaction.elementexpress.com') do
|
30
|
+
add_credentials(xml)
|
31
|
+
add_payment_method(xml, payment)
|
32
|
+
add_transaction(xml, money, options)
|
33
|
+
add_terminal(xml, options)
|
34
|
+
add_address(xml, options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
commit(action, request, money)
|
39
|
+
end
|
40
|
+
|
41
|
+
def authorize(money, payment, options = {})
|
42
|
+
request = build_soap_request do |xml|
|
43
|
+
xml.CreditCardAuthorization(xmlns: 'https://transaction.elementexpress.com') do
|
44
|
+
add_credentials(xml)
|
45
|
+
add_payment_method(xml, payment)
|
46
|
+
add_transaction(xml, money, options)
|
47
|
+
add_terminal(xml, options)
|
48
|
+
add_address(xml, options)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
commit('CreditCardAuthorization', request, money)
|
53
|
+
end
|
54
|
+
|
55
|
+
def capture(money, authorization, options = {})
|
56
|
+
trans_id, = split_authorization(authorization)
|
57
|
+
options[:trans_id] = trans_id
|
58
|
+
|
59
|
+
request = build_soap_request do |xml|
|
60
|
+
xml.CreditCardAuthorizationCompletion(xmlns: 'https://transaction.elementexpress.com') do
|
61
|
+
add_credentials(xml)
|
62
|
+
add_transaction(xml, money, options)
|
63
|
+
add_terminal(xml, options)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
commit('CreditCardAuthorizationCompletion', request, money)
|
68
|
+
end
|
69
|
+
|
70
|
+
def refund(money, authorization, options = {})
|
71
|
+
trans_id, = split_authorization(authorization)
|
72
|
+
options[:trans_id] = trans_id
|
73
|
+
|
74
|
+
request = build_soap_request do |xml|
|
75
|
+
xml.CreditCardReturn(xmlns: 'https://transaction.elementexpress.com') do
|
76
|
+
add_credentials(xml)
|
77
|
+
add_transaction(xml, money, options)
|
78
|
+
add_terminal(xml, options)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
commit('CreditCardReturn', request, money)
|
83
|
+
end
|
84
|
+
|
85
|
+
def credit(money, payment, options = {})
|
86
|
+
request = build_soap_request do |xml|
|
87
|
+
xml.CreditCardCredit(xmlns: 'https://transaction.elementexpress.com') do
|
88
|
+
add_credentials(xml)
|
89
|
+
add_payment_method(xml, payment)
|
90
|
+
add_transaction(xml, money, options)
|
91
|
+
add_terminal(xml, options)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
commit('CreditCardCredit', request, money)
|
96
|
+
end
|
97
|
+
|
98
|
+
def void(authorization, options = {})
|
99
|
+
trans_id, trans_amount = split_authorization(authorization)
|
100
|
+
options.merge!({ trans_id: trans_id, trans_amount: trans_amount, reversal_type: 'Full' })
|
101
|
+
|
102
|
+
request = build_soap_request do |xml|
|
103
|
+
xml.CreditCardReversal(xmlns: 'https://transaction.elementexpress.com') do
|
104
|
+
add_credentials(xml)
|
105
|
+
add_transaction(xml, trans_amount, options)
|
106
|
+
add_terminal(xml, options)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
commit('CreditCardReversal', request, trans_amount)
|
111
|
+
end
|
112
|
+
|
113
|
+
def store(payment, options = {})
|
114
|
+
request = build_soap_request do |xml|
|
115
|
+
xml.PaymentAccountCreate(xmlns: 'https://services.elementexpress.com') do
|
116
|
+
add_credentials(xml)
|
117
|
+
add_payment_method(xml, payment)
|
118
|
+
add_payment_account(xml, payment, options[:payment_account_reference_number] || SecureRandom.hex(20))
|
119
|
+
add_address(xml, options)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
commit('PaymentAccountCreate', request, nil)
|
124
|
+
end
|
125
|
+
|
126
|
+
def verify(credit_card, options = {})
|
127
|
+
request = build_soap_request do |xml|
|
128
|
+
xml.CreditCardAVSOnly(xmlns: 'https://transaction.elementexpress.com') do
|
129
|
+
add_credentials(xml)
|
130
|
+
add_payment_method(xml, credit_card)
|
131
|
+
add_transaction(xml, 0, options)
|
132
|
+
add_terminal(xml, options)
|
133
|
+
add_address(xml, options)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# send request with the transaction amount set to 0
|
138
|
+
commit('CreditCardAVSOnly', request, 0)
|
139
|
+
end
|
140
|
+
|
141
|
+
def supports_scrubbing?
|
142
|
+
true
|
143
|
+
end
|
144
|
+
|
145
|
+
def scrub(transcript)
|
146
|
+
transcript.
|
147
|
+
gsub(%r((<AccountToken>).+?(</AccountToken>))i, '\1[FILTERED]\2').
|
148
|
+
gsub(%r((<CardNumber>).+?(</CardNumber>))i, '\1[FILTERED]\2').
|
149
|
+
gsub(%r((<CVV>).+?(</CVV>))i, '\1[FILTERED]\2').
|
150
|
+
gsub(%r((<AccountNumber>).+?(</AccountNumber>))i, '\1[FILTERED]\2').
|
151
|
+
gsub(%r((<RoutingNumber>).+?(</RoutingNumber>))i, '\1[FILTERED]\2')
|
152
|
+
end
|
153
|
+
|
154
|
+
private
|
155
|
+
|
156
|
+
def add_credentials(xml)
|
157
|
+
xml.credentials do
|
158
|
+
xml.AccountID @options[:account_id]
|
159
|
+
xml.AccountToken @options[:account_token]
|
160
|
+
xml.AcceptorID @options[:acceptor_id]
|
161
|
+
end
|
162
|
+
xml.application do
|
163
|
+
xml.ApplicationID @options[:application_id]
|
164
|
+
xml.ApplicationName @options[:application_name]
|
165
|
+
xml.ApplicationVersion @options[:application_version]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def add_payment_method(xml, payment)
|
170
|
+
if payment.is_a?(String)
|
171
|
+
add_payment_account_id(xml, payment)
|
172
|
+
elsif payment.is_a?(Check)
|
173
|
+
add_echeck(xml, payment)
|
174
|
+
else
|
175
|
+
add_credit_card(xml, payment)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def add_payment_account(xml, payment, payment_account_reference_number)
|
180
|
+
xml.paymentAccount do
|
181
|
+
xml.PaymentAccountType payment_account_type(payment)
|
182
|
+
xml.PaymentAccountReferenceNumber payment_account_reference_number
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def add_payment_account_id(xml, payment)
|
187
|
+
xml.extendedParameters do
|
188
|
+
xml.ExtendedParameters do
|
189
|
+
xml.Key 'PaymentAccount'
|
190
|
+
xml.Value('xsi:type' => 'PaymentAccount') do
|
191
|
+
xml.PaymentAccountID payment
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def add_transaction(xml, money, options = {})
|
198
|
+
xml.transaction do
|
199
|
+
xml.ReversalType options[:reversal_type] if options[:reversal_type]
|
200
|
+
xml.TransactionID options[:trans_id] if options[:trans_id]
|
201
|
+
xml.TransactionAmount amount(money.to_i) if money
|
202
|
+
xml.MarketCode market_code(money, options) if options[:market_code] || money
|
203
|
+
xml.ReferenceNumber options[:order_id] || SecureRandom.hex(20)
|
204
|
+
xml.TicketNumber options[:ticket_number] if options[:ticket_number]
|
205
|
+
xml.MerchantSuppliedTransactionId options[:merchant_supplied_transaction_id] if options[:merchant_supplied_transaction_id]
|
206
|
+
xml.PaymentType options[:payment_type] if options[:payment_type]
|
207
|
+
xml.SubmissionType options[:submission_type] if options[:submission_type]
|
208
|
+
xml.DuplicateCheckDisableFlag options[:duplicate_check_disable_flag].to_s == 'true' ? 'True' : 'False' unless options[:duplicate_check_disable_flag].nil?
|
209
|
+
xml.DuplicateOverrideFlag options[:duplicate_override_flag].to_s == 'true' ? 'True' : 'False' unless options[:duplicate_override_flag].nil?
|
210
|
+
xml.MerchantDescriptor options[:merchant_descriptor] if options[:merchant_descriptor]
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def market_code(money, options)
|
215
|
+
options[:market_code] || 'Default'
|
216
|
+
end
|
217
|
+
|
218
|
+
def add_terminal(xml, options)
|
219
|
+
xml.terminal do
|
220
|
+
xml.TerminalID options[:terminal_id] || '01'
|
221
|
+
xml.CardPresentCode options[:card_present_code] || 'UseDefault'
|
222
|
+
xml.CardholderPresentCode 'UseDefault'
|
223
|
+
xml.CardInputCode 'UseDefault'
|
224
|
+
xml.CVVPresenceCode 'UseDefault'
|
225
|
+
xml.TerminalCapabilityCode 'UseDefault'
|
226
|
+
xml.TerminalEnvironmentCode 'UseDefault'
|
227
|
+
xml.MotoECICode 'NonAuthenticatedSecureECommerceTransaction'
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def add_credit_card(xml, payment)
|
232
|
+
xml.card do
|
233
|
+
xml.CardNumber payment.number
|
234
|
+
xml.ExpirationMonth format(payment.month, :two_digits)
|
235
|
+
xml.ExpirationYear format(payment.year, :two_digits)
|
236
|
+
xml.CardholderName payment.first_name + ' ' + payment.last_name
|
237
|
+
xml.CVV payment.verification_value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def add_echeck(xml, payment)
|
242
|
+
xml.demandDepositAccount do
|
243
|
+
xml.AccountNumber payment.account_number
|
244
|
+
xml.RoutingNumber payment.routing_number
|
245
|
+
xml.DDAAccountType payment.account_type.capitalize
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def add_address(xml, options)
|
250
|
+
if address = options[:billing_address] || options[:address]
|
251
|
+
xml.address do
|
252
|
+
xml.BillingAddress1 address[:address1] if address[:address1]
|
253
|
+
xml.BillingAddress2 address[:address2] if address[:address2]
|
254
|
+
xml.BillingCity address[:city] if address[:city]
|
255
|
+
xml.BillingState address[:state] if address[:state]
|
256
|
+
xml.BillingZipcode address[:zip] if address[:zip]
|
257
|
+
xml.BillingEmail address[:email] if address[:email]
|
258
|
+
xml.BillingPhone address[:phone_number] if address[:phone_number]
|
259
|
+
end
|
260
|
+
end
|
261
|
+
if shipping_address = options[:shipping_address]
|
262
|
+
xml.address do
|
263
|
+
xml.ShippingAddress1 shipping_address[:address1] if shipping_address[:address1]
|
264
|
+
xml.ShippingAddress2 shipping_address[:address2] if shipping_address[:address2]
|
265
|
+
xml.ShippingCity shipping_address[:city] if shipping_address[:city]
|
266
|
+
xml.ShippingState shipping_address[:state] if shipping_address[:state]
|
267
|
+
xml.ShippingZipcode shipping_address[:zip] if shipping_address[:zip]
|
268
|
+
xml.ShippingEmail shipping_address[:email] if shipping_address[:email]
|
269
|
+
xml.ShippingPhone shipping_address[:phone_number] if shipping_address[:phone_number]
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def parse(xml)
|
275
|
+
response = {}
|
276
|
+
|
277
|
+
doc = Nokogiri::XML(xml)
|
278
|
+
doc.remove_namespaces!
|
279
|
+
root = doc.root.xpath('//response/*')
|
280
|
+
|
281
|
+
root = doc.root.xpath('//Response/*') if root.empty?
|
282
|
+
|
283
|
+
root.each do |node|
|
284
|
+
if node.elements.empty?
|
285
|
+
response[node.name.downcase] = node.text
|
286
|
+
else
|
287
|
+
node_name = node.name.downcase
|
288
|
+
response[node_name] = Hash.new
|
289
|
+
|
290
|
+
node.elements.each do |childnode|
|
291
|
+
response[node_name][childnode.name.downcase] = childnode.text
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
response
|
297
|
+
end
|
298
|
+
|
299
|
+
def commit(action, xml, amount)
|
300
|
+
response = parse(ssl_post(url(action), xml, headers(action)))
|
301
|
+
|
302
|
+
Response.new(
|
303
|
+
success_from(response),
|
304
|
+
message_from(response),
|
305
|
+
response,
|
306
|
+
authorization: authorization_from(action, response, amount),
|
307
|
+
avs_result: success_from(response) ? avs_from(response) : nil,
|
308
|
+
cvv_result: success_from(response) ? cvv_from(response) : nil,
|
309
|
+
test: test?
|
310
|
+
)
|
311
|
+
end
|
312
|
+
|
313
|
+
def authorization_from(action, response, amount)
|
314
|
+
if action == 'PaymentAccountCreate'
|
315
|
+
response['paymentaccount']['paymentaccountid']
|
316
|
+
else
|
317
|
+
"#{response['transaction']['transactionid']}|#{amount}" if response['transaction']
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
def success_from(response)
|
322
|
+
response['expressresponsecode'] == '0'
|
323
|
+
end
|
324
|
+
|
325
|
+
def message_from(response)
|
326
|
+
response['expressresponsemessage']
|
327
|
+
end
|
328
|
+
|
329
|
+
def avs_from(response)
|
330
|
+
AVSResult.new(code: response['card']['avsresponsecode']) if response['card']
|
331
|
+
end
|
332
|
+
|
333
|
+
def cvv_from(response)
|
334
|
+
CVVResult.new(response['card']['cvvresponsecode']) if response['card']
|
335
|
+
end
|
336
|
+
|
337
|
+
def split_authorization(authorization)
|
338
|
+
authorization.split('|')
|
339
|
+
end
|
340
|
+
|
341
|
+
def build_soap_request
|
342
|
+
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
343
|
+
xml['soap'].Envelope('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
344
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
345
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/') do
|
346
|
+
|
347
|
+
xml['soap'].Body do
|
348
|
+
yield(xml)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
builder.to_xml
|
354
|
+
end
|
355
|
+
|
356
|
+
def payment_account_type(payment)
|
357
|
+
if payment.is_a?(Check)
|
358
|
+
payment_account_type = payment.account_type
|
359
|
+
else
|
360
|
+
payment_account_type = 'CreditCard'
|
361
|
+
end
|
362
|
+
payment_account_type
|
363
|
+
end
|
364
|
+
|
365
|
+
def url(action)
|
366
|
+
if action == 'PaymentAccountCreate'
|
367
|
+
test? ? SERVICE_TEST_URL : SERVICE_LIVE_URL
|
368
|
+
else
|
369
|
+
test? ? test_url : live_url
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
def interface(action)
|
374
|
+
return 'transaction' if action != 'PaymentAccountCreate'
|
375
|
+
return 'services' if action == 'PaymentAccountCreate'
|
376
|
+
end
|
377
|
+
|
378
|
+
def headers(action)
|
379
|
+
{
|
380
|
+
'Content-Type' => 'text/xml; charset=utf-8',
|
381
|
+
'SOAPAction' => "https://#{interface(action)}.elementexpress.com/#{action}"
|
382
|
+
}
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
@@ -1,53 +1,52 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class EpayGateway < Gateway
|
4
|
-
|
5
|
-
self.live_url = 'https://' + API_HOST + '/remote/payment'
|
4
|
+
self.live_url = 'https://ssl.ditonlinebetalingssystem.dk/'
|
6
5
|
|
7
6
|
self.default_currency = 'DKK'
|
8
7
|
self.money_format = :cents
|
9
|
-
self.
|
10
|
-
|
11
|
-
|
8
|
+
self.supported_countries = %w[DK SE NO]
|
9
|
+
self.supported_cardtypes = %i[dankort forbrugsforeningen visa master
|
10
|
+
american_express diners_club jcb maestro]
|
12
11
|
self.homepage_url = 'http://epay.dk/'
|
13
12
|
self.display_name = 'ePay'
|
14
13
|
|
15
14
|
CURRENCY_CODES = {
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
15
|
+
ADP: '020', AED: '784', AFA: '004', ALL: '008', AMD: '051',
|
16
|
+
ANG: '532', AOA: '973', ARS: '032', AUD: '036', AWG: '533',
|
17
|
+
AZM: '031', BAM: '977', BBD: '052', BDT: '050', BGL: '100',
|
18
|
+
BGN: '975', BHD: '048', BIF: '108', BMD: '060', BND: '096',
|
19
|
+
BOB: '068', BOV: '984', BRL: '986', BSD: '044', BTN: '064',
|
20
|
+
BWP: '072', BYR: '974', BZD: '084', CAD: '124', CDF: '976',
|
21
|
+
CHF: '756', CLF: '990', CLP: '152', CNY: '156', COP: '170',
|
22
|
+
CRC: '188', CUP: '192', CVE: '132', CYP: '196', CZK: '203',
|
23
|
+
DJF: '262', DKK: '208', DOP: '214', DZD: '012', ECS: '218',
|
24
|
+
ECV: '983', EEK: '233', EGP: '818', ERN: '232', ETB: '230',
|
25
|
+
EUR: '978', FJD: '242', FKP: '238', GBP: '826', GEL: '981',
|
26
|
+
GHC: '288', GIP: '292', GMD: '270', GNF: '324', GTQ: '320',
|
27
|
+
GWP: '624', GYD: '328', HKD: '344', HNL: '340', HRK: '191',
|
28
|
+
HTG: '332', HUF: '348', IDR: '360', ILS: '376', INR: '356',
|
29
|
+
IQD: '368', IRR: '364', ISK: '352', JMD: '388', JOD: '400',
|
30
|
+
JPY: '392', KES: '404', KGS: '417', KHR: '116', KMF: '174',
|
31
|
+
KPW: '408', KRW: '410', KWD: '414', KYD: '136', KZT: '398',
|
32
|
+
LAK: '418', LBP: '422', LKR: '144', LRD: '430', LSL: '426',
|
33
|
+
LTL: '440', LVL: '428', LYD: '434', MAD: '504', MDL: '498',
|
34
|
+
MGF: '450', MKD: '807', MMK: '104', MNT: '496', MOP: '446',
|
35
|
+
MRO: '478', MTL: '470', MUR: '480', MVR: '462', MWK: '454',
|
36
|
+
MXN: '484', MXV: '979', MYR: '458', MZM: '508', NAD: '516',
|
37
|
+
NGN: '566', NIO: '558', NOK: '578', NPR: '524', NZD: '554',
|
38
|
+
OMR: '512', PAB: '590', PEN: '604', PGK: '598', PHP: '608',
|
39
|
+
PKR: '586', PLN: '985', PYG: '600', QAR: '634', ROL: '642',
|
40
|
+
RUB: '643', RUR: '810', RWF: '646', SAR: '682', SBD: '090',
|
41
|
+
SCR: '690', SDD: '736', SEK: '752', SGD: '702', SHP: '654',
|
42
|
+
SIT: '705', SKK: '703', SLL: '694', SOS: '706', SRG: '740',
|
43
|
+
STD: '678', SVC: '222', SYP: '760', SZL: '748', THB: '764',
|
44
|
+
TJS: '972', TMM: '795', TND: '788', TOP: '776', TPE: '626',
|
45
|
+
TRL: '792', TRY: '949', TTD: '780', TWD: '901', TZS: '834',
|
46
|
+
UAH: '980', UGX: '800', USD: '840', UYU: '858', UZS: '860',
|
47
|
+
VEB: '862', VND: '704', VUV: '548', XAF: '950', XCD: '951',
|
48
|
+
XOF: '952', XPF: '953', YER: '886', YUM: '891', ZAR: '710',
|
49
|
+
ZMK: '894', ZWD: '716'
|
51
50
|
}
|
52
51
|
|
53
52
|
# login: merchant number
|
@@ -64,6 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
64
63
|
add_invoice(post, options)
|
65
64
|
add_creditcard_or_reference(post, credit_card_or_reference)
|
66
65
|
add_instant_capture(post, false)
|
66
|
+
add_3ds_auth(post, options)
|
67
67
|
|
68
68
|
commit(:authorize, post)
|
69
69
|
end
|
@@ -75,6 +75,7 @@ module ActiveMerchant #:nodoc:
|
|
75
75
|
add_creditcard_or_reference(post, credit_card_or_reference)
|
76
76
|
add_invoice(post, options)
|
77
77
|
add_instant_capture(post, true)
|
78
|
+
add_3ds_auth(post, options)
|
78
79
|
|
79
80
|
commit(:authorize, post)
|
80
81
|
end
|
@@ -110,6 +111,17 @@ module ActiveMerchant #:nodoc:
|
|
110
111
|
refund(money, identification, options)
|
111
112
|
end
|
112
113
|
|
114
|
+
def supports_scrubbing
|
115
|
+
true
|
116
|
+
end
|
117
|
+
|
118
|
+
def scrub(transcript)
|
119
|
+
transcript.
|
120
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
121
|
+
gsub(%r(((?:\?|&)cardno=)\d*(&?)), '\1[FILTERED]\2').
|
122
|
+
gsub(%r((&?cvc=)\d*(&?)), '\1[FILTERED]\2')
|
123
|
+
end
|
124
|
+
|
113
125
|
private
|
114
126
|
|
115
127
|
def add_amount(post, money, options)
|
@@ -148,21 +160,31 @@ module ActiveMerchant #:nodoc:
|
|
148
160
|
post[:instantcapture] = option ? 1 : 0
|
149
161
|
end
|
150
162
|
|
163
|
+
def add_3ds_auth(post, options)
|
164
|
+
if options[:three_d_secure]
|
165
|
+
post[:eci] = options.dig(:three_d_secure, :eci)
|
166
|
+
post[:xid] = options.dig(:three_d_secure, :xid)
|
167
|
+
post[:cavv] = options.dig(:three_d_secure, :cavv)
|
168
|
+
post[:threeds_version] = options.dig(:three_d_secure, :version)
|
169
|
+
post[:ds_transaction_id] = options.dig(:three_d_secure, :ds_transaction_id)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
151
173
|
def commit(action, params)
|
152
174
|
response = send("do_#{action}", params)
|
153
175
|
|
154
176
|
if action == :authorize
|
155
177
|
Response.new response['accept'].to_i == 1,
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
178
|
+
response['errortext'],
|
179
|
+
response,
|
180
|
+
test: test?,
|
181
|
+
authorization: response['tid']
|
160
182
|
else
|
161
183
|
Response.new response['result'] == 'true',
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
184
|
+
messages(response['epay'], response['pbs']),
|
185
|
+
response,
|
186
|
+
test: test?,
|
187
|
+
authorization: params[:transaction]
|
166
188
|
end
|
167
189
|
end
|
168
190
|
|
@@ -175,19 +197,18 @@ module ActiveMerchant #:nodoc:
|
|
175
197
|
def soap_post(method, params)
|
176
198
|
data = xml_builder(params, method)
|
177
199
|
headers = make_headers(data, method)
|
178
|
-
REXML::Document.new(ssl_post(
|
200
|
+
REXML::Document.new(ssl_post(live_url + 'remote/payment.asmx', data, headers))
|
179
201
|
end
|
180
202
|
|
181
203
|
def do_authorize(params)
|
182
204
|
headers = {}
|
183
|
-
headers['Referer'] = (options[:password] ||
|
184
|
-
|
185
|
-
response = raw_ssl_request(:post, 'https://' + API_HOST + '/auth/default.aspx', authorize_post_data(params), headers)
|
205
|
+
headers['Referer'] = (options[:password] || 'activemerchant.org')
|
186
206
|
|
207
|
+
response = raw_ssl_request(:post, live_url + 'auth/default.aspx', authorize_post_data(params), headers)
|
187
208
|
# Authorize gives the response back by redirecting with the values in
|
188
209
|
# the URL query
|
189
210
|
if location = response['Location']
|
190
|
-
query = CGI::parse(URI.parse(location.gsub(' ', '%20')).query)
|
211
|
+
query = CGI::parse(URI.parse(location.gsub(' ', '%20').gsub('<', '%3C').gsub('>', '%3E')).query)
|
191
212
|
else
|
192
213
|
return {
|
193
214
|
'accept' => '0',
|
@@ -198,7 +219,7 @@ module ActiveMerchant #:nodoc:
|
|
198
219
|
end
|
199
220
|
|
200
221
|
result = {}
|
201
|
-
query.each_pair do |k,v|
|
222
|
+
query.each_pair do |k, v|
|
202
223
|
result[k] = v.is_a?(Array) && v.size == 1 ? v[0] : v # make values like ['v'] into 'v'
|
203
224
|
end
|
204
225
|
result
|
@@ -233,42 +254,42 @@ module ActiveMerchant #:nodoc:
|
|
233
254
|
def make_headers(data, soap_call)
|
234
255
|
{
|
235
256
|
'Content-Type' => 'text/xml; charset=utf-8',
|
236
|
-
'Host' =>
|
257
|
+
'Host' => 'ssl.ditonlinebetalingssystem.dk',
|
237
258
|
'Content-Length' => data.size.to_s,
|
238
|
-
'SOAPAction' => self.live_url + '/' + soap_call
|
259
|
+
'SOAPAction' => self.live_url + 'remote/payment/' + soap_call
|
239
260
|
}
|
240
261
|
end
|
241
262
|
|
242
263
|
def xml_builder(params, soap_call)
|
243
|
-
xml = Builder::XmlMarkup.new(:
|
264
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
244
265
|
xml.instruct!
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
end
|
266
|
+
xml.tag! 'soap:Envelope', { 'xmlns:xsi' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
267
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
268
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' } do
|
269
|
+
xml.tag! 'soap:Body' do
|
270
|
+
xml.tag! soap_call, { 'xmlns' => "#{self.live_url}remote/payment" } do
|
271
|
+
xml.tag! 'merchantnumber', @options[:login]
|
272
|
+
xml.tag! 'transactionid', params[:transaction]
|
273
|
+
xml.tag! 'amount', params[:amount].to_s if soap_call != 'delete'
|
254
274
|
end
|
255
275
|
end
|
276
|
+
end
|
256
277
|
xml.target!
|
257
278
|
end
|
258
279
|
|
259
280
|
def authorize_post_data(params = {})
|
260
281
|
params[:language] = '2'
|
261
|
-
params[:cms] = '
|
262
|
-
params[:accepturl] = '
|
263
|
-
params[:declineurl] = '
|
282
|
+
params[:cms] = 'activemerchant_3ds'
|
283
|
+
params[:accepturl] = live_url + 'auth/default.aspx?accept=1'
|
284
|
+
params[:declineurl] = live_url + 'auth/default.aspx?decline=1'
|
264
285
|
params[:merchantnumber] = @options[:login]
|
265
286
|
|
266
|
-
params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
287
|
+
params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
267
288
|
end
|
268
289
|
|
269
290
|
# Limited to 20 digits max
|
270
291
|
def format_order_number(number)
|
271
|
-
number.to_s.gsub(/[^\w]/, '').rjust(4,
|
292
|
+
number.to_s.gsub(/[^\w]/, '').rjust(4, '0')[0...20]
|
272
293
|
end
|
273
294
|
end
|
274
295
|
end
|