Module: SunatInvoice::Utils

Included in:
Invoice, Item, Provider, Signature, Tax
Defined in:
lib/sunat_invoice/utils.rb

Constant Summary collapse

UBL_NAMESPACES =
{
  'xmlns' => "#{@namespace_path}:Invoice-2",
  'xmlns:cac' => "#{@namespace_path}:CommonAggregateComponents-2",
  'xmlns:cbc' => "#{@namespace_path}:CommonBasicComponents-2",
  'xmlns:ccts' => 'urn:un:unece:uncefact:documentation:2',
  'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#',
  'xmlns:ext' => "#{@namespace_path}:CommonExtensionComponents-2",
  'xmlns:qdt' => "#{@namespace_path}:QualifiedDatatypes-2",
  'xmlns:sac' => "#{@sunat_namespace_path}:SunatAggregateComponents-1",
  'xmlns:udt' => 'urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2',
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance'
}.freeze

Instance Method Summary collapse

Instance Method Details

#amount_xml(xml, tag, price, currency) ⇒ Object



27
28
29
# File 'lib/sunat_invoice/utils.rb', line 27

def amount_xml(xml, tag, price, currency)
  xml.send(tag, price, currencyID: currency)
end

#ubl_ext(xml, &block) ⇒ Object



21
22
23
24
25
# File 'lib/sunat_invoice/utils.rb', line 21

def ubl_ext(xml, &block)
  xml['ext'].UBLExtension do
    xml['ext'].ExtensionContent(&block)
  end
end