activemerchant 1.42.6 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/CHANGELOG +1420 -2
- data/CONTRIBUTORS +106 -0
- data/README.md +107 -103
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +12 -13
- data/lib/active_merchant/billing/base.rb +13 -16
- data/lib/active_merchant/billing/check.rb +35 -24
- data/lib/active_merchant/billing/compatibility.rb +117 -0
- data/lib/active_merchant/billing/credit_card.rb +196 -81
- data/lib/active_merchant/billing/credit_card_formatting.rb +6 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +199 -75
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +171 -39
- data/lib/active_merchant/billing/gateways/adyen.rb +380 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +933 -604
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +74 -54
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +130 -370
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +23 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +351 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +109 -32
- data/lib/active_merchant/billing/gateways/beanstream.rb +59 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -9
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -498
- data/lib/active_merchant/billing/gateways/blue_snap.rb +347 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +80 -46
- data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +15 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +311 -121
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +311 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +6 -7
- data/lib/active_merchant/billing/gateways/card_stream.rb +235 -89
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +50 -8
- data/lib/active_merchant/billing/gateways/cecabank.rb +27 -14
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +233 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +91 -97
- data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +356 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +294 -158
- data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +59 -347
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +24 -39
- data/lib/active_merchant/billing/gateways/elavon.rb +146 -147
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +41 -31
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +79 -78
- data/lib/active_merchant/billing/gateways/eway_managed.rb +35 -36
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +369 -228
- data/lib/active_merchant/billing/gateways/exact.rb +32 -26
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +90 -64
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -14
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +128 -122
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +190 -64
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +446 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +270 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +29 -27
- data/lib/active_merchant/billing/gateways/global_collect.rb +340 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +35 -36
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +29 -32
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -6
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +247 -41
- data/lib/active_merchant/billing/gateways/itransact.rb +4 -5
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +198 -71
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +45 -43
- data/lib/active_merchant/billing/gateways/litle.rb +328 -444
- data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -115
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +37 -19
- data/lib/active_merchant/billing/gateways/merchant_one.rb +13 -15
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +57 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +59 -48
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +38 -19
- data/lib/active_merchant/billing/gateways/mercury.rb +77 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +11 -30
- data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
- data/lib/active_merchant/billing/gateways/migs.rb +81 -22
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +23 -25
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +146 -64
- data/lib/active_merchant/billing/gateways/moneris_us.rb +197 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -15
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +86 -64
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +11 -5
- data/lib/active_merchant/billing/gateways/netaxept.rb +21 -22
- data/lib/active_merchant/billing/gateways/netbanx.rb +290 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +70 -35
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -6
- data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +274 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +90 -47
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +48 -20
- data/lib/active_merchant/billing/gateways/opp.rb +369 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +79 -44
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -102
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +48 -29
- data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +67 -48
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +20 -26
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +7 -15
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +40 -36
- data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
- data/lib/active_merchant/billing/gateways/payex.rb +38 -30
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +62 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +74 -27
- data/lib/active_merchant/billing/gateways/payflow_express.rb +77 -81
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +54 -45
- data/lib/active_merchant/billing/gateways/paymentez.rb +304 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +160 -66
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +54 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +17 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +36 -27
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +7 -6
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +2 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -88
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +445 -0
- data/lib/active_merchant/billing/gateways/payway.rb +8 -8
- data/lib/active_merchant/billing/gateways/pin.rb +74 -18
- data/lib/active_merchant/billing/gateways/plugnpay.rb +66 -76
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +30 -30
- data/lib/active_merchant/billing/gateways/psl_card.rb +27 -34
- data/lib/active_merchant/billing/gateways/qbms.rb +65 -54
- data/lib/active_merchant/billing/gateways/quantum.rb +18 -18
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +295 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -350
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +78 -48
- data/lib/active_merchant/billing/gateways/redsys.rb +310 -170
- data/lib/active_merchant/billing/gateways/s5.rb +246 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +415 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +195 -90
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -12
- data/lib/active_merchant/billing/gateways/secure_net.rb +51 -43
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -10
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -14
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +10 -18
- data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +35 -38
- data/lib/active_merchant/billing/gateways/smart_ps.rb +50 -42
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +9 -9
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +62 -12
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -103
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +12 -18
- data/lib/active_merchant/billing/gateways/telr.rb +274 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +143 -30
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transax.rb +5 -6
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -232
- data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +86 -57
- data/lib/active_merchant/billing/gateways/usa_epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +196 -89
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +157 -32
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +42 -49
- data/lib/active_merchant/billing/gateways/viaklix.rb +11 -24
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +233 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +26 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +153 -31
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +207 -63
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +31 -24
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +195 -0
- data/lib/active_merchant/country.rb +335 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
- data/lib/active_merchant/network_connection_retries.rb +80 -0
- data/lib/active_merchant/post_data.rb +25 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -27
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3988 -0
- data/lib/support/gateway_support.rb +7 -9
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +6 -7
- data/lib/support/ssl_version.rb +87 -0
- metadata +148 -323
- checksums.yaml.gz.sig +0 -0
- data/gem-public_cert.pem +0 -21
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/app55.rb +0 -185
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -249
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/alipay/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/alipay/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/alipay.rb +0 -18
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -64
- data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +0 -74
- data/lib/active_merchant/billing/integrations/bit_pay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bit_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus/notification.rb +0 -133
- data/lib/active_merchant/billing/integrations/citrus/return.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus.rb +0 -51
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/doku/helper.rb +0 -102
- data/lib/active_merchant/billing/integrations/doku/notification.rb +0 -69
- data/lib/active_merchant/billing/integrations/doku/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/doku.rb +0 -24
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -118
- data/lib/active_merchant/billing/integrations/ipay88/notification.rb +0 -103
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -29
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -23
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -123
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
- data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -60
- data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
- data/lib/active_merchant/billing/integrations/paydollar.rb +0 -59
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -39
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -76
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -154
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +0 -19
- data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +0 -16
- data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +0 -30
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -96
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -107
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -171
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -58
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/common.rb +0 -104
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/helper.rb +0 -145
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/return.rb +0 -35
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +0 -39
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
|
@@ -5,22 +5,20 @@ module ActiveMerchant #:nodoc:
|
|
|
5
5
|
# not backed by any database.
|
|
6
6
|
#
|
|
7
7
|
# You may use Check in place of CreditCard with any gateway that supports it.
|
|
8
|
-
class Check
|
|
9
|
-
include Validateable
|
|
10
|
-
|
|
8
|
+
class Check < Model
|
|
11
9
|
attr_accessor :first_name, :last_name,
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
:bank_name, :routing_number, :account_number,
|
|
11
|
+
:account_holder_type, :account_type, :number
|
|
14
12
|
|
|
15
13
|
# Used for Canadian bank accounts
|
|
16
14
|
attr_accessor :institution_number, :transit_number
|
|
17
15
|
|
|
18
16
|
def name
|
|
19
|
-
@name ||= "#{
|
|
17
|
+
@name ||= "#{first_name} #{last_name}".strip
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
def name=(value)
|
|
23
|
-
return if value
|
|
21
|
+
return if empty?(value)
|
|
24
22
|
|
|
25
23
|
@name = value
|
|
26
24
|
segments = value.split(' ')
|
|
@@ -29,39 +27,52 @@ module ActiveMerchant #:nodoc:
|
|
|
29
27
|
end
|
|
30
28
|
|
|
31
29
|
def validate
|
|
30
|
+
errors = []
|
|
31
|
+
|
|
32
32
|
[:name, :routing_number, :account_number].each do |attr|
|
|
33
|
-
errors
|
|
33
|
+
errors << [attr, 'cannot be empty'] if empty?(self.send(attr))
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
errors
|
|
36
|
+
errors << [:routing_number, 'is invalid'] unless valid_routing_number?
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if(!empty?(account_holder_type) && !%w[business personal].include?(account_holder_type.to_s))
|
|
39
|
+
errors << [:account_holder_type, 'must be personal or business']
|
|
40
|
+
end
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if(!empty?(account_type) && !%w[checking savings].include?(account_type.to_s))
|
|
43
|
+
errors << [:account_type, 'must be checking or savings']
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
errors_hash(errors)
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
def type
|
|
46
50
|
'check'
|
|
47
51
|
end
|
|
48
52
|
|
|
53
|
+
def credit_card?
|
|
54
|
+
false
|
|
55
|
+
end
|
|
56
|
+
|
|
49
57
|
# Routing numbers may be validated by calculating a checksum and dividing it by 10. The
|
|
50
58
|
# formula is:
|
|
51
59
|
# (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
|
|
52
60
|
# See http://en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
|
|
53
61
|
def valid_routing_number?
|
|
54
|
-
|
|
55
|
-
case
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
|
63
|
+
case digits.size
|
|
64
|
+
when 9
|
|
65
|
+
checksum = ((3 * (digits[0] + digits[3] + digits[6])) +
|
|
66
|
+
(7 * (digits[1] + digits[4] + digits[7])) +
|
|
67
|
+
(digits[2] + digits[5] + digits[8])) % 10
|
|
68
|
+
case checksum
|
|
69
|
+
when 0
|
|
70
|
+
true
|
|
71
|
+
else
|
|
72
|
+
false
|
|
73
|
+
end
|
|
74
|
+
else
|
|
75
|
+
false
|
|
65
76
|
end
|
|
66
77
|
end
|
|
67
78
|
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
module ActiveMerchant
|
|
2
|
+
module Billing
|
|
3
|
+
module Compatibility
|
|
4
|
+
module Model
|
|
5
|
+
def valid?
|
|
6
|
+
Compatibility.deprecated
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def errors
|
|
11
|
+
Compatibility.deprecated
|
|
12
|
+
internal_errors
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@rails_required = false
|
|
17
|
+
def self.rails_required!
|
|
18
|
+
@rails_required = true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.deprecated
|
|
22
|
+
ActiveMerchant.deprecated(
|
|
23
|
+
%(Implicit inclusion of Rails-specific functionality is deprecated.) +
|
|
24
|
+
%( Explicitly require "active_merchant/billing/rails" if you need it.)
|
|
25
|
+
) unless @rails_required
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.humanize(lower_case_and_underscored_word)
|
|
29
|
+
result = lower_case_and_underscored_word.to_s.dup
|
|
30
|
+
result.gsub!(/_id$/, '')
|
|
31
|
+
result.gsub!(/_/, ' ')
|
|
32
|
+
result.gsub(/([a-z\d]*)/i, &:downcase).gsub(/^\w/) { $&.upcase }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# This lives in compatibility until we remove the deprecation for implicitly
|
|
39
|
+
# requiring Rails
|
|
40
|
+
module ActiveMerchant
|
|
41
|
+
module Billing
|
|
42
|
+
module Rails
|
|
43
|
+
module Model
|
|
44
|
+
def valid?
|
|
45
|
+
internal_errors.clear
|
|
46
|
+
|
|
47
|
+
validate.each do |attribute, errors|
|
|
48
|
+
errors.each do |error|
|
|
49
|
+
internal_errors.add(attribute, error)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
internal_errors.empty?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
def internal_errors
|
|
59
|
+
@errors ||= Errors.new
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class Errors < Hash
|
|
63
|
+
def initialize
|
|
64
|
+
super() { |h, k| h[k] = [] }
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
alias count size
|
|
68
|
+
|
|
69
|
+
def [](key)
|
|
70
|
+
super(key.to_s)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def []=(key, value)
|
|
74
|
+
super(key.to_s, value)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def empty?
|
|
78
|
+
all? { |k, v| v&.empty? }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def on(field)
|
|
82
|
+
self[field].to_a.first
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def add(field, error)
|
|
86
|
+
self[field] << error
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def add_to_base(error)
|
|
90
|
+
add(:base, error)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def each_full
|
|
94
|
+
full_messages.each { |msg| yield msg }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def full_messages
|
|
98
|
+
result = []
|
|
99
|
+
|
|
100
|
+
self.each do |key, messages|
|
|
101
|
+
next unless(messages && !messages.empty?)
|
|
102
|
+
if key == 'base'
|
|
103
|
+
result << messages.first.to_s
|
|
104
|
+
else
|
|
105
|
+
result << "#{Compatibility.humanize(key)} #{messages.first}"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
result
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
Compatibility::Model.send(:include, Rails::Model)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'time'
|
|
2
2
|
require 'date'
|
|
3
|
-
require 'active_merchant/billing/
|
|
3
|
+
require 'active_merchant/billing/model'
|
|
4
4
|
|
|
5
5
|
module ActiveMerchant #:nodoc:
|
|
6
6
|
module Billing #:nodoc:
|
|
@@ -15,12 +15,9 @@ module ActiveMerchant #:nodoc:
|
|
|
15
15
|
# * American Express
|
|
16
16
|
# * Diner's Club
|
|
17
17
|
# * JCB
|
|
18
|
-
# * Switch
|
|
19
|
-
# * Solo
|
|
20
18
|
# * Dankort
|
|
21
19
|
# * Maestro
|
|
22
20
|
# * Forbrugsforeningen
|
|
23
|
-
# * Laser
|
|
24
21
|
#
|
|
25
22
|
# For testing purposes, use the 'bogus' credit card brand. This skips the vast majority of
|
|
26
23
|
# validations, allowing you to focus on your core concerns until you're ready to be more concerned
|
|
@@ -35,38 +32,48 @@ module ActiveMerchant #:nodoc:
|
|
|
35
32
|
#
|
|
36
33
|
# == Example Usage
|
|
37
34
|
# cc = CreditCard.new(
|
|
38
|
-
# :first_name
|
|
39
|
-
# :last_name
|
|
40
|
-
# :month
|
|
41
|
-
# :year
|
|
42
|
-
# :brand
|
|
43
|
-
# :number
|
|
35
|
+
# :first_name => 'Steve',
|
|
36
|
+
# :last_name => 'Smith',
|
|
37
|
+
# :month => '9',
|
|
38
|
+
# :year => '2017',
|
|
39
|
+
# :brand => 'visa',
|
|
40
|
+
# :number => '4242424242424242',
|
|
41
|
+
# :verification_value => '424'
|
|
44
42
|
# )
|
|
45
43
|
#
|
|
46
|
-
# cc.
|
|
44
|
+
# cc.validate # => {}
|
|
47
45
|
# cc.display_number # => XXXX-XXXX-XXXX-4242
|
|
48
46
|
#
|
|
49
|
-
class CreditCard
|
|
47
|
+
class CreditCard < Model
|
|
50
48
|
include CreditCardMethods
|
|
51
|
-
include Validateable
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
class << self
|
|
51
|
+
# Inherited, but can be overridden w/o changing parent's value
|
|
52
|
+
attr_accessor :require_verification_value
|
|
53
|
+
attr_accessor :require_name
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
self.require_name = true
|
|
54
57
|
self.require_verification_value = true
|
|
55
58
|
|
|
56
59
|
# Returns or sets the credit card number.
|
|
57
60
|
#
|
|
58
61
|
# @return [String]
|
|
59
|
-
|
|
62
|
+
attr_reader :number
|
|
63
|
+
|
|
64
|
+
def number=(value)
|
|
65
|
+
@number = (empty?(value) ? value : value.to_s.gsub(/[^\d]/, ''))
|
|
66
|
+
end
|
|
60
67
|
|
|
61
68
|
# Returns or sets the expiry month for the card.
|
|
62
69
|
#
|
|
63
70
|
# @return [Integer]
|
|
64
|
-
|
|
71
|
+
attr_reader :month
|
|
65
72
|
|
|
66
73
|
# Returns or sets the expiry year for the card.
|
|
67
74
|
#
|
|
68
75
|
# @return [Integer]
|
|
69
|
-
|
|
76
|
+
attr_reader :year
|
|
70
77
|
|
|
71
78
|
# Returns or sets the credit card brand.
|
|
72
79
|
#
|
|
@@ -78,17 +85,25 @@ module ActiveMerchant #:nodoc:
|
|
|
78
85
|
# * +'american_express'+
|
|
79
86
|
# * +'diners_club'+
|
|
80
87
|
# * +'jcb'+
|
|
81
|
-
# * +'switch'+
|
|
82
|
-
# * +'solo'+
|
|
83
88
|
# * +'dankort'+
|
|
84
89
|
# * +'maestro'+
|
|
85
90
|
# * +'forbrugsforeningen'+
|
|
86
|
-
# * +'laser'+
|
|
87
91
|
#
|
|
88
92
|
# Or, if you wish to test your implementation, +'bogus'+.
|
|
89
93
|
#
|
|
90
94
|
# @return (String) the credit card brand
|
|
91
|
-
|
|
95
|
+
def brand
|
|
96
|
+
if !defined?(@brand) || empty?(@brand)
|
|
97
|
+
self.class.brand?(number)
|
|
98
|
+
else
|
|
99
|
+
@brand
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def brand=(value)
|
|
104
|
+
value = value && value.to_s.dup
|
|
105
|
+
@brand = (value.respond_to?(:downcase) ? value.downcase : value)
|
|
106
|
+
end
|
|
92
107
|
|
|
93
108
|
# Returns or sets the first name of the card holder.
|
|
94
109
|
#
|
|
@@ -100,9 +115,6 @@ module ActiveMerchant #:nodoc:
|
|
|
100
115
|
# @return [String]
|
|
101
116
|
attr_accessor :last_name
|
|
102
117
|
|
|
103
|
-
# Required for Switch / Solo cards
|
|
104
|
-
attr_accessor :start_month, :start_year, :issue_number
|
|
105
|
-
|
|
106
118
|
# Returns or sets the card verification value.
|
|
107
119
|
#
|
|
108
120
|
# This attribute is optional but recommended. The verification value is
|
|
@@ -112,18 +124,80 @@ module ActiveMerchant #:nodoc:
|
|
|
112
124
|
# @return [String] the verification value
|
|
113
125
|
attr_accessor :verification_value
|
|
114
126
|
|
|
127
|
+
# Sets if the credit card requires a verification value.
|
|
128
|
+
#
|
|
129
|
+
# @return [Boolean]
|
|
130
|
+
def require_verification_value=(value)
|
|
131
|
+
@require_verification_value_set = true
|
|
132
|
+
@require_verification_value = value
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Returns if this credit card needs a verification value.
|
|
136
|
+
#
|
|
137
|
+
# By default this returns the configured value from `CreditCard.require_verification_value`,
|
|
138
|
+
# but one can set a per instance requirement with `credit_card.require_verification_value = false`.
|
|
139
|
+
#
|
|
140
|
+
# @return [Boolean]
|
|
141
|
+
def requires_verification_value?
|
|
142
|
+
@require_verification_value_set ||= false
|
|
143
|
+
if @require_verification_value_set
|
|
144
|
+
@require_verification_value
|
|
145
|
+
else
|
|
146
|
+
self.class.requires_verification_value?
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
115
150
|
# Returns or sets the track data for the card
|
|
116
151
|
#
|
|
117
152
|
# @return [String]
|
|
118
153
|
attr_accessor :track_data
|
|
119
154
|
|
|
155
|
+
# Returns or sets whether a card has been processed using manual entry.
|
|
156
|
+
#
|
|
157
|
+
# This attribute is optional and is only used by gateways who use this information in their transaction risk
|
|
158
|
+
# calculations. See {this page on 'card not present' transactions}[http://en.wikipedia.org/wiki/Card_not_present_transaction]
|
|
159
|
+
# for further explanation and examples of this kind of transaction.
|
|
160
|
+
#
|
|
161
|
+
# @return [true, false]
|
|
162
|
+
attr_accessor :manual_entry
|
|
163
|
+
|
|
164
|
+
# Returns or sets the ICC/ASN1 credit card data for a EMV transaction, typically this is a BER-encoded TLV string.
|
|
165
|
+
#
|
|
166
|
+
# @return [String]
|
|
167
|
+
attr_accessor :icc_data
|
|
168
|
+
|
|
169
|
+
# Returns or sets information about the source of the card data.
|
|
170
|
+
#
|
|
171
|
+
# @return [String]
|
|
172
|
+
attr_accessor :read_method
|
|
173
|
+
|
|
174
|
+
READ_METHOD_DESCRIPTIONS = {
|
|
175
|
+
nil => 'A card reader was not used.',
|
|
176
|
+
'fallback_no_chip' => 'Magstripe was read because the card has no chip.',
|
|
177
|
+
'fallback_chip_error' => "Magstripe was read because the card's chip failed.",
|
|
178
|
+
'contactless' => 'Data was read by a Contactless EMV kernel. Issuer script results are not available.',
|
|
179
|
+
'contactless_magstripe' => 'Contactless data was read with a non-EMV protocol.',
|
|
180
|
+
'contact' => 'Data was read using the EMV protocol. Issuer script results may follow.',
|
|
181
|
+
'contact_quickchip' => 'Data was read by the Quickchip EMV kernel. Issuer script results are not available.',
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
# Returns the ciphertext of the card's encrypted PIN.
|
|
185
|
+
#
|
|
186
|
+
# @return [String]
|
|
187
|
+
attr_accessor :encrypted_pin_cryptogram
|
|
188
|
+
|
|
189
|
+
# Returns the Key Serial Number (KSN) of the card's encrypted PIN.
|
|
190
|
+
#
|
|
191
|
+
# @return [String]
|
|
192
|
+
attr_accessor :encrypted_pin_ksn
|
|
193
|
+
|
|
120
194
|
def type
|
|
121
|
-
|
|
195
|
+
ActiveMerchant.deprecated 'CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead.'
|
|
122
196
|
brand
|
|
123
197
|
end
|
|
124
198
|
|
|
125
199
|
def type=(value)
|
|
126
|
-
|
|
200
|
+
ActiveMerchant.deprecated 'CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead.'
|
|
127
201
|
self.brand = value
|
|
128
202
|
end
|
|
129
203
|
|
|
@@ -148,29 +222,42 @@ module ActiveMerchant #:nodoc:
|
|
|
148
222
|
|
|
149
223
|
# Returns whether the +first_name+ attribute has been set.
|
|
150
224
|
def first_name?
|
|
151
|
-
|
|
225
|
+
first_name.present?
|
|
152
226
|
end
|
|
153
227
|
|
|
154
228
|
# Returns whether the +last_name+ attribute has been set.
|
|
155
229
|
def last_name?
|
|
156
|
-
|
|
230
|
+
last_name.present?
|
|
157
231
|
end
|
|
158
232
|
|
|
159
233
|
# Returns the full name of the card holder.
|
|
160
234
|
#
|
|
161
235
|
# @return [String] the full name of the card holder
|
|
162
236
|
def name
|
|
163
|
-
|
|
237
|
+
"#{first_name} #{last_name}".strip
|
|
164
238
|
end
|
|
165
239
|
|
|
166
240
|
def name=(full_name)
|
|
167
241
|
names = full_name.split
|
|
168
242
|
self.last_name = names.pop
|
|
169
|
-
self.first_name = names.join(
|
|
243
|
+
self.first_name = names.join(' ')
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
%w(month year start_month start_year).each do |m|
|
|
247
|
+
class_eval %(
|
|
248
|
+
def #{m}=(v)
|
|
249
|
+
@#{m} = case v
|
|
250
|
+
when "", nil, 0
|
|
251
|
+
nil
|
|
252
|
+
else
|
|
253
|
+
v.to_i
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
)
|
|
170
257
|
end
|
|
171
258
|
|
|
172
259
|
def verification_value?
|
|
173
|
-
|
|
260
|
+
!verification_value.blank?
|
|
174
261
|
end
|
|
175
262
|
|
|
176
263
|
# Returns a display-friendly version of the card number.
|
|
@@ -199,83 +286,111 @@ module ActiveMerchant #:nodoc:
|
|
|
199
286
|
#
|
|
200
287
|
# Any validation errors are added to the {#errors} attribute.
|
|
201
288
|
def validate
|
|
202
|
-
validate_essential_attributes
|
|
289
|
+
errors = validate_essential_attributes + validate_verification_value
|
|
203
290
|
|
|
204
291
|
# Bogus card is pretty much for testing purposes. Lets just skip these extra tests if its used
|
|
205
|
-
return if brand == 'bogus'
|
|
292
|
+
return errors_hash(errors) if brand == 'bogus'
|
|
206
293
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
294
|
+
errors_hash(
|
|
295
|
+
errors +
|
|
296
|
+
validate_card_brand_and_number
|
|
297
|
+
)
|
|
211
298
|
end
|
|
212
299
|
|
|
213
300
|
def self.requires_verification_value?
|
|
214
301
|
require_verification_value
|
|
215
302
|
end
|
|
216
303
|
|
|
217
|
-
|
|
304
|
+
def self.requires_name?
|
|
305
|
+
require_name
|
|
306
|
+
end
|
|
218
307
|
|
|
219
|
-
def
|
|
220
|
-
|
|
221
|
-
self.year = year.to_i
|
|
222
|
-
self.start_month = start_month.to_i unless start_month.nil?
|
|
223
|
-
self.start_year = start_year.to_i unless start_year.nil?
|
|
224
|
-
self.number = number.to_s.gsub(/[^\d]/, "")
|
|
225
|
-
self.brand.downcase! if brand.respond_to?(:downcase)
|
|
226
|
-
self.brand = self.class.brand?(number) if brand.blank?
|
|
308
|
+
def emv?
|
|
309
|
+
icc_data.present?
|
|
227
310
|
end
|
|
228
311
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
312
|
+
private
|
|
313
|
+
|
|
314
|
+
def validate_essential_attributes #:nodoc:
|
|
315
|
+
errors = []
|
|
316
|
+
|
|
317
|
+
if self.class.requires_name?
|
|
318
|
+
errors << [:first_name, 'cannot be empty'] if first_name.blank?
|
|
319
|
+
errors << [:last_name, 'cannot be empty'] if last_name.blank?
|
|
234
320
|
end
|
|
235
321
|
|
|
236
|
-
|
|
237
|
-
errors
|
|
322
|
+
if(empty?(month) || empty?(year))
|
|
323
|
+
errors << [:month, 'is required'] if empty?(month)
|
|
324
|
+
errors << [:year, 'is required'] if empty?(year)
|
|
325
|
+
else
|
|
326
|
+
errors << [:month, 'is not a valid month'] if !valid_month?(month)
|
|
327
|
+
|
|
328
|
+
if expired?
|
|
329
|
+
errors << [:year, 'expired']
|
|
330
|
+
else
|
|
331
|
+
errors << [:year, 'is not a valid year'] if !valid_expiry_year?(year)
|
|
332
|
+
end
|
|
238
333
|
end
|
|
239
|
-
end
|
|
240
334
|
|
|
241
|
-
|
|
242
|
-
errors.add :brand, "is required" if brand.blank? && number.present?
|
|
243
|
-
errors.add :brand, "is invalid" unless brand.blank? || CreditCard.card_companies.keys.include?(brand)
|
|
335
|
+
errors
|
|
244
336
|
end
|
|
245
337
|
|
|
246
|
-
|
|
338
|
+
def validate_card_brand_and_number #:nodoc:
|
|
339
|
+
errors = []
|
|
247
340
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
341
|
+
if !empty?(brand)
|
|
342
|
+
errors << [:brand, 'is invalid'] if !CreditCard.card_companies.include?(brand)
|
|
343
|
+
end
|
|
251
344
|
|
|
252
|
-
if
|
|
253
|
-
errors
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
errors.add :month, "is not a valid month" unless valid_month?(@month)
|
|
257
|
-
errors.add :year, "expired" if expired?
|
|
258
|
-
errors.add :year, "is not a valid year" unless expired? || valid_expiry_year?(@year)
|
|
345
|
+
if empty?(number)
|
|
346
|
+
errors << [:number, 'is required']
|
|
347
|
+
elsif !CreditCard.valid_number?(number)
|
|
348
|
+
errors << [:number, 'is not a valid credit card number']
|
|
259
349
|
end
|
|
350
|
+
|
|
351
|
+
if errors.empty?
|
|
352
|
+
errors << [:brand, 'does not match the card number'] if !CreditCard.matching_brand?(number, brand)
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
errors
|
|
260
356
|
end
|
|
261
357
|
|
|
262
|
-
def
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
errors.add :issue_number, "cannot be empty"
|
|
269
|
-
else
|
|
270
|
-
errors.add :issue_number, "is invalid" unless valid_issue_number?(@issue_number)
|
|
271
|
-
end
|
|
358
|
+
def validate_verification_value #:nodoc:
|
|
359
|
+
errors = []
|
|
360
|
+
|
|
361
|
+
if verification_value?
|
|
362
|
+
unless valid_card_verification_value?(verification_value, brand)
|
|
363
|
+
errors << [:verification_value, "should be #{card_verification_value_length(brand)} digits"]
|
|
272
364
|
end
|
|
365
|
+
elsif requires_verification_value? && !valid_card_verification_value?(verification_value, brand)
|
|
366
|
+
errors << [:verification_value, 'is required']
|
|
273
367
|
end
|
|
368
|
+
errors
|
|
274
369
|
end
|
|
275
370
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
371
|
+
class ExpiryDate #:nodoc:
|
|
372
|
+
attr_reader :month, :year
|
|
373
|
+
def initialize(month, year)
|
|
374
|
+
@month = month.to_i
|
|
375
|
+
@year = year.to_i
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
def expired? #:nodoc:
|
|
379
|
+
Time.now.utc > expiration
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
def expiration #:nodoc:
|
|
383
|
+
Time.utc(year, month, month_days, 23, 59, 59)
|
|
384
|
+
rescue ArgumentError
|
|
385
|
+
Time.at(0).utc
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
private
|
|
389
|
+
|
|
390
|
+
def month_days
|
|
391
|
+
mdays = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
|
392
|
+
mdays[2] = 29 if Date.leap?(year)
|
|
393
|
+
mdays[month]
|
|
279
394
|
end
|
|
280
395
|
end
|
|
281
396
|
end
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
|
3
3
|
module CreditCardFormatting
|
|
4
|
+
def expdate(credit_card)
|
|
5
|
+
"#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
|
|
6
|
+
end
|
|
4
7
|
|
|
5
8
|
# This method is used to format numerical information pertaining to credit cards.
|
|
6
9
|
#
|
|
@@ -10,12 +13,11 @@ module ActiveMerchant #:nodoc:
|
|
|
10
13
|
return '' if number.blank?
|
|
11
14
|
|
|
12
15
|
case option
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
when :two_digits then sprintf('%.2i', number.to_i)[-2..-1]
|
|
17
|
+
when :four_digits then sprintf('%.4i', number.to_i)[-4..-1]
|
|
18
|
+
else number
|
|
16
19
|
end
|
|
17
20
|
end
|
|
18
|
-
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
end
|