Class: BrNfe::Service::Thema::V1::Base
- Inherits:
-
Base
- Object
- ActiveModelBase
- Base
- Base
- BrNfe::Service::Thema::V1::Base
- Defined in:
- lib/br_nfe/service/thema/v1/base.rb
Direct Known Subclasses
CancelaNfse, ConsultaLoteRps, ConsultaNfsPorRps, ConsultaNfse, RecepcaoLoteRps
Instance Attribute Summary
Attributes inherited from Base
Attributes inherited from Base
#certificate_pkcs12_password, #certificate_pkcs12_path, #certificate_pkcs12_value, #env, #ibge_code_of_issuer_city, #ibge_code_of_issuer_uf
Attributes inherited from ActiveModelBase
Instance Method Summary collapse
- #canonicalization_method_algorithm ⇒ Object
-
#content_xml ⇒ Object
Método é sobrescrito para atender o padrão do órgão emissor.
- #get_wsdl_by_city ⇒ Object
- #message_namespaces ⇒ Object
-
#namespace_identifier ⇒ Object
Setado manualmente em content_xml.
- #nfse_xml_path ⇒ Object
- #response_encoding ⇒ Object
-
#signature_type ⇒ Object
Assinatura através da gem signer.
-
#soap_body_root_tag ⇒ Object
Método que deve ser sobrescrito em cada subclass.
- #soap_namespaces ⇒ Object
-
#ts_aliquota(value) ⇒ Object
Alíquota.
Methods inherited from Base
#body_xml_path, #request, #response_root_path, #xml_current_dir_path
Methods included from Concerns::ValuesTs::ServiceV1
#ts_art, #ts_bairro, #ts_cep, #ts_cnpj, #ts_codigo_cancelamento_nfse, #ts_codigo_cnae, #ts_codigo_mensagem_alerta, #ts_codigo_municipio_ibge, #ts_codigo_obra, #ts_codigo_tributacao, #ts_codigo_verificacao, #ts_complemento_endereco, #ts_cpf, #ts_date, #ts_datetime, #ts_descricao_mensagem_alerta, #ts_discriminacao, #ts_email, #ts_endereco, #ts_id_tag, #ts_indicacao_cpf_cnpj, #ts_inscricao_municipal, #ts_item_lista_servico, #ts_natureza_operacao, #ts_nome_fantasia, #ts_numero_endereco, #ts_numero_lote, #ts_numero_nfse, #ts_numero_protocolo, #ts_numero_rps, #ts_outras_informacoes, #ts_quantidade_rps, #ts_razao_social, #ts_regime_especial_tributacao, #ts_serie_rps, #ts_sim_nao, #ts_situacao_lote_rps, #ts_status_nfse, #ts_status_rps, #ts_telefone, #ts_tipo_rps, #ts_uf, #ts_valor
Methods inherited from Base
#certificado_obrigatorio?, #certificate, #certificate=, #certificate_key, #certificate_key=, #certificate_pkcs12, #certificate_pkcs12=, #client_wsdl, #client_wsdl_params, #env_namespace, #env_test?, #find_xml, #get_xml_dirs, #id_attribute?, #method_wsdl, #namespace_for_signature, #namespace_for_tags, #original_response, #render_xml, #response, #sign_xml, #signature_type?, #soap_xml, #tag_xml, #url_wsdl, #wsdl_encoding, #xml_builder, #xml_current_dir_path, #xml_default_dir_path, #xml_version
Methods included from Association::HaveEmitente
Methods inherited from ActiveModelBase
#assign_attributes, #default_values, #initialize
Constructor Details
This class inherits a constructor from BrNfe::ActiveModelBase
Instance Method Details
#canonicalization_method_algorithm ⇒ Object
29 30 31 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 29 def canonicalization_method_algorithm 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315' end |
#content_xml ⇒ Object
Método é sobrescrito para atender o padrão do órgão emissor. Deve ser enviado o XML da requsiução dentro da tag CDATA seguindo a estrutura requerida.
<b><Tipo de retorno: /b> String XML
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 70 def content_xml xml_signed = xml_builder.html_safe dados = "<ns1:#{soap_body_root_tag}>" dados += '<ns1:xml>' dados += '<![CDATA[' dados += '<?xml version="1.0" encoding="ISO-8859-1"?>' unless xml_signed.include?('<?xml') dados += xml_signed dados += ']]>' dados += '</ns1:xml>' dados += "</ns1:#{soap_body_root_tag}>" dados end |
#get_wsdl_by_city ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 7 def get_wsdl_by_city if ibge_code_of_issuer_city == '4205902' # Gaspar-SC { send: "http://nfse#{'hml' if env == :test}.gaspar.sc.gov.br/nfse/services/NFSEremessa?wsdl", consult: "http://nfse#{'hml' if env == :test}.gaspar.sc.gov.br/nfse/services/NFSEconsulta?wsdl", cancel: "http://nfse#{'hml' if env == :test}.gaspar.sc.gov.br/nfse/services/NFSEcancelamento?wsdl" } else # Default for tdd { send: "http://nfsehml.gaspar.sc.gov.br/nfse/services/NFSEremessa?wsdl", consult: "http://nfsehml.gaspar.sc.gov.br/nfse/services/NFSEconsulta?wsdl", cancel: "http://nfsehml.gaspar.sc.gov.br/nfse/services/NFSEcancelamento?wsdl" } end end |
#message_namespaces ⇒ Object
33 34 35 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 33 def {"xmlns" => "http://www.abrasf.org.br/ABRASF/arquivos/nfse.xsd"} end |
#namespace_identifier ⇒ Object
Setado manualmente em content_xml
43 44 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 43 def namespace_identifier end |
#nfse_xml_path ⇒ Object
60 61 62 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 60 def nfse_xml_path '//*' #Começa o XMl a partir do body e pega a tag ConsultarNfseResposta end |
#response_encoding ⇒ Object
56 57 58 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 56 def response_encoding 'ISO-8859-1' end |
#signature_type ⇒ Object
Assinatura através da gem signer
25 26 27 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 25 def signature_type :method_sign end |
#soap_body_root_tag ⇒ Object
Método que deve ser sobrescrito em cada subclass. É utilizado para saber qual a tag root de cada requisição
<b><Tipo de retorno: /b> String
51 52 53 54 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 51 def soap_body_root_tag # 'recepcionarLoteRps' < Exemplo raise "Deve ser sobrescrito nas subclasses" end |
#soap_namespaces ⇒ Object
37 38 39 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 37 def soap_namespaces super.merge({"xmlns:ns1" => "http://server.nfse.thema.inf.br"}) end |
#ts_aliquota(value) ⇒ Object
Alíquota. Valor percentual.
Formato: 0.XXXX
Ex: 1% = 0.01
25,5% = 0.255
100% = 1.0
Irá receber o valor decimal do percentual da aliquota e irá dividir por 100 conforme indicado na documentação.
92 93 94 95 |
# File 'lib/br_nfe/service/thema/v1/base.rb', line 92 def ts_aliquota value value = value.to_f/100 value_monetary(value, 4) end |