Class: Ticketbai::Documents::Annulment

Inherits:
Ticketbai::Document show all
Defined in:
lib/ticketbai/documents/annulment.rb

Constant Summary collapse

ROOT_NAME =
'T:AnulaTicketBai'.freeze
XMLNS =
{
  'xmlns:T' => 'urn:ticketbai:anulacion'
}.freeze
ATTRIBUTES =
%i[issuer invoice_header software].freeze

Constants inherited from Ticketbai::Document

Ticketbai::Document::TBAI_VERSION

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Annulment

Returns a new instance of Annulment.

Parameters:



18
19
20
# File 'lib/ticketbai/documents/annulment.rb', line 18

def initialize(**args)
  super(args)
end

Instance Method Details

#createNokogiri::XML::Builder

Returns:

  • (Nokogiri::XML::Builder)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ticketbai/documents/annulment.rb', line 23

def create
  builder = Nokogiri::XML::Builder.new(encoding: Encoding::UTF_8.to_s) do |xml|
    xml.TicketBai(XMLNS) do
      xml.Cabecera do
        xml.IDVersionTBAI TBAI_VERSION
      end
      xml.IDFactura do
        @issuer.build_xml(xml)
        @invoice_header.build_xml(xml)
      end
      xml.HuellaTBAI do
        @software.build_xml(xml)
      end
    end
  end

  modify_xml_root_name(builder)

  builder
end