activemerchant 1.42.6 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/CHANGELOG +1420 -2
- data/CONTRIBUTORS +106 -0
- data/README.md +107 -103
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +12 -13
- data/lib/active_merchant/billing/base.rb +13 -16
- data/lib/active_merchant/billing/check.rb +35 -24
- data/lib/active_merchant/billing/compatibility.rb +117 -0
- data/lib/active_merchant/billing/credit_card.rb +196 -81
- data/lib/active_merchant/billing/credit_card_formatting.rb +6 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +199 -75
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +171 -39
- data/lib/active_merchant/billing/gateways/adyen.rb +380 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +933 -604
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +74 -54
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +130 -370
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +23 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +351 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +109 -32
- data/lib/active_merchant/billing/gateways/beanstream.rb +59 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -9
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -498
- data/lib/active_merchant/billing/gateways/blue_snap.rb +347 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +80 -46
- data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +15 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +311 -121
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +311 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +6 -7
- data/lib/active_merchant/billing/gateways/card_stream.rb +235 -89
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +50 -8
- data/lib/active_merchant/billing/gateways/cecabank.rb +27 -14
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +233 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +91 -97
- data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +356 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +294 -158
- data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +59 -347
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +24 -39
- data/lib/active_merchant/billing/gateways/elavon.rb +146 -147
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +41 -31
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +79 -78
- data/lib/active_merchant/billing/gateways/eway_managed.rb +35 -36
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +369 -228
- data/lib/active_merchant/billing/gateways/exact.rb +32 -26
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +90 -64
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -14
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +128 -122
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +190 -64
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +446 -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 +270 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +29 -27
- data/lib/active_merchant/billing/gateways/global_collect.rb +340 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +35 -36
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +29 -32
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -6
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +247 -41
- data/lib/active_merchant/billing/gateways/itransact.rb +4 -5
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +198 -71
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +45 -43
- data/lib/active_merchant/billing/gateways/litle.rb +328 -444
- data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -115
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +37 -19
- data/lib/active_merchant/billing/gateways/merchant_one.rb +13 -15
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +57 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +59 -48
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +38 -19
- data/lib/active_merchant/billing/gateways/mercury.rb +77 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +11 -30
- data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
- data/lib/active_merchant/billing/gateways/migs.rb +81 -22
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +23 -25
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +146 -64
- data/lib/active_merchant/billing/gateways/moneris_us.rb +197 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -15
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +86 -64
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +11 -5
- data/lib/active_merchant/billing/gateways/netaxept.rb +21 -22
- data/lib/active_merchant/billing/gateways/netbanx.rb +290 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +70 -35
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -6
- data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +274 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +90 -47
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +48 -20
- data/lib/active_merchant/billing/gateways/opp.rb +369 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +79 -44
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -102
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +48 -29
- data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +67 -48
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +20 -26
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +7 -15
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +40 -36
- data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
- data/lib/active_merchant/billing/gateways/payex.rb +38 -30
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +62 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +74 -27
- data/lib/active_merchant/billing/gateways/payflow_express.rb +77 -81
- 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 +54 -45
- data/lib/active_merchant/billing/gateways/paymentez.rb +304 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +160 -66
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +54 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +17 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +36 -27
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +7 -6
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +2 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -88
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +445 -0
- data/lib/active_merchant/billing/gateways/payway.rb +8 -8
- data/lib/active_merchant/billing/gateways/pin.rb +74 -18
- data/lib/active_merchant/billing/gateways/plugnpay.rb +66 -76
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +30 -30
- data/lib/active_merchant/billing/gateways/psl_card.rb +27 -34
- data/lib/active_merchant/billing/gateways/qbms.rb +65 -54
- data/lib/active_merchant/billing/gateways/quantum.rb +18 -18
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +295 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -350
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +78 -48
- data/lib/active_merchant/billing/gateways/redsys.rb +310 -170
- data/lib/active_merchant/billing/gateways/s5.rb +246 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +415 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +195 -90
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -12
- data/lib/active_merchant/billing/gateways/secure_net.rb +51 -43
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -10
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -14
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +10 -18
- data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +35 -38
- data/lib/active_merchant/billing/gateways/smart_ps.rb +50 -42
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +9 -9
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +62 -12
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -103
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +12 -18
- data/lib/active_merchant/billing/gateways/telr.rb +274 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +143 -30
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transax.rb +5 -6
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -232
- data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +86 -57
- data/lib/active_merchant/billing/gateways/usa_epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +196 -89
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +157 -32
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +42 -49
- data/lib/active_merchant/billing/gateways/viaklix.rb +11 -24
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +233 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +26 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +153 -31
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +207 -63
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +31 -24
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +195 -0
- data/lib/active_merchant/country.rb +335 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
- data/lib/active_merchant/network_connection_retries.rb +80 -0
- data/lib/active_merchant/post_data.rb +25 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -27
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3988 -0
- data/lib/support/gateway_support.rb +7 -9
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +6 -7
- data/lib/support/ssl_version.rb +87 -0
- metadata +148 -323
- checksums.yaml.gz.sig +0 -0
- data/gem-public_cert.pem +0 -21
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/app55.rb +0 -185
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -249
- 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/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/alipay/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/alipay/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/alipay.rb +0 -18
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -64
- data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +0 -74
- data/lib/active_merchant/billing/integrations/bit_pay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bit_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus/notification.rb +0 -133
- data/lib/active_merchant/billing/integrations/citrus/return.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus.rb +0 -51
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/doku/helper.rb +0 -102
- data/lib/active_merchant/billing/integrations/doku/notification.rb +0 -69
- data/lib/active_merchant/billing/integrations/doku/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/doku.rb +0 -24
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -118
- data/lib/active_merchant/billing/integrations/ipay88/notification.rb +0 -103
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -29
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -23
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -123
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
- data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -60
- data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
- data/lib/active_merchant/billing/integrations/paydollar.rb +0 -59
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -39
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -76
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -154
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +0 -19
- data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +0 -16
- data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +0 -30
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -96
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -107
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -171
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -58
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/common.rb +0 -104
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/helper.rb +0 -145
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/return.rb +0 -35
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +0 -39
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class FirstdataE4V27Gateway < Gateway
|
|
4
|
+
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v27'
|
|
5
|
+
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v27'
|
|
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 = [: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 = ['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
|
+
end
|
|
152
|
+
|
|
153
|
+
add_address(xml, options)
|
|
154
|
+
add_customer_data(xml, options)
|
|
155
|
+
add_invoice(xml, options)
|
|
156
|
+
add_tax_fields(xml, options)
|
|
157
|
+
add_level_3(xml, options)
|
|
158
|
+
|
|
159
|
+
xml.target!
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def build_capture_or_credit_request(money, identification, options)
|
|
163
|
+
xml = Builder::XmlMarkup.new
|
|
164
|
+
|
|
165
|
+
add_identification(xml, identification)
|
|
166
|
+
add_amount(xml, money, options)
|
|
167
|
+
add_customer_data(xml, options)
|
|
168
|
+
add_card_authentication_data(xml, options)
|
|
169
|
+
|
|
170
|
+
xml.target!
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def build_store_request(credit_card, options)
|
|
174
|
+
xml = Builder::XmlMarkup.new
|
|
175
|
+
|
|
176
|
+
add_credit_card(xml, credit_card, options)
|
|
177
|
+
add_address(xml, options)
|
|
178
|
+
add_customer_data(xml, options)
|
|
179
|
+
|
|
180
|
+
xml.target!
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def add_credentials(xml)
|
|
184
|
+
xml.tag! 'ExactID', @options[:login]
|
|
185
|
+
xml.tag! 'Password', @options[:password]
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def add_transaction_type(xml, action)
|
|
189
|
+
xml.tag! 'Transaction_Type', TRANSACTIONS[action]
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def add_identification(xml, identification)
|
|
193
|
+
authorization_num, transaction_tag, _ = identification.split(';')
|
|
194
|
+
|
|
195
|
+
xml.tag! 'Authorization_Num', authorization_num
|
|
196
|
+
xml.tag! 'Transaction_Tag', transaction_tag
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def add_amount(xml, money, options)
|
|
200
|
+
currency_code = options[:currency] || default_currency
|
|
201
|
+
xml.tag! 'DollarAmount', localized_amount(money, currency_code)
|
|
202
|
+
xml.tag! 'Currency', currency_code
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def add_credit_card(xml, credit_card, options)
|
|
206
|
+
if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
|
|
207
|
+
xml.tag! 'Track1', credit_card.track_data
|
|
208
|
+
xml.tag! 'Ecommerce_Flag', 'R'
|
|
209
|
+
else
|
|
210
|
+
xml.tag! 'Card_Number', credit_card.number
|
|
211
|
+
xml.tag! 'Expiry_Date', expdate(credit_card)
|
|
212
|
+
xml.tag! 'CardHoldersName', credit_card.name
|
|
213
|
+
xml.tag! 'CardType', card_type(credit_card.brand)
|
|
214
|
+
xml.tag! 'WalletProviderID', options[:wallet_provider_id] if options[:wallet_provider_id]
|
|
215
|
+
|
|
216
|
+
add_credit_card_eci(xml, credit_card, options)
|
|
217
|
+
add_credit_card_verification_strings(xml, credit_card, options)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def add_credit_card_eci(xml, credit_card, options)
|
|
222
|
+
eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
|
|
223
|
+
# Discover requires any Apple Pay transaction, regardless of in-app
|
|
224
|
+
# or web, and regardless of the ECI contained in the PKPaymentToken,
|
|
225
|
+
# to have an ECI value explicitly of 04.
|
|
226
|
+
'04'
|
|
227
|
+
else
|
|
228
|
+
(credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
xml.tag! 'Ecommerce_Flag', eci.to_s =~ /^[0-9]+$/ ? 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
|
+
xml.tag! 'TransarmorToken', params[0]
|
|
274
|
+
xml.tag! 'Expiry_Date', expdate(credit_card)
|
|
275
|
+
xml.tag! 'CardHoldersName', credit_card.name
|
|
276
|
+
xml.tag! 'CardType', card_type(credit_card.brand)
|
|
277
|
+
xml.tag! 'WalletProviderID', options[:wallet_provider_id] if options[:wallet_provider_id]
|
|
278
|
+
add_card_authentication_data(xml, options)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def add_customer_data(xml, options)
|
|
282
|
+
xml.tag! 'Customer_Ref', options[:customer] if options[:customer]
|
|
283
|
+
xml.tag! 'Client_IP', options[:ip] if options[:ip]
|
|
284
|
+
xml.tag! 'Client_Email', options[:email] if options[:email]
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def add_address(xml, options)
|
|
288
|
+
if (address = options[:billing_address] || options[:address])
|
|
289
|
+
xml.tag! 'Address' do
|
|
290
|
+
xml.tag! 'Address1', address[:address1]
|
|
291
|
+
xml.tag! 'Address2', address[:address2] if address[:address2]
|
|
292
|
+
xml.tag! 'City', address[:city]
|
|
293
|
+
xml.tag! 'State', address[:state]
|
|
294
|
+
xml.tag! 'Zip', address[:zip]
|
|
295
|
+
xml.tag! 'CountryCode', address[:country]
|
|
296
|
+
end
|
|
297
|
+
xml.tag! 'ZipCode', address[:zip]
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def add_invoice(xml, options)
|
|
302
|
+
xml.tag! 'Reference_No', options[:order_id]
|
|
303
|
+
xml.tag! 'Reference_3', options[:description] if options[:description]
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def add_tax_fields(xml, options)
|
|
307
|
+
xml.tag! 'Tax1Amount', options[:tax1_amount] if options[:tax1_amount]
|
|
308
|
+
xml.tag! 'Tax1Number', options[:tax1_number] if options[:tax1_number]
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def add_level_3(xml, options)
|
|
312
|
+
xml.tag!('Level3') { |x| x << options[:level_3] } if options[:level_3]
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def expdate(credit_card)
|
|
316
|
+
"#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def card_type(credit_card_brand)
|
|
320
|
+
BRANDS[credit_card_brand.to_sym] if credit_card_brand
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def commit(action, data, credit_card = nil)
|
|
324
|
+
url = (test? ? self.test_url : self.live_url)
|
|
325
|
+
request = build_request(action, data)
|
|
326
|
+
begin
|
|
327
|
+
response = parse(ssl_post(url, request, headers('POST', url, request)))
|
|
328
|
+
rescue ResponseError => e
|
|
329
|
+
response = parse_error(e.response)
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
Response.new(successful?(response), message_from(response), response,
|
|
333
|
+
:test => test?,
|
|
334
|
+
:authorization => successful?(response) ? response_authorization(action, response, credit_card) : '',
|
|
335
|
+
:avs_result => {:code => response[:avs]},
|
|
336
|
+
:cvv_result => response[:cvv2],
|
|
337
|
+
:error_code => standard_error_code(response)
|
|
338
|
+
)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def headers(method, url, request)
|
|
342
|
+
content_type = 'application/xml'
|
|
343
|
+
content_digest = Digest::SHA1.hexdigest(request)
|
|
344
|
+
sending_time = Time.now.utc.iso8601
|
|
345
|
+
payload = [method, content_type, content_digest, sending_time, url.split('.com')[1]].join("\n")
|
|
346
|
+
hmac = OpenSSL::HMAC.digest('sha1', @options[:hmac_key], payload)
|
|
347
|
+
encoded = Base64.strict_encode64(hmac)
|
|
348
|
+
|
|
349
|
+
{
|
|
350
|
+
'x-gge4-date' => sending_time,
|
|
351
|
+
'x-gge4-content-sha1' => content_digest,
|
|
352
|
+
'Authorization' => 'GGE4_API ' + @options[:key_id].to_s + ':' + encoded,
|
|
353
|
+
'Accepts' => content_type,
|
|
354
|
+
'Content-Type' => content_type
|
|
355
|
+
}
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def successful?(response)
|
|
359
|
+
response[:transaction_approved] == SUCCESS
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
def response_authorization(action, response, credit_card)
|
|
363
|
+
if action == :store
|
|
364
|
+
store_authorization_from(response, credit_card)
|
|
365
|
+
else
|
|
366
|
+
authorization_from(response)
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def authorization_from(response)
|
|
371
|
+
if response[:authorization_num] && response[:transaction_tag]
|
|
372
|
+
[
|
|
373
|
+
response[:authorization_num],
|
|
374
|
+
response[:transaction_tag],
|
|
375
|
+
(response[:dollar_amount].to_f * 100).round
|
|
376
|
+
].join(';')
|
|
377
|
+
else
|
|
378
|
+
''
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
def store_authorization_from(response, credit_card)
|
|
383
|
+
if response[:transarmor_token].present?
|
|
384
|
+
[
|
|
385
|
+
response[:transarmor_token],
|
|
386
|
+
credit_card.brand,
|
|
387
|
+
credit_card.first_name,
|
|
388
|
+
credit_card.last_name,
|
|
389
|
+
credit_card.month,
|
|
390
|
+
credit_card.year
|
|
391
|
+
].map { |value| value.to_s.tr(';', '') }.join(';')
|
|
392
|
+
else
|
|
393
|
+
raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
def money_from_authorization(auth)
|
|
398
|
+
_, _, amount = auth.split(/;/, 3)
|
|
399
|
+
amount.to_i
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
def message_from(response)
|
|
403
|
+
if response[:faultcode] && response[:faultstring]
|
|
404
|
+
response[:faultstring]
|
|
405
|
+
elsif response[:error_number] && response[:error_number] != '0'
|
|
406
|
+
response[:error_description]
|
|
407
|
+
else
|
|
408
|
+
result = (response[:exact_message] || '')
|
|
409
|
+
result << " - #{response[:bank_message]}" if response[:bank_message].present?
|
|
410
|
+
result
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
def parse_error(error)
|
|
415
|
+
{
|
|
416
|
+
:transaction_approved => 'false',
|
|
417
|
+
:error_number => error.code,
|
|
418
|
+
:error_description => error.body,
|
|
419
|
+
:ecommerce_error_code => error.body.gsub(/[^\d]/, '')
|
|
420
|
+
}
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
def standard_error_code(response)
|
|
424
|
+
STANDARD_ERROR_CODE_MAPPING[response[:bank_resp_code] || response[:ecommerce_error_code]]
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
def parse(xml)
|
|
428
|
+
response = {}
|
|
429
|
+
xml = REXML::Document.new(xml)
|
|
430
|
+
|
|
431
|
+
if (root = REXML::XPath.first(xml, '//TransactionResult'))
|
|
432
|
+
parse_elements(response, root)
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
SENSITIVE_FIELDS.each { |key| response.delete(key) }
|
|
436
|
+
response
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
def parse_elements(response, root)
|
|
440
|
+
root.elements.to_a.each do |node|
|
|
441
|
+
response[node.name.gsub(/EXact/, 'Exact').underscore.to_sym] = (node.text || '').strip
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
end
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class Flo2cashGateway < Gateway
|
|
4
|
+
self.display_name = 'Flo2Cash'
|
|
5
|
+
self.homepage_url = 'http://www.flo2cash.co.nz/'
|
|
6
|
+
|
|
7
|
+
self.test_url = 'https://demo.flo2cash.co.nz/ws/paymentws.asmx'
|
|
8
|
+
self.live_url = 'https://secure.flo2cash.co.nz/ws/paymentws.asmx'
|
|
9
|
+
|
|
10
|
+
self.supported_countries = ['NZ']
|
|
11
|
+
self.default_currency = 'NZD'
|
|
12
|
+
self.money_format = :dollars
|
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
|
|
14
|
+
|
|
15
|
+
BRAND_MAP = {
|
|
16
|
+
'visa' => 'VISA',
|
|
17
|
+
'master' => 'MC',
|
|
18
|
+
'american_express' => 'AMEX',
|
|
19
|
+
'diners_club' => 'DINERS'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def initialize(options={})
|
|
23
|
+
requires!(options, :username, :password, :account_id)
|
|
24
|
+
super
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def purchase(amount, payment_method, options={})
|
|
28
|
+
MultiResponse.run do |r|
|
|
29
|
+
r.process { authorize(amount, payment_method, options) }
|
|
30
|
+
r.process { capture(amount, r.authorization, options) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def authorize(amount, payment_method, options={})
|
|
35
|
+
post = {}
|
|
36
|
+
add_invoice(post, amount, options)
|
|
37
|
+
add_payment_method(post, payment_method)
|
|
38
|
+
add_customer_data(post, options)
|
|
39
|
+
|
|
40
|
+
commit('ProcessAuthorise', post)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def capture(amount, authorization, options={})
|
|
44
|
+
post = {}
|
|
45
|
+
add_invoice(post, amount, options)
|
|
46
|
+
add_reference(post, authorization)
|
|
47
|
+
add_customer_data(post, options)
|
|
48
|
+
|
|
49
|
+
commit('ProcessCapture', post)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def refund(amount, authorization, options={})
|
|
53
|
+
post = {}
|
|
54
|
+
add_invoice(post, amount, options)
|
|
55
|
+
add_reference(post, authorization)
|
|
56
|
+
add_customer_data(post, options)
|
|
57
|
+
|
|
58
|
+
commit('ProcessRefund', post)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def supports_scrubbing?
|
|
62
|
+
true
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def scrub(transcript)
|
|
66
|
+
transcript.
|
|
67
|
+
gsub(%r((<Password>)[^<]+(<))i, '\1[FILTERED]\2').
|
|
68
|
+
gsub(%r((<CardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
|
|
69
|
+
gsub(%r((<CardCSC>)[^<]+(<))i, '\1[FILTERED]\2')
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
|
|
75
|
+
CURRENCY_CODES['NZD'] = '554'
|
|
76
|
+
|
|
77
|
+
def add_invoice(post, money, options)
|
|
78
|
+
post[:Amount] = amount(money)
|
|
79
|
+
post[:Reference] = options[:order_id]
|
|
80
|
+
post[:Particular] = options[:description]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def add_payment_method(post, payment_method)
|
|
84
|
+
post[:CardNumber] = payment_method.number
|
|
85
|
+
post[:CardType] = BRAND_MAP[payment_method.brand.to_s]
|
|
86
|
+
post[:CardExpiry] = format(payment_method.month, :two_digits) + format(payment_method.year, :two_digits)
|
|
87
|
+
post[:CardHolderName] = payment_method.name
|
|
88
|
+
post[:CardCSC] = payment_method.verification_value
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def add_customer_data(post, options)
|
|
92
|
+
if(billing_address = (options[:billing_address] || options[:address]))
|
|
93
|
+
post[:Email] = billing_address[:email]
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def add_reference(post, authorization)
|
|
98
|
+
post[:OriginalTransactionId] = authorization
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def commit(action, post)
|
|
102
|
+
post[:Username] = @options[:username]
|
|
103
|
+
post[:Password] = @options[:password]
|
|
104
|
+
post[:AccountId] = @options[:account_id]
|
|
105
|
+
|
|
106
|
+
data = build_request(action, post)
|
|
107
|
+
begin
|
|
108
|
+
raw = parse(ssl_post(url, data, headers(action)), action)
|
|
109
|
+
rescue ActiveMerchant::ResponseError => e
|
|
110
|
+
if(e.response.code == '500' && e.response.body.start_with?('<?xml'))
|
|
111
|
+
raw = parse(e.response.body, action)
|
|
112
|
+
else
|
|
113
|
+
raise
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
succeeded = success_from(raw[:status])
|
|
118
|
+
Response.new(
|
|
119
|
+
succeeded,
|
|
120
|
+
message_from(succeeded, raw),
|
|
121
|
+
raw,
|
|
122
|
+
:authorization => authorization_from(action, raw[:transaction_id], post[:OriginalTransactionId]),
|
|
123
|
+
:error_code => error_code_from(succeeded, raw),
|
|
124
|
+
:test => test?
|
|
125
|
+
)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def headers(action)
|
|
129
|
+
{
|
|
130
|
+
'Content-Type' => 'application/soap+xml; charset=utf-8',
|
|
131
|
+
'SOAPAction' => %{"http://www.flo2cash.co.nz/webservices/paymentwebservice/#{action}"}
|
|
132
|
+
}
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def build_request(action, post)
|
|
136
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
|
137
|
+
post.each do |field, value|
|
|
138
|
+
xml.tag!(field, value)
|
|
139
|
+
end
|
|
140
|
+
body = xml.target!
|
|
141
|
+
envelope_wrap(action, body)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def envelope_wrap(action, body)
|
|
145
|
+
<<-EOS
|
|
146
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
147
|
+
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
|
148
|
+
<soap12:Body>
|
|
149
|
+
<#{action} xmlns="http://www.flo2cash.co.nz/webservices/paymentwebservice">
|
|
150
|
+
#{body}
|
|
151
|
+
</#{action}>
|
|
152
|
+
</soap12:Body>
|
|
153
|
+
</soap12:Envelope>
|
|
154
|
+
EOS
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def url
|
|
158
|
+
(test? ? test_url : live_url)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def parse(body, action)
|
|
162
|
+
response = {}
|
|
163
|
+
xml = REXML::Document.new(body)
|
|
164
|
+
root = (REXML::XPath.first(xml, "//#{action}Response") || REXML::XPath.first(xml, '//detail'))
|
|
165
|
+
|
|
166
|
+
root.elements.to_a.each do |node|
|
|
167
|
+
parse_element(response, node)
|
|
168
|
+
end if root
|
|
169
|
+
|
|
170
|
+
response
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def parse_element(response, node)
|
|
174
|
+
if node.has_elements?
|
|
175
|
+
node.elements.each { |element| parse_element(response, element) }
|
|
176
|
+
else
|
|
177
|
+
response[node.name.underscore.to_sym] = node.text
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def success_from(response)
|
|
182
|
+
response == 'SUCCESSFUL'
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def message_from(succeeded, response)
|
|
186
|
+
if succeeded
|
|
187
|
+
'Succeeded'
|
|
188
|
+
else
|
|
189
|
+
response[:message] || response[:errormessage] || 'Unable to read error message'
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def authorization_from(action, current, original)
|
|
194
|
+
# Refunds require the authorization from the authorize() of the MultiResponse.
|
|
195
|
+
if action == 'ProcessCapture'
|
|
196
|
+
original
|
|
197
|
+
else
|
|
198
|
+
current
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
|
203
|
+
'Transaction Declined - Expired Card' => STANDARD_ERROR_CODE[:expired_card],
|
|
204
|
+
'Bank Declined Transaction' => STANDARD_ERROR_CODE[:card_declined],
|
|
205
|
+
'Insufficient Funds' => STANDARD_ERROR_CODE[:card_declined],
|
|
206
|
+
'Transaction Declined - Bank Error' => STANDARD_ERROR_CODE[:processing_error],
|
|
207
|
+
'No Reply from Bank' => STANDARD_ERROR_CODE[:processing_error],
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
def error_code_from(succeeded, response)
|
|
211
|
+
succeeded ? nil : STANDARD_ERROR_CODE_MAPPING[response[:message]]
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
|
2
|
+
module Billing #:nodoc:
|
|
3
|
+
class Flo2cashSimpleGateway < Flo2cashGateway
|
|
4
|
+
self.display_name = 'Flo2Cash Simple'
|
|
5
|
+
|
|
6
|
+
def purchase(amount, payment_method, options={})
|
|
7
|
+
post = {}
|
|
8
|
+
add_invoice(post, amount, options)
|
|
9
|
+
add_payment_method(post, payment_method)
|
|
10
|
+
add_customer_data(post, options)
|
|
11
|
+
|
|
12
|
+
commit('ProcessPurchase', post)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Flo2Cash's "simple mode" does not support auth/capture
|
|
16
|
+
undef_method :authorize
|
|
17
|
+
undef_method :capture
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|