activemerchant 1.38.0 → 1.79.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1402 -3
- data/CONTRIBUTORS +154 -0
- data/README.md +157 -144
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/base.rb +21 -17
- data/lib/active_merchant/billing/check.rb +32 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +215 -67
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +152 -53
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +170 -24
- data/lib/active_merchant/billing/gateways/adyen.rb +299 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +904 -606
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +326 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
- data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
- data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
- data/lib/active_merchant/billing/gateways/borgun.rb +221 -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 +387 -139
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -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 +45 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
- 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 +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +225 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +237 -98
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
- data/lib/active_merchant/billing/gateways/dibs.rb +205 -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 +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +23 -12
- data/lib/active_merchant/billing/gateways/eway.rb +12 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
- data/lib/active_merchant/billing/gateways/exact.rb +10 -1
- data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +110 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
- 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 +256 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- 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/ideal/ideal_base.rb +2 -5
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
- data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
- 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 +227 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
- data/lib/active_merchant/billing/gateways/litle.rb +329 -439
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +26 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +33 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
- data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
- data/lib/active_merchant/billing/gateways/migs.rb +73 -14
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
- data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +81 -56
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
- data/lib/active_merchant/billing/gateways/opp.rb +372 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
- data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
- data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
- data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +276 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -20
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
- 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 +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +32 -24
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
- data/lib/active_merchant/billing/gateways/pin.rb +68 -13
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +14 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +12 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +40 -25
- data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +412 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
- data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +14 -3
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +74 -14
- data/lib/active_merchant/billing/gateways/stripe.rb +472 -83
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
- 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/transnational.rb +2 -231
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +156 -64
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +171 -45
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -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 +24 -17
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +208 -0
- data/lib/active_merchant/country.rb +334 -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 +9 -0
- data/lib/active_merchant/network_connection_retries.rb +81 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +94 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +22 -22
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_version.rb +87 -0
- metadata +164 -306
- data/gem-public_cert.pem +0 -20
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- 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 -73
- 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/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/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/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 -114
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
- 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 -129
- 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/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 -28
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
- 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 -74
- 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 -91
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
- 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/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 -0
@@ -0,0 +1,156 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SwipeCheckoutGateway < Gateway
|
6
|
+
TRANSACTION_APPROVED_MSG = 'Transaction approved'
|
7
|
+
TRANSACTION_DECLINED_MSG = 'Transaction declined'
|
8
|
+
|
9
|
+
LIVE_URLS = {
|
10
|
+
'NZ' => 'https://api.swipehq.com',
|
11
|
+
'CA' => 'https://api.swipehq.ca'
|
12
|
+
}
|
13
|
+
self.test_url = 'https://api.swipehq.com'
|
14
|
+
|
15
|
+
TRANSACTION_API = '/createShopifyTransaction.php'
|
16
|
+
|
17
|
+
self.supported_countries = %w[ NZ CA ]
|
18
|
+
self.default_currency = 'NZD'
|
19
|
+
self.supported_cardtypes = [:visa, :master]
|
20
|
+
self.homepage_url = 'https://www.swipehq.com/checkout'
|
21
|
+
self.display_name = 'Swipe Checkout'
|
22
|
+
self.money_format = :dollars
|
23
|
+
|
24
|
+
# Swipe Checkout requires the merchant's email and API key for authorization.
|
25
|
+
# This can be found under Settings > API Credentials after logging in to your
|
26
|
+
# Swipe Checkout merchant console at https://merchant.swipehq.[com|ca]
|
27
|
+
#
|
28
|
+
# :region determines which Swipe URL is used, this can be one of "NZ" or "CA".
|
29
|
+
# Currently Swipe Checkout has New Zealand and Canadian domains (swipehq.com
|
30
|
+
# and swipehq.ca respectively). Merchants must use the region that they
|
31
|
+
# signed up in for authentication with their merchant ID and API key to succeed.
|
32
|
+
def initialize(options = {})
|
33
|
+
requires!(options, :login, :api_key, :region)
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
# Transfers funds immediately.
|
38
|
+
# Note that Swipe Checkout only supports purchase at this stage
|
39
|
+
def purchase(money, creditcard, options = {})
|
40
|
+
post = {}
|
41
|
+
add_invoice(post, options)
|
42
|
+
add_creditcard(post, creditcard)
|
43
|
+
add_customer_data(post, creditcard, options)
|
44
|
+
add_amount(post, money, options)
|
45
|
+
|
46
|
+
commit('sale', money, post)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def add_customer_data(post, creditcard, options)
|
52
|
+
post[:email] = options[:email]
|
53
|
+
post[:ip_address] = options[:ip]
|
54
|
+
|
55
|
+
address = options[:billing_address] || options[:address]
|
56
|
+
return if address.nil?
|
57
|
+
|
58
|
+
post[:company] = address[:company]
|
59
|
+
|
60
|
+
post[:first_name], post[:last_name] = split_names(address[:name])
|
61
|
+
post[:address] = "#{address[:address1]}, #{address[:address2]}"
|
62
|
+
post[:city] = address[:city]
|
63
|
+
post[:country] = address[:country]
|
64
|
+
post[:mobile] = address[:phone] # API only has a "mobile" field, no "phone"
|
65
|
+
end
|
66
|
+
|
67
|
+
def add_invoice(post, options)
|
68
|
+
# store shopping-cart order ID in Swipe for merchant's records
|
69
|
+
post[:td_user_data] = options[:order_id] if options[:order_id]
|
70
|
+
post[:td_item] = options[:description] if options[:description]
|
71
|
+
post[:td_description] = options[:description] if options[:description]
|
72
|
+
post[:item_quantity] = "1"
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_creditcard(post, creditcard)
|
76
|
+
post[:card_number] = creditcard.number
|
77
|
+
post[:card_type] = creditcard.brand
|
78
|
+
post[:name_on_card] = "#{creditcard.first_name} #{creditcard.last_name}"
|
79
|
+
post[:card_expiry] = expdate(creditcard)
|
80
|
+
post[:secure_number] = creditcard.verification_value
|
81
|
+
end
|
82
|
+
|
83
|
+
def expdate(creditcard)
|
84
|
+
year = format(creditcard.year, :two_digits)
|
85
|
+
month = format(creditcard.month, :two_digits)
|
86
|
+
|
87
|
+
"#{month}#{year}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def add_amount(post, money, options)
|
91
|
+
post[:amount] = money.to_s
|
92
|
+
|
93
|
+
post[:currency] = (options[:currency] || currency(money))
|
94
|
+
end
|
95
|
+
|
96
|
+
def commit(action, money, parameters)
|
97
|
+
case action
|
98
|
+
when "sale"
|
99
|
+
begin
|
100
|
+
response = call_api(TRANSACTION_API, parameters)
|
101
|
+
|
102
|
+
# response code and message params should always be present
|
103
|
+
code = response["response_code"]
|
104
|
+
message = response["message"]
|
105
|
+
|
106
|
+
if code == 200
|
107
|
+
result = response["data"]["result"]
|
108
|
+
success = (result == 'accepted' || (test? && result == 'test-accepted'))
|
109
|
+
|
110
|
+
Response.new(success,
|
111
|
+
success ?
|
112
|
+
TRANSACTION_APPROVED_MSG :
|
113
|
+
TRANSACTION_DECLINED_MSG,
|
114
|
+
response,
|
115
|
+
:test => test?
|
116
|
+
)
|
117
|
+
else
|
118
|
+
build_error_response(message, response)
|
119
|
+
end
|
120
|
+
rescue ResponseError => e
|
121
|
+
build_error_response("ssl_post() with url #{url} raised ResponseError: #{e}")
|
122
|
+
rescue JSON::ParserError => e
|
123
|
+
msg = 'Invalid response received from the Swipe Checkout API. ' +
|
124
|
+
'Please contact support@optimizerhq.com if you continue to receive this message.' +
|
125
|
+
" (Full error message: #{e})"
|
126
|
+
build_error_response(msg)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def call_api(api, params=nil)
|
132
|
+
params ||= {}
|
133
|
+
params[:merchant_id] = @options[:login]
|
134
|
+
params[:api_key] = @options[:api_key]
|
135
|
+
|
136
|
+
# ssl_post() returns the response body as a string on success,
|
137
|
+
# or raises a ResponseError exception on failure
|
138
|
+
JSON.parse(ssl_post(url(@options[:region], api), params.to_query))
|
139
|
+
end
|
140
|
+
|
141
|
+
def url(region, api)
|
142
|
+
((test? ? self.test_url : LIVE_URLS[region]) + api)
|
143
|
+
end
|
144
|
+
|
145
|
+
def build_error_response(message, params={})
|
146
|
+
Response.new(
|
147
|
+
false,
|
148
|
+
message,
|
149
|
+
params,
|
150
|
+
:test => test?
|
151
|
+
)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
@@ -0,0 +1,275 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class TelrGateway < Gateway
|
6
|
+
self.display_name = "Telr"
|
7
|
+
self.homepage_url = "http://www.telr.com/"
|
8
|
+
|
9
|
+
self.live_url = "https://secure.telr.com/gateway/remote.xml"
|
10
|
+
|
11
|
+
self.supported_countries = ["AE", "IN", "SA"]
|
12
|
+
self.default_currency = "AED"
|
13
|
+
self.money_format = :dollars
|
14
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :maestro, :solo, :jcb]
|
15
|
+
|
16
|
+
CVC_CODE_TRANSLATOR = {
|
17
|
+
'Y' => 'M',
|
18
|
+
'N' => 'N',
|
19
|
+
'X' => 'P',
|
20
|
+
'E' => 'U',
|
21
|
+
}
|
22
|
+
|
23
|
+
AVS_CODE_TRANSLATOR = {
|
24
|
+
'Y' => 'M',
|
25
|
+
'P' => 'A',
|
26
|
+
'N' => 'N',
|
27
|
+
'X' => 'I',
|
28
|
+
'E' => 'R'
|
29
|
+
}
|
30
|
+
|
31
|
+
def initialize(options={})
|
32
|
+
requires!(options, :merchant_id, :api_key)
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
def purchase(amount, payment_method, options={})
|
37
|
+
commit(:purchase, amount, options[:currency]) do |doc|
|
38
|
+
add_invoice(doc, "sale", amount, payment_method, options)
|
39
|
+
add_payment_method(doc, payment_method, options)
|
40
|
+
add_customer_data(doc, payment_method, options)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def authorize(amount, payment_method, options={})
|
45
|
+
commit(:authorize, amount, options[:currency]) do |doc|
|
46
|
+
add_invoice(doc, "auth", amount, payment_method, options)
|
47
|
+
add_payment_method(doc, payment_method, options)
|
48
|
+
add_customer_data(doc, payment_method, options)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def capture(amount, authorization, options={})
|
53
|
+
commit(:capture) do |doc|
|
54
|
+
add_invoice(doc, "capture", amount, authorization, options)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def void(authorization, options={})
|
59
|
+
_, amount, currency = split_authorization(authorization)
|
60
|
+
commit(:void) do |doc|
|
61
|
+
add_invoice(doc, "void", amount.to_i, authorization, options.merge(currency: currency))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def refund(amount, authorization, options={})
|
66
|
+
commit(:refund) do |doc|
|
67
|
+
add_invoice(doc, "refund", amount, authorization, options)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def verify(credit_card, options={})
|
72
|
+
commit(:verify) do |doc|
|
73
|
+
add_invoice(doc, "verify", 100, credit_card, options)
|
74
|
+
add_payment_method(doc, credit_card, options)
|
75
|
+
add_customer_data(doc, credit_card, options)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def verify_credentials
|
80
|
+
response = void("0")
|
81
|
+
!["01", "04"].include?(response.error_code)
|
82
|
+
end
|
83
|
+
|
84
|
+
def supports_scrubbing?
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
def scrub(transcript)
|
89
|
+
transcript.
|
90
|
+
gsub(%r((<Number>)[^<]+(<))i, '\1[FILTERED]\2').
|
91
|
+
gsub(%r((<CVV>)[^<]+(<))i, '\1[FILTERED]\2').
|
92
|
+
gsub(%r((<Key>)[^<]+(<))i, '\1[FILTERED]\2')
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def add_invoice(doc, action, money, payment_method, options)
|
98
|
+
doc.tran do
|
99
|
+
doc.type(action)
|
100
|
+
doc.amount(amount(money))
|
101
|
+
doc.currency(options[:currency] || currency(money))
|
102
|
+
doc.cartid(options[:order_id])
|
103
|
+
doc.class_(transaction_class(action, payment_method))
|
104
|
+
doc.description(options[:description] || "Description")
|
105
|
+
doc.test_(test_mode)
|
106
|
+
add_ref(doc, action, payment_method)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def add_payment_method(doc, payment_method, options)
|
111
|
+
return if payment_method.is_a?(String)
|
112
|
+
doc.card do
|
113
|
+
doc.number(payment_method.number)
|
114
|
+
doc.cvv(payment_method.verification_value)
|
115
|
+
doc.expiry do
|
116
|
+
doc.month(format(payment_method.month, :two_digits))
|
117
|
+
doc.year(format(payment_method.year, :four_digits))
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def add_customer_data(doc, payment_method, options)
|
123
|
+
return if payment_method.is_a?(String)
|
124
|
+
doc.billing do
|
125
|
+
doc.name do
|
126
|
+
doc.first(payment_method.first_name)
|
127
|
+
doc.last(payment_method.last_name)
|
128
|
+
end
|
129
|
+
doc.email(options[:email] || "unspecified@email.com")
|
130
|
+
doc.ip(options[:ip]) if options[:ip]
|
131
|
+
doc.address do
|
132
|
+
add_address(doc, options)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def add_address(doc, options)
|
138
|
+
address = options[:billing_address] || {}
|
139
|
+
doc.country(address[:country] ? lookup_country_code(address[:country]) : "NA")
|
140
|
+
doc.city(address[:city] || "City")
|
141
|
+
doc.line1(address[:address1] || "Address")
|
142
|
+
return unless address
|
143
|
+
doc.line2(address[:address2]) if address[:address2]
|
144
|
+
doc.zip(address[:zip]) if address[:zip]
|
145
|
+
doc.region(address[:state]) if address[:state]
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_ref(doc, action, payment_method)
|
149
|
+
if ["capture", "refund", "void"].include?(action) || payment_method.is_a?(String)
|
150
|
+
doc.ref(split_authorization(payment_method)[0])
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_authentication(doc)
|
155
|
+
doc.store(@options[:merchant_id])
|
156
|
+
doc.key(@options[:api_key])
|
157
|
+
end
|
158
|
+
|
159
|
+
def lookup_country_code(code)
|
160
|
+
country = Country.find(code) rescue nil
|
161
|
+
country.code(:alpha2)
|
162
|
+
end
|
163
|
+
|
164
|
+
def commit(action, amount=nil, currency=nil)
|
165
|
+
currency = default_currency if currency == nil
|
166
|
+
request = build_xml_request { |doc| yield(doc) }
|
167
|
+
response = ssl_post(live_url, request, headers)
|
168
|
+
parsed = parse(response)
|
169
|
+
|
170
|
+
succeeded = success_from(parsed)
|
171
|
+
Response.new(
|
172
|
+
succeeded,
|
173
|
+
message_from(succeeded, parsed),
|
174
|
+
parsed,
|
175
|
+
authorization: authorization_from(action, parsed, amount, currency),
|
176
|
+
avs_result: avs_result(parsed),
|
177
|
+
cvv_result: cvv_result(parsed),
|
178
|
+
error_code: error_code_from(succeeded, parsed),
|
179
|
+
test: test?
|
180
|
+
)
|
181
|
+
end
|
182
|
+
|
183
|
+
def root_attributes
|
184
|
+
{
|
185
|
+
store: @options[:merchant_id],
|
186
|
+
key: @options[:api_key]
|
187
|
+
}
|
188
|
+
end
|
189
|
+
|
190
|
+
def build_xml_request
|
191
|
+
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
192
|
+
xml.remote do |doc|
|
193
|
+
|
194
|
+
add_authentication(doc)
|
195
|
+
yield(doc)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
builder.doc.to_xml
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_mode
|
203
|
+
test? ? '1' : '0'
|
204
|
+
end
|
205
|
+
|
206
|
+
def transaction_class(action, payment_method)
|
207
|
+
if payment_method.is_a?(String) && action == "sale"
|
208
|
+
return "cont"
|
209
|
+
else
|
210
|
+
return "moto"
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def parse(xml)
|
215
|
+
response = {}
|
216
|
+
|
217
|
+
doc = Nokogiri::XML(xml)
|
218
|
+
doc.root.xpath("*").each do |node|
|
219
|
+
if (node.elements.size == 0)
|
220
|
+
response[node.name.downcase.to_sym] = node.text
|
221
|
+
else
|
222
|
+
node.elements.each do |childnode|
|
223
|
+
name = "#{childnode.name.downcase}"
|
224
|
+
response[name.to_sym] = childnode.text
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end unless doc.root.nil?
|
228
|
+
|
229
|
+
response
|
230
|
+
end
|
231
|
+
|
232
|
+
def authorization_from(action, response, amount, currency)
|
233
|
+
auth = response[:tranref]
|
234
|
+
auth = [auth, amount, currency].join('|')
|
235
|
+
auth
|
236
|
+
end
|
237
|
+
|
238
|
+
def split_authorization(authorization)
|
239
|
+
authorization.split('|')
|
240
|
+
end
|
241
|
+
|
242
|
+
def success_from(response)
|
243
|
+
response[:status] == "A"
|
244
|
+
end
|
245
|
+
|
246
|
+
def message_from(succeeded, response)
|
247
|
+
if succeeded
|
248
|
+
"Succeeded"
|
249
|
+
else
|
250
|
+
response[:message]
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def error_code_from(succeeded, response)
|
255
|
+
unless succeeded
|
256
|
+
response[:code]
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
def cvv_result(parsed)
|
261
|
+
CVVResult.new(CVC_CODE_TRANSLATOR[parsed[:cvv]])
|
262
|
+
end
|
263
|
+
|
264
|
+
def avs_result(parsed)
|
265
|
+
AVSResult.new(code: AVS_CODE_TRANSLATOR[parsed[:avs]])
|
266
|
+
end
|
267
|
+
|
268
|
+
def headers
|
269
|
+
{
|
270
|
+
"Content-Type" => "text/xml"
|
271
|
+
}
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
class TnsGateway < Gateway
|
4
|
+
include MastercardGateway
|
5
|
+
|
6
|
+
class_attribute :live_na_url, :live_ap_url, :test_na_url, :test_ap_url
|
7
|
+
|
8
|
+
self.live_na_url = 'https://secure.na.tnspayments.com/api/rest/version/36/'
|
9
|
+
self.test_na_url = 'https://secure.na.tnspayments.com/api/rest/version/36/'
|
10
|
+
|
11
|
+
self.live_ap_url = 'https://secure.ap.tnspayments.com/api/rest/version/36/'
|
12
|
+
self.test_ap_url = 'https://secure.ap.tnspayments.com/api/rest/version/36/'
|
13
|
+
|
14
|
+
self.display_name = 'TNS'
|
15
|
+
self.homepage_url = 'http://www.tnsi.com/'
|
16
|
+
self.supported_countries = %w(AR AU BR FR DE HK MX NZ SG GB US)
|
17
|
+
self.default_currency = 'USD'
|
18
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro, :laser]
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,65 +1,146 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
|
+
|
2
3
|
module Billing #:nodoc:
|
3
4
|
class TransFirstGateway < Gateway
|
4
|
-
self.
|
5
|
+
self.test_url = 'https://ws.cert.transfirst.com'
|
6
|
+
self.live_url = 'https://webservices.primerchants.com'
|
5
7
|
|
6
8
|
self.supported_countries = ['US']
|
7
9
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
8
10
|
self.homepage_url = 'http://www.transfirst.com/'
|
9
11
|
self.display_name = 'TransFirst'
|
10
12
|
|
11
|
-
|
13
|
+
UNUSED_CREDIT_CARD_FIELDS = %w(UserId TrackData MerchZIP MerchCustPNum MCC InstallmentNum InstallmentOf POSInd POSEntryMode POSConditionCode EComInd AuthCharInd CardCertData CAVVData)
|
12
14
|
|
13
15
|
DECLINED = 'The transaction was declined'
|
14
16
|
|
17
|
+
ACTIONS = {
|
18
|
+
purchase: "CCSale",
|
19
|
+
purchase_echeck: "ACHDebit",
|
20
|
+
refund: "CreditCardCredit",
|
21
|
+
refund_echeck: "ACHVoidTransaction",
|
22
|
+
void: "CreditCardAutoRefundorVoid",
|
23
|
+
}
|
24
|
+
|
25
|
+
ENDPOINTS = {
|
26
|
+
purchase: "creditcard.asmx",
|
27
|
+
purchase_echeck: "checkverifyws/checkverifyws.asmx",
|
28
|
+
refund: "creditcard.asmx",
|
29
|
+
refund_echeck: "checkverifyws/checkverifyws.asmx",
|
30
|
+
void: "creditcard.asmx"
|
31
|
+
}
|
32
|
+
|
15
33
|
def initialize(options = {})
|
16
34
|
requires!(options, :login, :password)
|
17
35
|
super
|
18
36
|
end
|
19
37
|
|
20
|
-
def purchase(money,
|
38
|
+
def purchase(money, payment, options = {})
|
21
39
|
post = {}
|
22
40
|
|
23
41
|
add_amount(post, money)
|
24
|
-
|
25
|
-
add_credit_card(post, credit_card)
|
42
|
+
add_payment(post, payment)
|
26
43
|
add_address(post, options)
|
44
|
+
add_invoice(post, options) if payment.credit_card?
|
45
|
+
add_pair(post, :RefID, options[:order_id], required: true)
|
27
46
|
|
28
|
-
commit(post)
|
47
|
+
commit((payment.is_a?(Check) ? :purchase_echeck : :purchase), post)
|
48
|
+
end
|
49
|
+
|
50
|
+
def refund(money, authorization, options={})
|
51
|
+
post = {}
|
52
|
+
|
53
|
+
transaction_id, payment_type = split_authorization(authorization)
|
54
|
+
add_amount(post, money)
|
55
|
+
add_pair(post, :TransID, transaction_id)
|
56
|
+
add_pair(post, :RefID, options[:order_id], required: true)
|
57
|
+
|
58
|
+
commit((payment_type == "check" ? :refund_echeck : :refund), post)
|
59
|
+
end
|
60
|
+
|
61
|
+
def void(authorization, options={})
|
62
|
+
post = {}
|
63
|
+
|
64
|
+
transaction_id, _ = split_authorization(authorization)
|
65
|
+
add_pair(post, :TransID, transaction_id)
|
66
|
+
|
67
|
+
commit(:void, post)
|
68
|
+
end
|
69
|
+
|
70
|
+
def supports_scrubbing?
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
74
|
+
def scrub(transcript)
|
75
|
+
transcript.
|
76
|
+
gsub(%r((&?RegKey=)\w*(&?)), '\1[FILTERED]\2').
|
77
|
+
gsub(%r((&?CardNumber=)\d*(&?)), '\1[FILTERED]\2').
|
78
|
+
gsub(%r((&?CVV2=)\d*(&?)), '\1[FILTERED]\2').
|
79
|
+
gsub(%r((&?TransRoute=)\d*(&?)), '\1[FILTERED]\2').
|
80
|
+
gsub(%r((&?BankAccountNo=)\d*(&?)), '\1[FILTERED]\2')
|
29
81
|
end
|
30
82
|
|
31
83
|
private
|
84
|
+
|
32
85
|
def add_amount(post, money)
|
33
|
-
add_pair(post, :Amount, amount(money), :
|
86
|
+
add_pair(post, :Amount, amount(money), required: true)
|
34
87
|
end
|
35
88
|
|
36
89
|
def add_address(post, options)
|
37
90
|
address = options[:billing_address] || options[:address]
|
38
91
|
|
39
92
|
if address
|
40
|
-
add_pair(post, :Address, address[:address1])
|
41
|
-
add_pair(post, :ZipCode, address[:zip])
|
93
|
+
add_pair(post, :Address, address[:address1], required: true)
|
94
|
+
add_pair(post, :ZipCode, address[:zip], required: true)
|
95
|
+
else
|
96
|
+
add_pair(post, :Address, "", required: true)
|
97
|
+
add_pair(post, :ZipCode, "", required: true)
|
42
98
|
end
|
43
99
|
end
|
44
100
|
|
45
101
|
def add_invoice(post, options)
|
46
|
-
add_pair(post, :
|
47
|
-
add_pair(post, :PONumber, options[:invoice], :
|
102
|
+
add_pair(post, :SECCCode, options[:invoice], required: true)
|
103
|
+
add_pair(post, :PONumber, options[:invoice], required: true)
|
48
104
|
add_pair(post, :SaleTaxAmount, amount(options[:tax] || 0))
|
49
|
-
add_pair(post, :PaymentDesc, options[:description], :required => true)
|
50
105
|
add_pair(post, :TaxIndicator, 0)
|
106
|
+
add_pair(post, :PaymentDesc, options[:description] || "", required: true)
|
107
|
+
add_pair(post, :CompanyName, options[:company_name] || "", required: true)
|
51
108
|
end
|
52
109
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
110
|
+
def add_payment(post, payment)
|
111
|
+
if payment.is_a?(Check)
|
112
|
+
add_echeck(post, payment)
|
113
|
+
else
|
114
|
+
add_credit_card(post, payment)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def add_credit_card(post, payment)
|
119
|
+
add_pair(post, :CardHolderName, payment.name, required: true)
|
120
|
+
add_pair(post, :CardNumber, payment.number, required: true)
|
121
|
+
add_pair(post, :Expiration, expdate(payment), required: true)
|
122
|
+
add_pair(post, :CVV2, payment.verification_value, required: true)
|
123
|
+
end
|
124
|
+
|
125
|
+
def add_echeck(post, payment)
|
126
|
+
add_pair(post, :TransRoute, payment.routing_number, required: true)
|
127
|
+
add_pair(post, :BankAccountNo, payment.account_number, required: true)
|
128
|
+
add_pair(post, :BankAccountType, add_or_use_default(payment.account_type, "Checking"), required: true)
|
129
|
+
add_pair(post, :CheckType, add_or_use_default(payment.account_holder_type, "Personal"), required: true)
|
130
|
+
add_pair(post, :Name, payment.name, required: true)
|
131
|
+
add_pair(post, :ProcessDate, Time.now.strftime("%m%d%y"), required: true)
|
132
|
+
add_pair(post, :Description, "", required: true)
|
133
|
+
end
|
56
134
|
|
57
|
-
|
58
|
-
|
135
|
+
def add_or_use_default(payment_data, default_value)
|
136
|
+
return payment_data.capitalize if payment_data
|
137
|
+
return default_value
|
59
138
|
end
|
60
139
|
|
61
|
-
def add_unused_fields(post)
|
62
|
-
|
140
|
+
def add_unused_fields(action, post)
|
141
|
+
return unless action == :purchase
|
142
|
+
|
143
|
+
UNUSED_CREDIT_CARD_FIELDS.each do |f|
|
63
144
|
post[f] = ""
|
64
145
|
end
|
65
146
|
end
|
@@ -75,7 +156,7 @@ module ActiveMerchant #:nodoc:
|
|
75
156
|
response = {}
|
76
157
|
|
77
158
|
xml = REXML::Document.new(data)
|
78
|
-
root = REXML::XPath.first(xml, "
|
159
|
+
root = REXML::XPath.first(xml, "*")
|
79
160
|
|
80
161
|
if root.nil?
|
81
162
|
response[:message] = data.to_s.strip
|
@@ -88,17 +169,42 @@ module ActiveMerchant #:nodoc:
|
|
88
169
|
response
|
89
170
|
end
|
90
171
|
|
91
|
-
def commit(params)
|
92
|
-
response = parse(
|
93
|
-
|
94
|
-
|
172
|
+
def commit(action, params)
|
173
|
+
response = parse(ssl_post(url(action), post_data(action, params)))
|
174
|
+
Response.new(
|
175
|
+
success_from(response),
|
176
|
+
message_from(response),
|
177
|
+
response,
|
95
178
|
:test => test?,
|
96
|
-
:authorization => response
|
179
|
+
:authorization => authorization_from(response),
|
97
180
|
:avs_result => { :code => response[:avs_code] },
|
98
181
|
:cvv_result => response[:cvv2_code]
|
99
182
|
)
|
100
183
|
end
|
101
184
|
|
185
|
+
def authorization_from(response)
|
186
|
+
if response[:status] == "APPROVED"
|
187
|
+
"#{response[:trans_id]}|check"
|
188
|
+
else
|
189
|
+
"#{response[:trans_id]}|creditcard"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def success_from(response)
|
194
|
+
case response[:status]
|
195
|
+
when "Authorized"
|
196
|
+
true
|
197
|
+
when "Voided"
|
198
|
+
true
|
199
|
+
when "APPROVED"
|
200
|
+
true
|
201
|
+
when "VOIDED"
|
202
|
+
true
|
203
|
+
else
|
204
|
+
false
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
102
208
|
def message_from(response)
|
103
209
|
case response[:message]
|
104
210
|
when 'Call Voice Center'
|
@@ -108,8 +214,8 @@ module ActiveMerchant #:nodoc:
|
|
108
214
|
end
|
109
215
|
end
|
110
216
|
|
111
|
-
def post_data(params = {})
|
112
|
-
add_unused_fields(params)
|
217
|
+
def post_data(action, params = {})
|
218
|
+
add_unused_fields(action, params)
|
113
219
|
params[:MerchantID] = @options[:login]
|
114
220
|
params[:RegKey] = @options[:password]
|
115
221
|
|
@@ -120,7 +226,15 @@ module ActiveMerchant #:nodoc:
|
|
120
226
|
def add_pair(post, key, value, options = {})
|
121
227
|
post[key] = value if !value.blank? || options[:required]
|
122
228
|
end
|
229
|
+
|
230
|
+
def url(action)
|
231
|
+
base_url = test? ? test_url : live_url
|
232
|
+
"#{base_url}/#{ENDPOINTS[action]}/#{ACTIONS[action]}"
|
233
|
+
end
|
234
|
+
|
235
|
+
def split_authorization(authorization)
|
236
|
+
authorization.split("|")
|
237
|
+
end
|
123
238
|
end
|
124
239
|
end
|
125
240
|
end
|
126
|
-
|