tanga_activemerchant 1.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1202 -0
- data/CONTRIBUTORS +414 -0
- data/MIT-LICENSE +20 -0
- data/README.md +221 -0
- data/gem-public_cert.pem +20 -0
- data/lib/active_merchant/billing/avs_result.rb +98 -0
- data/lib/active_merchant/billing/base.rb +57 -0
- data/lib/active_merchant/billing/check.rb +69 -0
- data/lib/active_merchant/billing/credit_card.rb +283 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +21 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +143 -0
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/expiry_date.rb +34 -0
- data/lib/active_merchant/billing/gateway.rb +181 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +725 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +956 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +468 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +105 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +314 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +393 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +169 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +501 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +142 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +401 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +225 -0
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +155 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +156 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +639 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +591 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +230 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +312 -0
- data/lib/active_merchant/billing/gateways/epay.rb +275 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
- data/lib/active_merchant/billing/gateways/eway.rb +225 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +291 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +320 -0
- data/lib/active_merchant/billing/gateways/exact.rb +218 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +173 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +167 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +176 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +314 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +257 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +35 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +249 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +13 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +29 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +66 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +221 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +163 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +262 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +447 -0
- data/lib/active_merchant/billing/gateways/litle.rb +554 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +176 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +115 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +322 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +275 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +191 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +311 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +322 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +265 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +219 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +244 -0
- data/lib/active_merchant/billing/gateways/moneris_us.rb +208 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +277 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +193 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +181 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +197 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +20 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +421 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +297 -0
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +46 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +633 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +261 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +396 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +119 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +196 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +209 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +268 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +224 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +179 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +670 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +61 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +248 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +106 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +43 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +239 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +199 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/pin.rb +165 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +294 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +303 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +292 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +335 -0
- data/lib/active_merchant/billing/gateways/realex.rb +303 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +93 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +114 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +102 -0
- data/lib/active_merchant/billing/gateways/sage.rb +152 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +324 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +143 -0
- data/lib/active_merchant/billing/gateways/samurai.rb +118 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +261 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +28 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +279 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +112 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +453 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +272 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +233 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +316 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +126 -0
- data/lib/active_merchant/billing/gateways/transax.rb +23 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +239 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +421 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1501 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +201 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +232 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
- data/lib/active_merchant/billing/gateways/vindicia.rb +361 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +57 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +313 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +303 -0
- data/lib/active_merchant/billing/gateways.rb +17 -0
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
- data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +73 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +229 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +340 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +38 -0
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
- data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/bogus.rb +23 -0
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +120 -0
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +158 -0
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/chronopay.rb +23 -0
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +200 -0
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +76 -0
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +32 -0
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +37 -0
- data/lib/active_merchant/billing/integrations/direc_pay.rb +41 -0
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +90 -0
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +120 -0
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/directebanking.rb +47 -0
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +77 -0
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +86 -0
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/dotpay.rb +22 -0
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +23 -0
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +64 -0
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +49 -0
- data/lib/active_merchant/billing/integrations/dwolla.rb +23 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +34 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +84 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +48 -0
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +40 -0
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +36 -0
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/easy_pay.rb +30 -0
- data/lib/active_merchant/billing/integrations/epay/helper.rb +55 -0
- data/lib/active_merchant/billing/integrations/epay/notification.rb +110 -0
- data/lib/active_merchant/billing/integrations/epay.rb +21 -0
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +61 -0
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +56 -0
- data/lib/active_merchant/billing/integrations/first_data.rb +38 -0
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +85 -0
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/gestpay.rb +25 -0
- data/lib/active_merchant/billing/integrations/helper.rb +117 -0
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/active_merchant/billing/integrations/hi_trust.rb +27 -0
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +114 -0
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +95 -0
- data/lib/active_merchant/billing/integrations/ipay88.rb +19 -0
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
- data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +48 -0
- data/lib/active_merchant/billing/integrations/maksuturva.rb +86 -0
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +75 -0
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +129 -0
- data/lib/active_merchant/billing/integrations/moneybookers.rb +26 -0
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
- data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +88 -0
- data/lib/active_merchant/billing/integrations/notification.rb +71 -0
- data/lib/active_merchant/billing/integrations/paxum/common.rb +24 -0
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +42 -0
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +33 -0
- data/lib/active_merchant/billing/integrations/paxum.rb +44 -0
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +116 -0
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +78 -0
- data/lib/active_merchant/billing/integrations/payflow_link.rb +21 -0
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +227 -0
- data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/paypal.rb +39 -0
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +20 -0
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +28 -0
- data/lib/active_merchant/billing/integrations/paysbuy.rb +36 -0
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +74 -0
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +165 -0
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +36 -0
- data/lib/active_merchant/billing/integrations/payu_in.rb +43 -0
- data/lib/active_merchant/billing/integrations/platron/helper.rb +32 -0
- data/lib/active_merchant/billing/integrations/platron/notification.rb +113 -0
- data/lib/active_merchant/billing/integrations/platron.rb +28 -0
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +112 -0
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +157 -0
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +25 -0
- data/lib/active_merchant/billing/integrations/pxpay.rb +31 -0
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +74 -0
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +137 -0
- data/lib/active_merchant/billing/integrations/quickpay.rb +21 -0
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +23 -0
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +91 -0
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +17 -0
- data/lib/active_merchant/billing/integrations/return.rb +42 -0
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +19 -0
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +55 -0
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/robokassa.rb +49 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +33 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +136 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +210 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +31 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +37 -0
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +91 -0
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +139 -0
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +44 -0
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +86 -0
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +13 -0
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +97 -0
- data/lib/active_merchant/billing/integrations/valitor/return.rb +13 -0
- data/lib/active_merchant/billing/integrations/valitor.rb +33 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +88 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +20 -0
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +50 -0
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +51 -0
- data/lib/active_merchant/billing/integrations/web_pay.rb +45 -0
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +17 -0
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +40 -0
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +47 -0
- data/lib/active_merchant/billing/integrations/webmoney.rb +43 -0
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +101 -0
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +160 -0
- data/lib/active_merchant/billing/integrations/world_pay.rb +34 -0
- data/lib/active_merchant/billing/integrations.rb +17 -0
- data/lib/active_merchant/billing/response.rb +77 -0
- data/lib/active_merchant/billing.rb +9 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/support/gateway_support.rb +65 -0
- data/lib/support/outbound_hosts.rb +25 -0
- data/lib/support/ssl_verify.rb +93 -0
- metadata +506 -0
@@ -0,0 +1,554 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class LitleGateway < Gateway
|
4
|
+
# Specific to Litle options:
|
5
|
+
# * <tt>:merchant_id</tt> - Merchant Id assigned by Litle
|
6
|
+
# * <tt>:user</tt> - Username assigned by Litle
|
7
|
+
# * <tt>:password</tt> - Password assigned by Litle
|
8
|
+
# * <tt>:version</tt> - The version of the api you are using (eg, '8.10')
|
9
|
+
# * <tt>:proxy_addr</tt> - Proxy address - nil if not needed
|
10
|
+
# * <tt>:proxy_port</tt> - Proxy port - nil if not needed
|
11
|
+
# * <tt>:url</tt> - URL assigned by Litle (for testing, use the sandbox)
|
12
|
+
#
|
13
|
+
# Standard Active Merchant options
|
14
|
+
# * <tt>:order_id</tt> - The order number
|
15
|
+
# * <tt>:ip</tt> - The IP address of the customer making the purchase
|
16
|
+
# * <tt>:customer</tt> - The name, customer number, or other information that identifies the customer
|
17
|
+
# * <tt>:invoice</tt> - The invoice number
|
18
|
+
# * <tt>:merchant</tt> - The name or description of the merchant offering the product
|
19
|
+
# * <tt>:description</tt> - A description of the transaction
|
20
|
+
# * <tt>:email</tt> - The email address of the customer
|
21
|
+
# * <tt>:currency</tt> - The currency of the transaction. Only important when you are using a currency that is not the default with a gateway that supports multiple currencies.
|
22
|
+
# * <tt>:billing_address</tt> - A hash containing the billing address of the customer.
|
23
|
+
# * <tt>:shipping_address</tt> - A hash containing the shipping address of the customer.
|
24
|
+
#
|
25
|
+
# The <tt>:billing_address</tt>, and <tt>:shipping_address</tt> hashes can have the following keys:
|
26
|
+
#
|
27
|
+
# * <tt>:name</tt> - The full name of the customer.
|
28
|
+
# * <tt>:company</tt> - The company name of the customer.
|
29
|
+
# * <tt>:address1</tt> - The primary street address of the customer.
|
30
|
+
# * <tt>:address2</tt> - Additional line of address information.
|
31
|
+
# * <tt>:city</tt> - The city of the customer.
|
32
|
+
# * <tt>:state</tt> - The state of the customer. The 2 digit code for US and Canadian addresses. The full name of the state or province for foreign addresses.
|
33
|
+
# * <tt>:country</tt> - The [ISO 3166-1-alpha-2 code](http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm) for the customer.
|
34
|
+
# * <tt>:zip</tt> - The zip or postal code of the customer.
|
35
|
+
# * <tt>:phone</tt> - The phone number of the customer.
|
36
|
+
|
37
|
+
self.test_url = 'https://www.testlitle.com/sandbox/communicator/online'
|
38
|
+
self.live_url = 'https://payments.litle.com/vap/communicator/online'
|
39
|
+
|
40
|
+
LITLE_SCHEMA_VERSION = '8.13'
|
41
|
+
|
42
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
43
|
+
self.supported_countries = ['US']
|
44
|
+
|
45
|
+
# The card types supported by the payment gateway
|
46
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
47
|
+
|
48
|
+
# The homepage URL of the gateway
|
49
|
+
self.homepage_url = 'http://www.litle.com/'
|
50
|
+
|
51
|
+
# The name of the gateway
|
52
|
+
self.display_name = 'Litle & Co.'
|
53
|
+
|
54
|
+
self.default_currency = 'USD'
|
55
|
+
|
56
|
+
def initialize(options = {})
|
57
|
+
begin
|
58
|
+
require 'LitleOnline'
|
59
|
+
rescue LoadError
|
60
|
+
raise "Could not load the LitleOnline gem (> 08.15.0). Use `gem install LitleOnline` to install it."
|
61
|
+
end
|
62
|
+
|
63
|
+
if wiredump_device
|
64
|
+
LitleOnline::Configuration.logger = ((Logger === wiredump_device) ? wiredump_device : Logger.new(wiredump_device))
|
65
|
+
LitleOnline::Configuration.logger.level = Logger::DEBUG
|
66
|
+
else
|
67
|
+
LitleOnline::Configuration.logger = Logger.new(STDOUT)
|
68
|
+
LitleOnline::Configuration.logger.level = Logger::WARN
|
69
|
+
end
|
70
|
+
|
71
|
+
@litle = LitleOnline::LitleOnlineRequest.new
|
72
|
+
|
73
|
+
options[:version] ||= LITLE_SCHEMA_VERSION
|
74
|
+
options[:merchant] ||= 'Default Report Group'
|
75
|
+
options[:user] ||= options[:login]
|
76
|
+
|
77
|
+
requires!(options, :merchant_id, :user, :password, :merchant, :version)
|
78
|
+
|
79
|
+
super
|
80
|
+
end
|
81
|
+
|
82
|
+
def authorize(money, creditcard_or_token, options = {})
|
83
|
+
to_pass = build_authorize_request(money, creditcard_or_token, options)
|
84
|
+
build_response(:authorization, @litle.authorization(to_pass))
|
85
|
+
end
|
86
|
+
|
87
|
+
def purchase(money, creditcard_or_token, options = {})
|
88
|
+
to_pass = build_purchase_request(money, creditcard_or_token, options)
|
89
|
+
build_response(:sale, @litle.sale(to_pass))
|
90
|
+
end
|
91
|
+
|
92
|
+
def capture(money, authorization, options = {})
|
93
|
+
transaction_id, kind = split_authorization(authorization)
|
94
|
+
to_pass = create_capture_hash(money, transaction_id, options)
|
95
|
+
build_response(:capture, @litle.capture(to_pass))
|
96
|
+
end
|
97
|
+
|
98
|
+
# Note: Litle requires that authorization requests be voided via auth_reversal
|
99
|
+
# and other requests via void. To maintain the same interface as the other
|
100
|
+
# gateways the transaction_id and the kind of transaction are concatenated
|
101
|
+
# together with a ; separator (e.g. 1234;authorization)
|
102
|
+
#
|
103
|
+
# A partial auth_reversal can be accomplished by passing :amount as an option
|
104
|
+
def void(identification, options = {})
|
105
|
+
transaction_id, kind = split_authorization(identification)
|
106
|
+
if(kind == 'authorization')
|
107
|
+
to_pass = create_auth_reversal_hash(transaction_id, options[:amount], options)
|
108
|
+
build_response(:authReversal, @litle.auth_reversal(to_pass))
|
109
|
+
else
|
110
|
+
to_pass = create_void_hash(transaction_id, options)
|
111
|
+
build_response(:void, @litle.void(to_pass))
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def credit(money, identification_or_token, options = {})
|
116
|
+
to_pass = build_credit_request(money, identification_or_token, options)
|
117
|
+
build_response(:credit, @litle.credit(to_pass))
|
118
|
+
end
|
119
|
+
|
120
|
+
def store(creditcard_or_paypage_registration_id, options = {})
|
121
|
+
to_pass = create_token_hash(creditcard_or_paypage_registration_id, options)
|
122
|
+
build_response(:registerToken, @litle.register_token_request(to_pass), %w(000 801 802))
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
CARD_TYPE = {
|
128
|
+
'visa' => 'VI',
|
129
|
+
'master' => 'MC',
|
130
|
+
'american_express' => 'AX',
|
131
|
+
'discover' => 'DI',
|
132
|
+
'jcb' => 'DI',
|
133
|
+
'diners_club' => 'DI'
|
134
|
+
}
|
135
|
+
|
136
|
+
AVS_RESPONSE_CODE = {
|
137
|
+
'00' => 'Y',
|
138
|
+
'01' => 'X',
|
139
|
+
'02' => 'D',
|
140
|
+
'10' => 'Z',
|
141
|
+
'11' => 'W',
|
142
|
+
'12' => 'A',
|
143
|
+
'13' => 'A',
|
144
|
+
'14' => 'P',
|
145
|
+
'20' => 'N',
|
146
|
+
'30' => 'S',
|
147
|
+
'31' => 'R',
|
148
|
+
'32' => 'U',
|
149
|
+
'33' => 'R',
|
150
|
+
'34' => 'I',
|
151
|
+
'40' => 'E'
|
152
|
+
}
|
153
|
+
|
154
|
+
def url
|
155
|
+
return @options[:url] if @options[:url].present?
|
156
|
+
|
157
|
+
test? ? self.test_url : self.live_url
|
158
|
+
end
|
159
|
+
|
160
|
+
def build_response(kind, litle_response, valid_responses=%w(000))
|
161
|
+
response = Hash.from_xml(litle_response.raw_xml.to_s)['litleOnlineResponse']
|
162
|
+
|
163
|
+
if response['response'] == "0"
|
164
|
+
detail = response["#{kind}Response"]
|
165
|
+
fraud = fraud_result(detail)
|
166
|
+
Response.new(
|
167
|
+
valid_responses.include?(detail['response']),
|
168
|
+
detail['message'],
|
169
|
+
{ :litleOnlineResponse => response },
|
170
|
+
:authorization => authorization_from(detail, kind),
|
171
|
+
:avs_result => { :code => fraud['avs'] },
|
172
|
+
:cvv_result => fraud['cvv'],
|
173
|
+
:test => test?
|
174
|
+
)
|
175
|
+
else
|
176
|
+
Response.new(false, response['message'], :litleOnlineResponse => response, :test => test?)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Generates an authorization string of the appropriate id and the kind of transaction
|
181
|
+
# See #void for how the kind is used
|
182
|
+
def authorization_from(litle_response, kind)
|
183
|
+
case kind
|
184
|
+
when :registerToken
|
185
|
+
authorization = litle_response['litleToken']
|
186
|
+
else
|
187
|
+
authorization = [litle_response['litleTxnId'], kind.to_s].join(";")
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def split_authorization(authorization)
|
192
|
+
transaction_id, kind = authorization.to_s.split(';')
|
193
|
+
[transaction_id, kind]
|
194
|
+
end
|
195
|
+
|
196
|
+
def build_authorize_request(money, creditcard_or_token, options)
|
197
|
+
payment_method = build_payment_method(creditcard_or_token, options)
|
198
|
+
|
199
|
+
hash = create_hash(money, options)
|
200
|
+
|
201
|
+
add_creditcard_or_cardtoken_hash(hash, payment_method)
|
202
|
+
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
def build_purchase_request(money, creditcard_or_token, options)
|
207
|
+
payment_method = build_payment_method(creditcard_or_token, options)
|
208
|
+
|
209
|
+
hash = create_hash(money, options)
|
210
|
+
|
211
|
+
add_creditcard_or_cardtoken_hash(hash, payment_method)
|
212
|
+
|
213
|
+
hash
|
214
|
+
end
|
215
|
+
|
216
|
+
def build_credit_request(money, identification_or_token, options)
|
217
|
+
payment_method = build_payment_method(identification_or_token, options)
|
218
|
+
|
219
|
+
hash = create_hash(money, options)
|
220
|
+
|
221
|
+
add_identification_or_cardtoken_hash(hash, payment_method)
|
222
|
+
|
223
|
+
unless payment_method.is_a?(LitleCardToken)
|
224
|
+
hash['orderSource'] = nil
|
225
|
+
hash['orderId'] = nil
|
226
|
+
end
|
227
|
+
|
228
|
+
hash
|
229
|
+
end
|
230
|
+
|
231
|
+
def build_payment_method(payment_method, options)
|
232
|
+
result = payment_method
|
233
|
+
|
234
|
+
# Build instance of the LitleCardToken class for internal use if this is a token request.
|
235
|
+
if payment_method.is_a?(String) && options.has_key?(:token)
|
236
|
+
result = LitleCardToken.new(:token => payment_method)
|
237
|
+
result.month = options[:token][:month]
|
238
|
+
result.year = options[:token][:year]
|
239
|
+
result.verification_value = options[:token][:verification_value]
|
240
|
+
result.brand = options[:token][:brand]
|
241
|
+
end
|
242
|
+
|
243
|
+
result
|
244
|
+
end
|
245
|
+
|
246
|
+
def add_creditcard_or_cardtoken_hash(hash, creditcard_or_cardtoken)
|
247
|
+
if creditcard_or_cardtoken.is_a?(LitleCardToken)
|
248
|
+
add_cardtoken_hash(hash, creditcard_or_cardtoken)
|
249
|
+
else
|
250
|
+
add_creditcard_hash(hash, creditcard_or_cardtoken)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def add_identification_or_cardtoken_hash(hash, identification_or_cardtoken)
|
255
|
+
if identification_or_cardtoken.is_a?(LitleCardToken)
|
256
|
+
add_cardtoken_hash(hash, identification_or_cardtoken)
|
257
|
+
else
|
258
|
+
transaction_id, kind = split_authorization(identification_or_cardtoken)
|
259
|
+
hash['litleTxnId'] = transaction_id
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
def add_cardtoken_hash(hash, cardtoken)
|
264
|
+
token_info = {}
|
265
|
+
token_info['litleToken'] = cardtoken.token
|
266
|
+
token_info['expDate'] = cardtoken.exp_date if cardtoken.exp_date?
|
267
|
+
token_info['cardValidationNum'] = cardtoken.verification_value unless cardtoken.verification_value.blank?
|
268
|
+
token_info['type'] = cardtoken.type unless cardtoken.type.blank?
|
269
|
+
|
270
|
+
hash['token'] = token_info
|
271
|
+
hash
|
272
|
+
end
|
273
|
+
|
274
|
+
def add_creditcard_hash(hash, creditcard)
|
275
|
+
cc_type = CARD_TYPE[creditcard.brand]
|
276
|
+
exp_date_yr = creditcard.year.to_s[2..3]
|
277
|
+
exp_date_mo = '%02d' % creditcard.month.to_i
|
278
|
+
exp_date = exp_date_mo + exp_date_yr
|
279
|
+
|
280
|
+
card_info = {
|
281
|
+
'type' => cc_type,
|
282
|
+
'number' => creditcard.number,
|
283
|
+
'expDate' => exp_date,
|
284
|
+
'cardValidationNum' => creditcard.verification_value
|
285
|
+
}
|
286
|
+
|
287
|
+
hash['card'] = card_info
|
288
|
+
hash
|
289
|
+
end
|
290
|
+
|
291
|
+
def create_capture_hash(money, authorization, options)
|
292
|
+
hash = create_hash(money, options)
|
293
|
+
hash['litleTxnId'] = authorization
|
294
|
+
hash
|
295
|
+
end
|
296
|
+
|
297
|
+
def create_token_hash(creditcard_or_paypage_registration_id, options)
|
298
|
+
hash = create_hash(0, options)
|
299
|
+
|
300
|
+
if creditcard_or_paypage_registration_id.is_a?(String)
|
301
|
+
hash['paypageRegistrationId'] = creditcard_or_paypage_registration_id
|
302
|
+
else
|
303
|
+
hash['accountNumber'] = creditcard_or_paypage_registration_id.number
|
304
|
+
end
|
305
|
+
|
306
|
+
hash
|
307
|
+
end
|
308
|
+
|
309
|
+
def create_void_hash(identification, options)
|
310
|
+
hash = create_hash(nil, options)
|
311
|
+
hash['litleTxnId'] = identification
|
312
|
+
hash
|
313
|
+
end
|
314
|
+
|
315
|
+
def create_auth_reversal_hash(identification, money, options)
|
316
|
+
hash = create_hash(money, options)
|
317
|
+
hash['litleTxnId'] = identification
|
318
|
+
hash
|
319
|
+
end
|
320
|
+
|
321
|
+
def create_hash(money, options)
|
322
|
+
fraud_check_type = {}
|
323
|
+
if options[:ip]
|
324
|
+
fraud_check_type['customerIpAddress'] = options[:ip]
|
325
|
+
end
|
326
|
+
|
327
|
+
enhanced_data = {}
|
328
|
+
if options[:invoice]
|
329
|
+
enhanced_data['invoiceReferenceNumber'] = options[:invoice]
|
330
|
+
end
|
331
|
+
|
332
|
+
if options[:description]
|
333
|
+
enhanced_data['customerReference'] = options[:description]
|
334
|
+
end
|
335
|
+
|
336
|
+
if options[:billing_address]
|
337
|
+
bill_to_address = {
|
338
|
+
'name' => options[:billing_address][:name],
|
339
|
+
'companyName' => options[:billing_address][:company],
|
340
|
+
'addressLine1' => options[:billing_address][:address1],
|
341
|
+
'addressLine2' => options[:billing_address][:address2],
|
342
|
+
'city' => options[:billing_address][:city],
|
343
|
+
'state' => options[:billing_address][:state],
|
344
|
+
'zip' => options[:billing_address][:zip],
|
345
|
+
'country' => options[:billing_address][:country],
|
346
|
+
'email' => options[:email],
|
347
|
+
'phone' => options[:billing_address][:phone]
|
348
|
+
}
|
349
|
+
end
|
350
|
+
if options[:shipping_address]
|
351
|
+
ship_to_address = {
|
352
|
+
'name' => options[:shipping_address][:name],
|
353
|
+
'companyName' => options[:shipping_address][:company],
|
354
|
+
'addressLine1' => options[:shipping_address][:address1],
|
355
|
+
'addressLine2' => options[:shipping_address][:address2],
|
356
|
+
'city' => options[:shipping_address][:city],
|
357
|
+
'state' => options[:shipping_address][:state],
|
358
|
+
'zip' => options[:shipping_address][:zip],
|
359
|
+
'country' => options[:shipping_address][:country],
|
360
|
+
'email' => options[:email],
|
361
|
+
'phone' => options[:shipping_address][:phone]
|
362
|
+
}
|
363
|
+
end
|
364
|
+
|
365
|
+
hash = {
|
366
|
+
'billToAddress' => bill_to_address,
|
367
|
+
'shipToAddress' => ship_to_address,
|
368
|
+
'orderId' => (options[:order_id] || @options[:order_id]),
|
369
|
+
'customerId' => options[:customer],
|
370
|
+
'reportGroup' => (options[:merchant] || @options[:merchant]),
|
371
|
+
'merchantId' => (options[:merchant_id] || @options[:merchant_id]),
|
372
|
+
'orderSource' => (options[:order_source] || 'ecommerce'),
|
373
|
+
'enhancedData' => enhanced_data,
|
374
|
+
'fraudCheckType' => fraud_check_type,
|
375
|
+
'user' => (options[:user] || @options[:user]),
|
376
|
+
'password' => (options[:password] || @options[:password]),
|
377
|
+
'version' => (options[:version] || @options[:version]),
|
378
|
+
'url' => (options[:url] || url),
|
379
|
+
'proxy_addr' => (options[:proxy_addr] || @options[:proxy_addr]),
|
380
|
+
'proxy_port' => (options[:proxy_port] || @options[:proxy_port]),
|
381
|
+
'id' => (options[:id] || options[:order_id] || @options[:order_id])
|
382
|
+
}
|
383
|
+
|
384
|
+
if (!money.nil? && money.to_s.length > 0)
|
385
|
+
hash.merge!({ 'amount' => money })
|
386
|
+
end
|
387
|
+
hash
|
388
|
+
end
|
389
|
+
|
390
|
+
def fraud_result(authorization_response)
|
391
|
+
if result = authorization_response['fraudResult']
|
392
|
+
if result.key?('cardValidationResult')
|
393
|
+
cvv_to_pass = result['cardValidationResult'].blank? ? "P" : result['cardValidationResult']
|
394
|
+
end
|
395
|
+
|
396
|
+
avs_to_pass = AVS_RESPONSE_CODE[result['avsResult']] unless result['avsResult'].blank?
|
397
|
+
end
|
398
|
+
{ 'cvv' => cvv_to_pass, 'avs' => avs_to_pass }
|
399
|
+
end
|
400
|
+
|
401
|
+
# A +LitleCardToken+ object represents a tokenized credit card, and is capable of validating the various
|
402
|
+
# data associated with these.
|
403
|
+
#
|
404
|
+
# == Example Usage
|
405
|
+
# token = LitleCardToken.new(
|
406
|
+
# :token => '1234567890123456',
|
407
|
+
# :month => '9',
|
408
|
+
# :year => '2010',
|
409
|
+
# :brand => 'visa',
|
410
|
+
# :verification_value => '123'
|
411
|
+
# )
|
412
|
+
#
|
413
|
+
# token.valid? # => true
|
414
|
+
# cc.exp_date # => 0910
|
415
|
+
#
|
416
|
+
class LitleCardToken
|
417
|
+
include Validateable
|
418
|
+
|
419
|
+
# Returns or sets the token. (required)
|
420
|
+
#
|
421
|
+
# @return [String]
|
422
|
+
attr_accessor :token
|
423
|
+
|
424
|
+
# Returns or sets the expiry month for the card associated with token. (optional)
|
425
|
+
#
|
426
|
+
# @return [Integer]
|
427
|
+
attr_accessor :month
|
428
|
+
|
429
|
+
# Returns or sets the expiry year for the card associated with token. (optional)
|
430
|
+
#
|
431
|
+
# @return [Integer]
|
432
|
+
attr_accessor :year
|
433
|
+
|
434
|
+
# Returns or sets the card verification value. (optional)
|
435
|
+
#
|
436
|
+
# @return [String] the verification value
|
437
|
+
attr_accessor :verification_value
|
438
|
+
|
439
|
+
# Returns or sets the credit card brand. (optional)
|
440
|
+
#
|
441
|
+
# Valid card types are
|
442
|
+
#
|
443
|
+
# * +'visa'+
|
444
|
+
# * +'master'+
|
445
|
+
# * +'discover'+
|
446
|
+
# * +'american_express'+
|
447
|
+
# * +'diners_club'+
|
448
|
+
# * +'jcb'+
|
449
|
+
# * +'switch'+
|
450
|
+
# * +'solo'+
|
451
|
+
# * +'dankort'+
|
452
|
+
# * +'maestro'+
|
453
|
+
# * +'forbrugsforeningen'+
|
454
|
+
# * +'laser'+
|
455
|
+
#
|
456
|
+
# @return (String) the credit card brand
|
457
|
+
attr_accessor :brand
|
458
|
+
|
459
|
+
# Returns the Litle credit card type identifier.
|
460
|
+
#
|
461
|
+
# @return (String) the credit card type identifier
|
462
|
+
def type
|
463
|
+
CARD_TYPE[brand] unless brand.blank?
|
464
|
+
end
|
465
|
+
|
466
|
+
# Returns true if the expiration date is set.
|
467
|
+
#
|
468
|
+
# @return (Boolean)
|
469
|
+
def exp_date?
|
470
|
+
!month.to_i.zero? && !year.to_i.zero?
|
471
|
+
end
|
472
|
+
|
473
|
+
# Returns the card token expiration date in MMYY format.
|
474
|
+
#
|
475
|
+
# @return (String) the expiration date in MMYY format
|
476
|
+
def exp_date
|
477
|
+
result = ''
|
478
|
+
if exp_date?
|
479
|
+
exp_date_yr = year.to_s[2..3]
|
480
|
+
exp_date_mo = '%02d' % month.to_i
|
481
|
+
|
482
|
+
result = exp_date_mo + exp_date_yr
|
483
|
+
end
|
484
|
+
result
|
485
|
+
end
|
486
|
+
|
487
|
+
# Validates the card token details.
|
488
|
+
#
|
489
|
+
# Any validation errors are added to the {#errors} attribute.
|
490
|
+
def validate
|
491
|
+
validate_card_token
|
492
|
+
validate_expiration_date
|
493
|
+
validate_card_brand
|
494
|
+
end
|
495
|
+
|
496
|
+
def check?
|
497
|
+
false
|
498
|
+
end
|
499
|
+
|
500
|
+
private
|
501
|
+
|
502
|
+
CARD_TYPE = {
|
503
|
+
'visa' => 'VI',
|
504
|
+
'master' => 'MC',
|
505
|
+
'american_express' => 'AX',
|
506
|
+
'discover' => 'DI',
|
507
|
+
'jcb' => 'DI',
|
508
|
+
'diners_club' => 'DI'
|
509
|
+
}
|
510
|
+
|
511
|
+
def before_validate #:nodoc:
|
512
|
+
self.month = month.to_i
|
513
|
+
self.year = year.to_i
|
514
|
+
end
|
515
|
+
|
516
|
+
# Litle XML Reference Guide 1.8.2
|
517
|
+
#
|
518
|
+
# The length of the original card number is reflected in the token, so a
|
519
|
+
# submitted 16-digit number results in a 16-digit token. Also, all tokens
|
520
|
+
# use only numeric characters, so you do not have to change your
|
521
|
+
# systems to accept alpha-numeric characters.
|
522
|
+
#
|
523
|
+
# The credit card token numbers themselves have two parts.
|
524
|
+
# The last four digits match the last four digits of the card number.
|
525
|
+
# The remaining digits (length can vary based upon original card number
|
526
|
+
# length) are a randomly generated.
|
527
|
+
def validate_card_token #:nodoc:
|
528
|
+
if token.to_s.length < 12 || token.to_s.match(/\A\d+\Z/).nil?
|
529
|
+
errors.add :token, "is not a valid card token"
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
def validate_expiration_date #:nodoc:
|
534
|
+
if !month.to_i.zero? || !year.to_i.zero?
|
535
|
+
errors.add :month, "is not a valid month" unless valid_month?(month)
|
536
|
+
errors.add :year, "is not a valid year" unless valid_expiry_year?(year)
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
540
|
+
def validate_card_brand #:nodoc:
|
541
|
+
errors.add :brand, "is invalid" unless brand.blank? || CreditCard.card_companies.keys.include?(brand)
|
542
|
+
end
|
543
|
+
|
544
|
+
def valid_month?(month)
|
545
|
+
(1..12).include?(month.to_i)
|
546
|
+
end
|
547
|
+
|
548
|
+
def valid_expiry_year?(year)
|
549
|
+
year.to_s =~ /\A\d{4}\Z/ && year.to_i > 1987
|
550
|
+
end
|
551
|
+
end
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|