Sha256: ef0e60bad93067d1fb12f2d8e6b20f1d2c362eaf98011f21d28fca387679bb90
Contents?: true
Size: 1.03 KB
Versions: 21
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module BrInvoicesPdf module Nfce module Parser module Customer extend Util::XmlLocate extend Util::MountParams module_function def dest_root_path(xml) "#{root_path(xml)}/dest" end def execute(xml) identification_type = identification_type_by(xml) root_path = dest_root_path(xml) { identification_type: identification_type, identification: locate_element(xml, "#{root_path}/#{identification_type}"), address: mount(xml, address_params(xml, root_path, 'Dest')) } end def identification_type_by(xml) root_path = dest_root_path(xml) return 'CNPJ' if locate_element(xml, "#{root_path}/CNPJ") return 'CPF' if locate_element(xml, "#{root_path}/CPF") return 'idEstrangeiro' if locate_element(xml, "#{root_path}/idEstrangeiro") end private_class_method :identification_type_by end end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
br_invoices_pdf-0.2.8 | lib/br_invoices_pdf/nfce/parser/customer.rb |