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
@@ -1,367 +1,24 @@
|
|
1
1
|
require 'rexml/document'
|
2
2
|
require 'digest/md5'
|
3
3
|
|
4
|
+
require 'active_merchant/billing/gateways/quickpay/quickpay_v10'
|
5
|
+
require 'active_merchant/billing/gateways/quickpay/quickpay_v4to7'
|
6
|
+
|
4
7
|
module ActiveMerchant #:nodoc:
|
5
8
|
module Billing #:nodoc:
|
6
9
|
class QuickpayGateway < Gateway
|
7
|
-
self.
|
8
|
-
|
9
|
-
self.default_currency = 'DKK'
|
10
|
-
self.money_format = :cents
|
11
|
-
self.supported_cardtypes = [:dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro]
|
12
|
-
self.supported_countries = ['DE', 'DK', 'ES', 'FI', 'FR', 'FO', 'GB', 'IS', 'NO', 'SE']
|
13
|
-
self.homepage_url = 'http://quickpay.net/'
|
14
|
-
self.display_name = 'QuickPay'
|
15
|
-
|
16
|
-
MD5_CHECK_FIELDS = {
|
17
|
-
3 => {
|
18
|
-
:authorize => %w(protocol msgtype merchant ordernumber amount
|
19
|
-
currency autocapture cardnumber expirationdate
|
20
|
-
cvd cardtypelock testmode),
|
21
|
-
|
22
|
-
:capture => %w(protocol msgtype merchant amount transaction),
|
23
|
-
|
24
|
-
:cancel => %w(protocol msgtype merchant transaction),
|
25
|
-
|
26
|
-
:refund => %w(protocol msgtype merchant amount transaction),
|
27
|
-
|
28
|
-
:subscribe => %w(protocol msgtype merchant ordernumber cardnumber
|
29
|
-
expirationdate cvd cardtypelock description testmode),
|
30
|
-
|
31
|
-
:recurring => %w(protocol msgtype merchant ordernumber amount
|
32
|
-
currency autocapture transaction),
|
33
|
-
|
34
|
-
:status => %w(protocol msgtype merchant transaction),
|
35
|
-
|
36
|
-
:chstatus => %w(protocol msgtype merchant)
|
37
|
-
},
|
38
|
-
|
39
|
-
4 => {
|
40
|
-
:authorize => %w(protocol msgtype merchant ordernumber amount
|
41
|
-
currency autocapture cardnumber expirationdate cvd
|
42
|
-
cardtypelock testmode fraud_remote_addr
|
43
|
-
fraud_http_accept fraud_http_accept_language
|
44
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
45
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
46
|
-
|
47
|
-
:capture => %w(protocol msgtype merchant amount transaction apikey),
|
48
|
-
|
49
|
-
:cancel => %w(protocol msgtype merchant transaction apikey),
|
50
|
-
|
51
|
-
:refund => %w(protocol msgtype merchant amount transaction apikey),
|
52
|
-
|
53
|
-
:subscribe => %w(protocol msgtype merchant ordernumber cardnumber
|
54
|
-
expirationdate cvd cardtypelock description testmode
|
55
|
-
fraud_remote_addr fraud_http_accept fraud_http_accept_language
|
56
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
57
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
58
|
-
|
59
|
-
:recurring => %w(protocol msgtype merchant ordernumber amount currency
|
60
|
-
autocapture transaction apikey),
|
61
|
-
|
62
|
-
:status => %w(protocol msgtype merchant transaction apikey),
|
63
|
-
|
64
|
-
:chstatus => %w(protocol msgtype merchant apikey)
|
65
|
-
},
|
66
|
-
|
67
|
-
5 => {
|
68
|
-
:authorize => %w(protocol msgtype merchant ordernumber amount
|
69
|
-
currency autocapture cardnumber expirationdate cvd
|
70
|
-
cardtypelock testmode fraud_remote_addr
|
71
|
-
fraud_http_accept fraud_http_accept_language
|
72
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
73
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
74
|
-
|
75
|
-
:capture => %w(protocol msgtype merchant amount transaction apikey),
|
76
|
-
|
77
|
-
:cancel => %w(protocol msgtype merchant transaction apikey),
|
78
|
-
|
79
|
-
:refund => %w(protocol msgtype merchant amount transaction apikey),
|
80
|
-
|
81
|
-
:subscribe => %w(protocol msgtype merchant ordernumber cardnumber
|
82
|
-
expirationdate cvd cardtypelock description testmode
|
83
|
-
fraud_remote_addr fraud_http_accept fraud_http_accept_language
|
84
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
85
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
86
|
-
|
87
|
-
:recurring => %w(protocol msgtype merchant ordernumber amount currency
|
88
|
-
autocapture transaction apikey),
|
89
|
-
|
90
|
-
:status => %w(protocol msgtype merchant transaction apikey),
|
91
|
-
|
92
|
-
:chstatus => %w(protocol msgtype merchant apikey)
|
93
|
-
},
|
94
|
-
|
95
|
-
6 => {
|
96
|
-
:authorize => %w(protocol msgtype merchant ordernumber amount
|
97
|
-
currency autocapture cardnumber expirationdate cvd
|
98
|
-
cardtypelock testmode fraud_remote_addr
|
99
|
-
fraud_http_accept fraud_http_accept_language
|
100
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
101
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
102
|
-
|
103
|
-
:capture => %w(protocol msgtype merchant amount transaction
|
104
|
-
apikey),
|
105
|
-
|
106
|
-
:cancel => %w(protocol msgtype merchant transaction apikey),
|
107
|
-
|
108
|
-
:refund => %w(protocol msgtype merchant amount transaction apikey),
|
10
|
+
self.abstract_class = true
|
109
11
|
|
110
|
-
|
111
|
-
|
112
|
-
fraud_remote_addr fraud_http_accept fraud_http_accept_language
|
113
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
114
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
12
|
+
def self.new(options = {})
|
13
|
+
options.fetch(:login) { raise ArgumentError.new('Missing required parameter: login') }
|
115
14
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
:status => %w(protocol msgtype merchant transaction apikey),
|
120
|
-
|
121
|
-
:chstatus => %w(protocol msgtype merchant apikey)
|
122
|
-
},
|
123
|
-
|
124
|
-
7 => {
|
125
|
-
:authorize => %w(protocol msgtype merchant ordernumber amount
|
126
|
-
currency autocapture cardnumber expirationdate cvd
|
127
|
-
acquirers cardtypelock testmode fraud_remote_addr
|
128
|
-
fraud_http_accept fraud_http_accept_language
|
129
|
-
fraud_http_accept_encoding fraud_http_accept_charset
|
130
|
-
fraud_http_referer fraud_http_user_agent apikey),
|
131
|
-
|
132
|
-
:capture => %w(protocol msgtype merchant amount transaction
|
133
|
-
apikey),
|
134
|
-
|
135
|
-
:cancel => %w(protocol msgtype merchant transaction apikey),
|
136
|
-
|
137
|
-
:refund => %w(protocol msgtype merchant amount transaction apikey),
|
138
|
-
|
139
|
-
:subscribe => %w(protocol msgtype merchant ordernumber amount currency
|
140
|
-
cardnumber expirationdate cvd acquirers cardtypelock
|
141
|
-
description testmode fraud_remote_addr fraud_http_accept
|
142
|
-
fraud_http_accept_language fraud_http_accept_encoding
|
143
|
-
fraud_http_accept_charset fraud_http_referer
|
144
|
-
fraud_http_user_agent apikey),
|
145
|
-
|
146
|
-
:recurring => %w(protocol msgtype merchant ordernumber amount currency
|
147
|
-
autocapture transaction apikey),
|
148
|
-
|
149
|
-
:status => %w(protocol msgtype merchant transaction apikey),
|
150
|
-
|
151
|
-
:chstatus => %w(protocol msgtype merchant apikey)
|
152
|
-
}
|
153
|
-
}
|
154
|
-
|
155
|
-
APPROVED = '000'
|
156
|
-
|
157
|
-
# The login is the QuickpayId
|
158
|
-
# The password is the md5checkword from the Quickpay manager
|
159
|
-
# To use the API-key from the Quickpay manager, specify :api-key
|
160
|
-
# Using the API-key, requires that you use version 4+. Specify :version => 4/5/6/7 in options.
|
161
|
-
def initialize(options = {})
|
162
|
-
requires!(options, :login, :password)
|
163
|
-
@protocol = options.delete(:version) || 7 # default to protocol version 7
|
164
|
-
super
|
165
|
-
end
|
166
|
-
|
167
|
-
def authorize(money, credit_card_or_reference, options = {})
|
168
|
-
post = {}
|
169
|
-
|
170
|
-
action = recurring_or_authorize(credit_card_or_reference)
|
171
|
-
|
172
|
-
add_amount(post, money, options)
|
173
|
-
add_invoice(post, options)
|
174
|
-
add_creditcard_or_reference(post, credit_card_or_reference, options)
|
175
|
-
add_autocapture(post, false)
|
176
|
-
add_fraud_parameters(post, options) if action.eql?(:authorize)
|
177
|
-
add_testmode(post)
|
178
|
-
|
179
|
-
commit(action, post)
|
180
|
-
end
|
181
|
-
|
182
|
-
def purchase(money, credit_card_or_reference, options = {})
|
183
|
-
post = {}
|
184
|
-
|
185
|
-
action = recurring_or_authorize(credit_card_or_reference)
|
186
|
-
|
187
|
-
add_amount(post, money, options)
|
188
|
-
add_creditcard_or_reference(post, credit_card_or_reference, options)
|
189
|
-
add_invoice(post, options)
|
190
|
-
add_fraud_parameters(post, options) if action.eql?(:authorize)
|
191
|
-
add_autocapture(post, true)
|
192
|
-
|
193
|
-
commit(action, post)
|
194
|
-
end
|
195
|
-
|
196
|
-
def capture(money, authorization, options = {})
|
197
|
-
post = {}
|
198
|
-
|
199
|
-
add_reference(post, authorization)
|
200
|
-
add_amount_without_currency(post, money)
|
201
|
-
commit(:capture, post)
|
202
|
-
end
|
203
|
-
|
204
|
-
def void(identification, options = {})
|
205
|
-
post = {}
|
206
|
-
|
207
|
-
add_reference(post, identification)
|
208
|
-
|
209
|
-
commit(:cancel, post)
|
210
|
-
end
|
211
|
-
|
212
|
-
def refund(money, identification, options = {})
|
213
|
-
post = {}
|
214
|
-
|
215
|
-
add_amount_without_currency(post, money)
|
216
|
-
add_reference(post, identification)
|
217
|
-
|
218
|
-
commit(:refund, post)
|
219
|
-
end
|
220
|
-
|
221
|
-
def credit(money, identification, options = {})
|
222
|
-
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
223
|
-
refund(money, identification, options)
|
224
|
-
end
|
225
|
-
|
226
|
-
def store(creditcard, options = {})
|
227
|
-
post = {}
|
228
|
-
|
229
|
-
add_creditcard(post, creditcard, options)
|
230
|
-
add_amount(post, 0, options) if @protocol >= 7
|
231
|
-
add_invoice(post, options)
|
232
|
-
add_description(post, options)
|
233
|
-
add_fraud_parameters(post, options)
|
234
|
-
add_testmode(post)
|
235
|
-
|
236
|
-
commit(:subscribe, post)
|
237
|
-
end
|
238
|
-
|
239
|
-
private
|
240
|
-
|
241
|
-
def add_amount(post, money, options = {})
|
242
|
-
post[:amount] = amount(money)
|
243
|
-
post[:currency] = options[:currency] || currency(money)
|
244
|
-
end
|
245
|
-
|
246
|
-
def add_amount_without_currency(post, money, options = {})
|
247
|
-
post[:amount] = amount(money)
|
248
|
-
end
|
249
|
-
|
250
|
-
def add_invoice(post, options)
|
251
|
-
post[:ordernumber] = format_order_number(options[:order_id])
|
252
|
-
end
|
253
|
-
|
254
|
-
def add_creditcard(post, credit_card, options)
|
255
|
-
post[:cardnumber] = credit_card.number
|
256
|
-
post[:cvd] = credit_card.verification_value
|
257
|
-
post[:expirationdate] = expdate(credit_card)
|
258
|
-
post[:cardtypelock] = options[:cardtypelock] unless options[:cardtypelock].blank?
|
259
|
-
post[:acquirers] = options[:acquirers] unless options[:acquirers].blank?
|
260
|
-
end
|
261
|
-
|
262
|
-
def add_reference(post, identification)
|
263
|
-
post[:transaction] = identification
|
264
|
-
end
|
265
|
-
|
266
|
-
def add_creditcard_or_reference(post, credit_card_or_reference, options)
|
267
|
-
if credit_card_or_reference.is_a?(String)
|
268
|
-
add_reference(post, credit_card_or_reference)
|
15
|
+
version = options[:login].to_i < 10000000 ? 10 : 7
|
16
|
+
if version <= 7
|
17
|
+
QuickpayV4to7Gateway.new(options)
|
269
18
|
else
|
270
|
-
|
19
|
+
QuickpayV10Gateway.new(options)
|
271
20
|
end
|
272
21
|
end
|
273
|
-
|
274
|
-
def add_autocapture(post, autocapture)
|
275
|
-
post[:autocapture] = autocapture ? 1 : 0
|
276
|
-
end
|
277
|
-
|
278
|
-
def recurring_or_authorize(credit_card_or_reference)
|
279
|
-
credit_card_or_reference.is_a?(String) ? :recurring : :authorize
|
280
|
-
end
|
281
|
-
|
282
|
-
def add_description(post, options)
|
283
|
-
post[:description] = options[:description]
|
284
|
-
end
|
285
|
-
|
286
|
-
def add_testmode(post)
|
287
|
-
return if post[:transaction].present?
|
288
|
-
post[:testmode] = test? ? '1' : '0'
|
289
|
-
end
|
290
|
-
|
291
|
-
def add_fraud_parameters(post, options)
|
292
|
-
if @protocol >= 4
|
293
|
-
post[:fraud_remote_addr] = options[:ip] if options[:ip]
|
294
|
-
post[:fraud_http_accept] = options[:fraud_http_accept] if options[:fraud_http_accept]
|
295
|
-
post[:fraud_http_accept_language] = options[:fraud_http_accept_language] if options[:fraud_http_accept_language]
|
296
|
-
post[:fraud_http_accept_encoding] = options[:fraud_http_accept_encoding] if options[:fraud_http_accept_encoding]
|
297
|
-
post[:fraud_http_accept_charset] = options[:fraud_http_accept_charset] if options[:fraud_http_accept_charset]
|
298
|
-
post[:fraud_http_referer] = options[:fraud_http_referer] if options[:fraud_http_referer]
|
299
|
-
post[:fraud_http_user_agent] = options[:fraud_http_user_agent] if options[:fraud_http_user_agent]
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
def commit(action, params)
|
304
|
-
response = parse(ssl_post(self.live_url, post_data(action, params)))
|
305
|
-
|
306
|
-
Response.new(successful?(response), message_from(response), response,
|
307
|
-
:test => test?,
|
308
|
-
:authorization => response[:transaction]
|
309
|
-
)
|
310
|
-
end
|
311
|
-
|
312
|
-
def successful?(response)
|
313
|
-
response[:qpstat] == APPROVED
|
314
|
-
end
|
315
|
-
|
316
|
-
def parse(data)
|
317
|
-
response = {}
|
318
|
-
|
319
|
-
doc = REXML::Document.new(data)
|
320
|
-
|
321
|
-
doc.root.elements.each do |element|
|
322
|
-
response[element.name.to_sym] = element.text
|
323
|
-
end
|
324
|
-
|
325
|
-
response
|
326
|
-
end
|
327
|
-
|
328
|
-
def message_from(response)
|
329
|
-
response[:qpstatmsg].to_s
|
330
|
-
end
|
331
|
-
|
332
|
-
def post_data(action, params = {})
|
333
|
-
params[:protocol] = @protocol
|
334
|
-
params[:msgtype] = action.to_s
|
335
|
-
params[:merchant] = @options[:login]
|
336
|
-
params[:apikey] = @options[:apikey] if @options[:apikey]
|
337
|
-
params[:md5check] = generate_check_hash(action, params)
|
338
|
-
|
339
|
-
params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
340
|
-
end
|
341
|
-
|
342
|
-
def generate_check_hash(action, params)
|
343
|
-
string = MD5_CHECK_FIELDS[@protocol][action].collect do |key|
|
344
|
-
params[key.to_sym]
|
345
|
-
end.join('')
|
346
|
-
|
347
|
-
# Add the md5checkword
|
348
|
-
string << @options[:password].to_s
|
349
|
-
|
350
|
-
Digest::MD5.hexdigest(string)
|
351
|
-
end
|
352
|
-
|
353
|
-
def expdate(credit_card)
|
354
|
-
year = format(credit_card.year, :two_digits)
|
355
|
-
month = format(credit_card.month, :two_digits)
|
356
|
-
|
357
|
-
"#{year}#{month}"
|
358
|
-
end
|
359
|
-
|
360
|
-
# Limited to 20 digits max
|
361
|
-
def format_order_number(number)
|
362
|
-
number.to_s.gsub(/[^\w]/, '').rjust(4, "0")[0...20]
|
363
|
-
end
|
364
22
|
end
|
365
23
|
end
|
366
24
|
end
|
367
|
-
|
@@ -0,0 +1,305 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class QvalentGateway < Gateway
|
4
|
+
self.display_name = 'Qvalent'
|
5
|
+
self.homepage_url = 'https://www.qvalent.com/'
|
6
|
+
|
7
|
+
self.test_url = 'https://ccapi.client.support.qvalent.com/post/CreditCardAPIReceiver'
|
8
|
+
self.live_url = 'https://ccapi.client.qvalent.com/post/CreditCardAPIReceiver'
|
9
|
+
|
10
|
+
self.supported_countries = ['AU']
|
11
|
+
self.default_currency = 'AUD'
|
12
|
+
self.money_format = :cents
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb diners]
|
14
|
+
|
15
|
+
CVV_CODE_MAPPING = {
|
16
|
+
'S' => 'D'
|
17
|
+
}
|
18
|
+
|
19
|
+
def initialize(options = {})
|
20
|
+
requires!(options, :username, :password, :merchant, :pem)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def purchase(amount, payment_method, options = {})
|
25
|
+
post = {}
|
26
|
+
add_invoice(post, amount, options)
|
27
|
+
add_order_number(post, options)
|
28
|
+
add_payment_method(post, payment_method)
|
29
|
+
add_verification_value(post, payment_method)
|
30
|
+
add_stored_credential_data(post, payment_method, options)
|
31
|
+
add_customer_data(post, options)
|
32
|
+
add_soft_descriptors(post, options)
|
33
|
+
add_customer_reference(post, options)
|
34
|
+
|
35
|
+
commit('capture', post)
|
36
|
+
end
|
37
|
+
|
38
|
+
def authorize(amount, payment_method, options = {})
|
39
|
+
post = {}
|
40
|
+
add_invoice(post, amount, options)
|
41
|
+
add_order_number(post, options)
|
42
|
+
add_payment_method(post, payment_method)
|
43
|
+
add_verification_value(post, payment_method)
|
44
|
+
add_stored_credential_data(post, payment_method, options)
|
45
|
+
add_customer_data(post, options)
|
46
|
+
add_soft_descriptors(post, options)
|
47
|
+
add_customer_reference(post, options)
|
48
|
+
|
49
|
+
commit('preauth', post)
|
50
|
+
end
|
51
|
+
|
52
|
+
def capture(amount, authorization, options = {})
|
53
|
+
post = {}
|
54
|
+
add_invoice(post, amount, options)
|
55
|
+
add_reference(post, authorization, options)
|
56
|
+
add_customer_data(post, options)
|
57
|
+
add_soft_descriptors(post, options)
|
58
|
+
add_customer_reference(post, options)
|
59
|
+
|
60
|
+
commit('captureWithoutAuth', post)
|
61
|
+
end
|
62
|
+
|
63
|
+
def refund(amount, authorization, options = {})
|
64
|
+
post = {}
|
65
|
+
add_invoice(post, amount, options)
|
66
|
+
add_reference(post, authorization, options)
|
67
|
+
add_customer_data(post, options)
|
68
|
+
add_soft_descriptors(post, options)
|
69
|
+
post['order.ECI'] = options[:eci] || 'SSL'
|
70
|
+
add_customer_reference(post, options)
|
71
|
+
|
72
|
+
commit('refund', post)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Credit requires the merchant account to be enabled for "Adhoc Refunds"
|
76
|
+
def credit(amount, payment_method, options = {})
|
77
|
+
post = {}
|
78
|
+
add_invoice(post, amount, options)
|
79
|
+
add_order_number(post, options)
|
80
|
+
add_payment_method(post, payment_method)
|
81
|
+
add_customer_data(post, options)
|
82
|
+
add_soft_descriptors(post, options)
|
83
|
+
add_customer_reference(post, options)
|
84
|
+
|
85
|
+
commit('refund', post)
|
86
|
+
end
|
87
|
+
|
88
|
+
def void(authorization, options = {})
|
89
|
+
post = {}
|
90
|
+
add_reference(post, authorization, options)
|
91
|
+
add_customer_data(post, options)
|
92
|
+
add_soft_descriptors(post, options)
|
93
|
+
add_customer_reference(post, options)
|
94
|
+
|
95
|
+
commit('reversal', post)
|
96
|
+
end
|
97
|
+
|
98
|
+
def store(payment_method, options = {})
|
99
|
+
post = {}
|
100
|
+
add_payment_method(post, payment_method)
|
101
|
+
add_card_reference(post, options)
|
102
|
+
|
103
|
+
commit('registerAccount', post)
|
104
|
+
end
|
105
|
+
|
106
|
+
def supports_scrubbing?
|
107
|
+
true
|
108
|
+
end
|
109
|
+
|
110
|
+
def scrub(transcript)
|
111
|
+
transcript.
|
112
|
+
gsub(%r((&?customer.password=)[^&]*), '\1[FILTERED]').
|
113
|
+
gsub(%r((&?card.PAN=)[^&]*), '\1[FILTERED]').
|
114
|
+
gsub(%r((&?card.CVN=)[^&]*), '\1[FILTERED]')
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
|
120
|
+
CURRENCY_CODES['AUD'] = 'AUD'
|
121
|
+
CURRENCY_CODES['INR'] = 'INR'
|
122
|
+
|
123
|
+
def add_soft_descriptors(post, options)
|
124
|
+
post['customer.merchantName'] = options[:customer_merchant_name] if options[:customer_merchant_name]
|
125
|
+
post['customer.merchantStreetAddress'] = options[:customer_merchant_street_address] if options[:customer_merchant_street_address]
|
126
|
+
post['customer.merchantLocation'] = options[:customer_merchant_location] if options[:customer_merchant_location]
|
127
|
+
post['customer.merchantState'] = options[:customer_merchant_state] if options[:customer_merchant_state]
|
128
|
+
post['customer.merchantCountry'] = options[:customer_merchant_country] if options[:customer_merchant_country]
|
129
|
+
post['customer.merchantPostCode'] = options[:customer_merchant_post_code] if options[:customer_merchant_post_code]
|
130
|
+
post['customer.subMerchantId'] = options[:customer_sub_merchant_id] if options[:customer_sub_merchant_id]
|
131
|
+
end
|
132
|
+
|
133
|
+
def add_invoice(post, money, options)
|
134
|
+
post['order.amount'] = amount(money)
|
135
|
+
post['card.currency'] = CURRENCY_CODES[options[:currency] || currency(money)]
|
136
|
+
end
|
137
|
+
|
138
|
+
def add_payment_method(post, payment_method)
|
139
|
+
post['card.cardHolderName'] = payment_method.name
|
140
|
+
post['card.PAN'] = payment_method.number
|
141
|
+
post['card.expiryYear'] = format(payment_method.year, :two_digits)
|
142
|
+
post['card.expiryMonth'] = format(payment_method.month, :two_digits)
|
143
|
+
end
|
144
|
+
|
145
|
+
def add_stored_credential_data(post, payment_method, options)
|
146
|
+
post['order.ECI'] = options[:eci] || eci(options)
|
147
|
+
if (stored_credential = options[:stored_credential]) && %w(visa master).include?(payment_method.brand)
|
148
|
+
post['card.posEntryMode'] = stored_credential[:initial_transaction] ? 'MANUAL' : 'STORED_CREDENTIAL'
|
149
|
+
stored_credential_usage(post, payment_method, options) unless stored_credential[:initiator] && stored_credential[:initiator] == 'cardholder'
|
150
|
+
post['order.authTraceId'] = stored_credential[:network_transaction_id] if stored_credential[:network_transaction_id]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def stored_credential_usage(post, payment_method, options)
|
155
|
+
return unless payment_method.brand == 'visa'
|
156
|
+
|
157
|
+
stored_credential = options[:stored_credential]
|
158
|
+
if stored_credential[:reason_type] == 'unscheduled'
|
159
|
+
if stored_credential[:initiator] == 'merchant'
|
160
|
+
post['card.storedCredentialUsage'] = 'UNSCHEDULED_MIT'
|
161
|
+
elsif stored_credential[:initiator] == 'customer'
|
162
|
+
post['card.storedCredentialUsage'] = 'UNSCHEDULED_CIT'
|
163
|
+
end
|
164
|
+
elsif stored_credential[:reason_type] == 'recurring'
|
165
|
+
post['card.storedCredentialUsage'] = 'RECURRING'
|
166
|
+
elsif stored_credential[:reason_type] == 'installment'
|
167
|
+
post['card.storedCredentialUsage'] = 'INSTALLMENT'
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def eci(options)
|
172
|
+
if options.dig(:stored_credential, :initial_transaction)
|
173
|
+
'SSL'
|
174
|
+
elsif options.dig(:stored_credential, :initiator) && options[:stored_credential][:initiator] == 'cardholder'
|
175
|
+
'MTO'
|
176
|
+
elsif options.dig(:stored_credential, :reason_type)
|
177
|
+
case options[:stored_credential][:reason_type]
|
178
|
+
when 'recurring'
|
179
|
+
'REC'
|
180
|
+
when 'installment'
|
181
|
+
'INS'
|
182
|
+
when 'unscheduled'
|
183
|
+
'MTO'
|
184
|
+
end
|
185
|
+
else
|
186
|
+
'SSL'
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def add_verification_value(post, payment_method)
|
191
|
+
post['card.CVN'] = payment_method.verification_value
|
192
|
+
end
|
193
|
+
|
194
|
+
def add_card_reference(post, options)
|
195
|
+
post['customer.customerReferenceNumber'] = options[:customer_reference_number] || options[:order_id]
|
196
|
+
end
|
197
|
+
|
198
|
+
def add_customer_reference(post, options)
|
199
|
+
post['customer.customerReferenceNumber'] = options[:customer_reference_number] if options[:customer_reference_number]
|
200
|
+
end
|
201
|
+
|
202
|
+
def add_reference(post, authorization, options)
|
203
|
+
post['customer.originalOrderNumber'] = authorization
|
204
|
+
add_order_number(post, options)
|
205
|
+
end
|
206
|
+
|
207
|
+
def add_order_number(post, options)
|
208
|
+
post['customer.orderNumber'] = options[:order_id] || SecureRandom.uuid
|
209
|
+
end
|
210
|
+
|
211
|
+
def add_customer_data(post, options)
|
212
|
+
post['order.ipAddress'] = options[:ip] || '127.0.0.1'
|
213
|
+
post['order.xid'] = options[:xid] if options[:xid]
|
214
|
+
post['order.cavv'] = options[:cavv] if options[:cavv]
|
215
|
+
end
|
216
|
+
|
217
|
+
def commit(action, post)
|
218
|
+
post['customer.username'] = @options[:username]
|
219
|
+
post['customer.password'] = @options[:password]
|
220
|
+
post['customer.merchant'] = @options[:merchant]
|
221
|
+
post['order.type'] = action
|
222
|
+
|
223
|
+
data = build_request(post)
|
224
|
+
raw = parse(ssl_post(url(action), data, headers))
|
225
|
+
|
226
|
+
succeeded = success_from(raw['response.responseCode'])
|
227
|
+
Response.new(
|
228
|
+
succeeded,
|
229
|
+
message_from(succeeded, raw),
|
230
|
+
raw,
|
231
|
+
authorization: raw['response.orderNumber'] || raw['response.customerReferenceNumber'],
|
232
|
+
cvv_result: cvv_result(succeeded, raw),
|
233
|
+
error_code: error_code_from(succeeded, raw),
|
234
|
+
test: test?
|
235
|
+
)
|
236
|
+
end
|
237
|
+
|
238
|
+
def cvv_result(succeeded, raw)
|
239
|
+
return unless succeeded
|
240
|
+
|
241
|
+
code = CVV_CODE_MAPPING[raw['response.cvnResponse']] || raw['response.cvnResponse']
|
242
|
+
CVVResult.new(code)
|
243
|
+
end
|
244
|
+
|
245
|
+
def headers
|
246
|
+
{
|
247
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
248
|
+
}
|
249
|
+
end
|
250
|
+
|
251
|
+
def build_request(post)
|
252
|
+
post.to_query + '&message.end'
|
253
|
+
end
|
254
|
+
|
255
|
+
def url(action)
|
256
|
+
(test? ? test_url : live_url)
|
257
|
+
end
|
258
|
+
|
259
|
+
def parse(body)
|
260
|
+
result = {}
|
261
|
+
body.to_s.each_line do |pair|
|
262
|
+
result[$1] = $2 if pair.strip =~ /\A([^=]+)=(.+)\Z/im
|
263
|
+
end
|
264
|
+
result
|
265
|
+
end
|
266
|
+
|
267
|
+
def parse_element(response, node)
|
268
|
+
if node.has_elements?
|
269
|
+
node.elements.each { |element| parse_element(response, element) }
|
270
|
+
else
|
271
|
+
response[node.name.underscore.to_sym] = node.text
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
SUCCESS_CODES = %w(00 08 10 11 16 QS QZ)
|
276
|
+
|
277
|
+
def success_from(response)
|
278
|
+
SUCCESS_CODES.include?(response)
|
279
|
+
end
|
280
|
+
|
281
|
+
def message_from(succeeded, response)
|
282
|
+
if succeeded
|
283
|
+
'Succeeded'
|
284
|
+
else
|
285
|
+
response['response.text'] || 'Unable to read error message'
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
290
|
+
'14' => STANDARD_ERROR_CODE[:invalid_number],
|
291
|
+
'QQ' => STANDARD_ERROR_CODE[:invalid_cvc],
|
292
|
+
'33' => STANDARD_ERROR_CODE[:expired_card],
|
293
|
+
'NT' => STANDARD_ERROR_CODE[:incorrect_address],
|
294
|
+
'12' => STANDARD_ERROR_CODE[:card_declined],
|
295
|
+
'06' => STANDARD_ERROR_CODE[:processing_error],
|
296
|
+
'01' => STANDARD_ERROR_CODE[:call_issuer],
|
297
|
+
'04' => STANDARD_ERROR_CODE[:pickup_card]
|
298
|
+
}
|
299
|
+
|
300
|
+
def error_code_from(succeeded, response)
|
301
|
+
succeeded ? nil : STANDARD_ERROR_CODE_MAPPING[response['response.responseCode']]
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|