br_nfe 2.1.0 → 2.1.1
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 +1 -0
- data/.travis.yml +0 -1
- data/Gemfile.lock +1 -1
- data/README.markdown +264 -106
- data/lib/br_nfe/{helper → association}/have_address.rb +1 -1
- data/lib/br_nfe/{helper → association}/have_condicao_pagamento.rb +1 -1
- data/lib/br_nfe/association/have_destinatario.rb +22 -0
- data/lib/br_nfe/association/have_emitente.rb +24 -0
- data/lib/br_nfe/base.rb +37 -27
- data/lib/br_nfe/condicao_pagamento.rb +2 -0
- data/lib/br_nfe/constants.rb +33 -0
- data/lib/br_nfe/endereco.rb +10 -0
- data/lib/br_nfe/helper/string_methods.rb +4 -0
- data/lib/br_nfe/{emitente.rb → person.rb} +11 -7
- data/lib/br_nfe/product/base.rb +82 -0
- data/lib/br_nfe/product/consulta_status_servico.rb +35 -0
- data/lib/br_nfe/product/emitente.rb +8 -0
- data/lib/br_nfe/product/gateway/base.rb +62 -0
- data/lib/br_nfe/product/gateway/web_service_svrs.rb +39 -0
- data/lib/br_nfe/product/value_nf.rb +9 -0
- data/lib/br_nfe/product/xml/soap_env.xml.slim +8 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/consReciNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/consSitNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/consStatServ_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/enviNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/inutNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/leiauteConsSitNFe_v3.10.xsd +502 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/leiauteConsStatServ_v3.10.xsd +98 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/leiauteInutNFe_v3.10.xsd +193 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/leiauteNFe_v3.10.xsd +6060 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/nfe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/procInutNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/procNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/retConsReciNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/retConsSitNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/retConsStatServ_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/retEnviNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/retInutNFe_v3.10.xsd +9 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/tiposBasico_v3.10.xsd +571 -0
- data/lib/br_nfe/product/xml/v3_10/XSD/xmldsig-core-schema_v1.01.xsd +98 -0
- data/lib/br_nfe/product/xml/v3_10/consulta_status_servico.xml.slim +4 -0
- data/lib/br_nfe/service/association/have_intermediario.rb +26 -0
- data/lib/br_nfe/service/association/have_rps.rb +36 -0
- data/lib/br_nfe/service/base.rb +24 -20
- data/lib/br_nfe/service/betha/v1/cancela_nfse.rb +43 -0
- data/lib/br_nfe/service/betha/v1/consulta_lote_rps.rb +20 -6
- data/lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb +17 -6
- data/lib/br_nfe/service/betha/v1/consulta_nfse.rb +16 -5
- data/lib/br_nfe/service/betha/v1/consulta_situacao_lote_rps.rb +15 -6
- data/lib/br_nfe/service/betha/v1/gateway.rb +4 -0
- data/lib/br_nfe/service/betha/v1/recepcao_lote_rps.rb +13 -5
- data/lib/br_nfe/service/betha/v1/xml/_tc_identificacao_prestador.xml.slim +3 -0
- data/lib/br_nfe/service/betha/v1/xml/_tc_pedido_cancelamento.xml.slim +4 -0
- data/lib/br_nfe/service/concerns/rules/cancelamento_nfs.rb +8 -0
- data/lib/br_nfe/service/concerns/rules/consulta_nfs_por_rps.rb +1 -1
- data/lib/br_nfe/service/concerns/rules/consulta_nfse.rb +5 -2
- data/lib/br_nfe/service/concerns/values_ts/service_v1.rb +319 -0
- data/lib/br_nfe/service/destinatario.rb +7 -0
- data/lib/br_nfe/service/emitente.rb +8 -0
- data/lib/br_nfe/service/intermediario.rb +1 -12
- data/lib/br_nfe/service/item.rb +7 -7
- data/lib/br_nfe/service/response/build/base.rb +166 -0
- data/lib/br_nfe/service/response/build/cancelamento.rb +62 -0
- data/lib/br_nfe/service/response/build/consulta_lote_rps.rb +25 -0
- data/lib/br_nfe/service/response/build/consulta_nfs_por_rps.rb +25 -0
- data/lib/br_nfe/service/response/build/consulta_nfse.rb +24 -0
- data/lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb +56 -0
- data/lib/br_nfe/service/response/build/invoice_build.rb +359 -0
- data/lib/br_nfe/service/response/build/recepcao_lote_rps.rb +69 -0
- data/lib/br_nfe/service/response/cancelamento.rb +22 -0
- data/lib/br_nfe/service/response/consulta_lote_rps.rb +18 -0
- data/lib/br_nfe/service/response/consulta_nfs_por_rps.rb +10 -0
- data/lib/br_nfe/service/response/consulta_nfse.rb +10 -0
- data/lib/br_nfe/service/response/consulta_situacao_lote_rps.rb +74 -0
- data/lib/br_nfe/service/response/default.rb +93 -0
- data/lib/br_nfe/{response/service → service/response}/nota_fiscal.rb +19 -12
- data/lib/br_nfe/service/response/paths/v1/tc_nfse.rb +275 -0
- data/lib/br_nfe/service/response/recepcao_lote_rps.rb +35 -0
- data/lib/br_nfe/service/rps.rb +30 -27
- data/lib/br_nfe/service/sc/florianopolis/xml/_service_item.xml.slim +4 -4
- data/lib/br_nfe/service/sc/florianopolis/xml/inf_requisicao.xml.slim +4 -4
- data/lib/br_nfe/service/simpliss/v1/cancela_nfse.rb +16 -6
- data/lib/br_nfe/service/simpliss/v1/consulta_lote_rps.rb +20 -12
- data/lib/br_nfe/service/simpliss/v1/consulta_nfs_por_rps.rb +21 -6
- data/lib/br_nfe/service/simpliss/v1/consulta_nfse.rb +20 -6
- data/lib/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps.rb +17 -6
- data/lib/br_nfe/service/simpliss/v1/recepcao_lote_rps.rb +16 -4
- data/lib/br_nfe/service/simpliss/v1/xml/_tc_item_servico.xml.slim +2 -2
- data/lib/br_nfe/service/thema/v1/cancela_nfse.rb +21 -19
- data/lib/br_nfe/service/thema/v1/consulta_lote_rps.rb +21 -19
- data/lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb +25 -18
- data/lib/br_nfe/service/thema/v1/consulta_nfse.rb +20 -20
- data/lib/br_nfe/service/thema/v1/consulta_situacao_lote_rps.rb +14 -20
- data/lib/br_nfe/service/thema/v1/recepcao_lote_rps.rb +11 -16
- data/lib/br_nfe/service/thema/v1/recepcao_lote_rps_limitado.rb +8 -6
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_nfse.xml.slim +1 -1
- data/lib/br_nfe/service/xml/v1/_tc_pedido_cancelamento.xml.slim +1 -1
- data/lib/br_nfe/service/xml/v1/_tc_valores.xml.slim +11 -11
- data/lib/br_nfe/version.rb +1 -1
- data/lib/br_nfe.rb +62 -62
- data/test/br_nfe/association/have_address_test.rb +64 -0
- data/test/br_nfe/association/have_condicao_pagamento_test.rb +75 -0
- data/test/br_nfe/association/have_destinatario_test.rb +76 -0
- data/test/br_nfe/association/have_emitente_test.rb +80 -0
- data/test/br_nfe/base_test.rb +96 -61
- data/test/br_nfe/endereco_test.rb +21 -0
- data/test/br_nfe/person_test.rb +55 -0
- data/test/br_nfe/product/base_test.rb +150 -0
- data/test/br_nfe/product/consulta_status_servico_test.rb +59 -0
- data/test/br_nfe/product/emitente_test.rb +29 -0
- data/test/br_nfe/product/gateway/base_test.rb +16 -0
- data/test/br_nfe/product/gateway/web_service_svrs_test.rb +36 -0
- data/test/br_nfe/service/association/have_intermediario_test.rb +80 -0
- data/test/br_nfe/service/association/have_rps_test.rb +62 -0
- data/test/br_nfe/service/base_test.rb +42 -42
- data/test/br_nfe/service/betha/v1/cancela_nfse_test.rb +90 -0
- data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +105 -5
- data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +103 -5
- data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +114 -5
- data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +118 -5
- data/test/br_nfe/service/betha/v1/gateway_test.rb +1 -1
- data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +51 -5
- data/test/br_nfe/service/concerns/rules/cancelamento_nfs_test.rb +2 -2
- data/test/br_nfe/service/concerns/rules/consulta_nfs_por_rps_test.rb +2 -7
- data/test/br_nfe/service/concerns/rules/consulta_nfse_test.rb +24 -3
- data/test/br_nfe/service/concerns/rules/recepcao_lote_rps_test.rb +1 -1
- data/test/br_nfe/{helper → service/concerns}/values_ts/service_v1_test.rb +2 -2
- data/test/br_nfe/{destinatario_test.rb → service/destinatario_test.rb} +3 -4
- data/test/br_nfe/service/emitente_test.rb +29 -0
- data/test/br_nfe/service/item_test.rb +14 -14
- data/test/br_nfe/service/response/build/base_test.rb +80 -0
- data/test/br_nfe/{response/service → service/response}/default_test.rb +1 -82
- data/test/br_nfe/service/response/nota_fiscal_test.rb +59 -0
- data/test/br_nfe/{response/service → service/response}/paths/v1/tc_nfse_test.rb +10 -10
- data/test/br_nfe/service/rps_test.rb +107 -138
- data/test/br_nfe/service/sc/florianopolis/emission_rps_test.rb +9 -9
- data/test/br_nfe/service/simpliss/v1/base_test.rb +1 -1
- data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +7 -10
- data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +11 -18
- data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +11 -18
- data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +11 -18
- data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +7 -11
- data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +3 -9
- data/test/br_nfe/service/thema/v1/base_test.rb +1 -1
- data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +7 -14
- data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +6 -17
- data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +6 -13
- data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +11 -18
- data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +7 -11
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +1 -5
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +3 -9
- data/test/factories/base.rb +0 -1
- data/test/factories/{emitente.rb → person.rb} +1 -1
- data/test/factories/product/base.rb +12 -0
- data/test/factories/product/consulta_status_servico.rb +12 -0
- data/test/factories/product/emitente.rb +15 -0
- data/test/factories/product/gateway/base.rb +5 -0
- data/test/factories/product/gateway/web_service_svrs.rb +5 -0
- data/test/factories/service/betha/v1/{cancelamento_nfs.rb → cancela_nfse.rb} +2 -1
- data/test/factories/service/betha/v1/consulta_lote_rps.rb +1 -1
- data/test/factories/service/betha/v1/consulta_nfs_por_rps.rb +1 -1
- data/test/factories/service/betha/v1/consulta_nfse.rb +1 -1
- data/test/factories/service/betha/v1/consulta_situacao_lote_rps.rb +1 -1
- data/test/factories/{destinatario.rb → service/destinatario.rb} +1 -1
- data/test/factories/service/emitente.rb +15 -0
- data/test/factories/service/item.rb +4 -4
- data/test/factories/service/response/build_response.rb +5 -0
- data/test/factories/service/response/default.rb +6 -0
- data/test/factories/{response/service → service/response}/nota_fiscal.rb +8 -8
- data/test/factories/service/rps.rb +11 -11
- data/test/factories/service/sc/florianopolis/base.rb +1 -1
- data/test/factories/service/sc/florianopolis/cancellation.rb +1 -1
- data/test/factories/service/sc/florianopolis/emission_rps.rb +1 -1
- data/test/factories/service/simpliss/v1/base.rb +1 -1
- data/test/factories/service/simpliss/v1/cancela_nfse.rb +1 -1
- data/test/factories/service/simpliss/v1/consulta_lote_rps.rb +1 -1
- data/test/factories/service/simpliss/v1/consulta_nfs_por_rps.rb +1 -1
- data/test/factories/service/simpliss/v1/consulta_nfse.rb +1 -1
- data/test/factories/service/simpliss/v1/consulta_situacao_lote_rps.rb +1 -1
- data/test/factories/service/simpliss/v1/recepcao_lote_rps.rb +1 -1
- data/test/factories/service/thema/v1/base.rb +1 -1
- data/test/factories/service/thema/v1/cancela_nfse.rb +1 -1
- data/test/factories/service/thema/v1/consulta_lote_rps.rb +1 -1
- data/test/factories/service/thema/v1/consulta_nfs_por_rps.rb +1 -1
- data/test/factories/service/thema/v1/consulta_nfse.rb +1 -1
- data/test/factories/service/thema/v1/consulta_situacao_lote_rps.rb +1 -1
- data/test/factories/service/thema/v1/recepcao_lote_rps.rb +1 -1
- data/test/fixtures/service/response/betha/v1/cancela_nfse/fault.xml +17 -0
- data/test/fixtures/service/response/betha/v1/cancela_nfse/success.xml +48 -0
- data/test/fixtures/service/response/betha/v1/consulta_lote_rps/fault.xml +18 -0
- data/test/fixtures/service/response/betha/v1/consulta_lote_rps/success.xml +108 -0
- data/test/fixtures/service/response/betha/v1/consulta_nfse/fault.xml +18 -0
- data/test/fixtures/service/response/betha/v1/consulta_nfse/nfs_empty.xml +12 -0
- data/test/fixtures/service/response/betha/v1/consulta_nfse/success.xml +115 -0
- data/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/fault.xml +18 -0
- data/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/success.xml +103 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/error.xml +13 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/fault.xml +17 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/success.xml +13 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed.xml +13 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed_by_code_error.xml +17 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived.xml +13 -0
- data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived_by_code_error.xml +17 -0
- data/test/fixtures/service/response/betha/v1/recepcao_lote_rps/error.xml +17 -0
- data/test/fixtures/service/response/betha/v1/recepcao_lote_rps/success.xml +14 -0
- metadata +160 -94
- data/lib/br_nfe/destinatario.rb +0 -26
- data/lib/br_nfe/helper/have_destinatario.rb +0 -18
- data/lib/br_nfe/helper/have_emitente.rb +0 -20
- data/lib/br_nfe/helper/have_intermediario.rb +0 -24
- data/lib/br_nfe/helper/have_rps.rb +0 -34
- data/lib/br_nfe/helper/values_ts/service_v1.rb +0 -317
- data/lib/br_nfe/response/service/build_response.rb +0 -463
- data/lib/br_nfe/response/service/default.rb +0 -185
- data/lib/br_nfe/response/service/paths/base.rb +0 -127
- data/lib/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta.rb +0 -22
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta.rb +0 -25
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta.rb +0 -25
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta.rb +0 -25
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta.rb +0 -31
- data/lib/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta.rb +0 -36
- data/lib/br_nfe/response/service/paths/v1/tc_nfse.rb +0 -271
- data/lib/br_nfe/service/betha/v1/cancelamento_nfs.rb +0 -36
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta.rb +0 -23
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta.rb +0 -21
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -21
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_cancelar_nfse_resposta.rb +0 -22
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_lote_rps_resposta.rb +0 -25
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_resposta.rb +0 -25
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -25
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_situacao_lote_rps_resposta.rb +0 -31
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_enviar_lote_rps_resposta.rb +0 -36
- data/lib/br_nfe/service/thema/v1/response_paths/servico_cancelar_nfse_resposta.rb +0 -17
- data/lib/br_nfe/service/thema/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -19
- data/test/br_nfe/emitente_test.rb +0 -46
- data/test/br_nfe/helper/have_address_test.rb +0 -62
- data/test/br_nfe/helper/have_condicao_pagamento_test.rb +0 -71
- data/test/br_nfe/helper/have_destinatario_test.rb +0 -64
- data/test/br_nfe/helper/have_emitente_test.rb +0 -63
- data/test/br_nfe/helper/have_intermediario_test.rb +0 -77
- data/test/br_nfe/helper/have_rps_test.rb +0 -59
- data/test/br_nfe/response/service/build_response_test.rb +0 -205
- data/test/br_nfe/response/service/nota_fiscal_test.rb +0 -41
- data/test/br_nfe/response/service/paths/base_test.rb +0 -196
- data/test/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta_test.rb +0 -25
- data/test/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta_test.rb +0 -30
- data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta_test.rb +0 -30
- data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta_test.rb +0 -30
- data/test/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta_test.rb +0 -30
- data/test/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta_test.rb +0 -34
- data/test/br_nfe/service/betha/v1/cancelamento_nfs_test.rb +0 -54
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb +0 -16
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta_test.rb +0 -16
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb +0 -16
- data/test/factories/response/service/build_response.rb +0 -5
- data/test/factories/response/service/default.rb +0 -10
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
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::Service::Response::NotaFiscal
|
|
17
|
+
#
|
|
18
|
+
# <b>Tipo de retorno: </b> _Array_
|
|
19
|
+
#
|
|
20
|
+
attr_accessor :notas_fiscais
|
|
21
|
+
|
|
22
|
+
# XML original da resposta
|
|
23
|
+
# Contém todo o XML Envelope da resposta SOAP
|
|
24
|
+
#
|
|
25
|
+
# <b>Tipo de retorno: </b> _String_ XML
|
|
26
|
+
#
|
|
27
|
+
attr_accessor :original_xml
|
|
28
|
+
|
|
29
|
+
# Status possíveis
|
|
30
|
+
# [:success, :falied, :soap_error, :http_error, :unknown_error]
|
|
31
|
+
#
|
|
32
|
+
# <b>Tipo de retorno: </b> _Hash_
|
|
33
|
+
#
|
|
34
|
+
attr_accessor :status
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def initialize(attributes = {})
|
|
38
|
+
self.notas_fiscais = [] # Para poder utilizar o <<
|
|
39
|
+
self.error_messages = [] # Para poder utilizar o <<
|
|
40
|
+
super
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def notas_fiscais
|
|
44
|
+
@notas_fiscais = [@notas_fiscais].flatten # Para retornar sempre um vetor
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def error_messages
|
|
48
|
+
@error_messages = [@error_messages].flatten
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Método para saber se a conexão com a prefeitura foi mal-sucedida.
|
|
52
|
+
# Caso ocorra algum erro na requisição irá retornar true.
|
|
53
|
+
#
|
|
54
|
+
# <b>Tipo de retorno: </b> _Boolean_
|
|
55
|
+
#
|
|
56
|
+
def unsuccessful_request?
|
|
57
|
+
status.in?([:soap_error, :http_error, :unknown_error])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Método para saber se a conexão com a prefeitura foi bem-sucedida.
|
|
61
|
+
# Caso a requisição ocorra certo e não apresente nenhuma exception
|
|
62
|
+
# irá retornar true.
|
|
63
|
+
#
|
|
64
|
+
# <b>Tipo de retorno: </b> _Boolean_
|
|
65
|
+
#
|
|
66
|
+
def successful_request?
|
|
67
|
+
!unsuccessful_request?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def success?
|
|
71
|
+
status == :success
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def status
|
|
75
|
+
@status ||= get_status
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def get_status
|
|
79
|
+
error_messages.blank? ? :success : :falied
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Retorna um array apenas com os códigos das mensagens de erro.
|
|
83
|
+
# Sempre retornar o código no formato de String.
|
|
84
|
+
#
|
|
85
|
+
# <b>Tipo de retorno: </b> _Array_
|
|
86
|
+
#
|
|
87
|
+
def message_codes
|
|
88
|
+
@message_codes ||= error_messages.select{|msg| msg.is_a?(Hash)}.map{|msg| msg[:code].try(:to_s) }
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module BrNfe
|
|
2
|
-
module
|
|
3
|
-
module
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
4
|
class NotaFiscal < BrNfe::ActiveModelBase
|
|
5
|
-
include BrNfe::
|
|
6
|
-
include BrNfe::
|
|
7
|
-
include BrNfe::
|
|
8
|
-
include BrNfe::
|
|
5
|
+
include BrNfe::Association::HaveDestinatario
|
|
6
|
+
include BrNfe::Association::HaveEmitente
|
|
7
|
+
include BrNfe::Association::HaveCondicaoPagamento
|
|
8
|
+
include BrNfe::Service::Association::HaveIntermediario
|
|
9
9
|
|
|
10
10
|
attr_accessor :numero_nf
|
|
11
11
|
attr_accessor :codigo_verificacao
|
|
@@ -38,18 +38,18 @@ module BrNfe
|
|
|
38
38
|
attr_accessor :codigo_municipio
|
|
39
39
|
|
|
40
40
|
#Valores dos serviços
|
|
41
|
-
attr_accessor :
|
|
42
|
-
attr_accessor :
|
|
41
|
+
attr_accessor :valor_total_servicos
|
|
42
|
+
attr_accessor :deducoes
|
|
43
43
|
attr_accessor :valor_pis
|
|
44
44
|
attr_accessor :valor_cofins
|
|
45
45
|
attr_accessor :valor_inss
|
|
46
46
|
attr_accessor :valor_ir
|
|
47
47
|
attr_accessor :valor_csll
|
|
48
|
-
attr_accessor :
|
|
48
|
+
attr_accessor :iss_retido
|
|
49
49
|
attr_accessor :outras_retencoes
|
|
50
50
|
attr_accessor :total_iss
|
|
51
|
-
attr_accessor :
|
|
52
|
-
attr_accessor :
|
|
51
|
+
attr_accessor :base_calculo
|
|
52
|
+
attr_accessor :iss_aliquota
|
|
53
53
|
attr_accessor :valor_liquido # v2
|
|
54
54
|
attr_accessor :desconto_condicionado # v2
|
|
55
55
|
attr_accessor :desconto_incondicionado # v2
|
|
@@ -85,7 +85,14 @@ module BrNfe
|
|
|
85
85
|
attr_accessor :codigo_obra
|
|
86
86
|
attr_accessor :codigo_art
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def emitente_class
|
|
91
|
+
BrNfe.emitente_service_class
|
|
92
|
+
end
|
|
93
|
+
def destinatario_class
|
|
94
|
+
BrNfe.destinatario_service_class
|
|
95
|
+
end
|
|
89
96
|
end
|
|
90
97
|
end
|
|
91
98
|
end
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
module Paths
|
|
5
|
+
module V1
|
|
6
|
+
module TcNfse
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
def response_default_path_to_nf
|
|
11
|
+
[:nfse, :inf_nfse]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def response_invoice_numero_nf_path
|
|
15
|
+
response_default_path_to_nf + [:numero]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def response_invoice_codigo_verificacao_path
|
|
19
|
+
response_default_path_to_nf + [:codigo_verificacao]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def response_invoice_data_emissao_path
|
|
23
|
+
response_default_path_to_nf + [:data_emissao]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def response_invoice_rps_numero_path
|
|
27
|
+
response_default_path_to_nf + [:identificacao_rps, :numero]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def response_invoice_rps_serie_path
|
|
31
|
+
response_default_path_to_nf + [:identificacao_rps, :serie]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def response_invoice_rps_tipo_path
|
|
35
|
+
response_default_path_to_nf + [:identificacao_rps, :tipo]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def response_invoice_data_emissao_rps_path
|
|
39
|
+
response_default_path_to_nf + [:data_emissao_rps]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def response_invoice_natureza_operacao_path
|
|
43
|
+
response_default_path_to_nf + [:natureza_operacao]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def response_invoice_regime_especial_tributacao_path
|
|
47
|
+
response_default_path_to_nf + [:regime_especial_tributacao]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def response_invoice_optante_simples_nacional_path
|
|
51
|
+
response_default_path_to_nf + [:optante_simples_nacional]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def response_invoice_incentivador_cultural_path
|
|
55
|
+
response_default_path_to_nf + [:incentivador_cultural]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def response_invoice_competencia_path
|
|
59
|
+
response_default_path_to_nf + [:competencia]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def response_invoice_outras_informacoes_path
|
|
63
|
+
response_default_path_to_nf + [:outras_informacoes]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def response_invoice_item_lista_servico_path
|
|
67
|
+
response_default_path_to_nf + [:servico, :item_lista_servico]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def response_invoice_cnae_code_path
|
|
71
|
+
response_default_path_to_nf + [:servico, :codigo_cnae]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def response_invoice_description_path
|
|
75
|
+
response_default_path_to_nf + [:servico, :discriminacao]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def response_invoice_codigo_municipio_path
|
|
79
|
+
response_default_path_to_nf + [:servico, :codigo_municipio]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def response_invoice_valor_total_servicos_path
|
|
83
|
+
response_default_path_to_nf + [:servico, :valores, :valor_servicos]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def response_invoice_deducoes_path
|
|
87
|
+
response_default_path_to_nf + [:servico, :valores, :valor_deducoes]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def response_invoice_valor_pis_path
|
|
91
|
+
response_default_path_to_nf + [:servico, :valores, :valor_pis]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def response_invoice_valor_cofins_path
|
|
95
|
+
response_default_path_to_nf + [:servico, :valores, :valor_cofins]
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def response_invoice_valor_inss_path
|
|
99
|
+
response_default_path_to_nf + [:servico, :valores, :valor_inss]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def response_invoice_valor_ir_path
|
|
103
|
+
response_default_path_to_nf + [:servico, :valores, :valor_ir]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def response_invoice_valor_csll_path
|
|
107
|
+
response_default_path_to_nf + [:servico, :valores, :valor_csll]
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def response_invoice_iss_retido_path
|
|
111
|
+
response_default_path_to_nf + [:servico, :valores, :iss_retido]
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def response_invoice_outras_retencoes_path
|
|
115
|
+
response_default_path_to_nf + [:servico, :valores, :outras_retencoes]
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def response_invoice_total_iss_path
|
|
119
|
+
response_default_path_to_nf + [:servico, :valores, :valor_iss]
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def response_invoice_base_calculo_path
|
|
123
|
+
response_default_path_to_nf + [:servico, :valores, :base_calculo]
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def response_invoice_iss_aliquota_path
|
|
127
|
+
response_default_path_to_nf + [:servico, :valores, :aliquota]
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def response_invoice_valor_liquido_path
|
|
131
|
+
response_default_path_to_nf + [:servico, :valores, :valor_liquido_nfse]
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def response_invoice_desconto_condicionado_path
|
|
135
|
+
response_default_path_to_nf + [:servico, :valores, :desconto_condicionado]
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def response_invoice_desconto_incondicionado_path
|
|
139
|
+
response_default_path_to_nf + [:servico, :valores, :desconto_incondicionado]
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def response_invoice_orgao_gerador_municipio_path
|
|
143
|
+
response_default_path_to_nf + [:orgao_gerador, :codigo_municipio]
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def response_invoice_orgao_gerador_uf_path
|
|
147
|
+
response_default_path_to_nf + [:orgao_gerador, :uf]
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def response_invoice_codigo_obra_path
|
|
151
|
+
response_default_path_to_nf + [:construcao_civil, :codigo_obra]
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def response_invoice_codigo_art_path
|
|
155
|
+
response_default_path_to_nf + [:construcao_civil, :art]
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def response_invoice_cancelamento_codigo_path
|
|
159
|
+
[:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :codigo_cancelamento]
|
|
160
|
+
end
|
|
161
|
+
def response_invoice_cancelamento_numero_nf_path
|
|
162
|
+
[:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :numero]
|
|
163
|
+
end
|
|
164
|
+
def response_invoice_cancelamento_cnpj_path
|
|
165
|
+
[:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :cnpj]
|
|
166
|
+
end
|
|
167
|
+
def response_invoice_cancelamento_inscricao_municipal_path
|
|
168
|
+
[:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :inscricao_municipal]
|
|
169
|
+
end
|
|
170
|
+
def response_invoice_cancelamento_municipio_path
|
|
171
|
+
[:nfse_cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :codigo_municipio]
|
|
172
|
+
end
|
|
173
|
+
def response_invoice_cancelamento_data_hora_path
|
|
174
|
+
[:nfse_cancelamento, :confirmacao, :data_hora_cancelamento]
|
|
175
|
+
end
|
|
176
|
+
def response_invoice_nfe_substituidora_path
|
|
177
|
+
[:nfse_substituicao, :substituicao_nfse, :nfse_substituidora]
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
############################## PATH PARA EMITENTE ##########################################
|
|
181
|
+
def response_invoice_emitente_path
|
|
182
|
+
response_default_path_to_nf+[:prestador_servico]
|
|
183
|
+
end
|
|
184
|
+
def response_invoice_emitente_cnpj_path
|
|
185
|
+
response_invoice_emitente_path + [:identificacao_prestador, :cnpj]
|
|
186
|
+
end
|
|
187
|
+
def response_invoice_emitente_inscricao_municipal_path
|
|
188
|
+
response_invoice_emitente_path + [:identificacao_prestador, :inscricao_municipal]
|
|
189
|
+
end
|
|
190
|
+
def response_invoice_emitente_razao_social_path
|
|
191
|
+
response_invoice_emitente_path + [:razao_social]
|
|
192
|
+
end
|
|
193
|
+
def response_invoice_emitente_nome_fantasia_path
|
|
194
|
+
response_invoice_emitente_path + [:nome_fantasia]
|
|
195
|
+
end
|
|
196
|
+
def response_invoice_emitente_telefone_path
|
|
197
|
+
response_invoice_emitente_path + [:contato, :telefone]
|
|
198
|
+
end
|
|
199
|
+
def response_invoice_emitente_email_path
|
|
200
|
+
response_invoice_emitente_path + [:contato, :email]
|
|
201
|
+
end
|
|
202
|
+
def response_invoice_emitente_endereco_logradouro_path
|
|
203
|
+
response_invoice_emitente_path + [:endereco, :endereco]
|
|
204
|
+
end
|
|
205
|
+
def response_invoice_emitente_endereco_numero_path
|
|
206
|
+
response_invoice_emitente_path + [:endereco, :numero]
|
|
207
|
+
end
|
|
208
|
+
def response_invoice_emitente_endereco_complemento_path
|
|
209
|
+
response_invoice_emitente_path + [:endereco, :complemento]
|
|
210
|
+
end
|
|
211
|
+
def response_invoice_emitente_endereco_bairro_path
|
|
212
|
+
response_invoice_emitente_path + [:endereco, :bairro]
|
|
213
|
+
end
|
|
214
|
+
def response_invoice_emitente_endereco_codigo_municipio_path
|
|
215
|
+
response_invoice_emitente_path + [:endereco, :codigo_municipio]
|
|
216
|
+
end
|
|
217
|
+
def response_invoice_emitente_endereco_uf_path
|
|
218
|
+
response_invoice_emitente_path + [:endereco, :uf]
|
|
219
|
+
end
|
|
220
|
+
def response_invoice_emitente_endereco_cep_path
|
|
221
|
+
response_invoice_emitente_path + [:endereco, :cep]
|
|
222
|
+
end
|
|
223
|
+
############################## PATH PARA DESTINATÁRIO ##########################################
|
|
224
|
+
def response_invoice_destinatario_cpf_path
|
|
225
|
+
response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :cpf_cnpj, :cpf]
|
|
226
|
+
end
|
|
227
|
+
def response_invoice_destinatario_cnpj_path
|
|
228
|
+
response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :cpf_cnpj, :cnpj]
|
|
229
|
+
end
|
|
230
|
+
def response_invoice_destinatario_inscricao_municipal_path
|
|
231
|
+
response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :inscricao_municipal]
|
|
232
|
+
end
|
|
233
|
+
def response_invoice_destinatario_inscricao_estadual_path
|
|
234
|
+
response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :inscricao_estadual]
|
|
235
|
+
end
|
|
236
|
+
def response_invoice_destinatario_inscricao_suframa_path
|
|
237
|
+
response_default_path_to_nf+[:tomador_servico, :identificacao_tomador, :inscricao_suframa]
|
|
238
|
+
end
|
|
239
|
+
def response_invoice_destinatario_razao_social_path
|
|
240
|
+
response_default_path_to_nf+[:tomador_servico, :razao_social]
|
|
241
|
+
end
|
|
242
|
+
def response_invoice_destinatario_telefone_path
|
|
243
|
+
response_default_path_to_nf+[:tomador_servico, :contato, :telefone]
|
|
244
|
+
end
|
|
245
|
+
def response_invoice_destinatario_email_path
|
|
246
|
+
response_default_path_to_nf+[:tomador_servico, :contato, :email]
|
|
247
|
+
end
|
|
248
|
+
def response_invoice_destinatario_endereco_logradouro_path
|
|
249
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :endereco]
|
|
250
|
+
end
|
|
251
|
+
def response_invoice_destinatario_endereco_numero_path
|
|
252
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :numero]
|
|
253
|
+
end
|
|
254
|
+
def response_invoice_destinatario_endereco_complemento_path
|
|
255
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :complemento]
|
|
256
|
+
end
|
|
257
|
+
def response_invoice_destinatario_endereco_bairro_path
|
|
258
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :bairro]
|
|
259
|
+
end
|
|
260
|
+
def response_invoice_destinatario_endereco_codigo_municipio_path
|
|
261
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :codigo_municipio]
|
|
262
|
+
end
|
|
263
|
+
def response_invoice_destinatario_endereco_uf_path
|
|
264
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :uf]
|
|
265
|
+
end
|
|
266
|
+
def response_invoice_destinatario_endereco_cep_path
|
|
267
|
+
response_default_path_to_nf+[:tomador_servico, :endereco, :cep]
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module BrNfe
|
|
2
|
+
module Service
|
|
3
|
+
module Response
|
|
4
|
+
class RecepcaoLoteRps < Default
|
|
5
|
+
# Número do protocolo de recebimento do XML
|
|
6
|
+
# Setado normalmente quando é enviado um lote RPS
|
|
7
|
+
# para processamento.
|
|
8
|
+
# O valor desse atributo é utilizado para posteriormente
|
|
9
|
+
# fazer a consulta para saber se o RPS já foi processado
|
|
10
|
+
#
|
|
11
|
+
# <b>Tipo de retorno: </b> _Integer_ ou _String_
|
|
12
|
+
#
|
|
13
|
+
attr_accessor :protocolo
|
|
14
|
+
|
|
15
|
+
# Data/Data hora do recebimento do XML pelo orgão emissor
|
|
16
|
+
# Nesse atrubuto pe setado a data/hora na qual o orgão emissor
|
|
17
|
+
# recebeu o XML que foi enviado.
|
|
18
|
+
# também é nesse atributo que é setado a data/hora do processamento
|
|
19
|
+
# da NF-e (nos casos de consulta)
|
|
20
|
+
#
|
|
21
|
+
# <b>Tipo de retorno: </b> _DateTime_
|
|
22
|
+
#
|
|
23
|
+
attr_accessor :data_recebimento
|
|
24
|
+
|
|
25
|
+
# Número do lote RPS
|
|
26
|
+
# Nesse atributo é setado o número do lote RPS
|
|
27
|
+
# quando o mesmo for retornado na resposta
|
|
28
|
+
#
|
|
29
|
+
# <b>Tipo de retorno: </b> _Integer_
|
|
30
|
+
#
|
|
31
|
+
attr_accessor :numero_lote
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/br_nfe/service/rps.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module BrNfe
|
|
2
2
|
module Service
|
|
3
3
|
class Rps < BrNfe::ActiveModelBase
|
|
4
|
-
include BrNfe::
|
|
5
|
-
include BrNfe::
|
|
6
|
-
include BrNfe::
|
|
4
|
+
include BrNfe::Association::HaveDestinatario
|
|
5
|
+
include BrNfe::Service::Association::HaveIntermediario
|
|
6
|
+
include BrNfe::Association::HaveCondicaoPagamento
|
|
7
7
|
|
|
8
8
|
# Método utilizado para saberse o modelo deve validar
|
|
9
9
|
# as informações obrigatórias do RPS.
|
|
@@ -19,14 +19,14 @@ module BrNfe
|
|
|
19
19
|
validates :numero, :serie, :tipo, presence: true, if: :validate_rps?
|
|
20
20
|
|
|
21
21
|
with_options if: :validar_recepcao_rps do |record|
|
|
22
|
-
record.validates :data_emissao, :item_lista_servico, :description, :codigo_municipio, :
|
|
23
|
-
record.validates :total_iss, :
|
|
22
|
+
record.validates :data_emissao, :item_lista_servico, :description, :codigo_municipio, :base_calculo, presence: true
|
|
23
|
+
record.validates :total_iss, :iss_aliquota, presence: true, unless: :iss_retido?
|
|
24
24
|
record.validates :municipio_incidencia, presence: true, if: :municipio_incidencia_obrigatorio?
|
|
25
25
|
|
|
26
|
-
record.validates :
|
|
26
|
+
record.validates :valor_total_servicos, :base_calculo, numericality: {greater_than: 0}
|
|
27
27
|
|
|
28
|
-
record.validates :
|
|
29
|
-
:valor_csll, :outras_retencoes, :total_iss, :
|
|
28
|
+
record.validates :deducoes, :valor_pis, :valor_cofins, :valor_inss, :valor_ir,
|
|
29
|
+
:valor_csll, :outras_retencoes, :total_iss, :iss_aliquota, :base_calculo,
|
|
30
30
|
:desconto_incondicionado, :desconto_condicionado, numericality: true, allow_blank: true
|
|
31
31
|
|
|
32
32
|
record.validate :validar_intermediario
|
|
@@ -60,7 +60,7 @@ module BrNfe
|
|
|
60
60
|
# Valor da base de cálculo da substituição tributária
|
|
61
61
|
#
|
|
62
62
|
# <b>Tipo: </b> _Float_
|
|
63
|
-
attr_accessor :
|
|
63
|
+
attr_accessor :total_base_calculo_st
|
|
64
64
|
|
|
65
65
|
# Valor total do ISS de substituição tributária
|
|
66
66
|
#
|
|
@@ -90,9 +90,9 @@ module BrNfe
|
|
|
90
90
|
# do valor de todos os itens
|
|
91
91
|
#
|
|
92
92
|
# <b>Tipo: </b> _Float_
|
|
93
|
-
attr_accessor :
|
|
94
|
-
def
|
|
95
|
-
@
|
|
93
|
+
attr_accessor :valor_total_servicos
|
|
94
|
+
def valor_total_servicos
|
|
95
|
+
@valor_total_servicos || items.map(&:valor_total).map(&:to_f).sum.round(2)
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
# Valor da base de cálculo
|
|
@@ -100,28 +100,28 @@ module BrNfe
|
|
|
100
100
|
# o valor das deduções
|
|
101
101
|
#
|
|
102
102
|
# <b>Tipo: </b> _Float_
|
|
103
|
-
attr_accessor :
|
|
104
|
-
def
|
|
105
|
-
@
|
|
103
|
+
attr_accessor :base_calculo
|
|
104
|
+
def base_calculo
|
|
105
|
+
@base_calculo || (valor_total_servicos.to_f - deducoes.to_f).round(2)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# Valor das deduções de impostos
|
|
109
109
|
#
|
|
110
110
|
# <b>Tipo: </b> _Float_
|
|
111
|
-
attr_accessor :
|
|
111
|
+
attr_accessor :deducoes
|
|
112
112
|
|
|
113
113
|
# Iss retido?
|
|
114
114
|
# Identifica se o ISS foi retido
|
|
115
115
|
#
|
|
116
116
|
# <b>Tipo: </b> _Integer_
|
|
117
|
-
attr_accessor :
|
|
117
|
+
attr_accessor :iss_retido
|
|
118
118
|
|
|
119
119
|
# Valor do Iss retido
|
|
120
120
|
# Total de iss retido da nota
|
|
121
121
|
#
|
|
122
122
|
# <b>Tipo: </b> _float_
|
|
123
123
|
#
|
|
124
|
-
attr_accessor :
|
|
124
|
+
attr_accessor :total_iss_retido
|
|
125
125
|
|
|
126
126
|
# Valor total do ISS (R$)
|
|
127
127
|
# Valor utilizado para identificar o valor total do ISS
|
|
@@ -139,9 +139,9 @@ module BrNfe
|
|
|
139
139
|
# 3.5% = 3.5
|
|
140
140
|
#
|
|
141
141
|
# <b>Tipo: </b> _Float_
|
|
142
|
-
attr_accessor :
|
|
143
|
-
def
|
|
144
|
-
@
|
|
142
|
+
attr_accessor :iss_aliquota
|
|
143
|
+
def iss_aliquota
|
|
144
|
+
@iss_aliquota || items.first.try(:iss_aliquota)
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
# Valor líquido da NF (R$)
|
|
@@ -149,12 +149,12 @@ module BrNfe
|
|
|
149
149
|
#
|
|
150
150
|
# <b>Tipo: </b> _Float_
|
|
151
151
|
#
|
|
152
|
-
attr_accessor :
|
|
153
|
-
def
|
|
154
|
-
@
|
|
152
|
+
attr_accessor :valor_liquido
|
|
153
|
+
def valor_liquido
|
|
154
|
+
@valor_liquido ||= valor_total_servicos.to_f - (
|
|
155
155
|
valor_pis.to_f + valor_cofins.to_f + valor_inss.to_f +
|
|
156
156
|
valor_ir.to_f + valor_csll.to_f + outras_retencoes.to_f +
|
|
157
|
-
|
|
157
|
+
total_iss_retido.to_f + desconto_incondicionado.to_f + desconto_condicionado.to_f
|
|
158
158
|
)
|
|
159
159
|
end
|
|
160
160
|
|
|
@@ -203,8 +203,8 @@ module BrNfe
|
|
|
203
203
|
numero_substituicao.present? && serie_substituicao.present? && tipo_substituicao.present?
|
|
204
204
|
end
|
|
205
205
|
|
|
206
|
-
def
|
|
207
|
-
BrNfe.true_values.include?(
|
|
206
|
+
def iss_retido?
|
|
207
|
+
BrNfe.true_values.include?(iss_retido)
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
def competencia
|
|
@@ -235,6 +235,9 @@ module BrNfe
|
|
|
235
235
|
def municipio_incidencia_obrigatorio?
|
|
236
236
|
"#{exigibilidade_iss}".in?(['1','01','6','06','7','07'])
|
|
237
237
|
end
|
|
238
|
+
def destinatario_class
|
|
239
|
+
BrNfe.destinatario_service_class
|
|
240
|
+
end
|
|
238
241
|
end
|
|
239
242
|
end
|
|
240
243
|
end
|
|
@@ -3,7 +3,7 @@ ItemServico
|
|
|
3
3
|
CodigoAtividade = BrNfe::Helper.only_number(item.cnae_code).max_size(8)
|
|
4
4
|
DescricaoServico = "#{item.description}".max_size(1000)
|
|
5
5
|
CST = BrNfe::Helper.only_number(item.cst).max_size(2)
|
|
6
|
-
Aliquota = value_monetary(item.
|
|
7
|
-
ValorUnitario = value_monetary(item.
|
|
8
|
-
Quantidade = item.
|
|
9
|
-
ValorTotal = value_monetary(item.
|
|
6
|
+
Aliquota = value_monetary(item.iss_aliquota, 4)
|
|
7
|
+
ValorUnitario = value_monetary(item.valor_unitario, 2)
|
|
8
|
+
Quantidade = item.quantidade.to_i
|
|
9
|
+
ValorTotal = value_monetary(item.valor_total, 2)
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
- rps.items.each do |item|
|
|
15
15
|
= render_xml '_service_item', item: item, dir_path: "#{BrNfe.root}/lib/br_nfe/service/sc/florianopolis/xml"
|
|
16
16
|
|
|
17
|
-
BaseCalculo = value_monetary(rps.
|
|
17
|
+
BaseCalculo = value_monetary(rps.base_calculo, 2)
|
|
18
18
|
ValorISSQN = value_monetary(rps.total_iss, 2)
|
|
19
19
|
|
|
20
|
-
- if rps.
|
|
21
|
-
BaseCalculoSubstituicao = value_monetary(rps.
|
|
20
|
+
- if rps.total_base_calculo_st.present?
|
|
21
|
+
BaseCalculoSubstituicao = value_monetary(rps.total_base_calculo_st, 2)
|
|
22
22
|
|
|
23
23
|
- if rps.total_issqn_st.present?
|
|
24
24
|
ValorISSQNSubstituicao = value_monetary(rps.total_issqn_st, 2)
|
|
25
25
|
|
|
26
|
-
ValorTotalServicos = value_monetary(rps.
|
|
26
|
+
ValorTotalServicos = value_monetary(rps.valor_total_servicos, 2)
|
|
27
27
|
|
|
28
28
|
- if rps.description.present?
|
|
29
29
|
DadosAdicionais = "#{rps.description}".max_size(1000)
|
|
@@ -4,8 +4,7 @@ module BrNfe
|
|
|
4
4
|
module V1
|
|
5
5
|
class CancelaNfse < BrNfe::Service::Simpliss::V1::Base
|
|
6
6
|
include BrNfe::Service::Concerns::Rules::CancelamentoNfs
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
def method_wsdl
|
|
10
9
|
:cancelar_nfse
|
|
11
10
|
end
|
|
@@ -14,15 +13,26 @@ module BrNfe
|
|
|
14
13
|
render_xml 'servico_cancelar_nfse_envio'
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
def response_root_path
|
|
18
|
-
[:cancelar_nfse_response]
|
|
19
|
-
end
|
|
20
|
-
|
|
21
16
|
# Tag root da requisição
|
|
22
17
|
#
|
|
23
18
|
def soap_body_root_tag
|
|
24
19
|
'CancelarNfse'
|
|
25
20
|
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def set_response
|
|
25
|
+
@response = BrNfe::Service::Response::Build::Cancelamento.new(
|
|
26
|
+
savon_response: @original_response, # Rsposta da requisição SOAP
|
|
27
|
+
keys_root_path: [:cancelar_nfse_response], # Caminho inicial da resposta / Chave pai principal
|
|
28
|
+
body_xml_path: nil,
|
|
29
|
+
xml_encode: response_encoding, # Codificação do xml de resposta
|
|
30
|
+
codigo_cancelamento_path: [:cancelar_nfse_result, :cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :codigo_cancelamento],
|
|
31
|
+
data_hora_cancelamento_path: [:cancelar_nfse_result, :cancelamento, :confirmacao, :data_hora_cancelamento],
|
|
32
|
+
numero_nfs_path: [:cancelar_nfse_result, :cancelamento, :confirmacao, :pedido, :inf_pedido_cancelamento, :identificacao_nfse, :numero],
|
|
33
|
+
message_errors_path: [:cancelar_nfse_result, :lista_mensagem_retorno, :mensagem_retorno]
|
|
34
|
+
).response
|
|
35
|
+
end
|
|
26
36
|
end
|
|
27
37
|
end
|
|
28
38
|
end
|