Sha256: a1761ebbb88d8a66dc44b65fc9742934af49bedf5ca537c38bc3948920ce2ff3

Contents?: true

Size: 708 Bytes

Versions: 25

Compression:

Stored size: 708 Bytes

Contents

module BrDanfe
  module DanfeLib
    module NfeLib
      class Cst
        def self.to_danfe(xml)
          value = origin(xml)

          if csosn?(xml)
            value += xml.css('ICMS/*/CSOSN').text
          elsif cst?(xml)
            value += xml.css('ICMS/*/CST').text
          end

          value
        end

        def self.origin(xml)
          xml.css('ICMS/*/orig').text
        end
        private_class_method :origin

        def self.cst?(xml)
          xml.css('ICMS/*/CST').text != ''
        end
        private_class_method :cst?

        def self.csosn?(xml)
          xml.css('ICMS/*/CSOSN').text != ''
        end
        private_class_method :csosn?
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
br_danfe-1.0.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.20.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.19.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.18.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.8 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.7 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.6 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.5 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.4 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.3 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.2 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.1 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.17.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.16.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.15.1 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.15.0 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.14.5 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.14.4 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.14.3 lib/br_danfe/danfe_lib/nfe_lib/cst.rb
br_danfe-0.14.2 lib/br_danfe/danfe_lib/nfe_lib/cst.rb