{I" class:ETI"ProcessedAsset;FI"logical_path;TI"$sprangular/models/creditCard.js;FI" pathname;TI"e/home/josh/Projects/Dynamo/sprangular/app/assets/javascripts/sprangular/models/creditCard.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+âC(UI" length;Ti†I" digest;TI"%270ad888c5e25320e6bbc0e4b5f00350;FI" source;TI"†(function() { 'use strict'; Sprangular.CreditCard = (function() { CreditCard.TYPE_NAMES = { master: 'MasterCard', visa: 'Visa', amex: 'American Express', discover: 'Discover', dinersclub: 'Diners Club', jcb: 'JCB' }; Validity.define(CreditCard, { number: ['required', '_validateCardFormat'], month: 'required', year: 'required', cvc: [ { length: { greaterThan: 2, lessThan: 5 } } ] }); function CreditCard() { this.number = ''; this.name = null; this.month = null; this.year = null; this.cvc = null; this.type = null; this.token = null; this.lastDigits = null; } CreditCard.prototype.init = function() { this.id = this.id; this.name = this.name; this.lastDigits = this.last_digits; this.token = this.gateway_payment_profile_id; return this.type = this.cc_type; }; CreditCard.prototype.isNew = function() { return !(this.token && this.token.length > 0); }; CreditCard.prototype.label = function() { return this.constructor.TYPE_NAMES[this.type] + " XXXX-XXXX-XXXX-" + this.lastDigits; }; CreditCard.prototype.determineType = function() { return this.type = this.number.match(/^3[47]/) ? 'amex' : this.number.match(/^4/) ? 'visa' : this.number.match(/^5[1-5]/) ? 'master' : this.number.match(/^6(5|011)/) ? 'discover' : this.number.match(/^3(0[0-5]|36|38)/) ? 'dinersclub' : this.number.match(/^(2131|1800|35)/) ? 'jcb' : void 0; }; CreditCard.prototype.same = function(other) { return this.id === other.id; }; CreditCard.prototype._validateCardFormat = function() { if (!Sprangular.Luhn.isValid(this.number)) { return 'invalid card number'; } }; return CreditCard; })(); }).call(this); ;TI"dependency_digest;TI"%127215b4eab924e105224949588ba27d;FI"required_paths;T[I"e/home/josh/Projects/Dynamo/sprangular/app/assets/javascripts/sprangular/models/creditCard.coffee;FI"dependency_paths;T[{I" path;TI"e/home/josh/Projects/Dynamo/sprangular/app/assets/javascripts/sprangular/models/creditCard.coffee;FI" mtime;TI"2015-04-10T17:42:58-04:00;TI" digest;TI"%e6cac9e9efb2426ce7d0724bd87cdfa7;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F