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
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
@@ -8,68 +8,94 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
|
9
9
|
self.supported_countries = ['US']
|
10
10
|
self.default_currency = 'USD'
|
11
|
-
self.supported_cardtypes = [
|
11
|
+
self.supported_cardtypes = %i[visa master american_express discover jbc diners_club]
|
12
12
|
|
13
13
|
self.homepage_url = 'http://developer.heartlandpaymentsystems.com/SecureSubmit/'
|
14
14
|
self.display_name = 'Heartland Payment Systems'
|
15
15
|
|
16
16
|
self.money_format = :dollars
|
17
17
|
|
18
|
-
|
18
|
+
PAYMENT_DATA_SOURCE_MAPPING = {
|
19
|
+
apple_pay: 'ApplePay',
|
20
|
+
master: 'MasterCard 3DSecure',
|
21
|
+
visa: 'Visa 3DSecure',
|
22
|
+
american_express: 'AMEX 3DSecure',
|
23
|
+
discover: 'Discover 3DSecure',
|
24
|
+
android_pay: 'GooglePayApp',
|
25
|
+
google_pay: 'GooglePayApp'
|
26
|
+
}
|
27
|
+
|
28
|
+
def initialize(options = {})
|
19
29
|
requires!(options, :secret_api_key)
|
20
30
|
super
|
21
31
|
end
|
22
32
|
|
23
|
-
def authorize(money, card_or_token, options={})
|
33
|
+
def authorize(money, card_or_token, options = {})
|
24
34
|
commit('CreditAuth') do |xml|
|
25
35
|
add_amount(xml, money)
|
26
36
|
add_allow_dup(xml)
|
27
|
-
|
37
|
+
add_card_or_token_customer_data(xml, card_or_token, options)
|
28
38
|
add_details(xml, options)
|
29
39
|
add_descriptor_name(xml, options)
|
30
|
-
|
40
|
+
add_card_or_token_payment(xml, card_or_token, options)
|
41
|
+
add_three_d_secure(xml, card_or_token, options)
|
42
|
+
add_stored_credentials(xml, options)
|
31
43
|
end
|
32
44
|
end
|
33
45
|
|
34
|
-
def capture(money, transaction_id, options={})
|
35
|
-
commit('CreditAddToBatch') do |xml|
|
46
|
+
def capture(money, transaction_id, options = {})
|
47
|
+
commit('CreditAddToBatch', transaction_id) do |xml|
|
36
48
|
add_amount(xml, money)
|
37
49
|
add_reference(xml, transaction_id)
|
38
50
|
end
|
39
51
|
end
|
40
52
|
|
41
|
-
def purchase(money,
|
42
|
-
|
53
|
+
def purchase(money, payment_method, options = {})
|
54
|
+
if payment_method.is_a?(Check)
|
55
|
+
commit_check_sale(money, payment_method, options)
|
56
|
+
elsif options.dig(:stored_credential, :reason_type) == 'recurring'
|
57
|
+
commit_recurring_billing_sale(money, payment_method, options)
|
58
|
+
else
|
59
|
+
commit_credit_sale(money, payment_method, options)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def refund(money, transaction_id, options = {})
|
64
|
+
commit('CreditReturn') do |xml|
|
43
65
|
add_amount(xml, money)
|
44
66
|
add_allow_dup(xml)
|
45
|
-
|
67
|
+
add_reference(xml, transaction_id)
|
68
|
+
add_card_or_token_customer_data(xml, transaction_id, options)
|
46
69
|
add_details(xml, options)
|
47
|
-
add_descriptor_name(xml, options)
|
48
|
-
add_payment(xml, card_or_token, options)
|
49
70
|
end
|
50
71
|
end
|
51
72
|
|
52
|
-
def
|
73
|
+
def credit(money, payment_method, options = {})
|
53
74
|
commit('CreditReturn') do |xml|
|
54
75
|
add_amount(xml, money)
|
55
76
|
add_allow_dup(xml)
|
56
|
-
|
57
|
-
add_customer_data(xml, transaction_id,options)
|
77
|
+
add_card_or_token_payment(xml, payment_method, options)
|
58
78
|
add_details(xml, options)
|
59
79
|
end
|
60
80
|
end
|
61
81
|
|
62
|
-
def verify(card_or_token, options={})
|
82
|
+
def verify(card_or_token, options = {})
|
63
83
|
commit('CreditAccountVerify') do |xml|
|
64
|
-
|
84
|
+
add_card_or_token_customer_data(xml, card_or_token, options)
|
65
85
|
add_descriptor_name(xml, options)
|
66
|
-
|
86
|
+
add_card_or_token_payment(xml, card_or_token, options)
|
67
87
|
end
|
68
88
|
end
|
69
89
|
|
70
|
-
def void(transaction_id, options={})
|
71
|
-
|
72
|
-
|
90
|
+
def void(transaction_id, options = {})
|
91
|
+
if options[:check_void]
|
92
|
+
commit('CheckVoid') do |xml|
|
93
|
+
add_reference(xml, transaction_id)
|
94
|
+
end
|
95
|
+
else
|
96
|
+
commit('CreditVoid') do |xml|
|
97
|
+
add_reference(xml, transaction_id)
|
98
|
+
end
|
73
99
|
end
|
74
100
|
end
|
75
101
|
|
@@ -81,20 +107,61 @@ module ActiveMerchant #:nodoc:
|
|
81
107
|
transcript.
|
82
108
|
gsub(%r((<hps:CardNbr>)[^<]*(<\/hps:CardNbr>))i, '\1[FILTERED]\2').
|
83
109
|
gsub(%r((<hps:CVV2>)[^<]*(<\/hps:CVV2>))i, '\1[FILTERED]\2').
|
84
|
-
gsub(%r((<hps:SecretAPIKey>)[^<]*(<\/hps:SecretAPIKey>))i, '\1[FILTERED]\2')
|
110
|
+
gsub(%r((<hps:SecretAPIKey>)[^<]*(<\/hps:SecretAPIKey>))i, '\1[FILTERED]\2').
|
111
|
+
gsub(%r((<hps:PaymentData>)[^<]*(<\/hps:PaymentData>))i, '\1[FILTERED]\2').
|
112
|
+
gsub(%r((<hps:RoutingNumber>)[^<]*(<\/hps:RoutingNumber>))i, '\1[FILTERED]\2').
|
113
|
+
gsub(%r((<hps:AccountNumber>)[^<]*(<\/hps:AccountNumber>))i, '\1[FILTERED]\2')
|
85
114
|
end
|
86
115
|
|
87
116
|
private
|
88
117
|
|
118
|
+
def commit_check_sale(money, check, options)
|
119
|
+
commit('CheckSale') do |xml|
|
120
|
+
add_check_payment(xml, check, options)
|
121
|
+
add_amount(xml, money)
|
122
|
+
add_sec_code(xml, options)
|
123
|
+
add_check_customer_data(xml, check, options)
|
124
|
+
add_details(xml, options)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def commit_credit_sale(money, card_or_token, options)
|
129
|
+
commit('CreditSale') do |xml|
|
130
|
+
add_amount(xml, money)
|
131
|
+
add_allow_dup(xml)
|
132
|
+
add_card_or_token_customer_data(xml, card_or_token, options)
|
133
|
+
add_details(xml, options)
|
134
|
+
add_descriptor_name(xml, options)
|
135
|
+
add_card_or_token_payment(xml, card_or_token, options)
|
136
|
+
add_three_d_secure(xml, card_or_token, options)
|
137
|
+
add_stored_credentials(xml, options)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def commit_recurring_billing_sale(money, card_or_token, options)
|
142
|
+
commit('RecurringBilling') do |xml|
|
143
|
+
add_amount(xml, money)
|
144
|
+
add_allow_dup(xml)
|
145
|
+
add_card_or_token_customer_data(xml, card_or_token, options)
|
146
|
+
add_details(xml, options)
|
147
|
+
add_descriptor_name(xml, options)
|
148
|
+
add_card_or_token_payment(xml, card_or_token, options)
|
149
|
+
add_three_d_secure(xml, card_or_token, options)
|
150
|
+
add_stored_credentials(xml, options)
|
151
|
+
add_stored_credentials_for_recurring_billing(xml, options)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
89
155
|
def add_reference(xml, transaction_id)
|
90
|
-
|
156
|
+
reference = transaction_id.to_s.include?('|') ? transaction_id.split('|').first : transaction_id
|
157
|
+
xml.hps :GatewayTxnId, reference
|
91
158
|
end
|
92
159
|
|
93
160
|
def add_amount(xml, money)
|
94
161
|
xml.hps :Amt, amount(money) if money
|
95
162
|
end
|
96
163
|
|
97
|
-
def
|
164
|
+
def add_card_or_token_customer_data(xml, credit_card, options)
|
98
165
|
xml.hps :CardHolderData do
|
99
166
|
if credit_card.respond_to?(:number)
|
100
167
|
xml.hps :CardHolderFirstName, credit_card.first_name if credit_card.first_name
|
@@ -104,20 +171,28 @@ module ActiveMerchant #:nodoc:
|
|
104
171
|
xml.hps :CardHolderEmail, options[:email] if options[:email]
|
105
172
|
xml.hps :CardHolderPhone, options[:phone] if options[:phone]
|
106
173
|
|
107
|
-
if(billing_address = (options[:billing_address] || options[:address]))
|
174
|
+
if (billing_address = (options[:billing_address] || options[:address]))
|
108
175
|
xml.hps :CardHolderAddr, billing_address[:address1] if billing_address[:address1]
|
109
176
|
xml.hps :CardHolderCity, billing_address[:city] if billing_address[:city]
|
110
177
|
xml.hps :CardHolderState, billing_address[:state] if billing_address[:state]
|
111
|
-
xml.hps :CardHolderZip, billing_address[:zip] if billing_address[:zip]
|
178
|
+
xml.hps :CardHolderZip, alphanumeric_zip(billing_address[:zip]) if billing_address[:zip]
|
112
179
|
end
|
113
180
|
end
|
114
181
|
end
|
115
182
|
|
116
|
-
def
|
183
|
+
def add_check_customer_data(xml, check, options)
|
184
|
+
xml.hps :ConsumerInfo do
|
185
|
+
xml.hps :FirstName, check.first_name
|
186
|
+
xml.hps :LastName, check.last_name
|
187
|
+
xml.hps :CheckName, options[:company_name] if options[:company_name]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def add_card_or_token_payment(xml, card_or_token, options)
|
117
192
|
xml.hps :CardData do
|
118
193
|
if card_or_token.respond_to?(:number)
|
119
194
|
if card_or_token.track_data
|
120
|
-
xml.tag!(
|
195
|
+
xml.tag!('hps:TrackData', 'method' => 'swipe') do
|
121
196
|
xml.text! card_or_token.track_data
|
122
197
|
end
|
123
198
|
if options[:encryption_type]
|
@@ -148,14 +223,29 @@ module ActiveMerchant #:nodoc:
|
|
148
223
|
end
|
149
224
|
end
|
150
225
|
|
226
|
+
def add_check_payment(xml, check, options)
|
227
|
+
xml.hps :CheckAction, 'SALE'
|
228
|
+
xml.hps :AccountInfo do
|
229
|
+
xml.hps :RoutingNumber, check.routing_number
|
230
|
+
xml.hps :AccountNumber, check.account_number
|
231
|
+
xml.hps :CheckNumber, check.number
|
232
|
+
xml.hps :AccountType, check.account_type&.upcase
|
233
|
+
end
|
234
|
+
xml.hps :CheckType, check.account_holder_type&.upcase
|
235
|
+
end
|
236
|
+
|
151
237
|
def add_details(xml, options)
|
152
238
|
xml.hps :AdditionalTxnFields do
|
153
239
|
xml.hps :Description, options[:description] if options[:description]
|
154
|
-
xml.hps :InvoiceNbr, options[:order_id] if options[:order_id]
|
240
|
+
xml.hps :InvoiceNbr, options[:order_id][0..59] if options[:order_id]
|
155
241
|
xml.hps :CustomerID, options[:customer_id] if options[:customer_id]
|
156
242
|
end
|
157
243
|
end
|
158
244
|
|
245
|
+
def add_sec_code(xml, options)
|
246
|
+
xml.hps :SECCode, options[:sec_code] || 'WEB'
|
247
|
+
end
|
248
|
+
|
159
249
|
def add_allow_dup(xml)
|
160
250
|
xml.hps :AllowDup, 'Y'
|
161
251
|
end
|
@@ -164,12 +254,80 @@ module ActiveMerchant #:nodoc:
|
|
164
254
|
xml.hps :TxnDescriptor, options[:descriptor_name] if options[:descriptor_name]
|
165
255
|
end
|
166
256
|
|
257
|
+
def add_three_d_secure(xml, card_or_token, options)
|
258
|
+
if card_or_token.is_a?(NetworkTokenizationCreditCard)
|
259
|
+
build_three_d_secure(xml, {
|
260
|
+
source: card_or_token.source,
|
261
|
+
cavv: card_or_token.payment_cryptogram,
|
262
|
+
eci: card_or_token.eci,
|
263
|
+
xid: card_or_token.transaction_id
|
264
|
+
})
|
265
|
+
elsif options[:three_d_secure]
|
266
|
+
options[:three_d_secure][:source] ||= card_brand(card_or_token)
|
267
|
+
build_three_d_secure(xml, options[:three_d_secure])
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
def build_three_d_secure(xml, three_d_secure)
|
272
|
+
# PaymentDataSource is required when supplying the SecureECommerce data group,
|
273
|
+
# and the gateway currently only allows the values within the mapping
|
274
|
+
return unless PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]
|
275
|
+
|
276
|
+
xml.hps :SecureECommerce do
|
277
|
+
xml.hps :PaymentDataSource, PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]
|
278
|
+
xml.hps :TypeOfPaymentData, '3DSecure' # Only type currently supported
|
279
|
+
xml.hps :PaymentData, three_d_secure[:cavv] if three_d_secure[:cavv]
|
280
|
+
# the gateway only allows a single character for the ECI
|
281
|
+
xml.hps :ECommerceIndicator, strip_leading_zero(three_d_secure[:eci]) if three_d_secure[:eci]
|
282
|
+
xml.hps :XID, three_d_secure[:xid] if three_d_secure[:xid]
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# We do not currently support installments on this gateway.
|
287
|
+
# The HPS gateway treats recurring transactions as a seperate transaction type
|
288
|
+
def add_stored_credentials(xml, options)
|
289
|
+
return unless options[:stored_credential]
|
290
|
+
|
291
|
+
xml.hps :CardOnFileData do
|
292
|
+
if options[:stored_credential][:initiator] == 'customer'
|
293
|
+
xml.hps :CardOnFile, 'C'
|
294
|
+
elsif options[:stored_credential][:initiator] == 'merchant'
|
295
|
+
xml.hps :CardOnFile, 'M'
|
296
|
+
else
|
297
|
+
return
|
298
|
+
end
|
299
|
+
|
300
|
+
if options[:stored_credential][:network_transaction_id]
|
301
|
+
xml.hps :CardBrandTxnId, options[:stored_credential][:network_transaction_id]
|
302
|
+
else
|
303
|
+
return
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
def add_stored_credentials_for_recurring_billing(xml, options)
|
309
|
+
xml.hps :RecurringData do
|
310
|
+
if options[:stored_credential][:reason_type] = 'recurring'
|
311
|
+
xml.hps :OneTime, 'N'
|
312
|
+
else
|
313
|
+
xml.hps :OneTime, 'Y'
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
def strip_leading_zero(value)
|
319
|
+
return value unless value[0] == '0'
|
320
|
+
|
321
|
+
value[1, 1]
|
322
|
+
end
|
323
|
+
|
167
324
|
def build_request(action)
|
168
325
|
xml = Builder::XmlMarkup.new(encoding: 'UTF-8')
|
169
326
|
xml.instruct!(:xml, encoding: 'UTF-8')
|
170
327
|
xml.SOAP :Envelope, {
|
171
|
-
|
172
|
-
|
328
|
+
'xmlns:SOAP' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
329
|
+
'xmlns:hps' => 'http://Hps.Exchange.PosGateway'
|
330
|
+
} do
|
173
331
|
xml.SOAP :Body do
|
174
332
|
xml.hps :PosRequest do
|
175
333
|
xml.hps 'Ver1.0'.to_sym do
|
@@ -202,9 +360,9 @@ module ActiveMerchant #:nodoc:
|
|
202
360
|
|
203
361
|
doc = Nokogiri::XML(raw)
|
204
362
|
doc.remove_namespaces!
|
205
|
-
if(header = doc.xpath(
|
363
|
+
if (header = doc.xpath('//Header').first)
|
206
364
|
header.elements.each do |node|
|
207
|
-
if
|
365
|
+
if node.elements.size == 0
|
208
366
|
response[node.name] = node.text
|
209
367
|
else
|
210
368
|
node.elements.each do |childnode|
|
@@ -213,33 +371,34 @@ module ActiveMerchant #:nodoc:
|
|
213
371
|
end
|
214
372
|
end
|
215
373
|
end
|
216
|
-
if(transaction = doc.xpath(
|
374
|
+
if (transaction = doc.xpath('//Transaction/*[1]').first)
|
217
375
|
transaction.elements.each do |node|
|
218
376
|
response[node.name] = node.text
|
219
377
|
end
|
220
378
|
end
|
221
|
-
if(fault = doc.xpath(
|
222
|
-
response[
|
379
|
+
if (fault = doc.xpath('//Fault/Reason/Text').first)
|
380
|
+
response['Fault'] = fault.text
|
223
381
|
end
|
224
382
|
|
225
383
|
response
|
226
384
|
end
|
227
385
|
|
228
|
-
def commit(action, &request)
|
386
|
+
def commit(action, reference = nil, &request)
|
229
387
|
data = build_request(action, &request)
|
230
388
|
|
231
|
-
response =
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
389
|
+
response =
|
390
|
+
begin
|
391
|
+
parse(ssl_post((test? ? test_url : live_url), data, 'Content-Type' => 'text/xml'))
|
392
|
+
rescue ResponseError => e
|
393
|
+
parse(e.response.body)
|
394
|
+
end
|
236
395
|
|
237
396
|
ActiveMerchant::Billing::Response.new(
|
238
397
|
successful?(response),
|
239
398
|
message_from(response),
|
240
399
|
response,
|
241
400
|
test: test?,
|
242
|
-
authorization: authorization_from(response),
|
401
|
+
authorization: authorization_from(response, reference),
|
243
402
|
avs_result: {
|
244
403
|
code: response['AVSRsltCode'],
|
245
404
|
message: response['AVSRsltText']
|
@@ -248,57 +407,65 @@ module ActiveMerchant #:nodoc:
|
|
248
407
|
)
|
249
408
|
end
|
250
409
|
|
410
|
+
SUCCESSFUL_RESPONSE_CODES = %w(0 00 85)
|
251
411
|
def successful?(response)
|
252
412
|
(
|
253
|
-
(response[
|
254
|
-
((response[
|
413
|
+
(response['GatewayRspCode'] == '0') &&
|
414
|
+
((SUCCESSFUL_RESPONSE_CODES.include? response['RspCode']) || !response['RspCode'])
|
255
415
|
)
|
256
416
|
end
|
257
417
|
|
258
418
|
def message_from(response)
|
259
|
-
if
|
260
|
-
response[
|
261
|
-
elsif
|
262
|
-
if
|
263
|
-
issuer_message(response["RspCode"])
|
264
|
-
else
|
419
|
+
if response['Fault']
|
420
|
+
response['Fault']
|
421
|
+
elsif response['GatewayRspCode'] == '0'
|
422
|
+
if SUCCESSFUL_RESPONSE_CODES.include? response['RspCode']
|
265
423
|
response['GatewayRspMsg']
|
424
|
+
else
|
425
|
+
issuer_message(response['RspCode'])
|
266
426
|
end
|
267
427
|
else
|
268
|
-
(GATEWAY_MESSAGES[response[
|
428
|
+
(GATEWAY_MESSAGES[response['GatewayRspCode']] || response['GatewayRspMsg'])
|
269
429
|
end
|
270
430
|
end
|
271
431
|
|
272
|
-
def authorization_from(response)
|
432
|
+
def authorization_from(response, reference)
|
433
|
+
return [reference, response['GatewayTxnId']].join('|') if reference
|
434
|
+
|
273
435
|
response['GatewayTxnId']
|
274
436
|
end
|
275
437
|
|
276
438
|
def test?
|
277
|
-
|
439
|
+
@options[:secret_api_key]&.include?('_cert_')
|
440
|
+
end
|
441
|
+
|
442
|
+
def alphanumeric_zip(zip)
|
443
|
+
zip.gsub(/[^0-9a-z]/i, '')
|
278
444
|
end
|
279
445
|
|
280
446
|
ISSUER_MESSAGES = {
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
447
|
+
'13' => 'Must be greater than or equal 0.',
|
448
|
+
'14' => 'The card number is incorrect.',
|
449
|
+
'54' => 'The card has expired.',
|
450
|
+
'55' => 'The 4-digit pin is invalid.',
|
451
|
+
'75' => 'Maximum number of pin retries exceeded.',
|
452
|
+
'80' => 'Card expiration date is invalid.',
|
453
|
+
'86' => "Can't verify card pin number."
|
288
454
|
}
|
289
455
|
def issuer_message(code)
|
290
|
-
return
|
291
|
-
return
|
456
|
+
return 'The card was declined.' if %w(02 03 04 05 41 43 44 51 56 61 62 63 65 78).include?(code)
|
457
|
+
return 'An error occurred while processing the card.' if %w(06 07 12 15 19 12 52 53 57 58 76 77 91 96 EC).include?(code)
|
292
458
|
return "The card's security code is incorrect." if %w(EB N7).include?(code)
|
459
|
+
|
293
460
|
ISSUER_MESSAGES[code]
|
294
461
|
end
|
295
462
|
|
296
463
|
GATEWAY_MESSAGES = {
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
464
|
+
'-2' => 'Authentication error. Please double check your service configuration.',
|
465
|
+
'12' => 'Invalid CPC data.',
|
466
|
+
'13' => 'Invalid card data.',
|
467
|
+
'14' => 'The card number is not a valid credit card number.',
|
468
|
+
'30' => 'Gateway timed out.'
|
302
469
|
}
|
303
470
|
end
|
304
471
|
end
|