Sha256: 674111da478c252603b6f9370e352d06ba00bc7886d7f5948acec78fb73beda6

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

module BrInvoicesPdf
  module Nfce
    module Parser
      module Totals
        extend Util::XmlLocate

        module_function

        TOTAL_ROOT_PATH = "#{Util::XmlLocate::ROOT_PATH}/total/ICMSTot"

        def execute(xml)
          {
            items: Products.execute(xml).count,
            subtotal: locate_element(xml, "#{TOTAL_ROOT_PATH}/vProd"),
            discounts: locate_element(xml, "#{TOTAL_ROOT_PATH}/vDesc"),
            total: locate_element(xml, "#{TOTAL_ROOT_PATH}/vNF"),
            cashback: '0.00'
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.7 lib/br_invoices_pdf/nfce/parser/totals.rb
br_invoices_pdf-0.2.6.alpha.19 lib/br_invoices_pdf/nfce/parser/totals.rb