activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,505 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class FirstdataE4V27Gateway < Gateway
|
4
|
+
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v28'
|
5
|
+
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v28'
|
6
|
+
|
7
|
+
TRANSACTIONS = {
|
8
|
+
sale: '00',
|
9
|
+
authorization: '01',
|
10
|
+
verify: '05',
|
11
|
+
capture: '32',
|
12
|
+
void: '33',
|
13
|
+
credit: '34',
|
14
|
+
store: '05'
|
15
|
+
}
|
16
|
+
|
17
|
+
SUCCESS = 'true'
|
18
|
+
|
19
|
+
SENSITIVE_FIELDS = %i[cvdcode expiry_date card_number]
|
20
|
+
|
21
|
+
BRANDS = {
|
22
|
+
visa: 'Visa',
|
23
|
+
master: 'Mastercard',
|
24
|
+
american_express: 'American Express',
|
25
|
+
jcb: 'JCB',
|
26
|
+
discover: 'Discover'
|
27
|
+
}
|
28
|
+
|
29
|
+
DEFAULT_ECI = '07'
|
30
|
+
|
31
|
+
self.supported_cardtypes = BRANDS.keys
|
32
|
+
self.supported_countries = %w[CA US]
|
33
|
+
self.default_currency = 'USD'
|
34
|
+
self.homepage_url = 'http://www.firstdata.com'
|
35
|
+
self.display_name = 'FirstData Global Gateway e4 v27'
|
36
|
+
|
37
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
38
|
+
# Bank error codes: https://support.payeezy.com/hc/en-us/articles/203730509-First-Data-Global-Gateway-e4-Bank-Response-Codes
|
39
|
+
'201' => STANDARD_ERROR_CODE[:incorrect_number],
|
40
|
+
'531' => STANDARD_ERROR_CODE[:invalid_cvc],
|
41
|
+
'503' => STANDARD_ERROR_CODE[:invalid_cvc],
|
42
|
+
'811' => STANDARD_ERROR_CODE[:invalid_cvc],
|
43
|
+
'605' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
44
|
+
'522' => STANDARD_ERROR_CODE[:expired_card],
|
45
|
+
'303' => STANDARD_ERROR_CODE[:card_declined],
|
46
|
+
'530' => STANDARD_ERROR_CODE[:card_declined],
|
47
|
+
'401' => STANDARD_ERROR_CODE[:call_issuer],
|
48
|
+
'402' => STANDARD_ERROR_CODE[:call_issuer],
|
49
|
+
'501' => STANDARD_ERROR_CODE[:pickup_card],
|
50
|
+
# Ecommerce error codes: https://support.payeezy.com/hc/en-us/articles/203730499-eCommerce-Response-Codes-ETG-e4-Transaction-Gateway-Codes
|
51
|
+
'22' => STANDARD_ERROR_CODE[:invalid_number],
|
52
|
+
'25' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
53
|
+
'31' => STANDARD_ERROR_CODE[:incorrect_cvc],
|
54
|
+
'44' => STANDARD_ERROR_CODE[:incorrect_zip],
|
55
|
+
'42' => STANDARD_ERROR_CODE[:processing_error]
|
56
|
+
}
|
57
|
+
|
58
|
+
def initialize(options = {})
|
59
|
+
requires!(options, :login, :password, :key_id, :hmac_key)
|
60
|
+
@options = options
|
61
|
+
|
62
|
+
super
|
63
|
+
end
|
64
|
+
|
65
|
+
def authorize(money, credit_card_or_store_authorization, options = {})
|
66
|
+
commit(:authorization, build_sale_or_authorization_request(money, credit_card_or_store_authorization, options))
|
67
|
+
end
|
68
|
+
|
69
|
+
def purchase(money, credit_card_or_store_authorization, options = {})
|
70
|
+
commit(:sale, build_sale_or_authorization_request(money, credit_card_or_store_authorization, options))
|
71
|
+
end
|
72
|
+
|
73
|
+
def capture(money, authorization, options = {})
|
74
|
+
commit(:capture, build_capture_or_credit_request(money, authorization, options))
|
75
|
+
end
|
76
|
+
|
77
|
+
def void(authorization, options = {})
|
78
|
+
commit(:void, build_capture_or_credit_request(money_from_authorization(authorization), authorization, options))
|
79
|
+
end
|
80
|
+
|
81
|
+
def refund(money, authorization, options = {})
|
82
|
+
commit(:credit, build_capture_or_credit_request(money, authorization, options))
|
83
|
+
end
|
84
|
+
|
85
|
+
def verify(credit_card, options = {})
|
86
|
+
commit(:verify, build_sale_or_authorization_request(0, credit_card, options))
|
87
|
+
end
|
88
|
+
|
89
|
+
# Tokenize a credit card with TransArmor
|
90
|
+
#
|
91
|
+
# The TransArmor token and other card data necessary for subsequent
|
92
|
+
# transactions is stored in the response's +authorization+ attribute.
|
93
|
+
# The authorization string may be passed to +authorize+ and +purchase+
|
94
|
+
# instead of a +ActiveMerchant::Billing::CreditCard+ instance.
|
95
|
+
#
|
96
|
+
# TransArmor support must be explicitly activated on your gateway
|
97
|
+
# account by FirstData. If your authorization string is empty, contact
|
98
|
+
# FirstData support for account setup assistance.
|
99
|
+
#
|
100
|
+
# https://support.payeezy.com/hc/en-us/articles/203731189-TransArmor-Tokenization
|
101
|
+
def store(credit_card, options = {})
|
102
|
+
commit(:store, build_store_request(credit_card, options), credit_card)
|
103
|
+
end
|
104
|
+
|
105
|
+
def verify_credentials
|
106
|
+
response = void('0')
|
107
|
+
response.message != 'Unauthorized Request. Bad or missing credentials.'
|
108
|
+
end
|
109
|
+
|
110
|
+
def supports_scrubbing?
|
111
|
+
true
|
112
|
+
end
|
113
|
+
|
114
|
+
def scrub(transcript)
|
115
|
+
transcript.
|
116
|
+
gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2').
|
117
|
+
gsub(%r((<CVDCode>).+(</CVDCode>)), '\1[FILTERED]\2').
|
118
|
+
gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2').
|
119
|
+
gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2').
|
120
|
+
gsub(%r((CARD NUMBER\s+: )#+\d+), '\1[FILTERED]')
|
121
|
+
end
|
122
|
+
|
123
|
+
def supports_network_tokenization?
|
124
|
+
true
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def build_request(action, body)
|
130
|
+
xml = Builder::XmlMarkup.new
|
131
|
+
|
132
|
+
xml.instruct!
|
133
|
+
xml.tag! 'Transaction', xmlns: 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes' do
|
134
|
+
add_credentials(xml)
|
135
|
+
add_transaction_type(xml, action)
|
136
|
+
xml << body
|
137
|
+
end
|
138
|
+
|
139
|
+
xml.target!
|
140
|
+
end
|
141
|
+
|
142
|
+
def build_sale_or_authorization_request(money, credit_card_or_store_authorization, options)
|
143
|
+
xml = Builder::XmlMarkup.new
|
144
|
+
|
145
|
+
add_amount(xml, money, options)
|
146
|
+
|
147
|
+
if credit_card_or_store_authorization.is_a? String
|
148
|
+
add_credit_card_token(xml, credit_card_or_store_authorization, options)
|
149
|
+
else
|
150
|
+
add_credit_card(xml, credit_card_or_store_authorization, options)
|
151
|
+
add_stored_credentials(xml, credit_card_or_store_authorization, options)
|
152
|
+
end
|
153
|
+
|
154
|
+
add_address(xml, options)
|
155
|
+
add_customer_data(xml, options)
|
156
|
+
add_invoice(xml, options)
|
157
|
+
add_tax_fields(xml, options)
|
158
|
+
add_level_3(xml, options)
|
159
|
+
|
160
|
+
xml.target!
|
161
|
+
end
|
162
|
+
|
163
|
+
def build_capture_or_credit_request(money, identification, options)
|
164
|
+
xml = Builder::XmlMarkup.new
|
165
|
+
|
166
|
+
add_identification(xml, identification)
|
167
|
+
add_amount(xml, money, options)
|
168
|
+
add_customer_data(xml, options)
|
169
|
+
add_card_authentication_data(xml, options)
|
170
|
+
|
171
|
+
xml.target!
|
172
|
+
end
|
173
|
+
|
174
|
+
def build_store_request(credit_card, options)
|
175
|
+
xml = Builder::XmlMarkup.new
|
176
|
+
|
177
|
+
add_credit_card(xml, credit_card, options)
|
178
|
+
add_address(xml, options)
|
179
|
+
add_customer_data(xml, options)
|
180
|
+
|
181
|
+
xml.target!
|
182
|
+
end
|
183
|
+
|
184
|
+
def add_credentials(xml)
|
185
|
+
xml.tag! 'ExactID', @options[:login]
|
186
|
+
xml.tag! 'Password', @options[:password]
|
187
|
+
end
|
188
|
+
|
189
|
+
def add_transaction_type(xml, action)
|
190
|
+
xml.tag! 'Transaction_Type', TRANSACTIONS[action]
|
191
|
+
end
|
192
|
+
|
193
|
+
def add_identification(xml, identification)
|
194
|
+
authorization_num, transaction_tag, = identification.split(';')
|
195
|
+
|
196
|
+
xml.tag! 'Authorization_Num', authorization_num
|
197
|
+
xml.tag! 'Transaction_Tag', transaction_tag
|
198
|
+
end
|
199
|
+
|
200
|
+
def add_amount(xml, money, options)
|
201
|
+
currency_code = options[:currency] || default_currency
|
202
|
+
xml.tag! 'DollarAmount', localized_amount(money, currency_code)
|
203
|
+
xml.tag! 'Currency', currency_code
|
204
|
+
end
|
205
|
+
|
206
|
+
def add_credit_card(xml, credit_card, options)
|
207
|
+
if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
|
208
|
+
xml.tag! 'Track1', credit_card.track_data
|
209
|
+
xml.tag! 'Ecommerce_Flag', 'R'
|
210
|
+
else
|
211
|
+
xml.tag! 'Card_Number', credit_card.number
|
212
|
+
xml.tag! 'Expiry_Date', expdate(credit_card)
|
213
|
+
xml.tag! 'CardHoldersName', credit_card.name
|
214
|
+
xml.tag! 'CardType', card_type(credit_card.brand)
|
215
|
+
|
216
|
+
add_wallet_provider_id(xml, credit_card, options)
|
217
|
+
add_credit_card_eci(xml, credit_card, options)
|
218
|
+
add_credit_card_verification_strings(xml, credit_card, options)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def add_credit_card_eci(xml, credit_card, options)
|
223
|
+
eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
|
224
|
+
# Payeezy requires an ECI of 5 for apple pay transactions
|
225
|
+
# See: https://support.payeezy.com/hc/en-us/articles/203730589-Ecommerce-Flag-Values
|
226
|
+
'05'
|
227
|
+
else
|
228
|
+
(credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
|
229
|
+
end
|
230
|
+
|
231
|
+
xml.tag! 'Ecommerce_Flag', /^[0-9]+$/.match?(eci.to_s) ? eci.to_s.rjust(2, '0') : eci
|
232
|
+
end
|
233
|
+
|
234
|
+
def add_credit_card_verification_strings(xml, credit_card, options)
|
235
|
+
if credit_card.is_a?(NetworkTokenizationCreditCard)
|
236
|
+
add_network_tokenization_credit_card(xml, credit_card)
|
237
|
+
else
|
238
|
+
if credit_card.verification_value?
|
239
|
+
xml.tag! 'CVD_Presence_Ind', '1'
|
240
|
+
xml.tag! 'CVDCode', credit_card.verification_value
|
241
|
+
end
|
242
|
+
|
243
|
+
add_card_authentication_data(xml, options)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def add_network_tokenization_credit_card(xml, credit_card)
|
248
|
+
case card_brand(credit_card).to_sym
|
249
|
+
when :american_express
|
250
|
+
cryptogram = Base64.decode64(credit_card.payment_cryptogram)
|
251
|
+
xml.tag!('XID', Base64.encode64(cryptogram[20...40]))
|
252
|
+
xml.tag!('CAVV', Base64.encode64(cryptogram[0...20]))
|
253
|
+
else
|
254
|
+
xml.tag!('XID', credit_card.transaction_id) if credit_card.transaction_id
|
255
|
+
xml.tag!('CAVV', credit_card.payment_cryptogram)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def add_card_authentication_data(xml, options)
|
260
|
+
xml.tag! 'CAVV', options[:cavv]
|
261
|
+
xml.tag! 'XID', options[:xid]
|
262
|
+
end
|
263
|
+
|
264
|
+
def add_credit_card_token(xml, store_authorization, options)
|
265
|
+
params = store_authorization.split(';')
|
266
|
+
credit_card = CreditCard.new(
|
267
|
+
brand: params[1],
|
268
|
+
first_name: params[2],
|
269
|
+
last_name: params[3],
|
270
|
+
month: params[4],
|
271
|
+
year: params[5]
|
272
|
+
)
|
273
|
+
|
274
|
+
xml.tag! 'TransarmorToken', params[0]
|
275
|
+
xml.tag! 'Expiry_Date', expdate(credit_card)
|
276
|
+
xml.tag! 'CardHoldersName', credit_card.name
|
277
|
+
xml.tag! 'CardType', card_type(credit_card.brand)
|
278
|
+
|
279
|
+
add_wallet_provider_id(xml, credit_card, options)
|
280
|
+
add_card_authentication_data(xml, options)
|
281
|
+
end
|
282
|
+
|
283
|
+
def add_wallet_provider_id(xml, credit_card, options)
|
284
|
+
provider_id = if options[:wallet_provider_id]
|
285
|
+
options[:wallet_provider_id]
|
286
|
+
elsif credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay
|
287
|
+
# See: https://support.payeezy.com/hc/en-us/articles/206601408-First-Data-Payeezy-Gateway-Web-Service-API-Reference-Guide#3.9
|
288
|
+
4
|
289
|
+
end
|
290
|
+
|
291
|
+
xml.tag! 'WalletProviderID', provider_id if provider_id
|
292
|
+
end
|
293
|
+
|
294
|
+
def add_customer_data(xml, options)
|
295
|
+
xml.tag! 'Customer_Ref', options[:customer] if options[:customer]
|
296
|
+
xml.tag! 'Client_IP', options[:ip] if options[:ip]
|
297
|
+
xml.tag! 'Client_Email', options[:email] if options[:email]
|
298
|
+
end
|
299
|
+
|
300
|
+
def add_address(xml, options)
|
301
|
+
if (address = options[:billing_address] || options[:address])
|
302
|
+
address = strip_line_breaks(address)
|
303
|
+
|
304
|
+
xml.tag! 'Address' do
|
305
|
+
xml.tag! 'Address1', address[:address1]
|
306
|
+
xml.tag! 'Address2', address[:address2] if address[:address2]
|
307
|
+
xml.tag! 'City', address[:city]
|
308
|
+
xml.tag! 'State', address[:state]
|
309
|
+
xml.tag! 'Zip', address[:zip]
|
310
|
+
xml.tag! 'CountryCode', address[:country]
|
311
|
+
end
|
312
|
+
xml.tag! 'ZipCode', address[:zip]
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
def strip_line_breaks(address)
|
317
|
+
return unless address.is_a?(Hash)
|
318
|
+
|
319
|
+
Hash[address.map { |k, s| [k, s&.tr("\r\n", ' ')&.strip] }]
|
320
|
+
end
|
321
|
+
|
322
|
+
def add_invoice(xml, options)
|
323
|
+
xml.tag! 'Reference_No', options[:order_id]
|
324
|
+
xml.tag! 'Reference_3', options[:description] if options[:description]
|
325
|
+
end
|
326
|
+
|
327
|
+
def add_tax_fields(xml, options)
|
328
|
+
xml.tag! 'Tax1Amount', options[:tax1_amount] if options[:tax1_amount]
|
329
|
+
xml.tag! 'Tax1Number', options[:tax1_number] if options[:tax1_number]
|
330
|
+
end
|
331
|
+
|
332
|
+
def add_level_3(xml, options)
|
333
|
+
xml.tag!('Level3') { |x| x << options[:level_3] } if options[:level_3]
|
334
|
+
end
|
335
|
+
|
336
|
+
def add_stored_credentials(xml, card, options)
|
337
|
+
return unless options[:stored_credential]
|
338
|
+
|
339
|
+
xml.tag! 'StoredCredentials' do
|
340
|
+
xml.tag! 'Indicator', stored_credential_indicator(xml, card, options)
|
341
|
+
if initiator = options.dig(:stored_credential, :initiator)
|
342
|
+
xml.tag! 'Initiation', initiator == 'merchant' ? 'M' : 'C'
|
343
|
+
end
|
344
|
+
if reason_type = options.dig(:stored_credential, :reason_type)
|
345
|
+
xml.tag! 'Schedule', reason_type == 'unscheduled' ? 'U' : 'S'
|
346
|
+
end
|
347
|
+
xml.tag! 'AuthorizationTypeOverride', options[:authorization_type_override] if options[:authorization_type_override]
|
348
|
+
if network_transaction_id = options[:stored_credential][:network_transaction_id]
|
349
|
+
xml.tag! 'TransactionId', network_transaction_id
|
350
|
+
else
|
351
|
+
xml.tag! 'TransactionId', 'new'
|
352
|
+
end
|
353
|
+
xml.tag! 'OriginalAmount', options[:original_amount] if options[:original_amount]
|
354
|
+
xml.tag! 'ProtectbuyIndicator', options[:protectbuy_indicator] if options[:protectbuy_indicator]
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def stored_credential_indicator(xml, card, options)
|
359
|
+
if card.brand == 'master' || options.dig(:stored_credential, :initial_transaction) == false
|
360
|
+
'S'
|
361
|
+
else
|
362
|
+
'1'
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
def expdate(credit_card)
|
367
|
+
"#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
|
368
|
+
end
|
369
|
+
|
370
|
+
def card_type(credit_card_brand)
|
371
|
+
BRANDS[credit_card_brand.to_sym] if credit_card_brand
|
372
|
+
end
|
373
|
+
|
374
|
+
def commit(action, data, credit_card = nil)
|
375
|
+
url = (test? ? self.test_url : self.live_url)
|
376
|
+
request = build_request(action, data)
|
377
|
+
begin
|
378
|
+
response = parse(ssl_post(url, request, headers('POST', url, request)))
|
379
|
+
rescue ResponseError => e
|
380
|
+
response = parse_error(e.response)
|
381
|
+
end
|
382
|
+
|
383
|
+
Response.new(successful?(response), message_from(response), response,
|
384
|
+
test: test?,
|
385
|
+
authorization: successful?(response) ? response_authorization(action, response, credit_card) : '',
|
386
|
+
avs_result: { code: response[:avs] },
|
387
|
+
cvv_result: response[:cvv2],
|
388
|
+
error_code: standard_error_code(response))
|
389
|
+
end
|
390
|
+
|
391
|
+
def headers(method, url, request)
|
392
|
+
content_type = 'application/xml'
|
393
|
+
content_digest = Digest::SHA1.hexdigest(request)
|
394
|
+
sending_time = Time.now.utc.iso8601
|
395
|
+
payload = [method, content_type, content_digest, sending_time, url.split('.com')[1]].join("\n")
|
396
|
+
hmac = OpenSSL::HMAC.digest('sha1', @options[:hmac_key], payload)
|
397
|
+
encoded = Base64.strict_encode64(hmac)
|
398
|
+
|
399
|
+
{
|
400
|
+
'x-gge4-date' => sending_time,
|
401
|
+
'x-gge4-content-sha1' => content_digest,
|
402
|
+
'Authorization' => 'GGE4_API ' + @options[:key_id].to_s + ':' + encoded,
|
403
|
+
'Accepts' => content_type,
|
404
|
+
'Content-Type' => content_type
|
405
|
+
}
|
406
|
+
end
|
407
|
+
|
408
|
+
def successful?(response)
|
409
|
+
response[:transaction_approved] == SUCCESS
|
410
|
+
end
|
411
|
+
|
412
|
+
def response_authorization(action, response, credit_card)
|
413
|
+
if action == :store
|
414
|
+
store_authorization_from(response, credit_card)
|
415
|
+
else
|
416
|
+
authorization_from(response)
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
def authorization_from(response)
|
421
|
+
if response[:authorization_num] && response[:transaction_tag]
|
422
|
+
[
|
423
|
+
response[:authorization_num],
|
424
|
+
response[:transaction_tag],
|
425
|
+
(response[:dollar_amount].to_f * 100).round
|
426
|
+
].join(';')
|
427
|
+
else
|
428
|
+
''
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
def store_authorization_from(response, credit_card)
|
433
|
+
if response[:transarmor_token].present?
|
434
|
+
[
|
435
|
+
response[:transarmor_token],
|
436
|
+
credit_card.brand,
|
437
|
+
credit_card.first_name,
|
438
|
+
credit_card.last_name,
|
439
|
+
credit_card.month,
|
440
|
+
credit_card.year
|
441
|
+
].map { |value| value.to_s.tr(';', '') }.join(';')
|
442
|
+
else
|
443
|
+
raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
def money_from_authorization(auth)
|
448
|
+
_, _, amount = auth.split(/;/, 3)
|
449
|
+
amount.to_i
|
450
|
+
end
|
451
|
+
|
452
|
+
def message_from(response)
|
453
|
+
if response[:faultcode] && response[:faultstring]
|
454
|
+
response[:faultstring]
|
455
|
+
elsif response[:error_number] && response[:error_number] != '0'
|
456
|
+
response[:error_description]
|
457
|
+
else
|
458
|
+
result = (response[:exact_message] || '')
|
459
|
+
result << " - #{response[:bank_message]}" if response[:bank_message].present?
|
460
|
+
result
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
def parse_error(error)
|
465
|
+
{
|
466
|
+
transaction_approved: 'false',
|
467
|
+
error_number: error.code,
|
468
|
+
error_description: error.body,
|
469
|
+
ecommerce_error_code: error.body.gsub(/[^\d]/, '')
|
470
|
+
}
|
471
|
+
end
|
472
|
+
|
473
|
+
def standard_error_code(response)
|
474
|
+
STANDARD_ERROR_CODE_MAPPING[response[:bank_resp_code] || response[:ecommerce_error_code]]
|
475
|
+
end
|
476
|
+
|
477
|
+
def parse(xml)
|
478
|
+
response = {}
|
479
|
+
xml = REXML::Document.new(xml)
|
480
|
+
|
481
|
+
if (root = REXML::XPath.first(xml, '//TransactionResult'))
|
482
|
+
parse_elements(response, root)
|
483
|
+
end
|
484
|
+
|
485
|
+
SENSITIVE_FIELDS.each { |key| response.delete(key) }
|
486
|
+
response
|
487
|
+
end
|
488
|
+
|
489
|
+
def parse_elements(response, root)
|
490
|
+
root.elements.to_a.each do |node|
|
491
|
+
if node.has_elements?
|
492
|
+
parse_elements(response, node)
|
493
|
+
else
|
494
|
+
response[name_node(root, node)] = (node.text || '').strip
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
def name_node(root, node)
|
500
|
+
parent = root.name unless root.name == 'TransactionResult'
|
501
|
+
"#{parent}#{node.name}".gsub(/EXact/, 'Exact').underscore.to_sym
|
502
|
+
end
|
503
|
+
end
|
504
|
+
end
|
505
|
+
end
|