br_nfe 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
describe BrNfe::Servico::Betha::V2::CancelamentoNfs do
|
4
|
-
subject { FactoryGirl.build(:br_nfe_servico_betha_v2_cancelamento_nfs, emitente: emitente) }
|
5
|
-
let(:rps) { FactoryGirl.build(:br_nfe_rps, :completo) }
|
6
|
-
let(:emitente) { FactoryGirl.build(:emitente) }
|
7
|
-
let(:intermediario) { FactoryGirl.build(:intermediario) }
|
8
|
-
|
9
|
-
describe "inheritance class" do
|
10
|
-
it { subject.class.superclass.must_equal BrNfe::Servico::Betha::V2::Gateway }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "validations" do
|
14
|
-
it { must validate_presence_of(:numero_nfse) }
|
15
|
-
it { must validate_presence_of(:codigo_cancelamento) }
|
16
|
-
context "validações do certificado" do
|
17
|
-
before { subject.certificate_pkcs12 = nil }
|
18
|
-
it { must validate_presence_of(:certificate) }
|
19
|
-
it { must validate_presence_of(:certificate_key) }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#method_wsdl" do
|
24
|
-
it { subject.method_wsdl.must_equal :cancelar_nfse }
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#xml_builder" do
|
28
|
-
it "não ocorre erro" do
|
29
|
-
subject.stubs(:assinatura_xml).returns('<Signature>signed</Signature>')
|
30
|
-
subject.xml_builder.class.must_equal Nokogiri::XML::Builder
|
31
|
-
end
|
32
|
-
it "estrutura" do
|
33
|
-
subject.expects(:xml_pedido_cancelamento_assinado).returns(Nokogiri::XML::Builder.new{|x| x.Cancelamento 'ok'} )
|
34
|
-
xml = subject.xml_builder.doc
|
35
|
-
|
36
|
-
xml.namespaces.must_equal({"xmlns"=>"http://www.betha.com.br/e-nota-contribuinte-ws"})
|
37
|
-
xml.remove_namespaces!
|
38
|
-
|
39
|
-
xml.xpath('CancelarNfseEnvio/Cancelamento').first.text.must_equal 'ok'
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
describe BrNfe::Servico::Betha::V2::ConsultaLoteRps do
|
4
|
-
subject { FactoryGirl.build(:br_nfe_servico_betha_v2_consulta_lote_rps, emitente: emitente) }
|
5
|
-
let(:emitente) { FactoryGirl.build(:emitente) }
|
6
|
-
|
7
|
-
describe "inheritance class" do
|
8
|
-
it { subject.class.superclass.must_equal BrNfe::Servico::Betha::V2::Gateway }
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "validations" do
|
12
|
-
it { must validate_presence_of(:protocolo) }
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "#method_wsdl" do
|
16
|
-
it { subject.method_wsdl.must_equal :consultar_lote_rps }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#xml_builder" do
|
20
|
-
it "não ocorre erro" do
|
21
|
-
subject.stubs(:assinatura_xml).returns('<Signature>signed</Signature>')
|
22
|
-
subject.xml_builder.class.must_equal Nokogiri::XML::Builder
|
23
|
-
end
|
24
|
-
it "estrutura" do
|
25
|
-
subject.protocolo = '1'.rjust(100, '1')
|
26
|
-
subject.expects(:xml_prestador).returns(Nokogiri::XML::Builder.new{|x| x.Pestador 'ok'} )
|
27
|
-
xml = subject.xml_builder.doc
|
28
|
-
|
29
|
-
xml.namespaces.must_equal({"xmlns"=>"http://www.betha.com.br/e-nota-contribuinte-ws"})
|
30
|
-
xml.remove_namespaces!
|
31
|
-
|
32
|
-
xml.xpath('ConsultarLoteRpsEnvio/Pestador').first.text.must_equal 'ok'
|
33
|
-
xml.xpath('ConsultarLoteRpsEnvio/Protocolo').first.text.must_equal '1'.rjust(50, '1')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
describe BrNfe::Servico::Betha::V2::ConsultaNfsePorRps do
|
4
|
-
subject { FactoryGirl.build(:br_nfe_servico_betha_v2_consulta_nfse_por_rps, emitente: emitente, rps: rps) }
|
5
|
-
let(:emitente) { FactoryGirl.build(:emitente) }
|
6
|
-
let(:rps) { FactoryGirl.build(:br_nfe_rps) }
|
7
|
-
|
8
|
-
describe "inheritance class" do
|
9
|
-
it { subject.class.superclass.must_equal BrNfe::Servico::Betha::V2::Gateway }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "#method_wsdl" do
|
13
|
-
it { subject.method_wsdl.must_equal :consultar_nfse_por_rps }
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#xml_builder" do
|
17
|
-
it "não ocorre erro" do
|
18
|
-
subject.stubs(:assinatura_xml).returns('<Signature>signed</Signature>')
|
19
|
-
subject.xml_builder.class.must_equal Nokogiri::XML::Builder
|
20
|
-
end
|
21
|
-
it "estrutura" do
|
22
|
-
sequence_1 = sequence('sequence1')
|
23
|
-
subject.expects(:xml_identificacao_rps).with(rps).returns(Nokogiri::XML::Builder.new{|x| x.IdentificacaoRps 'valor ident rps'} ).in_sequence(sequence_1)
|
24
|
-
subject.expects(:xml_prestador).returns(Nokogiri::XML::Builder.new{|x| x.Pestador 'dados prestador'} ).in_sequence(sequence_1)
|
25
|
-
xml = subject.xml_builder.doc
|
26
|
-
|
27
|
-
xml.namespaces.must_equal({"xmlns"=>"http://www.betha.com.br/e-nota-contribuinte-ws"})
|
28
|
-
xml.remove_namespaces!
|
29
|
-
|
30
|
-
xml.xpath('ConsultarNfseRpsEnvio/IdentificacaoRps').first.text.must_equal 'valor ident rps'
|
31
|
-
xml.xpath('ConsultarNfseRpsEnvio/Pestador').first.text.must_equal 'dados prestador'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
describe BrNfe::Servico::Betha::V2::EnvioLoteRpsSincrono do
|
4
|
-
subject { FactoryGirl.build(:br_nfe_servico_betha_v2_envio_lote_rps_sincrono, emitente: emitente) }
|
5
|
-
let(:emitente) { FactoryGirl.build(:emitente) }
|
6
|
-
|
7
|
-
describe "inheritance class" do
|
8
|
-
it { subject.class.superclass.must_equal BrNfe::Servico::Betha::V2::RecepcaoLoteRps }
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "validations" do
|
12
|
-
it { must validate_presence_of(:numero_lote_rps) }
|
13
|
-
|
14
|
-
context "validações do certificado" do
|
15
|
-
before { subject.certificate_pkcs12 = nil }
|
16
|
-
it { must validate_presence_of(:certificate) }
|
17
|
-
it { must validate_presence_of(:certificate_key) }
|
18
|
-
end
|
19
|
-
|
20
|
-
it "deve chamar o metodo validar_lote_rps" do
|
21
|
-
subject.expects(:validar_lote_rps)
|
22
|
-
subject.valid?
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#method_wsdl" do
|
27
|
-
it { subject.method_wsdl.must_equal :recepcionar_lote_rps_sincrono }
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#xml_builder" do
|
31
|
-
it "não ocorre erro" do
|
32
|
-
subject.stubs(:assinatura_xml).returns('<Signature>signed</Signature>')
|
33
|
-
subject.xml_builder.class.must_equal Nokogiri::XML::Builder
|
34
|
-
end
|
35
|
-
it "estrutura" do
|
36
|
-
subject.numero_lote_rps = 88966
|
37
|
-
lote_rps_xml = Nokogiri::XML::Builder.new{|x| x.LoteRps 'valor loterps'}
|
38
|
-
subject.expects(:lote_rps_xml).returns(lote_rps_xml)
|
39
|
-
subject.expects(:assinatura_xml).with(lote_rps_xml.doc.root.to_s, '#lote88966').returns('<Signature>signed</Signature>')
|
40
|
-
xml = subject.xml_builder.doc
|
41
|
-
|
42
|
-
xml.namespaces.must_equal({"xmlns"=>"http://www.betha.com.br/e-nota-contribuinte-ws"})
|
43
|
-
xml.remove_namespaces!
|
44
|
-
|
45
|
-
xml.xpath('EnviarLoteRpsSincronoEnvio/LoteRps').first.text.must_equal 'valor loterps'
|
46
|
-
xml.xpath('EnviarLoteRpsSincronoEnvio/Signature').first.text.must_equal 'signed'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
end
|
@@ -1,372 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
describe BrNfe::Servico::Betha::V2::Gateway do
|
4
|
-
subject { FactoryGirl.build(:br_nfe_servico_betha_v2_gateway, emitente: emitente) }
|
5
|
-
let(:rps) { FactoryGirl.build(:br_nfe_rps, :completo) }
|
6
|
-
let(:emitente) { FactoryGirl.build(:emitente) }
|
7
|
-
let(:intermediario) { FactoryGirl.build(:intermediario) }
|
8
|
-
|
9
|
-
describe "inheritance class" do
|
10
|
-
it { subject.class.superclass.must_equal BrNfe::Servico::Betha::Base }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#namespaces" do
|
14
|
-
it "deve ter um valor" do
|
15
|
-
subject.namespaces.must_equal({"xmlns:e" => "http://www.betha.com.br/e-nota-contribuinte-ws"})
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#namespace_identifier" do
|
20
|
-
it "deve ter o valor e" do
|
21
|
-
subject.namespace_identifier.must_equal :e
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "#version" do
|
26
|
-
it { subject.version.must_equal :v2 }
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#wsdl" do
|
30
|
-
it "quando o env for test" do
|
31
|
-
subject.env = :test
|
32
|
-
subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/nfseWS?wsdl'
|
33
|
-
end
|
34
|
-
it "quando o env não for" do
|
35
|
-
subject.env = :production
|
36
|
-
subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-ws/nfseWS?wsdl'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "#cabecalho" do
|
41
|
-
it { subject.cabecalho.must_equal "<nfseCabecMsg><![CDATA[<cabecalho xmlns=\"http://www.betha.com.br/e-nota-contribuinte-ws\" versao=\"2.02\"> <versaoDados>2.02</versaoDados></cabecalho>]]></nfseCabecMsg>" }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe "#content_xml" do
|
45
|
-
it do
|
46
|
-
subject.expects(:canonical_xml_builder).returns("<xmlBuilder>value</xmlBuilder>")
|
47
|
-
subject.content_xml.must_equal "<nfseDadosMsg><![CDATA[<xmlBuilder>value</xmlBuilder>]]></nfseDadosMsg>"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#canonical_xml_builder" do
|
52
|
-
it "deve canonicalizar o valor do metodo xml_builder" do
|
53
|
-
xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |new_xml|
|
54
|
-
new_xml.Principal{
|
55
|
-
new_xml.Valor 1
|
56
|
-
}
|
57
|
-
end
|
58
|
-
subject.expects(:xml_builder).returns(xml)
|
59
|
-
subject.canonical_xml_builder.must_equal("<Principal><Valor>1</Valor></Principal>")
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "#format_data_xml_for_signature" do
|
65
|
-
it "deve adicionar o attr xmlns no root do XML" do
|
66
|
-
xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |new_xml|
|
67
|
-
new_xml.Principal{
|
68
|
-
new_xml.Valor 1
|
69
|
-
}
|
70
|
-
end.doc.root
|
71
|
-
|
72
|
-
subject.send(:format_data_xml_for_signature, xml).must_equal "<Principal xmlns=\"http://www.betha.com.br/e-nota-contribuinte-ws\"><Valor>1</Valor></Principal>"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context "#xml_intermediario_servico" do
|
77
|
-
it "estrutura com todos os atributos" do
|
78
|
-
xml = subject.send(:xml_intermediario_servico, intermediario).doc
|
79
|
-
xml.xpath('Intermediario/RazaoSocial').first.text.must_equal intermediario.razao_social
|
80
|
-
xml.xpath('Intermediario/IdentificacaoIntermediario/CpfCnpj/Cnpj').first.text.must_equal BrNfe::Helper::CpfCnpj.new(intermediario.cpf_cnpj).sem_formatacao
|
81
|
-
xml.xpath('Intermediario/IdentificacaoIntermediario/InscricaoMunicipal').first.text.must_equal intermediario.inscricao_municipal
|
82
|
-
end
|
83
|
-
it "estrutura sem os atributos não obrigatorios" do
|
84
|
-
intermediario.assign_attributes({cpf_cnpj: '132.456.789-01', inscricao_municipal: ''})
|
85
|
-
xml = subject.send(:xml_intermediario_servico, intermediario).doc
|
86
|
-
|
87
|
-
xml.xpath('Intermediario/IdentificacaoIntermediario/CpfCnpj/Cpf').first.text.must_equal BrNfe::Helper::CpfCnpj.new(intermediario.cpf_cnpj).sem_formatacao
|
88
|
-
xml.xpath('Intermediario/IdentificacaoIntermediario/InscricaoMunicipal').first.must_be_nil
|
89
|
-
end
|
90
|
-
it "se não tiver intermediario não monta o xml" do
|
91
|
-
xml = subject.send(:xml_intermediario_servico, nil).doc
|
92
|
-
xml.root.to_s.must_equal ''
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context "#xml_prestador" do
|
97
|
-
it "estrutura com todos os atributos" do
|
98
|
-
xml = subject.send(:xml_prestador).doc
|
99
|
-
|
100
|
-
xml.xpath('Prestador/CpfCnpj/Cnpj').first.text.must_equal emitente.cnpj
|
101
|
-
xml.xpath('Prestador/InscricaoMunicipal').first.text.must_equal emitente.inscricao_municipal
|
102
|
-
end
|
103
|
-
it "estrutura sem os atributos não obrigatorios" do
|
104
|
-
emitente.inscricao_municipal = ''
|
105
|
-
xml = subject.send(:xml_prestador).doc
|
106
|
-
|
107
|
-
xml.xpath('Prestador/InscricaoMunicipal').first.must_be_nil
|
108
|
-
end
|
109
|
-
it "se o env não for production não exibe a inscricao_municipal pois a base de testes da Betha está bugada" do
|
110
|
-
emitente.inscricao_municipal = '7987897'
|
111
|
-
subject.env = :test
|
112
|
-
xml = subject.send(:xml_prestador).doc
|
113
|
-
|
114
|
-
xml.xpath('Prestador/InscricaoMunicipal').first.must_be_nil
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "#xml_dados_servico" do
|
119
|
-
before do
|
120
|
-
rps.assign_attributes({
|
121
|
-
valor_servicos: 1_003.456,
|
122
|
-
valor_deducoes: 1_003.123465132,
|
123
|
-
valor_pis: 1_003.0,
|
124
|
-
valor_cofins: 1_003.3654,
|
125
|
-
valor_inss: 1_004.456,
|
126
|
-
valor_ir: 1_005.456,
|
127
|
-
valor_csll: 1_006.456,
|
128
|
-
outras_retencoes: 1_007.456,
|
129
|
-
valor_iss: 1_008.456,
|
130
|
-
aliquota: 1_009.456,
|
131
|
-
desconto_incondicionado: 1_010.456,
|
132
|
-
desconto_condicionado: 1_011.456,
|
133
|
-
responsavel_retencao: '123',
|
134
|
-
item_lista_servico: '6.356.01',
|
135
|
-
iss_retido: true,
|
136
|
-
codigo_cnae: '65.687.5654',
|
137
|
-
discriminacao: 'áêçOÓó'.ljust(2_005, 'a'),
|
138
|
-
codigo_municipio: '1234AAA567890123',
|
139
|
-
exigibilidade_iss: '4',
|
140
|
-
codigo_pais: 'A123456',
|
141
|
-
municipio_incidencia: '1234AAA567890123',
|
142
|
-
numero_processo: '5'.rjust(50, '5'),
|
143
|
-
codigo_tributacao_municipio: '123465'.ljust(30, 'A'),
|
144
|
-
})
|
145
|
-
end
|
146
|
-
it "deve vir com a estrutura adecuada com todos os valores preenchidos" do
|
147
|
-
xml = subject.send(:xml_dados_servico, rps).doc
|
148
|
-
|
149
|
-
xml.xpath('Servico/IssRetido').first.text.must_equal "1"
|
150
|
-
xml.xpath('Servico/ResponsavelRetencao').first.text.must_equal "1"
|
151
|
-
xml.xpath('Servico/ItemListaServico').first.text.must_equal "63560"
|
152
|
-
xml.xpath('Servico/CodigoCnae').first.text.must_equal "6568756"
|
153
|
-
xml.xpath('Servico/Discriminacao').first.text.must_equal 'aecOOo'.ljust(2_000, 'a')
|
154
|
-
xml.xpath('Servico/CodigoMunicipio').first.text.must_equal "1234567"
|
155
|
-
xml.xpath('Servico/CodigoPais').first.text.must_equal "1234"
|
156
|
-
xml.xpath('Servico/ExigibilidadeISS').first.text.must_equal "4"
|
157
|
-
xml.xpath('Servico/MunicipioIncidencia').first.text.must_equal "1234567"
|
158
|
-
xml.xpath('Servico/NumeroProcesso').first.text.must_equal "5".rjust(30, '5')
|
159
|
-
xml.xpath('Servico/CodigoTributacaoMunicipio').first.text.must_equal '123465'.ljust(20, 'A')
|
160
|
-
|
161
|
-
xml.xpath('Servico/Valores/ValorServicos').first.text.must_equal "1003.46"
|
162
|
-
xml.xpath('Servico/Valores/ValorDeducoes').first.text.must_equal "1003.12"
|
163
|
-
xml.xpath('Servico/Valores/ValorPis').first.text.must_equal "1003.0"
|
164
|
-
xml.xpath('Servico/Valores/ValorCofins').first.text.must_equal "1003.37"
|
165
|
-
xml.xpath('Servico/Valores/ValorInss').first.text.must_equal "1004.46"
|
166
|
-
xml.xpath('Servico/Valores/ValorIr').first.text.must_equal "1005.46"
|
167
|
-
xml.xpath('Servico/Valores/ValorCsll').first.text.must_equal "1006.46"
|
168
|
-
xml.xpath('Servico/Valores/OutrasRetencoes').first.text.must_equal "1007.46"
|
169
|
-
xml.xpath('Servico/Valores/ValorIss').first.text.must_equal "1008.46"
|
170
|
-
xml.xpath('Servico/Valores/Aliquota').first.text.must_equal "1009.46"
|
171
|
-
xml.xpath('Servico/Valores/DescontoIncondicionado').first.text.must_equal "1010.46"
|
172
|
-
xml.xpath('Servico/Valores/DescontoCondicionado').first.text.must_equal "1011.46"
|
173
|
-
end
|
174
|
-
|
175
|
-
it "se exigibilidade_iss não for 4, então não posso mandar o codigo do pais" do
|
176
|
-
rps.exigibilidade_iss = '1'
|
177
|
-
xml = subject.send(:xml_dados_servico, rps).doc
|
178
|
-
xml.xpath('Servico/CodigoPais').first.must_be_nil
|
179
|
-
end
|
180
|
-
|
181
|
-
it "sem os valores não obrigatórios" do
|
182
|
-
rps.assign_attributes({
|
183
|
-
valor_servicos: '',
|
184
|
-
valor_deducoes: '',
|
185
|
-
valor_pis: '',
|
186
|
-
valor_cofins: '',
|
187
|
-
valor_inss: '',
|
188
|
-
valor_ir: '',
|
189
|
-
valor_csll: '',
|
190
|
-
outras_retencoes: '',
|
191
|
-
valor_iss: '',
|
192
|
-
aliquota: '',
|
193
|
-
desconto_incondicionado: '',
|
194
|
-
desconto_condicionado: '',
|
195
|
-
responsavel_retencao: '',
|
196
|
-
item_lista_servico: '',
|
197
|
-
iss_retido: '',
|
198
|
-
codigo_cnae: '',
|
199
|
-
discriminacao: '',
|
200
|
-
codigo_municipio: '',
|
201
|
-
exigibilidade_iss: '',
|
202
|
-
codigo_pais: '',
|
203
|
-
municipio_incidencia: '',
|
204
|
-
numero_processo: '',
|
205
|
-
codigo_tributacao_municipio: '',
|
206
|
-
})
|
207
|
-
|
208
|
-
xml = subject.send(:xml_dados_servico, rps).doc
|
209
|
-
|
210
|
-
xml.xpath('Servico/IssRetido').first.text.must_equal "2"
|
211
|
-
xml.xpath('Servico/ResponsavelRetencao').first.must_be_nil
|
212
|
-
xml.xpath('Servico/ItemListaServico').first.must_be_nil
|
213
|
-
xml.xpath('Servico/CodigoCnae').first.must_be_nil
|
214
|
-
xml.xpath('Servico/Discriminacao').first.text.must_equal ''
|
215
|
-
xml.xpath('Servico/CodigoMunicipio').first.text.must_equal ''
|
216
|
-
xml.xpath('Servico/CodigoPais').first.must_be_nil
|
217
|
-
xml.xpath('Servico/ExigibilidadeISS').first.text.must_equal ""
|
218
|
-
xml.xpath('Servico/MunicipioIncidencia').first.must_be_nil
|
219
|
-
xml.xpath('Servico/NumeroProcesso').first.must_be_nil
|
220
|
-
xml.xpath('Servico/CodigoTributacaoMunicipio').first.must_be_nil
|
221
|
-
|
222
|
-
xml.xpath('Servico/Valores/ValorServicos').first.text.must_equal "0.0"
|
223
|
-
xml.xpath('Servico/Valores/ValorDeducoes').first.must_be_nil
|
224
|
-
xml.xpath('Servico/Valores/ValorPis').first.must_be_nil
|
225
|
-
xml.xpath('Servico/Valores/ValorCofins').first.must_be_nil
|
226
|
-
xml.xpath('Servico/Valores/ValorInss').first.must_be_nil
|
227
|
-
xml.xpath('Servico/Valores/ValorIr').first.must_be_nil
|
228
|
-
xml.xpath('Servico/Valores/ValorCsll').first.must_be_nil
|
229
|
-
xml.xpath('Servico/Valores/OutrasRetencoes').first.must_be_nil
|
230
|
-
xml.xpath('Servico/Valores/ValorIss').first.must_be_nil
|
231
|
-
xml.xpath('Servico/Valores/Aliquota').first.must_be_nil
|
232
|
-
xml.xpath('Servico/Valores/DescontoIncondicionado').first.must_be_nil
|
233
|
-
xml.xpath('Servico/Valores/DescontoCondicionado').first.must_be_nil
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
describe "#xml_inf_declaracao_prestacao_servico" do
|
238
|
-
before do
|
239
|
-
rps.assign_attributes({
|
240
|
-
data_emissao: DateTime.parse('12/04/1991 03:45'),
|
241
|
-
status: '123',
|
242
|
-
competencia: DateTime.parse('05/11/2000')
|
243
|
-
})
|
244
|
-
emitente.assign_attributes({
|
245
|
-
regime_especial_tributacao: 1,
|
246
|
-
optante_simples_nacional: true,
|
247
|
-
incentivo_fiscal: false,
|
248
|
-
})
|
249
|
-
end
|
250
|
-
it do
|
251
|
-
sequence1 = sequence('sequence1')
|
252
|
-
subject.expects(:xml_identificacao_rps).with(rps).returns(Nokogiri::XML::Builder.new {|xml| xml.Doc1 1}).in_sequence(sequence1)
|
253
|
-
subject.expects(:xml_rps_substituido).with(rps).returns( Nokogiri::XML::Builder.new {|xml| xml.Doc2 2}).in_sequence(sequence1)
|
254
|
-
subject.expects(:xml_dados_servico).with(rps).returns( Nokogiri::XML::Builder.new {|xml| xml.Doc3 3}).in_sequence(sequence1)
|
255
|
-
subject.expects(:xml_prestador).returns( Nokogiri::XML::Builder.new {|xml| xml.Doc4 4}).in_sequence(sequence1)
|
256
|
-
subject.expects(:xml_dados_tomador).with(rps.destinatario).returns(Nokogiri::XML::Builder.new {|xml| xml.Doc5 5}).in_sequence(sequence1)
|
257
|
-
subject.expects(:xml_intermediario_servico).with(rps.intermediario).returns(Nokogiri::XML::Builder.new {|xml| xml.Doc6 6}).in_sequence(sequence1)
|
258
|
-
subject.expects(:xml_dados_construcao_civil).with(rps).returns(Nokogiri::XML::Builder.new {|xml| xml.Doc7 7}).in_sequence(sequence1)
|
259
|
-
xml = subject.send(:xml_inf_declaracao_prestacao_servico, rps).doc
|
260
|
-
|
261
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Rps/Doc1').first.text.must_equal '1'
|
262
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Rps/DataEmissao').first.text.must_equal '1991-04-12'
|
263
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Rps/Status').first.text.must_equal '1'
|
264
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Rps/Doc2').first.text.must_equal '2'
|
265
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Competencia').first.text.must_equal '2000-11-05'
|
266
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Doc3').first.text.must_equal '3'
|
267
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Doc4').first.text.must_equal '4'
|
268
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Doc5').first.text.must_equal '5'
|
269
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Doc6').first.text.must_equal '6'
|
270
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/Doc7').first.text.must_equal '7'
|
271
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/RegimeEspecialTributacao').first.text.must_equal '1'
|
272
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/OptanteSimplesNacional').first.text.must_equal '1'
|
273
|
-
xml.xpath('InfDeclaracaoPrestacaoServico/IncentivoFiscal').first.text.must_equal '2'
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
describe "#xml_rps_assinado" do
|
278
|
-
it do
|
279
|
-
info_servico = Nokogiri::XML::Builder.new {|xml| xml.InfoServico 'valores'}
|
280
|
-
subject.expects(:xml_inf_declaracao_prestacao_servico).with(rps).returns(info_servico)
|
281
|
-
subject.expects(:assinatura_xml).with(info_servico.doc.root.to_s, "#rps#{rps.numero}").returns("<Signature>true</Signature>")
|
282
|
-
xml = subject.send(:xml_rps_assinado, rps).doc
|
283
|
-
xml.xpath('Rps/InfoServico').first.text.must_equal 'valores'
|
284
|
-
xml.xpath('Rps/Signature').first.text.must_equal 'true'
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
describe "#xml_pedido_cancelamento_assinado" do
|
289
|
-
it do
|
290
|
-
subject.numero_nfse = 888
|
291
|
-
xml_cancelamento = Nokogiri::XML::Builder.new {|xml| xml.XmlCancelamento 'valores'}
|
292
|
-
subject.expects(:xml_inf_pedido_cancelamento).returns(xml_cancelamento)
|
293
|
-
subject.expects(:assinatura_xml).with(xml_cancelamento.doc.root.to_s, "#nf888").returns("<Signature>true</Signature>")
|
294
|
-
xml = subject.send(:xml_pedido_cancelamento_assinado).doc
|
295
|
-
xml.xpath('Pedido/XmlCancelamento').first.text.must_equal 'valores'
|
296
|
-
xml.xpath('Pedido/Signature').first.text.must_equal 'true'
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
describe "#xml_inf_pedido_cancelamento" do
|
301
|
-
before do
|
302
|
-
subject.assign_attributes({
|
303
|
-
numero_nfse: '336ABC6554411233664125',
|
304
|
-
codigo_cancelamento: '1234567890',
|
305
|
-
emitente:{
|
306
|
-
cnpj: '12345678901234',
|
307
|
-
inscricao_municipal: '9996654785524865464565',
|
308
|
-
endereco: {codigo_municipio: '123456789012345'}
|
309
|
-
}
|
310
|
-
})
|
311
|
-
end
|
312
|
-
|
313
|
-
it "com env = production" do
|
314
|
-
subject.env = :production
|
315
|
-
xml = subject.send(:xml_inf_pedido_cancelamento).doc
|
316
|
-
|
317
|
-
xml.xpath('InfPedidoCancelamento').first.attr('Id').must_equal 'nf336ABC6554411233664125'
|
318
|
-
# Apenas 15 nuemros
|
319
|
-
xml.xpath('InfPedidoCancelamento/IdentificacaoNfse/Numero').first.text.must_equal '336655441123366'
|
320
|
-
xml.xpath('InfPedidoCancelamento/IdentificacaoNfse/InscricaoMunicipal').first.text.must_equal '999665478552486'
|
321
|
-
xml.xpath('InfPedidoCancelamento/IdentificacaoNfse/CodigoMunicipio').first.text.must_equal '1234567'
|
322
|
-
xml.xpath('InfPedidoCancelamento/CodigoCancelamento').first.text.must_equal '1234'
|
323
|
-
end
|
324
|
-
|
325
|
-
it "com env = test" do
|
326
|
-
subject.env = :test
|
327
|
-
xml = subject.send(:xml_inf_pedido_cancelamento).doc
|
328
|
-
|
329
|
-
xml.xpath('InfPedidoCancelamento').first.attr('Id').must_equal 'nf336ABC6554411233664125'
|
330
|
-
xml.xpath('InfPedidoCancelamento/IdentificacaoNfse/Numero').first.text.must_equal '336655441123366'
|
331
|
-
xml.xpath('InfPedidoCancelamento/IdentificacaoNfse/InscricaoMunicipal').first.must_be_nil
|
332
|
-
xml.xpath('InfPedidoCancelamento/IdentificacaoNfse/CodigoMunicipio').first.text.must_equal '1234567'
|
333
|
-
xml.xpath('InfPedidoCancelamento/CodigoCancelamento').first.text.must_equal '1234'
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
# describe "#xml_condicao_pagamento" do
|
340
|
-
# it "estrutura a prazo" do
|
341
|
-
# xml = subject.send(:xml_condicao_pagamento, rps).doc
|
342
|
-
|
343
|
-
# xml.xpath('CondicaoPagamento/Condicao').first.text.must_equal rps.condicao_pagamento.condicao
|
344
|
-
# xml.xpath('CondicaoPagamento/QtdParcela').first.text.must_equal '2'
|
345
|
-
|
346
|
-
# xml.xpath('CondicaoPagamento/Parcelas/Parcela').first.text.must_equal '1'
|
347
|
-
# xml.xpath('CondicaoPagamento/Parcelas/DataVencimento').first.text.must_equal '15/10/2015'
|
348
|
-
# xml.xpath('CondicaoPagamento/Parcelas/Valor').first.text.must_equal '10.0'
|
349
|
-
|
350
|
-
# xml.xpath('CondicaoPagamento/Parcelas/Parcela').last.text.must_equal '2'
|
351
|
-
# xml.xpath('CondicaoPagamento/Parcelas/DataVencimento').last.text.must_equal '15/11/2015'
|
352
|
-
# xml.xpath('CondicaoPagamento/Parcelas/Valor').last.text.must_equal '20.0'
|
353
|
-
# end
|
354
|
-
|
355
|
-
# it "estrutura a vista" do
|
356
|
-
# rps.condicao_pagamento.assign_attributes(condicao: 'A_VISTA', parcelas: [])
|
357
|
-
# xml = subject.send(:xml_condicao_pagamento, rps).doc
|
358
|
-
|
359
|
-
# xml.xpath('CondicaoPagamento/Condicao').first.text.must_equal 'A_VISTA'
|
360
|
-
# xml.xpath('CondicaoPagamento/QtdParcela').first.must_be_nil
|
361
|
-
|
362
|
-
# xml.xpath('CondicaoPagamento/Parcelas').first.must_be_nil
|
363
|
-
# end
|
364
|
-
|
365
|
-
# it "quando não tem condicao_pagamento" do
|
366
|
-
# rps.condicao_pagamento = nil
|
367
|
-
# xml = subject.send(:xml_condicao_pagamento, rps).doc
|
368
|
-
# xml.root.to_s.must_equal ''
|
369
|
-
# end
|
370
|
-
# end
|
371
|
-
|
372
|
-
end
|