652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
|
# File 'lib/XMLFields.rb', line 652
def self.from_hash(hash, name='card')
base = hash[name]
if(base)
this = Card.new
this.mop = base['type']
this.track = base['track']
this.number = base['number']
this.expDate = base['expDate']
this.cardValidationNum = base['cardValidationNum']
this.pin = base['pin']
SchemaValidation.validate_enum(this.mop, false, ['','MC','VI','AX','DC','DI','PP','JC','BL','EC','GC'], name, 'type')
SchemaValidation.validate_length(this.track, false, 1, 256, name, 'track')
SchemaValidation.validate_length(this.number, false, 13, 25, name, 'number')
SchemaValidation.validate_length(this.expDate, false, 4, 4, name, 'expDate')
SchemaValidation.validate_length(this.cardValidationNum, false, 1, 4, name, 'cardValidationNum')
SchemaValidation.validate_length(this.pin, false, 4, 12, name, 'pin')
this
else
nil
end
end
|