Class: CnpOnline::DetailTax

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

Class Method Summary collapse

Class Method Details

.from_hash(hash, index = 0, name = 'detailTax') ⇒ Object



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/XMLFields.rb', line 497

def self.from_hash(hash, index=0, name='detailTax')
  base = hash[name][index]
  if(base)
    this = DetailTax.new
    this.taxIncludedInTotal = base['taxIncludedInTotal']
    this.taxAmount = base['taxAmount']
    this.taxRate = base['taxRate']
    this.taxTypeIdentifier = base['taxTypeIdentifier']
    this.cardAcceptorTaxId = base['cardAcceptorTaxId']
    SchemaValidation.validate_boolean(this.taxIncludedInTotal, false, name, 'taxIncludedInTotal')
    SchemaValidation.validate_size(this.taxAmount, true, -999999999999, 999999999999, name, 'taxAmount')
    SchemaValidation.validate_regex(this.taxRate, false, /\A(\+|\-)?\d*\.?\d*\Z/, name, 'taxRate')
    SchemaValidation.validate_enum(this.taxTypeIdentifier, false, ['00','01','02','03','04','05','06','10','11','12','13','14','20','21','22'], name, 'taxTypeIdentifier')
    SchemaValidation.validate_length(this.cardAcceptorTaxId, false, 1, 20, name, 'cardAcceptorTaxId')
    this
  else
    nil
  end
end