Class: LitleOnline::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



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/XMLFields.rb', line 477

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