Class: CnpOnline::Echeck

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/XMLFields.rb

Class Method Summary collapse

Class Method Details

.from_hash(hash, name = 'echeck') ⇒ Object



1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
# File 'lib/XMLFields.rb', line 1009

def self.from_hash(hash, name='echeck')
  base = hash[name]
  if(base)
    this = Echeck.new
    this.accType = base['accType']
    this.accNum = base['accNum']
    this.routingNum = base['routingNum']
    this.checkNum = base['checkNum']
    this.ccdPaymentInformation = base['ccdPaymentInformation']
    SchemaValidation.validate_enum(this.accType, true, ['Checking','Savings','Corporate','Corp Savings'], name, 'accType')
    SchemaValidation.validate_length(this.accNum, true, 1, 17, name, 'accNum')
    SchemaValidation.validate_length(this.routingNum, true, 9, 9, name, 'routingNum')
    SchemaValidation.validate_length(this.checkNum, false, 1, 15, name, 'checkNum')
    SchemaValidation.validate_length(this.ccdPaymentInformation, false, 1, 80, name, 'ccdPaymentInformation')
    this
  else
    nil
  end
end