Sha256: dc81ef6cecbf8461483c5ae538745b17075479b45c6f5ccf1a6a4b70d17a0c76
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
class Skr.Models.CreditCard extends Skr.Models.Base props: name: 'string' number: 'string' month: 'integer' year: 'integer' cvc: 'integer' session: parent: 'object' expiry: 'string' linkToAddress: 'object' derived: cardType: deps: ['number'], fn: -> Skr.Vendor.Payment.fns.cardType(@number) cardIsValid: deps: ['name', 'number', 'month', 'year', 'cvc', 'cardType'], fn: -> v = Skr.Vendor.Payment.fns @name and _.trim(@name.length) > 2 and @cardType and v.validateCardNumber(@number) and v.validateCardExpiry(@month, @year) and v.validateCardCVC(@cvc, @cardType) events: 'change:expiry': 'onExpiryChange' 'change:name': 'onNameChange' initialize: -> @listenTo(@linkToAddress, 'change:name', @onAddressNameChange) if @linkToAddress onAddressNameChange: -> if @name is @linkToAddress.previousAttributes().name @name = @linkToAddress.name onNameChange: -> @parent.name = @name onExpiryChange: -> [@month, @year] = @expiry.split(' / ') dataForSave: (options = {}) -> attrs = super # ActiveMerchant uses 'verification_value' attrs.verification_value = attrs.cvc attrs
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stockor-0.5.0 | client/skr/models/CreditCard.coffee |
stockor-0.4.0 | client/skr/models/CreditCard.coffee |