activemerchant 1.79.2 → 1.129.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +1391 -0
- data/README.md +29 -14
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +55 -22
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +82 -62
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +61 -56
- data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
- 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 +35 -36
- data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
- data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
- 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 +12 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
- 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 +115 -115
- data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
- data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
- data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
- data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
- data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +561 -259
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
- data/lib/active_merchant/billing/gateways/cams.rb +31 -31
- data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
- data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
- data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
- data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
- data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
- data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
- data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
- data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
- 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 +34 -40
- data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
- data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
- data/lib/active_merchant/billing/gateways/element.rb +106 -56
- data/lib/active_merchant/billing/gateways/epay.rb +74 -64
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +74 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
- data/lib/active_merchant/billing/gateways/exact.rb +29 -37
- data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +70 -40
- data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
- data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
- data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +236 -69
- data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
- data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
- data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
- data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
- data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
- data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
- data/lib/active_merchant/billing/gateways/litle.rb +247 -53
- data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
- data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
- data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
- data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +45 -40
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +255 -138
- data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
- data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
- 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 +167 -80
- data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
- 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 +134 -48
- data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
- data/lib/active_merchant/billing/gateways/omise.rb +30 -31
- data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
- data/lib/active_merchant/billing/gateways/opp.rb +166 -144
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
- data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
- 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 +39 -40
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
- data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
- data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
- 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 +178 -54
- data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
- data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +27 -14
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
- data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
- data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
- 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 +87 -34
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
- data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
- data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
- 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 +132 -50
- data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
- data/lib/active_merchant/billing/gateways/s5.rb +16 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
- data/lib/active_merchant/billing/gateways/sage.rb +49 -48
- data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
- 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 +66 -47
- data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
- data/lib/active_merchant/billing/gateways/telr.rb +46 -48
- data/lib/active_merchant/billing/gateways/tns.rb +8 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
- data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
- 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 +22 -18
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
- data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
- data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
- data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +32 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +24 -38
- data/lib/active_merchant/country.rb +9 -5
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
- data/lib/active_merchant/network_connection_retries.rb +28 -31
- data/lib/active_merchant/post_data.rb +5 -3
- data/lib/active_merchant/posts_data.rb +5 -7
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +3 -3
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +1592 -2329
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +9 -10
- metadata +98 -37
- 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 -309
@@ -3,24 +3,28 @@ require 'nokogiri'
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class LitleGateway < Gateway
|
6
|
-
SCHEMA_VERSION = '9.
|
6
|
+
SCHEMA_VERSION = '9.14'
|
7
|
+
|
8
|
+
class_attribute :postlive_url, :prelive_url
|
7
9
|
|
8
10
|
self.test_url = 'https://www.testvantivcnp.com/sandbox/communicator/online'
|
11
|
+
self.prelive_url = 'https://payments.vantivprelive.com/vap/communicator/online'
|
12
|
+
self.postlive_url = 'https://payments.vantivpostlive.com/vap/communicator/online'
|
9
13
|
self.live_url = 'https://payments.vantivcnp.com/vap/communicator/online'
|
10
14
|
|
11
15
|
self.supported_countries = ['US']
|
12
16
|
self.default_currency = 'USD'
|
13
|
-
self.supported_cardtypes = [
|
17
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
14
18
|
|
15
|
-
self.homepage_url = '
|
19
|
+
self.homepage_url = 'https://www.fisglobal.com/'
|
16
20
|
self.display_name = 'Vantiv eCommerce'
|
17
21
|
|
18
|
-
def initialize(options={})
|
22
|
+
def initialize(options = {})
|
19
23
|
requires!(options, :login, :password, :merchant_id)
|
20
24
|
super
|
21
25
|
end
|
22
26
|
|
23
|
-
def purchase(money, payment_method, options={})
|
27
|
+
def purchase(money, payment_method, options = {})
|
24
28
|
request = build_xml_request do |doc|
|
25
29
|
add_authentication(doc)
|
26
30
|
if check?(payment_method)
|
@@ -33,10 +37,100 @@ module ActiveMerchant #:nodoc:
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
36
|
-
|
40
|
+
check?(payment_method) ? commit(:echeckSales, request, money) : commit(:sale, request, money)
|
41
|
+
end
|
42
|
+
|
43
|
+
def add_level_two_data(doc, payment_method, options = {})
|
44
|
+
level_2_data = options[:level_2_data]
|
45
|
+
if level_2_data
|
46
|
+
doc.enhancedData do
|
47
|
+
case payment_method.brand
|
48
|
+
when 'visa'
|
49
|
+
doc.salesTax(level_2_data[:sales_tax]) if level_2_data[:sales_tax]
|
50
|
+
when 'master'
|
51
|
+
doc.customerReference(level_2_data[:customer_code]) if level_2_data[:customer_code]
|
52
|
+
doc.salesTax(level_2_data[:total_tax_amount]) if level_2_data[:total_tax_amount]
|
53
|
+
doc.detailTax do
|
54
|
+
doc.taxIncludedInTotal(level_2_data[:tax_included_in_total]) if level_2_data[:tax_included_in_total]
|
55
|
+
doc.taxAmount(level_2_data[:tax_amount]) if level_2_data[:tax_amount]
|
56
|
+
doc.cardAcceptorTaxId(level_2_data[:card_acceptor_tax_id]) if level_2_data[:card_acceptor_tax_id]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_level_three_data(doc, payment_method, options = {})
|
64
|
+
level_3_data = options[:level_3_data]
|
65
|
+
if level_3_data
|
66
|
+
doc.enhancedData do
|
67
|
+
case payment_method.brand
|
68
|
+
when 'visa'
|
69
|
+
add_level_three_information_tags_visa(doc, payment_method, level_3_data)
|
70
|
+
when 'master'
|
71
|
+
add_level_three_information_tags_master(doc, payment_method, level_3_data)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def add_level_three_information_tags_visa(doc, payment_method, level_3_data)
|
78
|
+
doc.discountAmount(level_3_data[:discount_amount]) if level_3_data[:discount_amount]
|
79
|
+
doc.shippingAmount(level_3_data[:shipping_amount]) if level_3_data[:shipping_amount]
|
80
|
+
doc.dutyAmount(level_3_data[:duty_amount]) if level_3_data[:duty_amount]
|
81
|
+
doc.detailTax do
|
82
|
+
doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
|
83
|
+
doc.taxAmount(level_3_data[:tax_amount]) if level_3_data[:tax_amount]
|
84
|
+
doc.taxRate(level_3_data[:tax_rate]) if level_3_data[:tax_rate]
|
85
|
+
doc.taxTypeIdentifier(level_3_data[:tax_type_identifier]) if level_3_data[:tax_type_identifier]
|
86
|
+
doc.cardAcceptorTaxId(level_3_data[:card_acceptor_tax_id]) if level_3_data[:card_acceptor_tax_id]
|
87
|
+
end
|
88
|
+
add_line_item_information_for_level_three_visa(doc, payment_method, level_3_data)
|
89
|
+
end
|
90
|
+
|
91
|
+
def add_level_three_information_tags_master(doc, payment_method, level_3_data)
|
92
|
+
doc.customerReference :customerReference, level_3_data[:customer_code] if level_3_data[:customer_code]
|
93
|
+
doc.salesTax(level_3_data[:total_tax_amount]) if level_3_data[:total_tax_amount]
|
94
|
+
doc.detailTax do
|
95
|
+
doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
|
96
|
+
doc.taxAmount(level_3_data[:tax_amount]) if level_3_data[:tax_amount]
|
97
|
+
doc.cardAcceptorTaxId :cardAcceptorTaxId, level_3_data[:card_acceptor_tax_id] if level_3_data[:card_acceptor_tax_id]
|
98
|
+
end
|
99
|
+
doc.lineItemData do
|
100
|
+
level_3_data[:line_items].each do |line_item|
|
101
|
+
doc.itemDescription(line_item[:item_description]) if line_item[:item_description]
|
102
|
+
doc.productCode(line_item[:product_code]) if line_item[:product_code]
|
103
|
+
doc.quantity(line_item[:quantity]) if line_item[:quantity]
|
104
|
+
doc.unitOfMeasure(line_item[:unit_of_measure]) if line_item[:unit_of_measure]
|
105
|
+
doc.lineItemTotal(line_item[:line_item_total]) if line_item[:line_item_total]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def add_line_item_information_for_level_three_visa(doc, payment_method, level_3_data)
|
111
|
+
doc.lineItemData do
|
112
|
+
level_3_data[:line_items].each do |line_item|
|
113
|
+
doc.itemSequenceNumber(line_item[:item_sequence_number]) if line_item[:item_sequence_number]
|
114
|
+
doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
|
115
|
+
doc.itemDescription(line_item[:item_description]) if line_item[:item_description]
|
116
|
+
doc.productCode(line_item[:product_code]) if line_item[:product_code]
|
117
|
+
doc.quantity(line_item[:quantity]) if line_item[:quantity]
|
118
|
+
doc.unitOfMeasure(line_item[:unit_of_measure]) if line_item[:unit_of_measure]
|
119
|
+
doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
|
120
|
+
doc.itemDiscountAmount(line_item[:discount_per_line_item]) unless line_item[:discount_per_line_item] < 0
|
121
|
+
doc.unitCost(line_item[:unit_cost]) unless line_item[:unit_cost] < 0
|
122
|
+
doc.detailTax do
|
123
|
+
doc.taxIncludedInTotal(line_item[:tax_included_in_total]) if line_item[:tax_included_in_total]
|
124
|
+
doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
|
125
|
+
doc.taxRate(line_item[:tax_rate]) if line_item[:tax_rate]
|
126
|
+
doc.taxTypeIdentifier(line_item[:tax_type_identifier]) if line_item[:tax_type_identifier]
|
127
|
+
doc.cardAcceptorTaxId(line_item[:card_acceptor_tax_id]) if line_item[:card_acceptor_tax_id]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
37
131
|
end
|
38
132
|
|
39
|
-
def authorize(money, payment_method, options={})
|
133
|
+
def authorize(money, payment_method, options = {})
|
40
134
|
request = build_xml_request do |doc|
|
41
135
|
add_authentication(doc)
|
42
136
|
if check?(payment_method)
|
@@ -52,8 +146,8 @@ module ActiveMerchant #:nodoc:
|
|
52
146
|
check?(payment_method) ? commit(:echeckVerification, request, money) : commit(:authorization, request, money)
|
53
147
|
end
|
54
148
|
|
55
|
-
def capture(money, authorization, options={})
|
56
|
-
transaction_id,
|
149
|
+
def capture(money, authorization, options = {})
|
150
|
+
transaction_id, = split_authorization(authorization)
|
57
151
|
|
58
152
|
request = build_xml_request do |doc|
|
59
153
|
add_authentication(doc)
|
@@ -72,19 +166,19 @@ module ActiveMerchant #:nodoc:
|
|
72
166
|
refund(money, authorization, options)
|
73
167
|
end
|
74
168
|
|
75
|
-
def refund(money, payment, options={})
|
169
|
+
def refund(money, payment, options = {})
|
76
170
|
request = build_xml_request do |doc|
|
77
171
|
add_authentication(doc)
|
78
172
|
add_descriptor(doc, options)
|
79
173
|
doc.send(refund_type(payment), transaction_attributes(options)) do
|
80
174
|
if payment.is_a?(String)
|
81
|
-
transaction_id,
|
175
|
+
transaction_id, = split_authorization(payment)
|
82
176
|
doc.litleTxnId(transaction_id)
|
83
177
|
doc.amount(money) if money
|
84
178
|
elsif check?(payment)
|
85
179
|
add_echeck_purchase_params(doc, money, payment, options)
|
86
180
|
else
|
87
|
-
|
181
|
+
add_credit_params(doc, money, payment, options)
|
88
182
|
end
|
89
183
|
end
|
90
184
|
end
|
@@ -99,7 +193,7 @@ module ActiveMerchant #:nodoc:
|
|
99
193
|
end
|
100
194
|
end
|
101
195
|
|
102
|
-
def void(authorization, options={})
|
196
|
+
def void(authorization, options = {})
|
103
197
|
transaction_id, kind, money = split_authorization(authorization)
|
104
198
|
|
105
199
|
request = build_xml_request do |doc|
|
@@ -164,21 +258,21 @@ module ActiveMerchant #:nodoc:
|
|
164
258
|
}
|
165
259
|
|
166
260
|
AVS_RESPONSE_CODE = {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
261
|
+
'00' => 'Y',
|
262
|
+
'01' => 'X',
|
263
|
+
'02' => 'D',
|
264
|
+
'10' => 'Z',
|
265
|
+
'11' => 'W',
|
266
|
+
'12' => 'A',
|
267
|
+
'13' => 'A',
|
268
|
+
'14' => 'P',
|
269
|
+
'20' => 'N',
|
270
|
+
'30' => 'S',
|
271
|
+
'31' => 'R',
|
272
|
+
'32' => 'U',
|
273
|
+
'33' => 'R',
|
274
|
+
'34' => 'I',
|
275
|
+
'40' => 'E'
|
182
276
|
}
|
183
277
|
|
184
278
|
def void_type(kind)
|
@@ -192,8 +286,8 @@ module ActiveMerchant #:nodoc:
|
|
192
286
|
end
|
193
287
|
|
194
288
|
def refund_type(payment)
|
195
|
-
|
196
|
-
if check?(payment) || kind
|
289
|
+
_, kind, = split_authorization(payment)
|
290
|
+
if check?(payment) || kind == 'echeckSales'
|
197
291
|
:echeckCredit
|
198
292
|
else
|
199
293
|
:credit
|
@@ -202,6 +296,7 @@ module ActiveMerchant #:nodoc:
|
|
202
296
|
|
203
297
|
def check?(payment_method)
|
204
298
|
return false if payment_method.is_a?(String)
|
299
|
+
|
205
300
|
card_brand(payment_method) == 'check'
|
206
301
|
end
|
207
302
|
|
@@ -221,11 +316,26 @@ module ActiveMerchant #:nodoc:
|
|
221
316
|
add_payment_method(doc, payment_method, options)
|
222
317
|
add_pos(doc, payment_method)
|
223
318
|
add_descriptor(doc, options)
|
319
|
+
add_level_two_data(doc, payment_method, options)
|
320
|
+
add_level_three_data(doc, payment_method, options)
|
224
321
|
add_merchant_data(doc, options)
|
225
322
|
add_debt_repayment(doc, options)
|
323
|
+
add_stored_credential_params(doc, options)
|
324
|
+
add_fraud_filter_override(doc, options)
|
325
|
+
end
|
326
|
+
|
327
|
+
def add_credit_params(doc, money, payment_method, options)
|
328
|
+
doc.orderId(truncate(options[:order_id], 24))
|
329
|
+
doc.amount(money)
|
330
|
+
add_order_source(doc, payment_method, options)
|
331
|
+
add_billing_address(doc, payment_method, options)
|
332
|
+
add_payment_method(doc, payment_method, options)
|
333
|
+
add_pos(doc, payment_method)
|
334
|
+
add_descriptor(doc, options)
|
335
|
+
add_merchant_data(doc, options)
|
226
336
|
end
|
227
337
|
|
228
|
-
def add_merchant_data(doc, options={})
|
338
|
+
def add_merchant_data(doc, options = {})
|
229
339
|
if options[:affiliate] || options[:campaign] || options[:merchant_grouping_id]
|
230
340
|
doc.merchantData do
|
231
341
|
doc.affiliate(options[:affiliate]) if options[:affiliate]
|
@@ -257,10 +367,15 @@ module ActiveMerchant #:nodoc:
|
|
257
367
|
doc.debtRepayment(true) if options[:debt_repayment] == true
|
258
368
|
end
|
259
369
|
|
370
|
+
def add_fraud_filter_override(doc, options)
|
371
|
+
doc.fraudFilterOverride(options[:fraud_filter_override]) if options[:fraud_filter_override]
|
372
|
+
end
|
373
|
+
|
260
374
|
def add_payment_method(doc, payment_method, options)
|
261
375
|
if payment_method.is_a?(String)
|
262
376
|
doc.token do
|
263
377
|
doc.litleToken(payment_method)
|
378
|
+
doc.expDate(format_exp_date(options[:basis_expiration_month], options[:basis_expiration_year])) if options[:basis_expiration_month] && options[:basis_expiration_year]
|
264
379
|
end
|
265
380
|
elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
|
266
381
|
doc.card do
|
@@ -268,10 +383,10 @@ module ActiveMerchant #:nodoc:
|
|
268
383
|
end
|
269
384
|
elsif check?(payment_method)
|
270
385
|
doc.echeck do
|
271
|
-
doc.accType(payment_method.account_type)
|
386
|
+
doc.accType(payment_method.account_type.capitalize)
|
272
387
|
doc.accNum(payment_method.account_number)
|
273
388
|
doc.routingNum(payment_method.routing_number)
|
274
|
-
doc.checkNum(payment_method.number)
|
389
|
+
doc.checkNum(payment_method.number) if payment_method.number
|
275
390
|
end
|
276
391
|
else
|
277
392
|
doc.card do
|
@@ -284,7 +399,7 @@ module ActiveMerchant #:nodoc:
|
|
284
399
|
doc.cardholderAuthentication do
|
285
400
|
doc.authenticationValue(payment_method.payment_cryptogram)
|
286
401
|
end
|
287
|
-
elsif options[:order_source]
|
402
|
+
elsif options[:order_source]&.start_with?('3ds')
|
288
403
|
doc.cardholderAuthentication do
|
289
404
|
doc.authenticationValue(options[:cavv]) if options[:cavv]
|
290
405
|
doc.authenticationTransactionId(options[:xid]) if options[:xid]
|
@@ -293,6 +408,38 @@ module ActiveMerchant #:nodoc:
|
|
293
408
|
end
|
294
409
|
end
|
295
410
|
|
411
|
+
def add_stored_credential_params(doc, options = {})
|
412
|
+
return unless options[:stored_credential]
|
413
|
+
|
414
|
+
if options[:stored_credential][:initial_transaction]
|
415
|
+
add_stored_credential_params_initial(doc, options)
|
416
|
+
else
|
417
|
+
add_stored_credential_params_used(doc, options)
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
def add_stored_credential_params_initial(doc, options)
|
422
|
+
case options[:stored_credential][:reason_type]
|
423
|
+
when 'unscheduled'
|
424
|
+
doc.processingType('initialCOF')
|
425
|
+
when 'installment'
|
426
|
+
doc.processingType('initialInstallment')
|
427
|
+
when 'recurring'
|
428
|
+
doc.processingType('initialRecurring')
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
def add_stored_credential_params_used(doc, options)
|
433
|
+
if options[:stored_credential][:reason_type] == 'unscheduled'
|
434
|
+
if options[:stored_credential][:initiator] == 'merchant'
|
435
|
+
doc.processingType('merchantInitiatedCOF')
|
436
|
+
else
|
437
|
+
doc.processingType('cardholderInitiatedCOF')
|
438
|
+
end
|
439
|
+
end
|
440
|
+
doc.originalNetworkTransactionId(options[:stored_credential][:network_transaction_id])
|
441
|
+
end
|
442
|
+
|
296
443
|
def add_billing_address(doc, payment_method, options)
|
297
444
|
return if payment_method.is_a?(String)
|
298
445
|
|
@@ -322,9 +469,9 @@ module ActiveMerchant #:nodoc:
|
|
322
469
|
return unless address
|
323
470
|
|
324
471
|
doc.companyName(address[:company]) unless address[:company].blank?
|
325
|
-
doc.addressLine1(address[:address1]) unless address[:address1].blank?
|
326
|
-
doc.addressLine2(address[:address2]) unless address[:address2].blank?
|
327
|
-
doc.city(address[:city]) unless address[:city].blank?
|
472
|
+
doc.addressLine1(truncate(address[:address1], 35)) unless address[:address1].blank?
|
473
|
+
doc.addressLine2(truncate(address[:address2], 35)) unless address[:address2].blank?
|
474
|
+
doc.city(truncate(address[:city], 35)) unless address[:city].blank?
|
328
475
|
doc.state(address[:state]) unless address[:state].blank?
|
329
476
|
doc.zip(address[:zip]) unless address[:zip].blank?
|
330
477
|
doc.country(address[:country]) unless address[:country].blank?
|
@@ -332,11 +479,12 @@ module ActiveMerchant #:nodoc:
|
|
332
479
|
end
|
333
480
|
|
334
481
|
def add_order_source(doc, payment_method, options)
|
335
|
-
|
336
|
-
|
482
|
+
order_source = order_source(options)
|
483
|
+
if order_source
|
484
|
+
doc.orderSource(order_source)
|
337
485
|
elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :apple_pay
|
338
486
|
doc.orderSource('applepay')
|
339
|
-
elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source
|
487
|
+
elsif payment_method.is_a?(NetworkTokenizationCreditCard) && %i[google_pay android_pay].include?(payment_method.source)
|
340
488
|
doc.orderSource('androidpay')
|
341
489
|
elsif payment_method.respond_to?(:track_data) && payment_method.track_data.present?
|
342
490
|
doc.orderSource('retail')
|
@@ -345,6 +493,31 @@ module ActiveMerchant #:nodoc:
|
|
345
493
|
end
|
346
494
|
end
|
347
495
|
|
496
|
+
def order_source(options = {})
|
497
|
+
return options[:order_source] unless options[:stored_credential]
|
498
|
+
|
499
|
+
order_source = nil
|
500
|
+
|
501
|
+
case options[:stored_credential][:reason_type]
|
502
|
+
when 'unscheduled'
|
503
|
+
if options[:stored_credential][:initiator] == 'merchant'
|
504
|
+
# For merchant-initiated, we should always set order source to
|
505
|
+
# 'ecommerce'
|
506
|
+
order_source = 'ecommerce'
|
507
|
+
else
|
508
|
+
# For cardholder-initiated, we rely on #add_order_source's
|
509
|
+
# default logic to set orderSource appropriately
|
510
|
+
order_source = options[:order_source]
|
511
|
+
end
|
512
|
+
when 'installment'
|
513
|
+
order_source = 'installment'
|
514
|
+
when 'recurring'
|
515
|
+
order_source = 'recurring'
|
516
|
+
end
|
517
|
+
|
518
|
+
order_source
|
519
|
+
end
|
520
|
+
|
348
521
|
def add_pos(doc, payment_method)
|
349
522
|
return unless payment_method.respond_to?(:track_data) && payment_method.track_data.present?
|
350
523
|
|
@@ -356,15 +529,21 @@ module ActiveMerchant #:nodoc:
|
|
356
529
|
end
|
357
530
|
|
358
531
|
def exp_date(payment_method)
|
359
|
-
|
532
|
+
format_exp_date(payment_method.month, payment_method.year)
|
533
|
+
end
|
534
|
+
|
535
|
+
def format_exp_date(month, year)
|
536
|
+
"#{format(month, :two_digits)}#{format(year, :two_digits)}"
|
360
537
|
end
|
361
538
|
|
362
539
|
def parse(kind, xml)
|
363
540
|
parsed = {}
|
364
|
-
|
365
541
|
doc = Nokogiri::XML(xml).remove_namespaces!
|
542
|
+
|
543
|
+
parsed['duplicate'] = doc.at_xpath('//saleResponse').try(:[], 'duplicate') == 'true' if kind == :sale
|
544
|
+
|
366
545
|
doc.xpath("//litleOnlineResponse/#{kind}Response/*").each do |node|
|
367
|
-
if
|
546
|
+
if node.elements.empty?
|
368
547
|
parsed[node.name.to_sym] = node.text
|
369
548
|
else
|
370
549
|
node.elements.each do |childnode|
|
@@ -376,33 +555,45 @@ module ActiveMerchant #:nodoc:
|
|
376
555
|
|
377
556
|
if parsed.empty?
|
378
557
|
%w(response message).each do |attribute|
|
379
|
-
parsed[attribute.to_sym] = doc.xpath(
|
558
|
+
parsed[attribute.to_sym] = doc.xpath('//litleOnlineResponse').attribute(attribute).value
|
380
559
|
end
|
381
560
|
end
|
382
561
|
|
383
562
|
parsed
|
384
563
|
end
|
385
564
|
|
386
|
-
def commit(kind, request, money=nil)
|
565
|
+
def commit(kind, request, money = nil)
|
387
566
|
parsed = parse(kind, ssl_post(url, request, headers))
|
388
567
|
|
389
568
|
options = {
|
390
569
|
authorization: authorization_from(kind, parsed, money),
|
391
570
|
test: test?,
|
392
|
-
:
|
393
|
-
:
|
571
|
+
avs_result: { code: AVS_RESPONSE_CODE[parsed[:fraudResult_avsResult]] },
|
572
|
+
cvv_result: parsed[:fraudResult_cardValidationResult]
|
394
573
|
}
|
395
574
|
|
396
|
-
Response.new(success_from(kind, parsed), parsed
|
575
|
+
Response.new(success_from(kind, parsed), message_from(parsed), parsed, options)
|
397
576
|
end
|
398
577
|
|
399
578
|
def success_from(kind, parsed)
|
400
|
-
return (parsed[:response]
|
579
|
+
return %w(000 001 010).any?(parsed[:response]) unless kind == :registerToken
|
580
|
+
|
401
581
|
%w(000 801 802).include?(parsed[:response])
|
402
582
|
end
|
403
583
|
|
584
|
+
def message_from(parsed)
|
585
|
+
case parsed[:response]
|
586
|
+
when '010'
|
587
|
+
return "#{parsed[:message]}: The authorized amount is less than the requested amount."
|
588
|
+
when '001'
|
589
|
+
return "#{parsed[:message]}: This is sent to acknowledge that the submitted transaction has been received."
|
590
|
+
else
|
591
|
+
parsed[:message]
|
592
|
+
end
|
593
|
+
end
|
594
|
+
|
404
595
|
def authorization_from(kind, parsed, money)
|
405
|
-
|
596
|
+
kind == :registerToken ? parsed[:litleToken] : "#{parsed[:litleTxnId]};#{kind};#{money}"
|
406
597
|
end
|
407
598
|
|
408
599
|
def split_authorization(authorization)
|
@@ -414,8 +605,8 @@ module ActiveMerchant #:nodoc:
|
|
414
605
|
attributes = {}
|
415
606
|
attributes[:id] = truncate(options[:id] || options[:order_id], 24)
|
416
607
|
attributes[:reportGroup] = options[:merchant] || 'Default Report Group'
|
417
|
-
attributes[:customerId] = options[:
|
418
|
-
attributes.delete_if { |
|
608
|
+
attributes[:customerId] = options[:customer_id]
|
609
|
+
attributes.delete_if { |_key, value| value == nil }
|
419
610
|
attributes
|
420
611
|
end
|
421
612
|
|
@@ -423,7 +614,7 @@ module ActiveMerchant #:nodoc:
|
|
423
614
|
{
|
424
615
|
merchantId: @options[:merchant_id],
|
425
616
|
version: SCHEMA_VERSION,
|
426
|
-
xmlns:
|
617
|
+
xmlns: 'http://www.litle.com/schema'
|
427
618
|
}
|
428
619
|
end
|
429
620
|
|
@@ -436,6 +627,9 @@ module ActiveMerchant #:nodoc:
|
|
436
627
|
end
|
437
628
|
|
438
629
|
def url
|
630
|
+
return postlive_url if @options[:url_override].to_s == 'postlive'
|
631
|
+
return prelive_url if @options[:url_override].to_s == 'prelive'
|
632
|
+
|
439
633
|
test? ? test_url : live_url
|
440
634
|
end
|
441
635
|
|
@@ -1,20 +1,30 @@
|
|
1
1
|
module ActiveMerchant
|
2
2
|
module Billing
|
3
3
|
module MastercardGateway
|
4
|
-
|
5
|
-
def initialize(options={})
|
4
|
+
def initialize(options = {})
|
6
5
|
requires!(options, :userid, :password)
|
7
6
|
super
|
8
7
|
end
|
9
8
|
|
10
|
-
def purchase(amount, payment_method, options={})
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
def purchase(amount, payment_method, options = {})
|
10
|
+
if options[:pay_mode]
|
11
|
+
post = new_post
|
12
|
+
add_invoice(post, amount, options)
|
13
|
+
add_reference(post, *new_authorization)
|
14
|
+
add_payment_method(post, payment_method)
|
15
|
+
add_customer_data(post, payment_method, options)
|
16
|
+
add_3dsecure_id(post, options)
|
17
|
+
|
18
|
+
commit('pay', post)
|
19
|
+
else
|
20
|
+
MultiResponse.run do |r|
|
21
|
+
r.process { authorize(amount, payment_method, options) }
|
22
|
+
r.process { capture(amount, r.authorization, options) }
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
16
26
|
|
17
|
-
def authorize(amount, payment_method, options={})
|
27
|
+
def authorize(amount, payment_method, options = {})
|
18
28
|
post = new_post
|
19
29
|
add_invoice(post, amount, options)
|
20
30
|
add_reference(post, *new_authorization)
|
@@ -25,7 +35,7 @@ module ActiveMerchant
|
|
25
35
|
commit('authorize', post)
|
26
36
|
end
|
27
37
|
|
28
|
-
def capture(amount, authorization, options={})
|
38
|
+
def capture(amount, authorization, options = {})
|
29
39
|
post = new_post
|
30
40
|
add_invoice(post, amount, options, :transaction)
|
31
41
|
add_reference(post, *next_authorization(authorization))
|
@@ -35,7 +45,7 @@ module ActiveMerchant
|
|
35
45
|
commit('capture', post)
|
36
46
|
end
|
37
47
|
|
38
|
-
def refund(amount, authorization, options={})
|
48
|
+
def refund(amount, authorization, options = {})
|
39
49
|
post = new_post
|
40
50
|
add_invoice(post, amount, options, :transaction)
|
41
51
|
add_reference(post, *next_authorization(authorization))
|
@@ -44,14 +54,14 @@ module ActiveMerchant
|
|
44
54
|
commit('refund', post)
|
45
55
|
end
|
46
56
|
|
47
|
-
def void(authorization, options={})
|
57
|
+
def void(authorization, options = {})
|
48
58
|
post = new_post
|
49
59
|
add_reference(post, *next_authorization(authorization), :targetTransactionId)
|
50
60
|
|
51
61
|
commit('void', post)
|
52
62
|
end
|
53
63
|
|
54
|
-
def verify(credit_card, options={})
|
64
|
+
def verify(credit_card, options = {})
|
55
65
|
MultiResponse.run(:use_first_response) do |r|
|
56
66
|
r.process { authorize(100, credit_card, options) }
|
57
67
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -59,7 +69,7 @@ module ActiveMerchant
|
|
59
69
|
end
|
60
70
|
|
61
71
|
def verify_credentials
|
62
|
-
url = build_url(SecureRandom.uuid,
|
72
|
+
url = build_url(SecureRandom.uuid, 'nonexistent')
|
63
73
|
begin
|
64
74
|
ssl_get(url, headers)
|
65
75
|
rescue ResponseError => e
|
@@ -81,6 +91,7 @@ module ActiveMerchant
|
|
81
91
|
end
|
82
92
|
|
83
93
|
private
|
94
|
+
|
84
95
|
def new_post
|
85
96
|
{
|
86
97
|
order: {},
|
@@ -94,16 +105,16 @@ module ActiveMerchant
|
|
94
105
|
billing: {},
|
95
106
|
device: {},
|
96
107
|
shipping: {},
|
97
|
-
transaction: {}
|
108
|
+
transaction: {}
|
98
109
|
}
|
99
110
|
end
|
100
111
|
|
101
|
-
def add_invoice(post, amount, options, node
|
112
|
+
def add_invoice(post, amount, options, node = :order)
|
102
113
|
post[node][:amount] = amount(amount)
|
103
114
|
post[node][:currency] = (options[:currency] || currency(amount))
|
104
115
|
end
|
105
116
|
|
106
|
-
def add_reference(post, orderid, transactionid, transaction_reference, reference_key
|
117
|
+
def add_reference(post, orderid, transactionid, transaction_reference, reference_key = :reference)
|
107
118
|
post[:orderid] = orderid
|
108
119
|
post[:transactionid] = transactionid
|
109
120
|
post[:transaction][reference_key] = transaction_reference if transaction_reference
|
@@ -164,7 +175,8 @@ module ActiveMerchant
|
|
164
175
|
|
165
176
|
def add_3dsecure_id(post, options)
|
166
177
|
return unless options[:threed_secure_id]
|
167
|
-
|
178
|
+
|
179
|
+
post.merge!({ '3DSecureId' => options[:threed_secure_id] })
|
168
180
|
end
|
169
181
|
|
170
182
|
def country_code(country)
|
@@ -178,7 +190,7 @@ module ActiveMerchant
|
|
178
190
|
def headers
|
179
191
|
{
|
180
192
|
'Authorization' => 'Basic ' + Base64.encode64("merchant.#{@options[:userid]}:#{@options[:password]}").strip.delete("\r\n"),
|
181
|
-
'Content-Type' => 'application/json'
|
193
|
+
'Content-Type' => 'application/json'
|
182
194
|
}
|
183
195
|
end
|
184
196
|
|
@@ -195,8 +207,8 @@ module ActiveMerchant
|
|
195
207
|
succeeded,
|
196
208
|
message_from(succeeded, raw),
|
197
209
|
raw,
|
198
|
-
:
|
199
|
-
:
|
210
|
+
authorization: authorization_from(post, raw),
|
211
|
+
test: test?
|
200
212
|
)
|
201
213
|
end
|
202
214
|
|
@@ -206,9 +218,16 @@ module ActiveMerchant
|
|
206
218
|
|
207
219
|
def base_url
|
208
220
|
if test?
|
209
|
-
|
221
|
+
test_url
|
210
222
|
else
|
211
|
-
@options[:region]
|
223
|
+
case @options[:region]
|
224
|
+
when 'asia_pacific'
|
225
|
+
live_ap_url
|
226
|
+
when 'europe'
|
227
|
+
live_eu_url
|
228
|
+
when 'north_america', nil
|
229
|
+
live_na_url
|
230
|
+
end
|
212
231
|
end
|
213
232
|
end
|
214
233
|
|
@@ -221,7 +240,7 @@ module ActiveMerchant
|
|
221
240
|
end
|
222
241
|
|
223
242
|
def success_from(response)
|
224
|
-
response['result'] ==
|
243
|
+
response['result'] == 'SUCCESS'
|
225
244
|
end
|
226
245
|
|
227
246
|
def message_from(succeeded, response)
|
@@ -262,7 +281,6 @@ module ActiveMerchant
|
|
262
281
|
next_transactionid = SecureRandom.uuid
|
263
282
|
[orderid, next_transactionid, prev_transactionid]
|
264
283
|
end
|
265
|
-
|
266
284
|
end
|
267
285
|
end
|
268
286
|
end
|