Sha256: dde716390ed95ce39d8d19635796b28fb744160f778c09ab792d15d51ca5b8c9
Contents?: true
Size: 1.31 KB
Versions: 16
Compression:
Stored size: 1.31 KB
Contents
module Einvoice module Tradevan module Model class VoidData < Base VALID_OPTIONS_KEYS = [ :type, :saleIdentifier, :invoiceNumber, :invoicePaperReturned, :allowanceNumber, :allowancePaperReturned, :companyUn ].freeze attr_accessor *VALID_OPTIONS_KEYS validates :type, presence: true, length: { is: 1 }, inclusion: { in: %w(C I A) } # Type C I validates :saleIdentifier, presence: true, length: { maximum: 100 }, if: proc { %w(C I).include?(self.type) } validates :invoiceNumber, presence: true, length: { is: 10 }, if: proc { %w(C I).include?(self.type) } validates :invoicePaperReturned, presence: true, length: { maximum: 1 }, inclusion: { in: %w(Y N) }, if: proc { %w(C I).include?(self.type) } # Type A validates :companyUn, presence: true, length: { is: 8 }, if: proc { self.type == 'A' } validates :allowanceNumber, presence: true, length: { is: 16 }, if: proc { self.type == 'A' } validates :allowancePaperReturned, presence: true, length: { is: 1 }, inclusion: { in: %w(Y N) }, if: proc { self.type == 'A' } def payload serializable_hash(except: [:errors, :validation_context, :itemList]) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems