br_nfe 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.travis.yml +8 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +27 -3
- data/LICENSE +1 -1
- data/README.markdown +10 -12
- data/Rakefile +13 -0
- data/br_nfe.gemspec +18 -21
- data/lib/br_nfe/active_model_base.rb +7 -1
- data/lib/br_nfe/base.rb +175 -37
- data/lib/br_nfe/endereco.rb +7 -1
- data/lib/br_nfe/helper/have_rps.rb +1 -1
- data/lib/br_nfe/helper/values_ts/service_v1.rb +313 -0
- data/lib/br_nfe/response/service/build_response.rb +286 -0
- data/lib/br_nfe/response/service/default.rb +185 -0
- data/lib/br_nfe/{servico/response → response/service}/nota_fiscal.rb +11 -10
- data/lib/br_nfe/response/service/paths/base.rb +93 -0
- data/lib/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta.rb +22 -0
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta.rb +25 -0
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta.rb +25 -0
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta.rb +25 -0
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta.rb +31 -0
- data/lib/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta.rb +36 -0
- data/lib/br_nfe/response/service/paths/v1/tc_nfse.rb +127 -0
- data/lib/br_nfe/service/base.rb +59 -0
- data/lib/br_nfe/service/betha/base.rb +8 -0
- data/lib/br_nfe/service/betha/v1/cancelamento_nfs.rb +39 -0
- data/lib/br_nfe/service/betha/v1/consulta_lote_rps.rb +34 -0
- data/lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb +32 -0
- data/lib/br_nfe/service/betha/v1/consulta_nfse.rb +32 -0
- data/lib/br_nfe/service/betha/v1/consulta_situacao_lote_rps.rb +30 -0
- data/lib/br_nfe/service/betha/v1/gateway.rb +21 -0
- data/lib/br_nfe/service/betha/v1/recepcao_lote_rps.rb +37 -0
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta.rb +19 -0
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta.rb +17 -0
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +17 -0
- data/lib/br_nfe/service/concerns/rules/cancelamento_nfs.rb +20 -0
- data/lib/br_nfe/service/concerns/rules/consulta_nfs_por_rps.rb +18 -0
- data/lib/br_nfe/service/concerns/rules/consulta_nfse.rb +29 -0
- data/lib/br_nfe/service/concerns/rules/recepcao_lote_rps.rb +50 -0
- data/lib/br_nfe/{servico → service}/intermediario.rb +1 -1
- data/lib/br_nfe/service/item.rb +70 -0
- data/lib/br_nfe/service/rps.rb +231 -0
- data/lib/br_nfe/service/sc/florianopolis/base.rb +25 -0
- data/lib/br_nfe/service/sc/florianopolis/cancellation.rb +30 -0
- data/lib/br_nfe/service/sc/florianopolis/emission_rps.rb +19 -0
- data/lib/br_nfe/service/sc/florianopolis/xml/_address.xml.slim +21 -0
- data/lib/br_nfe/service/sc/florianopolis/xml/_contact.xml.slim +3 -0
- data/lib/br_nfe/service/sc/florianopolis/xml/_service_item.xml.slim +9 -0
- data/lib/br_nfe/service/sc/florianopolis/xml/cancellation.xml.slim +6 -0
- data/lib/br_nfe/service/sc/florianopolis/xml/inf_requisicao.xml.slim +55 -0
- data/lib/br_nfe/service/sc/gaspar/cancela_nfse.rb +13 -0
- data/lib/br_nfe/service/sc/gaspar/consulta_lote_rps.rb +13 -0
- data/lib/br_nfe/service/sc/gaspar/consulta_nfs_por_rps.rb +13 -0
- data/lib/br_nfe/service/sc/gaspar/consulta_nfse.rb +17 -0
- data/lib/br_nfe/service/sc/gaspar/consulta_situacao_lote_rps.rb +13 -0
- data/lib/br_nfe/service/sc/gaspar/recepcao_lote_rps.rb +13 -0
- data/lib/br_nfe/service/sc/gaspar/recepcao_lote_rps_limitado.rb +13 -0
- data/lib/br_nfe/service/thema/v1/base.rb +55 -0
- data/lib/br_nfe/service/thema/v1/cancela_nfse.rb +48 -0
- data/lib/br_nfe/service/thema/v1/consulta_lote_rps.rb +49 -0
- data/lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb +48 -0
- data/lib/br_nfe/service/thema/v1/consulta_nfse.rb +47 -0
- data/lib/br_nfe/service/thema/v1/consulta_situacao_lote_rps.rb +46 -0
- data/lib/br_nfe/service/thema/v1/recepcao_lote_rps.rb +51 -0
- data/lib/br_nfe/service/thema/v1/recepcao_lote_rps_limitado.rb +30 -0
- data/lib/br_nfe/service/xml/v1/_tc_contato.xml.slim +7 -0
- data/lib/br_nfe/service/xml/v1/_tc_cpf_cnpj.xml.slim +5 -0
- data/lib/br_nfe/service/xml/v1/_tc_dados_construcao_civil.xml.slim +2 -0
- data/lib/br_nfe/service/xml/v1/_tc_dados_prestador.xml.slim +15 -0
- data/lib/br_nfe/service/xml/v1/_tc_dados_servico.xml.slim +14 -0
- data/lib/br_nfe/service/xml/v1/_tc_dados_tomador.xml.slim +15 -0
- data/lib/br_nfe/service/xml/v1/_tc_endereco.xml.slim +13 -0
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_intermediario_servico.xml.slim +7 -0
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_nfse.xml.slim +7 -0
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_orgao_gerador.xml.slim +8 -0
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_prestador.xml.slim +3 -0
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_rps.xml.slim +16 -0
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_tomador.xml.slim +4 -0
- data/lib/br_nfe/service/xml/v1/_tc_inf_pedido_cancelamento.xml.slim +4 -0
- data/lib/br_nfe/service/xml/v1/_tc_inf_rps.xml.slim +47 -0
- data/lib/br_nfe/service/xml/v1/_tc_lote_rps.xml.slim +9 -0
- data/lib/br_nfe/service/xml/v1/_tc_pedido_cancelamento.xml.slim +4 -0
- data/lib/br_nfe/service/xml/v1/_tc_rps.xml.slim +8 -0
- data/lib/br_nfe/service/xml/v1/_tc_valores.xml.slim +48 -0
- data/lib/br_nfe/service/xml/v1/servico_cancelar_nfse_envio.xml.slim +9 -0
- data/lib/br_nfe/service/xml/v1/servico_consultar_lote_rps_envio.xml.slim +4 -0
- data/lib/br_nfe/service/xml/v1/servico_consultar_nfse_envio.xml.slim +19 -0
- data/lib/br_nfe/service/xml/v1/servico_consultar_nfse_rps_envio.xml.slim +5 -0
- data/lib/br_nfe/service/xml/v1/servico_consultar_situacao_lote_rps_envio.xml.slim +4 -0
- data/lib/br_nfe/service/xml/v1/servico_enviar_lote_rps_envio.xml.slim +9 -0
- data/lib/br_nfe/version.rb +2 -2
- data/lib/br_nfe/xml/_signed_info_sh1.xml.slim +9 -0
- data/lib/br_nfe/xml/signature_sh1.xml.slim +12 -0
- data/lib/br_nfe/xml/soap_env.xml.slim +3 -0
- data/lib/br_nfe.rb +72 -20
- data/test/br_nfe/base_test.rb +257 -108
- data/test/br_nfe/helper/have_intermediario_test.rb +2 -2
- data/test/br_nfe/helper/have_rps_test.rb +4 -4
- data/test/br_nfe/response/service/build_response_test.rb +377 -0
- data/test/br_nfe/response/service/default_test.rb +218 -0
- data/test/br_nfe/{servico/response → response/service}/nota_fiscal_test.rb +2 -2
- data/test/br_nfe/response/service/paths/base_test.rb +199 -0
- data/test/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta_test.rb +25 -0
- data/test/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta_test.rb +30 -0
- data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta_test.rb +30 -0
- data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta_test.rb +30 -0
- data/test/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta_test.rb +30 -0
- data/test/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta_test.rb +34 -0
- data/test/br_nfe/response/service/paths/v1/tc_nfse_test.rb +122 -0
- data/test/br_nfe/service/base_test.rb +138 -0
- data/test/br_nfe/service/betha/base_test.rb +9 -0
- data/test/br_nfe/service/betha/v1/cancelamento_nfs_test.rb +60 -0
- data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +55 -0
- data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +55 -0
- data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +53 -0
- data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +49 -0
- data/test/br_nfe/service/betha/v1/gateway_test.rb +35 -0
- data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +84 -0
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb +16 -0
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta_test.rb +16 -0
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb +16 -0
- data/test/br_nfe/service/betha/v1/xsd/TiposNFe_v01.xsd +583 -0
- data/test/br_nfe/service/betha/v1/xsd/nfse_v01.xsd +652 -0
- data/test/br_nfe/service/betha/v1/xsd/servico_cancelar_nfse_envio_v01.xsd +17 -0
- data/test/br_nfe/service/betha/v1/xsd/servico_consultar_lote_rps_envio_v01.xsd +16 -0
- data/test/br_nfe/service/betha/v1/xsd/servico_consultar_nfse_envio_v01.xsd +28 -0
- data/test/br_nfe/service/betha/v1/xsd/servico_consultar_nfse_rps_envio_v01.xsd +16 -0
- data/test/br_nfe/service/betha/v1/xsd/servico_consultar_situacao_lote_rps_envio_v01.xsd +16 -0
- data/test/br_nfe/service/betha/v1/xsd/servico_enviar_lote_rps_envio_v01.xsd +17 -0
- data/test/br_nfe/service/betha/v1/xsd/xmldsig-core-schema.xsd +308 -0
- data/test/br_nfe/service/betha/v1/xsd/xmldsig-core-schema_v01.xsd +95 -0
- data/test/br_nfe/service/concerns/rules/cancelamento_nfs_test.rb +15 -0
- data/test/br_nfe/service/concerns/rules/consulta_nfs_por_rps_test.rb +36 -0
- data/test/br_nfe/service/concerns/rules/consulta_nfse_test.rb +42 -0
- data/test/br_nfe/{servico/base_test.rb → service/concerns/rules/recepcao_lote_rps_test.rb} +12 -4
- data/test/br_nfe/{servico → service}/intermediario_test.rb +1 -1
- data/test/br_nfe/service/item_test.rb +34 -0
- data/test/br_nfe/{servico → service}/rps_test.rb +191 -43
- data/test/br_nfe/service/sc/florianopolis/XSD/TiposNFSe_v2.0.xsd +863 -0
- data/test/br_nfe/service/sc/florianopolis/XSD/xmldsig-core-schema.xsd +309 -0
- data/test/br_nfe/service/sc/florianopolis/base_test.rb +20 -0
- data/test/br_nfe/service/sc/florianopolis/cancellation_test.rb +36 -0
- data/test/br_nfe/service/sc/florianopolis/emission_rps_test.rb +145 -0
- data/test/br_nfe/service/sc/gaspar/cancela_nfse_test.rb +21 -0
- data/test/br_nfe/service/sc/gaspar/consulta_nfs_por_rps_test.rb +21 -0
- data/test/br_nfe/service/sc/gaspar/consulta_nfse_test.rb +21 -0
- data/test/br_nfe/service/sc/gaspar/consulta_situacao_lote_rps_test.rb +21 -0
- data/test/br_nfe/service/sc/gaspar/recepcao_lote_rps_limitado_test.rb +22 -0
- data/test/br_nfe/service/sc/gaspar/recepcao_lote_rps_test.rb +22 -0
- data/test/br_nfe/service/thema/v1/base_test.rb +65 -0
- data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +56 -0
- data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +47 -0
- data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +50 -0
- data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +50 -0
- data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +47 -0
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +62 -0
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test_limitado.rb +50 -0
- data/test/br_nfe/service/thema/v1/xsd/nfse.xsd +656 -0
- data/test/br_nfe/service/thema/v1/xsd/xmldsig-core-schema20020212.xsd +318 -0
- data/test/br_nfe/service/xsd/v1/nfse.xsd +779 -0
- data/test/br_nfe/service/xsd/v1/xmldsig-core-schema20020212.xsd +316 -0
- data/test/cert.pfx +0 -0
- data/test/factories/base.rb +2 -0
- data/test/factories/destinatario.rb +3 -3
- data/test/factories/response/service/build_response.rb +5 -0
- data/test/factories/response/service/default.rb +10 -0
- data/test/factories/{servico/response → response/service}/nota_fiscal.rb +9 -9
- data/test/factories/service/base.rb +6 -0
- data/test/factories/service/betha/base.rb +4 -0
- data/test/factories/service/betha/v1/cancelamento_nfs.rb +9 -0
- data/test/factories/{servico → service}/betha/v1/consulta_lote_rps.rb +2 -2
- data/test/factories/{servico → service}/betha/v1/consulta_nfs_por_rps.rb +1 -1
- data/test/factories/service/betha/v1/consulta_nfse.rb +8 -0
- data/test/factories/{servico → service}/betha/v1/consulta_situacao_lote_rps.rb +2 -2
- data/test/factories/{servico → service}/betha/v1/gateway.rb +1 -1
- data/test/factories/service/betha/v1/recepcao_lote_rps.rb +8 -0
- data/test/factories/{servico → service}/intermediario.rb +2 -2
- data/test/factories/service/item.rb +12 -0
- data/test/factories/service/rps.rb +50 -0
- data/test/factories/service/sc/florianopolis/base.rb +5 -0
- data/test/factories/service/sc/florianopolis/cancellation.rb +7 -0
- data/test/factories/service/sc/florianopolis/emission_rps.rb +7 -0
- data/test/factories/service/sc/gaspar/cancela_nfse.rb +9 -0
- data/test/factories/service/sc/gaspar/consulta_lote_rps.rb +7 -0
- data/test/factories/service/sc/gaspar/consulta_nfs_por_rps.rb +6 -0
- data/test/factories/service/sc/gaspar/consulta_nfse.rb +8 -0
- data/test/factories/service/sc/gaspar/consulta_situacao_lote_rps.rb +6 -0
- data/test/factories/service/sc/gaspar/recepcao_lote_rps.rb +9 -0
- data/test/factories/service/sc/gaspar/recepcao_lote_rps_limitado.rb +9 -0
- data/test/factories/service/thema/v1/base.rb +7 -0
- data/test/factories/service/thema/v1/cancela_nfse.rb +9 -0
- data/test/factories/service/thema/v1/consulta_lote_rps.rb +7 -0
- data/test/factories/service/thema/v1/consulta_nfs_por_rps.rb +6 -0
- data/test/factories/service/thema/v1/consulta_nfse.rb +8 -0
- data/test/factories/service/thema/v1/consulta_situacao_lote_rps.rb +6 -0
- data/test/factories/service/thema/v1/recepcao_lote_rps.rb +9 -0
- data/test/factories/service/thema/v1/recepcao_lote_rps_limitado.rb +8 -0
- data/test/test_helper.rb +42 -0
- metadata +338 -121
- data/lib/br_nfe/servico/base.rb +0 -35
- data/lib/br_nfe/servico/betha/base.rb +0 -85
- data/lib/br_nfe/servico/betha/build_response.rb +0 -141
- data/lib/br_nfe/servico/betha/v1/build_response.rb +0 -121
- data/lib/br_nfe/servico/betha/v1/cancelamento_nfs.rb +0 -52
- data/lib/br_nfe/servico/betha/v1/consulta_lote_rps.rb +0 -33
- data/lib/br_nfe/servico/betha/v1/consulta_nfs_por_rps.rb +0 -37
- data/lib/br_nfe/servico/betha/v1/consulta_nfse.rb +0 -51
- data/lib/br_nfe/servico/betha/v1/consulta_situacao_lote_rps.rb +0 -18
- data/lib/br_nfe/servico/betha/v1/gateway.rb +0 -125
- data/lib/br_nfe/servico/betha/v1/recepcao_lote_rps.rb +0 -97
- data/lib/br_nfe/servico/betha/v2/build_response.rb +0 -159
- data/lib/br_nfe/servico/betha/v2/cancelamento_nfs.rb +0 -30
- data/lib/br_nfe/servico/betha/v2/consulta_lote_rps.rb +0 -30
- data/lib/br_nfe/servico/betha/v2/consulta_nfse_por_rps.rb +0 -27
- data/lib/br_nfe/servico/betha/v2/envio_lote_rps_sincrono.rb +0 -30
- data/lib/br_nfe/servico/betha/v2/gateway.rb +0 -230
- data/lib/br_nfe/servico/betha/v2/gera_nfse.rb +0 -30
- data/lib/br_nfe/servico/betha/v2/recepcao_lote_rps.rb +0 -52
- data/lib/br_nfe/servico/betha/v2/substituicao_nfse.rb +0 -43
- data/lib/br_nfe/servico/response/default.rb +0 -34
- data/lib/br_nfe/servico/rps.rb +0 -108
- data/test/br_nfe/servico/betha/base_test.rb +0 -135
- data/test/br_nfe/servico/betha/v1/build_response_test.rb +0 -557
- data/test/br_nfe/servico/betha/v1/cancelamento_nfs_test.rb +0 -72
- data/test/br_nfe/servico/betha/v1/consulta_lote_rps_test.rb +0 -46
- data/test/br_nfe/servico/betha/v1/consulta_nfs_por_rps_test.rb +0 -68
- data/test/br_nfe/servico/betha/v1/consulta_nfse_test.rb +0 -74
- data/test/br_nfe/servico/betha/v1/consulta_situacao_lote_rps_test.rb +0 -27
- data/test/br_nfe/servico/betha/v1/gateway_test.rb +0 -151
- data/test/br_nfe/servico/betha/v1/recepcao_lote_rps_test.rb +0 -249
- data/test/br_nfe/servico/betha/v2/cancelamento_nfs_test.rb +0 -44
- data/test/br_nfe/servico/betha/v2/consulta_lote_rps_test.rb +0 -38
- data/test/br_nfe/servico/betha/v2/consulta_nfse_por_rps_test.rb +0 -36
- data/test/br_nfe/servico/betha/v2/envio_lote_rps_sincrono_test.rb +0 -51
- data/test/br_nfe/servico/betha/v2/gateway_test.rb +0 -372
- data/test/br_nfe/servico/betha/v2/gera_nfse_test.rb +0 -62
- data/test/br_nfe/servico/betha/v2/recepcao_lote_rps_test.rb +0 -108
- data/test/br_nfe/servico/betha/v2/substituicao_nfse_test.rb +0 -84
- data/test/br_nfe/servico/response/default_test.rb +0 -54
- data/test/factories/servico/base.rb +0 -5
- data/test/factories/servico/betha/base.rb +0 -5
- data/test/factories/servico/betha/v1/build_response.rb +0 -6
- data/test/factories/servico/betha/v1/cancelamento_nfs.rb +0 -7
- data/test/factories/servico/betha/v1/consulta_nfse.rb +0 -8
- data/test/factories/servico/betha/v1/recepcao_lote_rps.rb +0 -6
- data/test/factories/servico/betha/v2/cancelamento_nfs.rb +0 -7
- data/test/factories/servico/betha/v2/consulta_lote_rps.rb +0 -6
- data/test/factories/servico/betha/v2/consulta_nfse_por_rps.rb +0 -6
- data/test/factories/servico/betha/v2/envio_lote_rps_sincrono.rb +0 -5
- data/test/factories/servico/betha/v2/gateway.rb +0 -5
- data/test/factories/servico/betha/v2/gera_nfse.rb +0 -6
- data/test/factories/servico/betha/v2/recepcao_lote_rps.rb +0 -5
- data/test/factories/servico/betha/v2/substituicao_nfse.rb +0 -8
- data/test/factories/servico/response/default.rb +0 -10
- data/test/factories/servico/rps.rb +0 -44
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Response
|
|
3
|
+
module Service
|
|
4
|
+
class Default < BrNfe::ActiveModelBase
|
|
5
|
+
|
|
6
|
+
# Array contendo as mensagens de erros
|
|
7
|
+
# No array pode conter Hash (com :codigo, :mensagem e :correcao)
|
|
8
|
+
# mas também pode conter mensagens de texto puro
|
|
9
|
+
#
|
|
10
|
+
# <b>Tipo de retorno: </b> _Array_
|
|
11
|
+
#
|
|
12
|
+
attr_accessor :error_messages
|
|
13
|
+
|
|
14
|
+
# Array contendo as notas fiscais encontradas no xml de retorno.
|
|
15
|
+
# Utillizado em algumas requisições onde pode ser que retorne algum XML de NFe
|
|
16
|
+
# É um Array contendo objetos da classe BrNfe::Response::Service::NotaFiscal
|
|
17
|
+
#
|
|
18
|
+
# <b>Tipo de retorno: </b> _Array_
|
|
19
|
+
#
|
|
20
|
+
attr_accessor :notas_fiscais
|
|
21
|
+
|
|
22
|
+
# Número do protocolo de recebimento do XML
|
|
23
|
+
# Setado normalmente quando é enviado um lote RPS
|
|
24
|
+
# para processamento.
|
|
25
|
+
# O valor desse atributo é utilizado para posteriormente
|
|
26
|
+
# fazer a consulta para saber se o RPS já foi processado
|
|
27
|
+
#
|
|
28
|
+
# <b>Tipo de retorno: </b> _Integer_ ou _String_
|
|
29
|
+
#
|
|
30
|
+
attr_accessor :protocolo
|
|
31
|
+
|
|
32
|
+
# Data/Data hora do recebimento do XML pelo orgão emissor
|
|
33
|
+
# Nesse atrubuto pe setado a data/hora na qual o orgão emissor
|
|
34
|
+
# recebeu o XML que foi enviado.
|
|
35
|
+
# também é nesse atributo que é setado a data/hora do processamento
|
|
36
|
+
# da NF-e (nos casos de consulta)
|
|
37
|
+
#
|
|
38
|
+
# <b>Tipo de retorno: </b> _DateTime_
|
|
39
|
+
#
|
|
40
|
+
attr_accessor :data_recebimento
|
|
41
|
+
|
|
42
|
+
# Número do lote RPS
|
|
43
|
+
# Nesse atributo é setado o número do lote RPS
|
|
44
|
+
# quando o mesmo for retornado na resposta
|
|
45
|
+
#
|
|
46
|
+
# <b>Tipo de retorno: </b> _Integer_
|
|
47
|
+
#
|
|
48
|
+
attr_accessor :numero_lote
|
|
49
|
+
|
|
50
|
+
# XML original da resposta
|
|
51
|
+
# Contém todo o XML Envelope da resposta SOAP
|
|
52
|
+
#
|
|
53
|
+
# <b>Tipo de retorno: </b> _String_ XML
|
|
54
|
+
#
|
|
55
|
+
attr_accessor :original_xml
|
|
56
|
+
|
|
57
|
+
# Data e hora do cancelamento da NF-e
|
|
58
|
+
# utilizado apenas para o Cancelamento da NF
|
|
59
|
+
#
|
|
60
|
+
# <b>Tipo de retorno: </b> _DateTime_
|
|
61
|
+
#
|
|
62
|
+
attr_accessor :cancelation_date_time
|
|
63
|
+
|
|
64
|
+
# Status possíveis
|
|
65
|
+
# [:success, :falied, :soap_error, :http_error, :unknown_error]
|
|
66
|
+
#
|
|
67
|
+
# <b>Tipo de retorno: </b> _Hash_
|
|
68
|
+
#
|
|
69
|
+
attr_accessor :status
|
|
70
|
+
|
|
71
|
+
# Código da situação do lote RPS
|
|
72
|
+
# Utilizado para saber se o Lote RPS já foi processado
|
|
73
|
+
# e se foi processado com sucesso ou teve algum erro
|
|
74
|
+
#
|
|
75
|
+
# <b>Tipo de retorno: </b> _Integer_ ou _String_
|
|
76
|
+
#
|
|
77
|
+
attr_accessor :situation
|
|
78
|
+
def situation
|
|
79
|
+
@situation ||= get_situation_by_message_codes if error_messages.present?
|
|
80
|
+
@situation
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def situation_unreceived_code_errors
|
|
84
|
+
@situation_unreceived_code_errors ||= []
|
|
85
|
+
@situation_unreceived_code_errors+['E4']
|
|
86
|
+
end
|
|
87
|
+
def situation_unreceived_code_errors=(value)
|
|
88
|
+
@situation_unreceived_code_errors = [value].flatten
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def situation_unprocessed_code_errors
|
|
92
|
+
@situation_unprocessed_code_errors ||= []
|
|
93
|
+
@situation_unprocessed_code_errors+['E92']
|
|
94
|
+
end
|
|
95
|
+
def situation_unprocessed_code_errors=(value)
|
|
96
|
+
@situation_unprocessed_code_errors = [value].flatten
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def situation_success_code_errors
|
|
100
|
+
@situation_success_code_errors ||= []
|
|
101
|
+
@situation_success_code_errors#+[]
|
|
102
|
+
end
|
|
103
|
+
def situation_success_code_errors=(value)
|
|
104
|
+
@situation_success_code_errors = [value].flatten
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Como alguns orgãos emissores (como a Betha) não tem a capacidade
|
|
108
|
+
# de programar para colocar o codigo da situação em determinados momentos
|
|
109
|
+
# e simplesmente colocam uma mensagem de erro na resposta sem setar a situação
|
|
110
|
+
# foi necessário construir esse método para que a partir dos códigos das mensagens
|
|
111
|
+
# seja possível distinguir qual a situação atual do lote enviado.
|
|
112
|
+
# Por exemplo: Quando retornar o erro com código 'E92' quer dizer que a situação
|
|
113
|
+
# do lote é :unprocessed. Equivalente ao código de situação 2
|
|
114
|
+
#
|
|
115
|
+
# <b>Tipo de retorno: </b> _Symbol_
|
|
116
|
+
#
|
|
117
|
+
def get_situation_by_message_codes
|
|
118
|
+
if (situation_unprocessed_code_errors & message_codes).any?
|
|
119
|
+
:unprocessed
|
|
120
|
+
elsif (situation_unreceived_code_errors & message_codes).any?
|
|
121
|
+
:unreceived
|
|
122
|
+
elsif (situation_success_code_errors & message_codes).any?
|
|
123
|
+
:success
|
|
124
|
+
elsif message_codes.any?
|
|
125
|
+
:error
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def initialize(attributes = {})
|
|
130
|
+
self.notas_fiscais = [] # Para poder utilizar o <<
|
|
131
|
+
self.error_messages = [] # Para poder utilizar o <<
|
|
132
|
+
super
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def notas_fiscais
|
|
136
|
+
@notas_fiscais = [@notas_fiscais].flatten # Para retornar sempre um vetor
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def error_messages
|
|
140
|
+
@error_messages = [@error_messages].flatten
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Método para saber se a conexão com a prefeitura foi mal-sucedida.
|
|
144
|
+
# Caso ocorra algum erro na requisição irá retornar true.
|
|
145
|
+
#
|
|
146
|
+
# <b>Tipo de retorno: </b> _Boolean_
|
|
147
|
+
#
|
|
148
|
+
def unsuccessful_request?
|
|
149
|
+
status.in?([:soap_error, :http_error, :unknown_error])
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Método para saber se a conexão com a prefeitura foi bem-sucedida.
|
|
153
|
+
# Caso a requisição ocorra certo e não apresente nenhuma exception
|
|
154
|
+
# irá retornar true.
|
|
155
|
+
#
|
|
156
|
+
# <b>Tipo de retorno: </b> _Boolean_
|
|
157
|
+
#
|
|
158
|
+
def successful_request?
|
|
159
|
+
!unsuccessful_request?
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def success?
|
|
163
|
+
status == :success
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def status
|
|
167
|
+
@status ||= get_status
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def get_status
|
|
171
|
+
error_messages.blank? ? :success : :falied
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Retorna um array apenas com os códigos das mensagens de erro.
|
|
175
|
+
# Sempre retornar o código no formato de String.
|
|
176
|
+
#
|
|
177
|
+
# <b>Tipo de retorno: </b> _Array_
|
|
178
|
+
#
|
|
179
|
+
def message_codes
|
|
180
|
+
@message_codes ||= error_messages.select{|msg| msg.is_a?(Hash)}.map{|msg| msg[:code].try(:to_s) }
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module BrNfe
|
|
2
|
-
module
|
|
3
|
-
module
|
|
2
|
+
module Response
|
|
3
|
+
module Service
|
|
4
4
|
class NotaFiscal < BrNfe::ActiveModelBase
|
|
5
5
|
include BrNfe::Helper::HaveIntermediario
|
|
6
6
|
include BrNfe::Helper::HaveDestinatario
|
|
@@ -11,6 +11,7 @@ module BrNfe
|
|
|
11
11
|
attr_accessor :codigo_verificacao
|
|
12
12
|
attr_accessor :data_emissao
|
|
13
13
|
attr_accessor :url_nf
|
|
14
|
+
attr_accessor :xml_nf
|
|
14
15
|
|
|
15
16
|
#identificacao do rps
|
|
16
17
|
attr_accessor :rps_numero
|
|
@@ -27,23 +28,23 @@ module BrNfe
|
|
|
27
28
|
|
|
28
29
|
# dados dos serviços
|
|
29
30
|
attr_accessor :item_lista_servico
|
|
30
|
-
attr_accessor :
|
|
31
|
-
attr_accessor :
|
|
31
|
+
attr_accessor :cnae_code
|
|
32
|
+
attr_accessor :description
|
|
32
33
|
attr_accessor :codigo_municipio
|
|
33
34
|
|
|
34
35
|
#Valores dos serviços
|
|
35
|
-
attr_accessor :
|
|
36
|
-
attr_accessor :
|
|
36
|
+
attr_accessor :total_services
|
|
37
|
+
attr_accessor :deductions
|
|
37
38
|
attr_accessor :valor_pis
|
|
38
39
|
attr_accessor :valor_cofins
|
|
39
40
|
attr_accessor :valor_inss
|
|
40
41
|
attr_accessor :valor_ir
|
|
41
42
|
attr_accessor :valor_csll
|
|
42
|
-
attr_accessor :
|
|
43
|
+
attr_accessor :iss_retained
|
|
43
44
|
attr_accessor :outras_retencoes
|
|
44
|
-
attr_accessor :
|
|
45
|
-
attr_accessor :
|
|
46
|
-
attr_accessor :
|
|
45
|
+
attr_accessor :total_iss
|
|
46
|
+
attr_accessor :base_calculation
|
|
47
|
+
attr_accessor :iss_tax_rate
|
|
47
48
|
attr_accessor :valor_liquido # v2
|
|
48
49
|
attr_accessor :desconto_condicionado # v2
|
|
49
50
|
attr_accessor :desconto_incondicionado # v2
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module Base
|
|
6
|
+
# Caminho referente ao caminho do número do lote
|
|
7
|
+
def lot_number_path; [] end
|
|
8
|
+
|
|
9
|
+
# Caminho para encontrar o número do protocolo
|
|
10
|
+
def protocol_path; [] end
|
|
11
|
+
|
|
12
|
+
# Caminho para encontrar a data de recebimento do lote/rps/nfe
|
|
13
|
+
def received_date_path; [] end
|
|
14
|
+
|
|
15
|
+
# Caminho para encontrar a situação
|
|
16
|
+
def situation_path; [] end
|
|
17
|
+
|
|
18
|
+
# Chaves para formatar a situação do Lote RPS
|
|
19
|
+
def situation_key_values
|
|
20
|
+
{
|
|
21
|
+
'1' => :unreceived, # Não Recebido
|
|
22
|
+
'2' => :unprocessed,# Não Processado
|
|
23
|
+
'3' => :error, # Processado com Erro
|
|
24
|
+
'4' => :success, # Processado com Sucesso
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Caminho para encontrar a data e hora do cancelamento da nF
|
|
29
|
+
def cancelation_date_time_path; [] end
|
|
30
|
+
|
|
31
|
+
def message_errors_path; [] end
|
|
32
|
+
def message_code_key; :codigo end
|
|
33
|
+
def message_msg_key; :mensagem end
|
|
34
|
+
def message_solution_key; :correcao end
|
|
35
|
+
|
|
36
|
+
# Caminho referente ao caminho onde se encontra as notas fiscais
|
|
37
|
+
# poderá encontrar apenas uma ou várias
|
|
38
|
+
def invoices_path; [] end
|
|
39
|
+
|
|
40
|
+
# Demais caminhos para encontrar os dados da NF-e
|
|
41
|
+
def invoice_numero_nf_path; [] end
|
|
42
|
+
def invoice_codigo_verificacao_path; [] end
|
|
43
|
+
def invoice_data_emissao_path; [] end
|
|
44
|
+
def invoice_url_nf_path; [] end
|
|
45
|
+
def invoice_rps_numero_path; [] end
|
|
46
|
+
def invoice_rps_serie_path; [] end
|
|
47
|
+
def invoice_rps_tipo_path; [] end
|
|
48
|
+
def invoice_rps_situacao_path; [] end
|
|
49
|
+
def invoice_rps_substituido_numero_path; [] end
|
|
50
|
+
def invoice_rps_substituido_serie_path; [] end
|
|
51
|
+
def invoice_rps_substituido_tipo_path; [] end
|
|
52
|
+
def invoice_data_emissao_rps_path; [] end
|
|
53
|
+
def invoice_competencia_path; [] end
|
|
54
|
+
def invoice_outras_informacoes_path; [] end
|
|
55
|
+
def invoice_item_lista_servico_path; [] end
|
|
56
|
+
def invoice_cnae_code_path; [] end
|
|
57
|
+
def invoice_description_path; [] end
|
|
58
|
+
def invoice_codigo_municipio_path; [] end
|
|
59
|
+
def invoice_total_services_path; [] end
|
|
60
|
+
def invoice_deductions_path; [] end
|
|
61
|
+
def invoice_valor_pis_path; [] end
|
|
62
|
+
def invoice_valor_cofins_path; [] end
|
|
63
|
+
def invoice_valor_inss_path; [] end
|
|
64
|
+
def invoice_valor_ir_path; [] end
|
|
65
|
+
def invoice_valor_csll_path; [] end
|
|
66
|
+
def invoice_iss_retained_path; [] end
|
|
67
|
+
def invoice_outras_retencoes_path; [] end
|
|
68
|
+
def invoice_total_iss_path; [] end
|
|
69
|
+
def invoice_base_calculation_path; [] end
|
|
70
|
+
def invoice_iss_tax_rate_path; [] end
|
|
71
|
+
def invoice_valor_liquido_path; [] end
|
|
72
|
+
def invoice_desconto_condicionado_path; [] end
|
|
73
|
+
def invoice_desconto_incondicionado_path; [] end
|
|
74
|
+
def invoice_responsavel_retencao_path; [] end
|
|
75
|
+
def invoice_numero_processo_path; [] end
|
|
76
|
+
def invoice_municipio_incidencia_path; [] end
|
|
77
|
+
def invoice_orgao_gerador_municipio_path; [] end
|
|
78
|
+
def invoice_orgao_gerador_uf_path; [] end
|
|
79
|
+
def invoice_cancelamento_codigo_path; [] end
|
|
80
|
+
def invoice_cancelamento_numero_nf_path; [] end
|
|
81
|
+
def invoice_cancelamento_cnpj_path; [] end
|
|
82
|
+
def invoice_cancelamento_municipio_path; [] end
|
|
83
|
+
def invoice_cancelamento_sucesso_path; [] end
|
|
84
|
+
def invoice_cancelamento_data_hora_path; [] end
|
|
85
|
+
def invoice_nfe_substituidora_path; [] end
|
|
86
|
+
def invoice_codigo_obra_path; [] end
|
|
87
|
+
def invoice_codigo_art_path; [] end
|
|
88
|
+
def invoice_cancelamento_inscricao_municipal_path; [] end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module V1
|
|
6
|
+
module ServicoCancelarNfseResposta
|
|
7
|
+
include BrNfe::Service::Response::Paths::Base
|
|
8
|
+
|
|
9
|
+
# def message_alerts_path; [] end
|
|
10
|
+
def message_errors_path
|
|
11
|
+
[:cancelar_nfse_resposta, :lista_mensagem_retorno, :mensagem_retorno]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def cancelation_date_time_path
|
|
15
|
+
[:cancelar_nfse_resposta, :cancelamento, :confirmacao, :inf_confirmacao_cancelamento, :data_hora]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module V1
|
|
6
|
+
module ServicoConsultarLoteRpsResposta
|
|
7
|
+
include BrNfe::Service::Response::Paths::Base
|
|
8
|
+
include BrNfe::Service::Response::Paths::V1::TcNfse
|
|
9
|
+
|
|
10
|
+
# def message_alerts_path; [] end
|
|
11
|
+
def message_errors_path
|
|
12
|
+
[:consultar_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Caminho referente ao caminho onde se encontra as notas fiscais
|
|
16
|
+
# poderá encontrar apenas uma ou várias
|
|
17
|
+
def invoices_path
|
|
18
|
+
[:consultar_lote_rps_resposta, :lista_nfse, :comp_nfse]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module V1
|
|
6
|
+
module ServicoConsultarNfseResposta
|
|
7
|
+
include BrNfe::Service::Response::Paths::Base
|
|
8
|
+
include BrNfe::Service::Response::Paths::V1::TcNfse
|
|
9
|
+
|
|
10
|
+
# def message_alerts_path; [] end
|
|
11
|
+
def message_errors_path
|
|
12
|
+
[:consultar_nfse_resposta, :lista_mensagem_retorno, :mensagem_retorno]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Caminho referente ao caminho onde se encontra as notas fiscais
|
|
16
|
+
# poderá encontrar apenas uma ou várias
|
|
17
|
+
def invoices_path
|
|
18
|
+
[:consultar_nfse_resposta, :lista_nfse, :comp_nfse]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module V1
|
|
6
|
+
module ServicoConsultarNfseRpsResposta
|
|
7
|
+
include BrNfe::Service::Response::Paths::Base
|
|
8
|
+
include BrNfe::Service::Response::Paths::V1::TcNfse
|
|
9
|
+
|
|
10
|
+
# def message_alerts_path; [] end
|
|
11
|
+
def message_errors_path
|
|
12
|
+
[:consultar_nfse_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Caminho referente ao caminho onde se encontra as notas fiscais
|
|
16
|
+
# poderá encontrar apenas uma ou várias
|
|
17
|
+
def invoices_path
|
|
18
|
+
[:consultar_nfse_rps_resposta, :comp_nfse]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module V1
|
|
6
|
+
module ServicoConsultarSituacaoLoteRpsResposta
|
|
7
|
+
include BrNfe::Service::Response::Paths::Base
|
|
8
|
+
|
|
9
|
+
# Caminho referente ao caminho do número do lote
|
|
10
|
+
def lot_number_path
|
|
11
|
+
[:consultar_situacao_lote_rps_resposta, :numero_lote]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Caminho para encontrar o número do protocolo
|
|
15
|
+
def situation_path
|
|
16
|
+
[:consultar_situacao_lote_rps_resposta, :situacao]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# def message_alerts_path; [] end
|
|
20
|
+
def message_errors_path
|
|
21
|
+
[:consultar_situacao_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
|
|
22
|
+
end
|
|
23
|
+
# def message_code_key; :codigo end
|
|
24
|
+
# def message_msg_key; :mensagem end
|
|
25
|
+
# def message_solution_key; :correcao end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|