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
@@ -2,9 +2,9 @@ module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
3
3
|
# Convenience methods that can be included into a custom Credit Card object, such as an ActiveRecord based Credit Card object.
|
4
4
|
module CreditCardMethods
|
5
|
-
CARD_COMPANIES = {
|
6
|
-
'visa' => /^4\d{12}(\d{3})?$/,
|
7
|
-
'master' => /^(5[1-5]\d{4}|677189)\d{10}$/,
|
5
|
+
CARD_COMPANIES = {
|
6
|
+
'visa' => /^4\d{12}(\d{3})?(\d{3})?$/,
|
7
|
+
'master' => /^(5[1-5]\d{4}|677189|222[1-9]\d{2}|22[3-9]\d{3}|2[3-6]\d{4}|27[01]\d{3}|2720\d{2})\d{10}$/,
|
8
8
|
'discover' => /^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/,
|
9
9
|
'american_express' => /^3[47]\d{13}$/,
|
10
10
|
'diners_club' => /^3(0[0-5]|[68]\d)\d{11}$/,
|
@@ -14,128 +14,227 @@ module ActiveMerchant #:nodoc:
|
|
14
14
|
'dankort' => /^5019\d{12}$/,
|
15
15
|
'maestro' => /^(5[06-8]|6\d)\d{10,17}$/,
|
16
16
|
'forbrugsforeningen' => /^600722\d{10}$/,
|
17
|
-
'laser' => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})
|
17
|
+
'laser' => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/,
|
18
|
+
'sodexo' => /^(606071|603389|606070|606069|606068|600818)\d{8}$/,
|
19
|
+
'vr' => /^(627416|637036)\d{8}$/
|
18
20
|
}
|
19
|
-
|
21
|
+
|
22
|
+
# http://www.barclaycard.co.uk/business/files/bin_rules.pdf
|
23
|
+
ELECTRON_RANGES = [
|
24
|
+
[400115],
|
25
|
+
(400837..400839),
|
26
|
+
(412921..412923),
|
27
|
+
[417935],
|
28
|
+
(419740..419741),
|
29
|
+
(419773..419775),
|
30
|
+
[424519],
|
31
|
+
(424962..424963),
|
32
|
+
[437860],
|
33
|
+
[444000],
|
34
|
+
[459472],
|
35
|
+
(484406..484411),
|
36
|
+
(484413..484414),
|
37
|
+
(484418..484418),
|
38
|
+
(484428..484455),
|
39
|
+
(491730..491759),
|
40
|
+
]
|
41
|
+
|
20
42
|
def self.included(base)
|
21
43
|
base.extend(ClassMethods)
|
22
44
|
end
|
23
|
-
|
45
|
+
|
24
46
|
def valid_month?(month)
|
25
47
|
(1..12).include?(month.to_i)
|
26
48
|
end
|
27
|
-
|
49
|
+
|
50
|
+
def credit_card?
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
28
54
|
def valid_expiry_year?(year)
|
29
55
|
(Time.now.year..Time.now.year + 20).include?(year.to_i)
|
30
56
|
end
|
31
|
-
|
57
|
+
|
32
58
|
def valid_start_year?(year)
|
33
|
-
year.to_s =~ /^\d{4}$/ && year.to_i > 1987
|
59
|
+
((year.to_s =~ /^\d{4}$/) && (year.to_i > 1987))
|
60
|
+
end
|
61
|
+
|
62
|
+
# Credit card providers have 3 digit verification values
|
63
|
+
# This isn't standardised, these are called various names such as
|
64
|
+
# CVC, CVV, CID, CSC and more
|
65
|
+
# See: http://en.wikipedia.org/wiki/Card_security_code
|
66
|
+
# American Express is the exception with 4 digits
|
67
|
+
#
|
68
|
+
# Below are links from the card providers with their requirements
|
69
|
+
# visa: http://usa.visa.com/personal/security/3-digit-security-code.jsp
|
70
|
+
# master: http://www.mastercard.com/ca/merchant/en/getstarted/Anatomy_MasterCard.html
|
71
|
+
# jcb: http://www.jcbcard.com/security/info.html
|
72
|
+
# diners_club: http://www.dinersclub.com/assets/DinersClub_card_ID_features.pdf
|
73
|
+
# discover: https://www.discover.com/credit-cards/help-center/glossary.html
|
74
|
+
# american_express: https://online.americanexpress.com/myca/fuidfyp/us/action?request_type=un_fuid&Face=en_US
|
75
|
+
def valid_card_verification_value?(cvv, brand)
|
76
|
+
cvv.to_s =~ /^\d{#{card_verification_value_length(brand)}}$/
|
77
|
+
end
|
78
|
+
|
79
|
+
def card_verification_value_length(brand)
|
80
|
+
brand == 'american_express' ? 4 : 3
|
34
81
|
end
|
35
|
-
|
82
|
+
|
36
83
|
def valid_issue_number?(number)
|
37
|
-
number.to_s =~ /^\d{1,2}$/
|
84
|
+
(number.to_s =~ /^\d{1,2}$/)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Returns if the card matches known Electron BINs
|
88
|
+
def electron?
|
89
|
+
self.class.electron?(number)
|
38
90
|
end
|
39
|
-
|
91
|
+
|
40
92
|
module ClassMethods
|
41
|
-
# Returns true if it validates. Optionally, you can pass a card brand as an argument and
|
93
|
+
# Returns true if it validates. Optionally, you can pass a card brand as an argument and
|
42
94
|
# make sure it is of the correct brand.
|
43
95
|
#
|
44
96
|
# References:
|
45
97
|
# - http://perl.about.com/compute/perl/library/nosearch/P073000.htm
|
46
98
|
# - http://www.beachnet.com/~hstiles/cardtype.html
|
47
99
|
def valid_number?(number)
|
48
|
-
valid_test_mode_card_number?(number) ||
|
49
|
-
valid_card_number_length?(number) &&
|
100
|
+
valid_test_mode_card_number?(number) ||
|
101
|
+
valid_card_number_length?(number) &&
|
102
|
+
valid_card_number_characters?(number) &&
|
50
103
|
valid_checksum?(number)
|
51
104
|
end
|
52
|
-
|
105
|
+
|
53
106
|
# Regular expressions for the known card companies.
|
54
|
-
#
|
55
|
-
# References:
|
56
|
-
# - http://en.wikipedia.org/wiki/Credit_card_number
|
57
|
-
# - http://www.barclaycardbusiness.co.uk/information_zone/processing/bin_rules.html
|
107
|
+
#
|
108
|
+
# References:
|
109
|
+
# - http://en.wikipedia.org/wiki/Credit_card_number
|
110
|
+
# - http://www.barclaycardbusiness.co.uk/information_zone/processing/bin_rules.html
|
58
111
|
def card_companies
|
59
112
|
CARD_COMPANIES
|
60
113
|
end
|
61
|
-
|
114
|
+
|
62
115
|
# Returns a string containing the brand of card from the list of known information below.
|
63
116
|
# Need to check the cards in a particular order, as there is some overlap of the allowable ranges
|
64
117
|
#--
|
65
|
-
# TODO Refactor this method. We basically need to tighten up the Maestro Regexp.
|
66
|
-
#
|
67
|
-
# Right now the Maestro regexp overlaps with the MasterCard regexp (IIRC). If we can tighten
|
68
|
-
# things up, we can boil this whole thing down to something like...
|
69
|
-
#
|
118
|
+
# TODO Refactor this method. We basically need to tighten up the Maestro Regexp.
|
119
|
+
#
|
120
|
+
# Right now the Maestro regexp overlaps with the MasterCard regexp (IIRC). If we can tighten
|
121
|
+
# things up, we can boil this whole thing down to something like...
|
122
|
+
#
|
70
123
|
# def brand?(number)
|
71
124
|
# return 'visa' if valid_test_mode_card_number?(number)
|
72
125
|
# card_companies.find([nil]) { |brand, regexp| number =~ regexp }.first.dup
|
73
126
|
# end
|
74
|
-
#
|
127
|
+
#
|
75
128
|
def brand?(number)
|
76
129
|
return 'bogus' if valid_test_mode_card_number?(number)
|
77
130
|
|
78
131
|
card_companies.reject { |c,p| c == 'maestro' }.each do |company, pattern|
|
79
|
-
return company.dup if number =~ pattern
|
132
|
+
return company.dup if number =~ pattern
|
80
133
|
end
|
81
|
-
|
134
|
+
|
82
135
|
return 'maestro' if number =~ card_companies['maestro']
|
83
136
|
|
84
137
|
return nil
|
85
138
|
end
|
86
139
|
|
140
|
+
def electron?(number)
|
141
|
+
return false unless [16, 19].include?(number.length)
|
142
|
+
|
143
|
+
# don't recalculate for each range
|
144
|
+
bank_identification_number = first_digits(number).to_i
|
145
|
+
|
146
|
+
ELECTRON_RANGES.any? do |range|
|
147
|
+
range.include?(bank_identification_number)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
87
151
|
def type?(number)
|
88
|
-
deprecated "CreditCard#type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand? instead."
|
152
|
+
ActiveMerchant.deprecated "CreditCard#type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand? instead."
|
89
153
|
brand?(number)
|
90
154
|
end
|
91
|
-
|
155
|
+
|
92
156
|
def first_digits(number)
|
93
|
-
number.to_s.slice(0,6)
|
157
|
+
number.to_s.slice(0,6)
|
94
158
|
end
|
95
|
-
|
96
|
-
def last_digits(number)
|
97
|
-
number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
|
159
|
+
|
160
|
+
def last_digits(number)
|
161
|
+
number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
|
98
162
|
end
|
99
|
-
|
163
|
+
|
100
164
|
def mask(number)
|
101
165
|
"XXXX-XXXX-XXXX-#{last_digits(number)}"
|
102
166
|
end
|
103
|
-
|
167
|
+
|
104
168
|
# Checks to see if the calculated brand matches the specified brand
|
105
169
|
def matching_brand?(number, brand)
|
106
170
|
brand?(number) == brand
|
107
171
|
end
|
108
172
|
|
109
173
|
def matching_type?(number, brand)
|
110
|
-
deprecated "CreditCard#matching_type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#matching_brand? instead."
|
174
|
+
ActiveMerchant.deprecated "CreditCard#matching_type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#matching_brand? instead."
|
111
175
|
matching_brand?(number, brand)
|
112
176
|
end
|
113
177
|
|
114
|
-
def deprecated(message)
|
115
|
-
warn(Kernel.caller[1] + message)
|
116
|
-
end
|
117
|
-
|
118
178
|
private
|
119
|
-
|
179
|
+
|
120
180
|
def valid_card_number_length?(number) #:nodoc:
|
121
181
|
number.to_s.length >= 12
|
122
182
|
end
|
123
|
-
|
183
|
+
|
184
|
+
def valid_card_number_characters?(number) #:nodoc:
|
185
|
+
!number.to_s.match(/\D/)
|
186
|
+
end
|
187
|
+
|
124
188
|
def valid_test_mode_card_number?(number) #:nodoc:
|
125
|
-
ActiveMerchant::Billing::Base.test? &&
|
189
|
+
ActiveMerchant::Billing::Base.test? &&
|
126
190
|
%w[1 2 3 success failure error].include?(number.to_s)
|
127
191
|
end
|
128
|
-
|
129
|
-
|
192
|
+
|
193
|
+
ODD_LUHN_VALUE = {
|
194
|
+
48 => 0,
|
195
|
+
49 => 1,
|
196
|
+
50 => 2,
|
197
|
+
51 => 3,
|
198
|
+
52 => 4,
|
199
|
+
53 => 5,
|
200
|
+
54 => 6,
|
201
|
+
55 => 7,
|
202
|
+
56 => 8,
|
203
|
+
57 => 9,
|
204
|
+
nil => 0
|
205
|
+
}.freeze
|
206
|
+
|
207
|
+
EVEN_LUHN_VALUE = {
|
208
|
+
48 => 0, # 0 * 2
|
209
|
+
49 => 2, # 1 * 2
|
210
|
+
50 => 4, # 2 * 2
|
211
|
+
51 => 6, # 3 * 2
|
212
|
+
52 => 8, # 4 * 2
|
213
|
+
53 => 1, # 5 * 2 - 9
|
214
|
+
54 => 3, # 6 * 2 - 9
|
215
|
+
55 => 5, # etc ...
|
216
|
+
56 => 7,
|
217
|
+
57 => 9,
|
218
|
+
}.freeze
|
219
|
+
|
220
|
+
# Checks the validity of a card number by use of the Luhn Algorithm.
|
130
221
|
# Please see http://en.wikipedia.org/wiki/Luhn_algorithm for details.
|
131
|
-
|
222
|
+
# This implementation is from the luhn_checksum gem, https://github.com/zendesk/luhn_checksum.
|
223
|
+
def valid_checksum?(numbers) #:nodoc:
|
132
224
|
sum = 0
|
133
|
-
|
134
|
-
|
135
|
-
|
225
|
+
|
226
|
+
odd = true
|
227
|
+
numbers.reverse.bytes.each do |number|
|
228
|
+
if odd
|
229
|
+
odd = false
|
230
|
+
sum += ODD_LUHN_VALUE[number]
|
231
|
+
else
|
232
|
+
odd = true
|
233
|
+
sum += EVEN_LUHN_VALUE[number]
|
234
|
+
end
|
136
235
|
end
|
137
|
-
|
138
|
-
|
236
|
+
|
237
|
+
sum % 10 == 0
|
139
238
|
end
|
140
239
|
end
|
141
240
|
end
|
@@ -4,29 +4,29 @@ module ActiveMerchant
|
|
4
4
|
# http://www.bbbonline.org/eExport/doc/MerchantGuide_cvv2.pdf
|
5
5
|
# Check additional codes from cybersource website
|
6
6
|
class CVVResult
|
7
|
-
|
7
|
+
|
8
8
|
MESSAGES = {
|
9
|
-
'D' => '
|
10
|
-
'I' => '
|
11
|
-
'M' => '
|
12
|
-
'N' => '
|
13
|
-
'P' => '
|
14
|
-
'S' => '
|
15
|
-
'U' => '
|
16
|
-
'X' => '
|
9
|
+
'D' => 'CVV check flagged transaction as suspicious',
|
10
|
+
'I' => 'CVV failed data validation check',
|
11
|
+
'M' => 'CVV matches',
|
12
|
+
'N' => 'CVV does not match',
|
13
|
+
'P' => 'CVV not processed',
|
14
|
+
'S' => 'CVV should have been present',
|
15
|
+
'U' => 'CVV request unable to be processed by issuer',
|
16
|
+
'X' => 'CVV check not supported for card'
|
17
17
|
}
|
18
|
-
|
18
|
+
|
19
19
|
def self.messages
|
20
20
|
MESSAGES
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
attr_reader :code, :message
|
24
|
-
|
24
|
+
|
25
25
|
def initialize(code)
|
26
|
-
@code = code.
|
26
|
+
@code = (code.blank? ? nil : code.upcase)
|
27
27
|
@message = MESSAGES[@code]
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def to_hash
|
31
31
|
{
|
32
32
|
'code' => code,
|
@@ -35,4 +35,4 @@ module ActiveMerchant
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
end
|
38
|
+
end
|
@@ -10,19 +10,16 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
#
|
11
11
|
# The standard list of gateway functions that most concrete gateway subclasses implement is:
|
12
12
|
#
|
13
|
-
# * <tt>purchase(money,
|
14
|
-
# * <tt>authorize(money,
|
13
|
+
# * <tt>purchase(money, credit_card, options = {})</tt>
|
14
|
+
# * <tt>authorize(money, credit_card, options = {})</tt>
|
15
15
|
# * <tt>capture(money, authorization, options = {})</tt>
|
16
16
|
# * <tt>void(identification, options = {})</tt>
|
17
|
-
# * <tt>
|
18
|
-
#
|
19
|
-
# Some gateways include features for recurring billing
|
20
|
-
#
|
21
|
-
# * <tt>recurring(money, creditcard, options = {})</tt>
|
17
|
+
# * <tt>refund(money, identification, options = {})</tt>
|
18
|
+
# * <tt>verify(credit_card, options = {})</tt>
|
22
19
|
#
|
23
20
|
# Some gateways also support features for storing credit cards:
|
24
21
|
#
|
25
|
-
# * <tt>store(
|
22
|
+
# * <tt>store(credit_card, options = {})</tt>
|
26
23
|
# * <tt>unstore(identification, options = {})</tt>
|
27
24
|
#
|
28
25
|
# === Gateway Options
|
@@ -51,19 +48,57 @@ module ActiveMerchant #:nodoc:
|
|
51
48
|
# * <tt>:zip</tt> - The zip or postal code of the customer.
|
52
49
|
# * <tt>:phone</tt> - The phone number of the customer.
|
53
50
|
#
|
54
|
-
# ==
|
51
|
+
# == Implementing new gateways
|
55
52
|
#
|
56
|
-
# See the {ActiveMerchant Guide to Contributing}[https://github.com/
|
53
|
+
# See the {ActiveMerchant Guide to Contributing}[https://github.com/activemerchant/active_merchant/wiki/Contributing]
|
57
54
|
#
|
58
55
|
class Gateway
|
59
56
|
include PostsData
|
60
|
-
include RequiresParameters
|
61
57
|
include CreditCardFormatting
|
62
|
-
include Utils
|
63
58
|
|
64
59
|
DEBIT_CARDS = [ :switch, :solo ]
|
65
|
-
|
60
|
+
|
66
61
|
CREDIT_DEPRECATION_MESSAGE = "Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead."
|
62
|
+
RECURRING_DEPRECATION_MESSAGE = "Recurring functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it."
|
63
|
+
|
64
|
+
# == Standardized Error Codes
|
65
|
+
#
|
66
|
+
# :incorrect_number - Card number does not comply with ISO/IEC 7812 numbering standard
|
67
|
+
# :invalid_number - Card number was not matched by processor
|
68
|
+
# :invalid_expiry_date - Expiry date does not match correct formatting
|
69
|
+
# :invalid_cvc - Security codes does not match correct format (3-4 digits)
|
70
|
+
# :expired_card - Card number is expired
|
71
|
+
# :incorrect_cvc - Security code was not matched by the processor
|
72
|
+
# :incorrect_zip - Zip code is not in correct format
|
73
|
+
# :incorrect_address - Billing address info was not matched by the processor
|
74
|
+
# :incorrect_pin - Card PIN is incorrect
|
75
|
+
# :card_declined - Card number declined by processor
|
76
|
+
# :processing_error - Processor error
|
77
|
+
# :call_issuer - Transaction requires voice authentication, call issuer
|
78
|
+
# :pickup_card - Issuer requests that you pickup the card from merchant
|
79
|
+
# :test_mode_live_card - Card was declined. Request was in test mode, but used a non test card.
|
80
|
+
# :unsupported_feature - Transaction failed due to gateway or merchant
|
81
|
+
# configuration not supporting a feature used, such
|
82
|
+
# as network tokenization.
|
83
|
+
|
84
|
+
STANDARD_ERROR_CODE = {
|
85
|
+
:incorrect_number => 'incorrect_number',
|
86
|
+
:invalid_number => 'invalid_number',
|
87
|
+
:invalid_expiry_date => 'invalid_expiry_date',
|
88
|
+
:invalid_cvc => 'invalid_cvc',
|
89
|
+
:expired_card => 'expired_card',
|
90
|
+
:incorrect_cvc => 'incorrect_cvc',
|
91
|
+
:incorrect_zip => 'incorrect_zip',
|
92
|
+
:incorrect_address => 'incorrect_address',
|
93
|
+
:incorrect_pin => 'incorrect_pin',
|
94
|
+
:card_declined => 'card_declined',
|
95
|
+
:processing_error => 'processing_error',
|
96
|
+
:call_issuer => 'call_issuer',
|
97
|
+
:pickup_card => 'pick_up_card',
|
98
|
+
:config_error => 'config_error',
|
99
|
+
:test_mode_live_card => 'test_mode_live_card',
|
100
|
+
:unsupported_feature => 'unsupported_feature',
|
101
|
+
}
|
67
102
|
|
68
103
|
cattr_reader :implementations
|
69
104
|
@@implementations = []
|
@@ -73,6 +108,10 @@ module ActiveMerchant #:nodoc:
|
|
73
108
|
@@implementations << subclass
|
74
109
|
end
|
75
110
|
|
111
|
+
def generate_unique_id
|
112
|
+
SecureRandom.hex(16)
|
113
|
+
end
|
114
|
+
|
76
115
|
# The format of the amounts used by the gateway
|
77
116
|
# :dollars => '12.50'
|
78
117
|
# :cents => '1250'
|
@@ -82,14 +121,14 @@ module ActiveMerchant #:nodoc:
|
|
82
121
|
# The default currency for the transactions if no currency is provided
|
83
122
|
class_attribute :default_currency
|
84
123
|
|
85
|
-
# The countries of merchants the gateway supports
|
86
|
-
class_attribute :supported_countries
|
87
|
-
self.supported_countries = []
|
88
|
-
|
89
124
|
# The supported card types for the gateway
|
90
125
|
class_attribute :supported_cardtypes
|
91
126
|
self.supported_cardtypes = []
|
92
127
|
|
128
|
+
class_attribute :currencies_without_fractions, :currencies_with_three_decimal_places
|
129
|
+
self.currencies_without_fractions = %w(BIF BYR CLP CVE DJF GNF ISK JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
|
130
|
+
self.currencies_with_three_decimal_places = %w()
|
131
|
+
|
93
132
|
class_attribute :homepage_url
|
94
133
|
class_attribute :display_name
|
95
134
|
|
@@ -101,8 +140,8 @@ module ActiveMerchant #:nodoc:
|
|
101
140
|
|
102
141
|
# The application making the calls to the gateway
|
103
142
|
# Useful for things like the PayPal build notation (BN) id fields
|
104
|
-
|
105
|
-
self.application_id =
|
143
|
+
class_attribute :application_id, instance_writer: false
|
144
|
+
self.application_id = nil
|
106
145
|
|
107
146
|
attr_reader :options
|
108
147
|
|
@@ -116,6 +155,23 @@ module ActiveMerchant #:nodoc:
|
|
116
155
|
result.to_s.downcase
|
117
156
|
end
|
118
157
|
|
158
|
+
def self.supported_countries=(country_codes)
|
159
|
+
country_codes.each do |country_code|
|
160
|
+
unless ActiveMerchant::Country.find(country_code)
|
161
|
+
raise ActiveMerchant::InvalidCountryCodeError, "No country could be found for the country #{country_code}"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
@supported_countries = country_codes.dup
|
165
|
+
end
|
166
|
+
|
167
|
+
def self.supported_countries
|
168
|
+
@supported_countries ||= []
|
169
|
+
end
|
170
|
+
|
171
|
+
def supported_countries
|
172
|
+
self.class.supported_countries
|
173
|
+
end
|
174
|
+
|
119
175
|
def card_brand(source)
|
120
176
|
self.class.card_brand(source)
|
121
177
|
end
|
@@ -133,6 +189,51 @@ module ActiveMerchant #:nodoc:
|
|
133
189
|
(@options.has_key?(:test) ? @options[:test] : Base.test?)
|
134
190
|
end
|
135
191
|
|
192
|
+
# Does this gateway know how to scrub sensitive information out of HTTP transcripts?
|
193
|
+
def supports_scrubbing?
|
194
|
+
false
|
195
|
+
end
|
196
|
+
|
197
|
+
def scrub(transcript)
|
198
|
+
raise RuntimeError.new("This gateway does not support scrubbing.")
|
199
|
+
end
|
200
|
+
|
201
|
+
def supports_network_tokenization?
|
202
|
+
false
|
203
|
+
end
|
204
|
+
|
205
|
+
protected # :nodoc: all
|
206
|
+
|
207
|
+
def normalize(field)
|
208
|
+
case field
|
209
|
+
when "true" then true
|
210
|
+
when "false" then false
|
211
|
+
when "" then nil
|
212
|
+
when "null" then nil
|
213
|
+
else field
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def user_agent
|
218
|
+
@@ua ||= JSON.dump({
|
219
|
+
:bindings_version => ActiveMerchant::VERSION,
|
220
|
+
:lang => 'ruby',
|
221
|
+
:lang_version => "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})",
|
222
|
+
:platform => RUBY_PLATFORM,
|
223
|
+
:publisher => 'active_merchant'
|
224
|
+
})
|
225
|
+
end
|
226
|
+
|
227
|
+
def strip_invalid_xml_chars(xml)
|
228
|
+
begin
|
229
|
+
REXML::Document.new(xml)
|
230
|
+
rescue REXML::ParseException
|
231
|
+
xml = xml.gsub(/&(?!(?:[a-z]+|#[0-9]+|x[a-zA-Z0-9]+);)/, '&')
|
232
|
+
end
|
233
|
+
|
234
|
+
xml
|
235
|
+
end
|
236
|
+
|
136
237
|
private # :nodoc: all
|
137
238
|
|
138
239
|
def name
|
@@ -142,7 +243,7 @@ module ActiveMerchant #:nodoc:
|
|
142
243
|
def amount(money)
|
143
244
|
return nil if money.nil?
|
144
245
|
cents = if money.respond_to?(:cents)
|
145
|
-
deprecated "Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents"
|
246
|
+
ActiveMerchant.deprecated "Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents"
|
146
247
|
money.cents
|
147
248
|
else
|
148
249
|
money
|
@@ -159,23 +260,68 @@ module ActiveMerchant #:nodoc:
|
|
159
260
|
end
|
160
261
|
end
|
161
262
|
|
263
|
+
def non_fractional_currency?(currency)
|
264
|
+
self.currencies_without_fractions.include?(currency.to_s)
|
265
|
+
end
|
266
|
+
|
267
|
+
def three_decimal_currency?(currency)
|
268
|
+
self.currencies_with_three_decimal_places.include?(currency.to_s)
|
269
|
+
end
|
270
|
+
|
162
271
|
def localized_amount(money, currency)
|
163
272
|
amount = amount(money)
|
164
|
-
non_fractional_currency?(currency) ? amount.split('.').first : amount
|
165
|
-
end
|
166
273
|
|
167
|
-
|
168
|
-
|
274
|
+
return amount unless non_fractional_currency?(currency) || three_decimal_currency?(currency)
|
275
|
+
if non_fractional_currency?(currency)
|
276
|
+
if self.money_format == :cents
|
277
|
+
sprintf("%.0f", amount.to_f / 100)
|
278
|
+
else
|
279
|
+
amount.split('.').first
|
280
|
+
end
|
281
|
+
elsif three_decimal_currency?(currency)
|
282
|
+
if self.money_format == :cents
|
283
|
+
amount.to_s
|
284
|
+
else
|
285
|
+
sprintf("%.3f", (amount.to_f / 10))
|
286
|
+
end
|
287
|
+
end
|
169
288
|
end
|
170
289
|
|
171
290
|
def currency(money)
|
172
291
|
money.respond_to?(:currency) ? money.currency : self.default_currency
|
173
292
|
end
|
174
293
|
|
294
|
+
def truncate(value, max_size)
|
295
|
+
return nil unless value
|
296
|
+
value.to_s[0, max_size]
|
297
|
+
end
|
298
|
+
|
299
|
+
def split_names(full_name)
|
300
|
+
names = (full_name || "").split
|
301
|
+
return [nil, nil] if names.size == 0
|
302
|
+
|
303
|
+
last_name = names.pop
|
304
|
+
first_name = names.join(" ")
|
305
|
+
[first_name, last_name]
|
306
|
+
end
|
307
|
+
|
175
308
|
def requires_start_date_or_issue_number?(credit_card)
|
176
309
|
return false if card_brand(credit_card).blank?
|
177
310
|
DEBIT_CARDS.include?(card_brand(credit_card).to_sym)
|
178
311
|
end
|
312
|
+
|
313
|
+
def requires!(hash, *params)
|
314
|
+
params.each do |param|
|
315
|
+
if param.is_a?(Array)
|
316
|
+
raise ArgumentError.new("Missing required parameter: #{param.first}") unless hash.has_key?(param.first)
|
317
|
+
|
318
|
+
valid_options = param[1..-1]
|
319
|
+
raise ArgumentError.new("Parameter: #{param.first} must be one of #{valid_options.to_sentence(:words_connector => 'or')}") unless valid_options.include?(hash[param.first])
|
320
|
+
else
|
321
|
+
raise ArgumentError.new("Missing required parameter: #{param}") unless hash.has_key?(param)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
179
325
|
end
|
180
326
|
end
|
181
327
|
end
|