br_nfe 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/br_nfe/active_model_base.rb +0 -5
- data/lib/br_nfe/base.rb +116 -7
- data/lib/br_nfe/helper/values_ts/service_v1.rb +15 -11
- data/lib/br_nfe/response/service/build_response.rb +230 -53
- data/lib/br_nfe/response/service/nota_fiscal.rb +9 -0
- data/lib/br_nfe/response/service/paths/base.rb +93 -59
- data/lib/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta.rb +2 -2
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta.rb +2 -2
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta.rb +2 -2
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta.rb +2 -2
- data/lib/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta.rb +4 -4
- data/lib/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta.rb +8 -8
- data/lib/br_nfe/response/service/paths/v1/tc_nfse.rb +201 -57
- data/lib/br_nfe/service/base.rb +104 -5
- data/lib/br_nfe/service/betha/base.rb +5 -0
- data/lib/br_nfe/service/betha/v1/cancelamento_nfs.rb +1 -4
- data/lib/br_nfe/service/betha/v1/consulta_lote_rps.rb +1 -4
- data/lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb +1 -4
- data/lib/br_nfe/service/betha/v1/consulta_nfse.rb +1 -4
- data/lib/br_nfe/service/betha/v1/consulta_situacao_lote_rps.rb +1 -3
- data/lib/br_nfe/service/betha/v1/gateway.rb +1 -1
- data/lib/br_nfe/service/betha/v1/recepcao_lote_rps.rb +1 -3
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta.rb +5 -1
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta.rb +5 -1
- data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +5 -1
- data/lib/br_nfe/service/concerns/rules/cancelamento_nfs.rb +5 -0
- data/lib/br_nfe/service/rps.rb +13 -4
- data/lib/br_nfe/service/simpliss/v1/base.rb +79 -0
- data/lib/br_nfe/service/simpliss/v1/cancela_nfse.rb +30 -0
- data/lib/br_nfe/service/simpliss/v1/consulta_lote_rps.rb +38 -0
- data/lib/br_nfe/service/simpliss/v1/consulta_nfs_por_rps.rb +31 -0
- data/lib/br_nfe/service/simpliss/v1/consulta_nfse.rb +30 -0
- data/lib/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps.rb +29 -0
- data/lib/br_nfe/service/simpliss/v1/recepcao_lote_rps.rb +35 -0
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_cancelar_nfse_resposta.rb +22 -0
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_lote_rps_resposta.rb +25 -0
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_resposta.rb +25 -0
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +25 -0
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_situacao_lote_rps_resposta.rb +31 -0
- data/lib/br_nfe/service/simpliss/v1/response_paths/servico_enviar_lote_rps_resposta.rb +36 -0
- data/lib/br_nfe/service/simpliss/v1/xml/_login.xml.slim +3 -0
- data/lib/br_nfe/service/simpliss/v1/xml/_tc_dados_servico.xml.slim +18 -0
- data/lib/br_nfe/service/simpliss/v1/xml/_tc_item_servico.xml.slim +3 -0
- data/lib/br_nfe/service/simpliss/v1/xml/servico_cancelar_nfse_envio.xml.slim +11 -0
- data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_lote_rps_envio.xml.slim +7 -0
- data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_nfse_envio.xml.slim +22 -0
- data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_nfse_rps_envio.xml.slim +8 -0
- data/lib/br_nfe/service/simpliss/v1/xml/servico_consultar_situacao_lote_rps_envio.xml.slim +7 -0
- data/lib/br_nfe/service/simpliss/v1/xml/servico_enviar_lote_rps_envio.xml.slim +11 -0
- data/lib/br_nfe/service/thema/v1/base.rb +48 -2
- data/lib/br_nfe/service/thema/v1/cancela_nfse.rb +14 -5
- data/lib/br_nfe/service/thema/v1/consulta_lote_rps.rb +5 -4
- data/lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb +5 -4
- data/lib/br_nfe/service/thema/v1/consulta_nfse.rb +5 -4
- data/lib/br_nfe/service/thema/v1/consulta_situacao_lote_rps.rb +1 -4
- data/lib/br_nfe/service/thema/v1/recepcao_lote_rps.rb +19 -5
- data/lib/br_nfe/service/thema/v1/recepcao_lote_rps_limitado.rb +1 -1
- data/lib/br_nfe/service/thema/v1/response_paths/servico_cancelar_nfse_resposta.rb +17 -0
- data/lib/br_nfe/service/thema/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +19 -0
- data/lib/br_nfe/service/xml/v1/_tc_contato.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_cpf_cnpj.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_dados_construcao_civil.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_dados_prestador.xml.slim +5 -5
- data/lib/br_nfe/service/xml/v1/_tc_dados_servico.xml.slim +6 -6
- data/lib/br_nfe/service/xml/v1/_tc_dados_tomador.xml.slim +4 -4
- data/lib/br_nfe/service/xml/v1/_tc_endereco.xml.slim +7 -7
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_intermediario_servico.xml.slim +3 -3
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_nfse.xml.slim +4 -4
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_orgao_gerador.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_prestador.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_rps.xml.slim +3 -3
- data/lib/br_nfe/service/xml/v1/_tc_identificacao_tomador.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_inf_pedido_cancelamento.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_inf_rps.xml.slim +13 -13
- data/lib/br_nfe/service/xml/v1/_tc_lote_rps.xml.slim +6 -6
- data/lib/br_nfe/service/xml/v1/_tc_pedido_cancelamento.xml.slim +1 -1
- data/lib/br_nfe/service/xml/v1/_tc_rps.xml.slim +2 -2
- data/lib/br_nfe/service/xml/v1/_tc_valores.xml.slim +16 -17
- data/lib/br_nfe/service/xml/v1/servico_cancelar_nfse_envio.xml.slim +3 -4
- data/lib/br_nfe/service/xml/v1/servico_consultar_lote_rps_envio.xml.slim +3 -3
- data/lib/br_nfe/service/xml/v1/servico_consultar_nfse_envio.xml.slim +8 -8
- data/lib/br_nfe/service/xml/v1/servico_consultar_nfse_rps_envio.xml.slim +3 -3
- data/lib/br_nfe/service/xml/v1/servico_consultar_situacao_lote_rps_envio.xml.slim +3 -3
- data/lib/br_nfe/service/xml/v1/servico_enviar_lote_rps_envio.xml.slim +3 -3
- data/lib/br_nfe/version.rb +1 -1
- data/lib/br_nfe/xml/_signed_info_sh1.xml.slim +9 -9
- data/lib/br_nfe/xml/signature_sh1.xml.slim +5 -5
- data/lib/br_nfe.rb +26 -10
- data/test/br_nfe/base_test.rb +5 -5
- data/test/br_nfe/helper/values_ts/service_v1_test.rb +376 -0
- data/test/br_nfe/response/service/build_response_test.rb +1 -173
- data/test/br_nfe/response/service/paths/base_test.rb +61 -64
- data/test/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta_test.rb +2 -2
- data/test/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta_test.rb +2 -2
- data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta_test.rb +2 -2
- data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta_test.rb +2 -2
- data/test/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta_test.rb +3 -3
- data/test/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta_test.rb +4 -4
- data/test/br_nfe/response/service/paths/v1/tc_nfse_test.rb +27 -31
- data/test/br_nfe/service/base_test.rb +206 -11
- data/test/br_nfe/service/betha/base_test.rb +9 -0
- data/test/br_nfe/service/betha/v1/cancelamento_nfs_test.rb +0 -6
- data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +0 -6
- data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +0 -4
- data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +0 -4
- data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +1 -5
- data/test/br_nfe/service/betha/v1/gateway_test.rb +4 -2
- data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +0 -4
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb +1 -1
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta_test.rb +1 -1
- data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb +1 -1
- data/test/br_nfe/service/rps_test.rb +39 -6
- data/test/br_nfe/service/simpliss/v1/base_test.rb +102 -0
- data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +97 -0
- data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +241 -0
- data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +239 -0
- data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +226 -0
- data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +122 -0
- data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +105 -0
- data/test/br_nfe/service/simpliss/v1/xsd/nfse_3.xsd +735 -0
- data/test/br_nfe/service/simpliss/v1/xsd/xmldsig-core-schema20020212.xsd +318 -0
- data/test/br_nfe/service/thema/v1/base_test.rb +23 -2
- data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +69 -3
- data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +134 -4
- data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +131 -4
- data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +214 -4
- data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +97 -4
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +109 -0
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +72 -4
- data/test/factories/service/rps.rb +17 -16
- data/test/factories/service/{sc/gaspar/recepcao_lote_rps_limitado.rb → simpliss/v1/base.rb} +1 -3
- data/test/factories/service/{sc/gaspar → simpliss/v1}/cancela_nfse.rb +2 -2
- data/test/factories/service/simpliss/v1/consulta_lote_rps.rb +7 -0
- data/test/factories/service/{sc/gaspar → simpliss/v1}/consulta_nfs_por_rps.rb +1 -1
- data/test/factories/service/{sc/gaspar → simpliss/v1}/consulta_nfse.rb +1 -1
- data/test/factories/service/simpliss/v1/consulta_situacao_lote_rps.rb +6 -0
- data/test/factories/service/{sc/gaspar → simpliss/v1}/recepcao_lote_rps.rb +1 -1
- data/test/fixtures/service/response/simpliss/v1/cancela_nfse/fault.xml +21 -0
- data/test/fixtures/service/response/simpliss/v1/cancela_nfse/success.xml +26 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/fault.xml +21 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/nfse_complete.xml +134 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_lote_rps/nfse_simple.xml +100 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse/fault.xml +16 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse/nfs_empty.xml +10 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse/nfse_complete.xml +134 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse/nfse_simple.xml +100 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/fault.xml +16 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/nfse_complete.xml +132 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_nfse_por_rps/nfse_simple.xml +98 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/error.xml +11 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/fault.xml +16 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/success.xml +11 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/unprocessed.xml +11 -0
- data/test/fixtures/service/response/simpliss/v1/consulta_situacao_lote_rps/unreceived.xml +11 -0
- data/test/fixtures/service/response/simpliss/v1/recepcao_lote_rps/error.xml +16 -0
- data/test/fixtures/service/response/simpliss/v1/recepcao_lote_rps/success.xml +12 -0
- data/test/fixtures/service/response/thema/v1/cancela_nfse/fault.xml +33 -0
- data/test/fixtures/service/response/thema/v1/cancela_nfse/success.xml +30 -0
- data/test/fixtures/service/response/thema/v1/consulta_lote_rps/fault.xml +19 -0
- data/test/fixtures/service/response/thema/v1/consulta_lote_rps/nfse_complete.xml +109 -0
- data/test/fixtures/service/response/thema/v1/consulta_nfse/fault.xml +20 -0
- data/test/fixtures/service/response/thema/v1/consulta_nfse/nfs_empty.xml +14 -0
- data/test/fixtures/service/response/thema/v1/consulta_nfse/nfse_complete.xml +111 -0
- data/test/fixtures/service/response/thema/v1/consulta_nfse/nfse_simple.xml +111 -0
- data/test/fixtures/service/response/thema/v1/consulta_nfse_por_rps/fault.xml +23 -0
- data/test/fixtures/service/response/thema/v1/consulta_nfse_por_rps/nfse_complete.xml +110 -0
- data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/error.xml +14 -0
- data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/fault.xml +15 -0
- data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/success.xml +14 -0
- data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/unprocessed.xml +14 -0
- data/test/fixtures/service/response/thema/v1/consulta_situacao_lote_rps/unreceived.xml +19 -0
- data/test/fixtures/service/response/thema/v1/recepcao_lote_rps/error.xml +17 -0
- data/test/fixtures/service/response/thema/v1/recepcao_lote_rps/success.xml +15 -0
- data/test/fixtures/service/response/thema/v1/recepcao_lote_rps_limitado/error.xml +19 -0
- data/test/fixtures/service/response/thema/v1/recepcao_lote_rps_limitado/success.xml +15 -0
- data/test/fixtures/service/thema/v1/cancelar_nfse_envio.xml +1 -0
- data/test/fixtures/service/thema/v1/cancelar_nfse_envio_signed.xml +2 -0
- data/test/fixtures/service/thema/v1/enviar_lote_rps.xml +1 -0
- data/test/fixtures/service/thema/v1/enviar_lote_rps_signed.xml +2 -0
- data/test/test_helper.rb +5 -0
- metadata +146 -37
- data/lib/br_nfe/service/sc/gaspar/cancela_nfse.rb +0 -13
- data/lib/br_nfe/service/sc/gaspar/consulta_lote_rps.rb +0 -13
- data/lib/br_nfe/service/sc/gaspar/consulta_nfs_por_rps.rb +0 -13
- data/lib/br_nfe/service/sc/gaspar/consulta_nfse.rb +0 -17
- data/lib/br_nfe/service/sc/gaspar/consulta_situacao_lote_rps.rb +0 -13
- data/lib/br_nfe/service/sc/gaspar/recepcao_lote_rps.rb +0 -13
- data/lib/br_nfe/service/sc/gaspar/recepcao_lote_rps_limitado.rb +0 -13
- data/test/br_nfe/service/sc/gaspar/cancela_nfse_test.rb +0 -21
- data/test/br_nfe/service/sc/gaspar/consulta_nfs_por_rps_test.rb +0 -21
- data/test/br_nfe/service/sc/gaspar/consulta_nfse_test.rb +0 -21
- data/test/br_nfe/service/sc/gaspar/consulta_situacao_lote_rps_test.rb +0 -21
- data/test/br_nfe/service/sc/gaspar/recepcao_lote_rps_limitado_test.rb +0 -22
- data/test/br_nfe/service/sc/gaspar/recepcao_lote_rps_test.rb +0 -22
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test_limitado.rb +0 -50
- data/test/factories/service/sc/gaspar/consulta_lote_rps.rb +0 -7
- data/test/factories/service/sc/gaspar/consulta_situacao_lote_rps.rb +0 -6
@@ -1,7 +1,106 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
+
module ResponsePathTest
|
4
|
+
def response_lot_number_path; :response_lot_number_path end
|
5
|
+
def response_protocol_path; :response_protocol_path end
|
6
|
+
def response_received_date_path; :response_received_date_path end
|
7
|
+
def response_situation_path; :response_situation_path end
|
8
|
+
def response_situation_key_values; {response_situation_key_values: :ok} end
|
9
|
+
def response_cancelation_date_time_path; :response_cancelation_date_time_path end
|
10
|
+
def response_message_errors_path; :response_message_errors_path end
|
11
|
+
def response_message_code_key; :response_message_code_key end
|
12
|
+
def response_message_msg_key; :response_message_msg_key end
|
13
|
+
def response_message_solution_key; :response_message_solution_key end
|
14
|
+
def response_invoices_path; :response_invoices_path end
|
15
|
+
def response_invoice_numero_nf_path; :response_invoice_numero_nf_path end
|
16
|
+
def response_invoice_codigo_verificacao_path; :response_invoice_codigo_verificacao_path end
|
17
|
+
def response_invoice_data_emissao_path; :response_invoice_data_emissao_path end
|
18
|
+
def response_invoice_url_nf_path; :response_invoice_url_nf_path end
|
19
|
+
def response_invoice_rps_numero_path; :response_invoice_rps_numero_path end
|
20
|
+
def response_invoice_rps_serie_path; :response_invoice_rps_serie_path end
|
21
|
+
def response_invoice_rps_tipo_path; :response_invoice_rps_tipo_path end
|
22
|
+
def response_invoice_rps_situacao_path; :response_invoice_rps_situacao_path end
|
23
|
+
def response_invoice_rps_substituido_numero_path; :response_invoice_rps_substituido_numero_path end
|
24
|
+
def response_invoice_rps_substituido_serie_path; :response_invoice_rps_substituido_serie_path end
|
25
|
+
def response_invoice_rps_substituido_tipo_path; :response_invoice_rps_substituido_tipo_path end
|
26
|
+
def response_invoice_data_emissao_rps_path; :response_invoice_data_emissao_rps_path end
|
27
|
+
def response_invoice_competencia_path; :response_invoice_competencia_path end
|
28
|
+
def response_invoice_natureza_operacao_path; :response_invoice_natureza_operacao_path end
|
29
|
+
def response_invoice_regime_especial_tributacao_path; :response_invoice_regime_especial_tributacao_path end
|
30
|
+
def response_invoice_optante_simples_nacional_path; :response_invoice_optante_simples_nacional_path end
|
31
|
+
def response_invoice_incentivador_cultural_path; :response_invoice_incentivador_cultural_path end
|
32
|
+
def response_invoice_outras_informacoes_path; :response_invoice_outras_informacoes_path end
|
33
|
+
def response_invoice_item_lista_servico_path; :response_invoice_item_lista_servico_path end
|
34
|
+
def response_invoice_cnae_code_path; :response_invoice_cnae_code_path end
|
35
|
+
def response_invoice_description_path; :response_invoice_description_path end
|
36
|
+
def response_invoice_codigo_municipio_path; :response_invoice_codigo_municipio_path end
|
37
|
+
def response_invoice_total_services_path; :response_invoice_total_services_path end
|
38
|
+
def response_invoice_deductions_path; :response_invoice_deductions_path end
|
39
|
+
def response_invoice_valor_pis_path; :response_invoice_valor_pis_path end
|
40
|
+
def response_invoice_valor_cofins_path; :response_invoice_valor_cofins_path end
|
41
|
+
def response_invoice_valor_inss_path; :response_invoice_valor_inss_path end
|
42
|
+
def response_invoice_valor_ir_path; :response_invoice_valor_ir_path end
|
43
|
+
def response_invoice_valor_csll_path; :response_invoice_valor_csll_path end
|
44
|
+
def response_invoice_iss_retained_path; :response_invoice_iss_retained_path end
|
45
|
+
def response_invoice_outras_retencoes_path; :response_invoice_outras_retencoes_path end
|
46
|
+
def response_invoice_total_iss_path; :response_invoice_total_iss_path end
|
47
|
+
def response_invoice_base_calculation_path; :response_invoice_base_calculation_path end
|
48
|
+
def response_invoice_iss_tax_rate_path; :response_invoice_iss_tax_rate_path end
|
49
|
+
def response_invoice_valor_liquido_path; :response_invoice_valor_liquido_path end
|
50
|
+
def response_invoice_desconto_condicionado_path; :response_invoice_desconto_condicionado_path end
|
51
|
+
def response_invoice_desconto_incondicionado_path; :response_invoice_desconto_incondicionado_path end
|
52
|
+
def response_invoice_responsavel_retencao_path; :response_invoice_responsavel_retencao_path end
|
53
|
+
def response_invoice_numero_processo_path; :response_invoice_numero_processo_path end
|
54
|
+
def response_invoice_municipio_incidencia_path; :response_invoice_municipio_incidencia_path end
|
55
|
+
def response_invoice_orgao_gerador_municipio_path; :response_invoice_orgao_gerador_municipio_path end
|
56
|
+
def response_invoice_orgao_gerador_uf_path; :response_invoice_orgao_gerador_uf_path end
|
57
|
+
def response_invoice_cancelamento_codigo_path; :response_invoice_cancelamento_codigo_path end
|
58
|
+
def response_invoice_cancelamento_numero_nf_path; :response_invoice_cancelamento_numero_nf_path end
|
59
|
+
def response_invoice_cancelamento_cnpj_path; :response_invoice_cancelamento_cnpj_path end
|
60
|
+
def response_invoice_cancelamento_municipio_path; :response_invoice_cancelamento_municipio_path end
|
61
|
+
def response_invoice_cancelamento_data_hora_path; :response_invoice_cancelamento_data_hora_path end
|
62
|
+
def response_invoice_nfe_substituidora_path; :response_invoice_nfe_substituidora_path end
|
63
|
+
def response_invoice_codigo_obra_path; :response_invoice_codigo_obra_path end
|
64
|
+
def response_invoice_codigo_art_path; :response_invoice_codigo_art_path end
|
65
|
+
def response_invoice_cancelamento_inscricao_municipal_path; :response_invoice_cancelamento_inscricao_municipal_path end
|
66
|
+
def response_invoice_emitente_cnpj_path; :response_invoice_emitente_cnpj_path end
|
67
|
+
def response_invoice_emitente_inscricao_municipal_path; :response_invoice_emitente_inscricao_municipal_path end
|
68
|
+
def response_invoice_emitente_razao_social_path; :response_invoice_emitente_razao_social_path end
|
69
|
+
def response_invoice_emitente_nome_fantasia_path; :response_invoice_emitente_nome_fantasia_path end
|
70
|
+
def response_invoice_emitente_telefone_path; :response_invoice_emitente_telefone_path end
|
71
|
+
def response_invoice_emitente_email_path; :response_invoice_emitente_email_path end
|
72
|
+
def response_invoice_emitente_endereco_logradouro_path; :response_invoice_emitente_endereco_logradouro_path end
|
73
|
+
def response_invoice_emitente_endereco_numero_path; :response_invoice_emitente_endereco_numero_path end
|
74
|
+
def response_invoice_emitente_endereco_complemento_path; :response_invoice_emitente_endereco_complemento_path end
|
75
|
+
def response_invoice_emitente_endereco_bairro_path; :response_invoice_emitente_endereco_bairro_path end
|
76
|
+
def response_invoice_emitente_endereco_codigo_municipio_path; :response_invoice_emitente_endereco_codigo_municipio_path end
|
77
|
+
def response_invoice_emitente_endereco_uf_path; :response_invoice_emitente_endereco_uf_path end
|
78
|
+
def response_invoice_emitente_endereco_cep_path; :response_invoice_emitente_endereco_cep_path end
|
79
|
+
def response_invoice_destinatario_cpf_path; :response_invoice_destinatario_cpf_path end
|
80
|
+
def response_invoice_destinatario_cnpj_path; :response_invoice_destinatario_cnpj_path end
|
81
|
+
def response_invoice_destinatario_inscricao_municipal_path; :response_invoice_destinatario_inscricao_municipal_path end
|
82
|
+
def response_invoice_destinatario_inscricao_estadual_path; :response_invoice_destinatario_inscricao_estadual_path end
|
83
|
+
def response_invoice_destinatario_inscricao_suframa_path; :response_invoice_destinatario_inscricao_suframa_path end
|
84
|
+
def response_invoice_destinatario_razao_social_path; :response_invoice_destinatario_razao_social_path end
|
85
|
+
def response_invoice_destinatario_telefone_path; :response_invoice_destinatario_telefone_path end
|
86
|
+
def response_invoice_destinatario_email_path; :response_invoice_destinatario_email_path end
|
87
|
+
def response_invoice_destinatario_endereco_logradouro_path; :response_invoice_destinatario_endereco_logradouro_path end
|
88
|
+
def response_invoice_destinatario_endereco_numero_path; :response_invoice_destinatario_endereco_numero_path end
|
89
|
+
def response_invoice_destinatario_endereco_complemento_path; :response_invoice_destinatario_endereco_complemento_path end
|
90
|
+
def response_invoice_destinatario_endereco_bairro_path; :response_invoice_destinatario_endereco_bairro_path end
|
91
|
+
def response_invoice_destinatario_endereco_codigo_municipio_path; :response_invoice_destinatario_endereco_codigo_municipio_path end
|
92
|
+
def response_invoice_destinatario_endereco_uf_path; :response_invoice_destinatario_endereco_uf_path end
|
93
|
+
def response_invoice_destinatario_endereco_cep_path; :response_invoice_destinatario_endereco_cep_path end
|
94
|
+
end
|
95
|
+
|
3
96
|
describe BrNfe::Service::Base do
|
4
97
|
subject { FactoryGirl.build(:br_nfe_servico_base) }
|
98
|
+
|
99
|
+
describe "Included modules" do
|
100
|
+
it "deve ter o module BrNfe::Helper::ValuesTs::ServiceV1 incluso" do
|
101
|
+
subject.class.included_modules.must_include(BrNfe::Helper::ValuesTs::ServiceV1)
|
102
|
+
end
|
103
|
+
end
|
5
104
|
|
6
105
|
describe '#xml_current_dir_path' do
|
7
106
|
it "o valor padrão deve ser o diretorio xml de serviços na versão do layout setado" do
|
@@ -10,14 +109,6 @@ describe BrNfe::Service::Base do
|
|
10
109
|
end
|
11
110
|
end
|
12
111
|
|
13
|
-
describe '#response_path_module' do
|
14
|
-
it "deve ser sobrescrito nas subclasses" do
|
15
|
-
assert_raises RuntimeError do
|
16
|
-
subject.response_path_module
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
112
|
describe "#response_root_path" do
|
22
113
|
it "deve ter um array vazio por padrão" do
|
23
114
|
subject.response_root_path.must_equal([])
|
@@ -107,10 +198,10 @@ describe BrNfe::Service::Base do
|
|
107
198
|
describe "#set_response" do
|
108
199
|
let(:build_response) { BrNfe::Response::Service::BuildResponse.new() }
|
109
200
|
it "Deve setar a variavel @original_response com a resposta original do savon" do
|
201
|
+
subject.class.send(:include, ResponsePathTest)
|
110
202
|
BrNfe::Response::Service::BuildResponse.any_instance.stubs(:response).returns(:response)
|
111
203
|
subject.stubs(:response_root_path).returns(:response_root_path)
|
112
204
|
subject.stubs(:nfse_xml_path).returns(:nfse_xml_path)
|
113
|
-
subject.stubs(:response_path_module)
|
114
205
|
subject.stubs(:body_xml_path).returns(:body_xml_path)
|
115
206
|
|
116
207
|
subject.set_response(:original).must_equal :response
|
@@ -118,16 +209,107 @@ describe BrNfe::Service::Base do
|
|
118
209
|
end
|
119
210
|
it "deve instanciar o build_response e retornar a resposta" do
|
120
211
|
build_response
|
212
|
+
subject.class.send(:include, ResponsePathTest)
|
121
213
|
subject.expects(:response_root_path).returns(:response_root_path)
|
122
214
|
subject.expects(:nfse_xml_path).returns(:nfse_xml_path)
|
123
|
-
subject.expects(:response_path_module)
|
124
215
|
subject.expects(:body_xml_path).returns(:body_xml_path)
|
216
|
+
subject.expects(:response_encoding).returns('ENCODE')
|
125
217
|
BrNfe::Response::Service::BuildResponse.expects(:new).with({
|
126
218
|
savon_response: :savon_response,
|
127
219
|
keys_root_path: :response_root_path,
|
128
220
|
nfe_xml_path: :nfse_xml_path,
|
129
|
-
module_methods: nil,
|
130
221
|
body_xml_path: :body_xml_path,
|
222
|
+
xml_encode: 'ENCODE',
|
223
|
+
lot_number_path: :response_lot_number_path,
|
224
|
+
protocol_path: :response_protocol_path,
|
225
|
+
received_date_path: :response_received_date_path,
|
226
|
+
situation_path: :response_situation_path,
|
227
|
+
situation_key_values: {response_situation_key_values: :ok},
|
228
|
+
cancelation_date_time_path: :response_cancelation_date_time_path,
|
229
|
+
message_errors_path: :response_message_errors_path,
|
230
|
+
message_code_key: :response_message_code_key,
|
231
|
+
message_msg_key: :response_message_msg_key,
|
232
|
+
message_solution_key: :response_message_solution_key,
|
233
|
+
invoices_path: :response_invoices_path,
|
234
|
+
invoice_numero_nf_path: :response_invoice_numero_nf_path,
|
235
|
+
invoice_codigo_verificacao_path: :response_invoice_codigo_verificacao_path,
|
236
|
+
invoice_data_emissao_path: :response_invoice_data_emissao_path,
|
237
|
+
invoice_url_nf_path: :response_invoice_url_nf_path,
|
238
|
+
invoice_rps_numero_path: :response_invoice_rps_numero_path,
|
239
|
+
invoice_rps_serie_path: :response_invoice_rps_serie_path,
|
240
|
+
invoice_rps_tipo_path: :response_invoice_rps_tipo_path,
|
241
|
+
invoice_rps_situacao_path: :response_invoice_rps_situacao_path,
|
242
|
+
invoice_rps_substituido_numero_path: :response_invoice_rps_substituido_numero_path,
|
243
|
+
invoice_rps_substituido_serie_path: :response_invoice_rps_substituido_serie_path,
|
244
|
+
invoice_rps_substituido_tipo_path: :response_invoice_rps_substituido_tipo_path,
|
245
|
+
invoice_data_emissao_rps_path: :response_invoice_data_emissao_rps_path,
|
246
|
+
invoice_competencia_path: :response_invoice_competencia_path,
|
247
|
+
invoice_natureza_operacao_path: :response_invoice_natureza_operacao_path,
|
248
|
+
invoice_regime_especial_tributacao_path: :response_invoice_regime_especial_tributacao_path,
|
249
|
+
invoice_optante_simples_nacional_path: :response_invoice_optante_simples_nacional_path,
|
250
|
+
invoice_incentivador_cultural_path: :response_invoice_incentivador_cultural_path,
|
251
|
+
invoice_outras_informacoes_path: :response_invoice_outras_informacoes_path,
|
252
|
+
invoice_item_lista_servico_path: :response_invoice_item_lista_servico_path,
|
253
|
+
invoice_cnae_code_path: :response_invoice_cnae_code_path,
|
254
|
+
invoice_description_path: :response_invoice_description_path,
|
255
|
+
invoice_codigo_municipio_path: :response_invoice_codigo_municipio_path,
|
256
|
+
invoice_total_services_path: :response_invoice_total_services_path,
|
257
|
+
invoice_deductions_path: :response_invoice_deductions_path,
|
258
|
+
invoice_valor_pis_path: :response_invoice_valor_pis_path,
|
259
|
+
invoice_valor_cofins_path: :response_invoice_valor_cofins_path,
|
260
|
+
invoice_valor_inss_path: :response_invoice_valor_inss_path,
|
261
|
+
invoice_valor_ir_path: :response_invoice_valor_ir_path,
|
262
|
+
invoice_valor_csll_path: :response_invoice_valor_csll_path,
|
263
|
+
invoice_iss_retained_path: :response_invoice_iss_retained_path,
|
264
|
+
invoice_outras_retencoes_path: :response_invoice_outras_retencoes_path,
|
265
|
+
invoice_total_iss_path: :response_invoice_total_iss_path,
|
266
|
+
invoice_base_calculation_path: :response_invoice_base_calculation_path,
|
267
|
+
invoice_iss_tax_rate_path: :response_invoice_iss_tax_rate_path,
|
268
|
+
invoice_valor_liquido_path: :response_invoice_valor_liquido_path,
|
269
|
+
invoice_desconto_condicionado_path: :response_invoice_desconto_condicionado_path,
|
270
|
+
invoice_desconto_incondicionado_path: :response_invoice_desconto_incondicionado_path,
|
271
|
+
invoice_responsavel_retencao_path: :response_invoice_responsavel_retencao_path,
|
272
|
+
invoice_numero_processo_path: :response_invoice_numero_processo_path,
|
273
|
+
invoice_municipio_incidencia_path: :response_invoice_municipio_incidencia_path,
|
274
|
+
invoice_orgao_gerador_municipio_path: :response_invoice_orgao_gerador_municipio_path,
|
275
|
+
invoice_orgao_gerador_uf_path: :response_invoice_orgao_gerador_uf_path,
|
276
|
+
invoice_cancelamento_codigo_path: :response_invoice_cancelamento_codigo_path,
|
277
|
+
invoice_cancelamento_numero_nf_path: :response_invoice_cancelamento_numero_nf_path,
|
278
|
+
invoice_cancelamento_cnpj_path: :response_invoice_cancelamento_cnpj_path,
|
279
|
+
invoice_cancelamento_municipio_path: :response_invoice_cancelamento_municipio_path,
|
280
|
+
invoice_cancelamento_data_hora_path: :response_invoice_cancelamento_data_hora_path,
|
281
|
+
invoice_cancelamento_inscricao_municipal_path: :response_invoice_cancelamento_inscricao_municipal_path,
|
282
|
+
invoice_nfe_substituidora_path: :response_invoice_nfe_substituidora_path,
|
283
|
+
invoice_codigo_obra_path: :response_invoice_codigo_obra_path,
|
284
|
+
invoice_codigo_art_path: :response_invoice_codigo_art_path,
|
285
|
+
invoice_emitente_cnpj_path: :response_invoice_emitente_cnpj_path,
|
286
|
+
invoice_emitente_inscricao_municipal_path: :response_invoice_emitente_inscricao_municipal_path,
|
287
|
+
invoice_emitente_razao_social_path: :response_invoice_emitente_razao_social_path,
|
288
|
+
invoice_emitente_nome_fantasia_path: :response_invoice_emitente_nome_fantasia_path,
|
289
|
+
invoice_emitente_telefone_path: :response_invoice_emitente_telefone_path,
|
290
|
+
invoice_emitente_email_path: :response_invoice_emitente_email_path,
|
291
|
+
invoice_emitente_endereco_logradouro_path: :response_invoice_emitente_endereco_logradouro_path,
|
292
|
+
invoice_emitente_endereco_numero_path: :response_invoice_emitente_endereco_numero_path,
|
293
|
+
invoice_emitente_endereco_complemento_path: :response_invoice_emitente_endereco_complemento_path,
|
294
|
+
invoice_emitente_endereco_bairro_path: :response_invoice_emitente_endereco_bairro_path,
|
295
|
+
invoice_emitente_endereco_codigo_municipio_path: :response_invoice_emitente_endereco_codigo_municipio_path,
|
296
|
+
invoice_emitente_endereco_uf_path: :response_invoice_emitente_endereco_uf_path,
|
297
|
+
invoice_emitente_endereco_cep_path: :response_invoice_emitente_endereco_cep_path,
|
298
|
+
invoice_destinatario_cpf_path: :response_invoice_destinatario_cpf_path,
|
299
|
+
invoice_destinatario_cnpj_path: :response_invoice_destinatario_cnpj_path,
|
300
|
+
invoice_destinatario_inscricao_municipal_path: :response_invoice_destinatario_inscricao_municipal_path,
|
301
|
+
invoice_destinatario_inscricao_estadual_path: :response_invoice_destinatario_inscricao_estadual_path,
|
302
|
+
invoice_destinatario_inscricao_suframa_path: :response_invoice_destinatario_inscricao_suframa_path,
|
303
|
+
invoice_destinatario_razao_social_path: :response_invoice_destinatario_razao_social_path,
|
304
|
+
invoice_destinatario_telefone_path: :response_invoice_destinatario_telefone_path,
|
305
|
+
invoice_destinatario_email_path: :response_invoice_destinatario_email_path,
|
306
|
+
invoice_destinatario_endereco_logradouro_path: :response_invoice_destinatario_endereco_logradouro_path,
|
307
|
+
invoice_destinatario_endereco_numero_path: :response_invoice_destinatario_endereco_numero_path,
|
308
|
+
invoice_destinatario_endereco_complemento_path: :response_invoice_destinatario_endereco_complemento_path,
|
309
|
+
invoice_destinatario_endereco_bairro_path: :response_invoice_destinatario_endereco_bairro_path,
|
310
|
+
invoice_destinatario_endereco_codigo_municipio_path: :response_invoice_destinatario_endereco_codigo_municipio_path,
|
311
|
+
invoice_destinatario_endereco_uf_path: :response_invoice_destinatario_endereco_uf_path,
|
312
|
+
invoice_destinatario_endereco_cep_path: :response_invoice_destinatario_endereco_cep_path,
|
131
313
|
}).returns(build_response)
|
132
314
|
build_response.expects(:response).returns('resposta')
|
133
315
|
|
@@ -135,4 +317,17 @@ describe BrNfe::Service::Base do
|
|
135
317
|
subject.instance_variable_get(:@response).must_equal('resposta')
|
136
318
|
end
|
137
319
|
end
|
320
|
+
|
321
|
+
describe "#ibge_code_of_issuer_city" do
|
322
|
+
it "se não setar um valor deve pegar o valor do codigo IBGE do endereço do emitente" do
|
323
|
+
subject.emitente.endereco.codigo_municipio = '12345678'
|
324
|
+
subject.ibge_code_of_issuer_city = nil
|
325
|
+
subject.ibge_code_of_issuer_city.must_equal '12345678'
|
326
|
+
end
|
327
|
+
it "se setar o valor em ibge_code_of_issuer_city não deve pegar do endereço do emitente" do
|
328
|
+
subject.emitente.endereco.codigo_municipio = '12345678'
|
329
|
+
subject.ibge_code_of_issuer_city = 78978945
|
330
|
+
subject.ibge_code_of_issuer_city.must_equal '78978945'
|
331
|
+
end
|
332
|
+
end
|
138
333
|
end
|
@@ -6,4 +6,13 @@ describe BrNfe::Service::Betha::Base do
|
|
6
6
|
it "deve herdar de BrNfe::Service::Base" do
|
7
7
|
subject.class.superclass.must_equal BrNfe::Service::Base
|
8
8
|
end
|
9
|
+
|
10
|
+
describe "#ts_item_lista_servico" do
|
11
|
+
it "deve retornar apenas numeros sem pontuação" do
|
12
|
+
subject.ts_item_lista_servico('12.44').must_equal '1244'
|
13
|
+
end
|
14
|
+
it "Deve sempre retornar 4 caracteres" do
|
15
|
+
subject.ts_item_lista_servico('2.44').must_equal '0244'
|
16
|
+
end
|
17
|
+
end
|
9
18
|
end
|
@@ -32,12 +32,6 @@ describe BrNfe::Service::Betha::V1::CancelamentoNfs do
|
|
32
32
|
it { subject.method_wsdl.must_equal :cancelar_nfse_envio }
|
33
33
|
end
|
34
34
|
|
35
|
-
describe "#response_path_module" do
|
36
|
-
it "deve ter o module ServicoCancelarNfseResposta" do
|
37
|
-
subject.response_path_module.must_equal BrNfe::Service::Response::Paths::V1::ServicoCancelarNfseResposta
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
35
|
it "#response_root_path" do
|
42
36
|
subject.response_root_path.must_equal [:cancelar_nfse_envio_response]
|
43
37
|
end
|
@@ -28,12 +28,6 @@ describe BrNfe::Service::Betha::V1::ConsultaLoteRps do
|
|
28
28
|
it { subject.method_wsdl.must_equal :consultar_lote_rps_envio }
|
29
29
|
end
|
30
30
|
|
31
|
-
describe "#response_path_module" do
|
32
|
-
it "deve ter um module" do
|
33
|
-
subject.response_path_module.must_equal BrNfe::Service::Betha::V1::ResponsePaths::ServicoConsultarLoteRpsResposta
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
31
|
it "#response_root_path" do
|
38
32
|
subject.response_root_path.must_equal [:consultar_lote_rps_envio_response]
|
39
33
|
end
|
@@ -29,10 +29,6 @@ describe BrNfe::Service::Betha::V1::ConsultaNfsPorRps do
|
|
29
29
|
it { subject.method_wsdl.must_equal :consultar_nfse_por_rps_envio }
|
30
30
|
end
|
31
31
|
|
32
|
-
it "#response_path_module" do
|
33
|
-
subject.response_path_module.must_equal BrNfe::Service::Betha::V1::ResponsePaths::ServicoConsultarNfseRpsResposta
|
34
|
-
end
|
35
|
-
|
36
32
|
it "#response_root_path" do
|
37
33
|
subject.response_root_path.must_equal [:consultar_nfse_rps_envio_response]
|
38
34
|
end
|
@@ -28,10 +28,6 @@ describe BrNfe::Service::Betha::V1::ConsultaNfse do
|
|
28
28
|
it { subject.method_wsdl.must_equal :consultar_nfse_envio }
|
29
29
|
end
|
30
30
|
|
31
|
-
it "#response_path_module" do
|
32
|
-
subject.response_path_module.must_equal BrNfe::Service::Betha::V1::ResponsePaths::ServicoConsultarNfseResposta
|
33
|
-
end
|
34
|
-
|
35
31
|
it "#response_root_path" do
|
36
32
|
subject.response_root_path.must_equal [:consultar_nfse_envio_response]
|
37
33
|
end
|
@@ -24,11 +24,7 @@ describe BrNfe::Service::Betha::V1::ConsultaSituacaoLoteRps do
|
|
24
24
|
it { subject.method_wsdl.must_equal :consultar_situacao_lote_rps_envio }
|
25
25
|
end
|
26
26
|
|
27
|
-
it "#
|
28
|
-
subject.response_path_module.must_equal BrNfe::Service::Response::Paths::V1::ServicoConsultarSituacaoLoteRpsResposta
|
29
|
-
end
|
30
|
-
|
31
|
-
it "#response_path_module" do
|
27
|
+
it "#response_root_path" do
|
32
28
|
subject.response_root_path.must_equal [:consultar_situacao_lote_rps_envio_response]
|
33
29
|
end
|
34
30
|
|
@@ -28,8 +28,10 @@ describe BrNfe::Service::Betha::V1::Gateway do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe "#
|
32
|
-
it
|
31
|
+
describe "#namespaces" do
|
32
|
+
it '-> namespace_identifier' do subject.namespace_identifier.must_equal 'ns1:' end
|
33
|
+
it '-> namespace_for_tags' do subject.namespace_for_tags.must_be_nil end
|
34
|
+
it '-> namespace_for_signature' do subject.namespace_for_signature.must_be_nil end
|
33
35
|
end
|
34
36
|
|
35
37
|
end
|
@@ -44,10 +44,6 @@ describe BrNfe::Service::Betha::V1::RecepcaoLoteRps do
|
|
44
44
|
it { subject.method_wsdl.must_equal :enviar_lote_rps_envio }
|
45
45
|
end
|
46
46
|
|
47
|
-
it "#response_path_module" do
|
48
|
-
subject.response_path_module.must_equal BrNfe::Service::Response::Paths::V1::ServicoEnviarLoteRpsResposta
|
49
|
-
end
|
50
|
-
|
51
47
|
it "#response_root_path" do
|
52
48
|
subject.response_root_path.must_equal [:enviar_lote_rps_envio_response]
|
53
49
|
end
|
data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb
CHANGED
@@ -11,6 +11,6 @@ describe BrNfe::Service::Betha::V1::ResponsePaths::ServicoConsultarLoteRpsRespo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "metodo invoices_path sobrescrito com valor padrão" do
|
14
|
-
subject.
|
14
|
+
subject.response_invoices_path.must_equal [:consultar_lote_rps_resposta, :lista_nfse, :compl_nfse]
|
15
15
|
end
|
16
16
|
end
|
@@ -11,6 +11,6 @@ describe BrNfe::Service::Betha::V1::ResponsePaths::ServicoConsultarNfseResposta
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "metodo invoices_path sobrescrito com valor padrão" do
|
14
|
-
subject.
|
14
|
+
subject.response_invoices_path.must_equal [:consultar_nfse_resposta, :lista_nfse, :compl_nfse]
|
15
15
|
end
|
16
16
|
end
|
data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb
CHANGED
@@ -11,6 +11,6 @@ describe BrNfe::Service::Betha::V1::ResponsePaths::ServicoConsultarNfseRpsRespo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "metodo invoices_path sobrescrito com valor padrão" do
|
14
|
-
subject.
|
14
|
+
subject.response_invoices_path.must_equal [:consultar_nfse_rps_resposta, :compl_nfse]
|
15
15
|
end
|
16
16
|
end
|
@@ -60,7 +60,10 @@ describe BrNfe::Service::Rps do
|
|
60
60
|
it { wont validate_presence_of(:iss_tax_rate) }
|
61
61
|
end
|
62
62
|
context "quando for false" do
|
63
|
-
before
|
63
|
+
before do
|
64
|
+
subject.items = []
|
65
|
+
subject.stubs(:iss_retained?).returns(false)
|
66
|
+
end
|
64
67
|
it { must validate_presence_of(:total_iss) }
|
65
68
|
it { must validate_presence_of(:iss_tax_rate) }
|
66
69
|
end
|
@@ -138,7 +141,6 @@ describe BrNfe::Service::Rps do
|
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
141
|
-
|
142
144
|
describe "#destinatario" do
|
143
145
|
it "sempre deve retornar um objeto BrNfe::Destinatario" do
|
144
146
|
novo = BrNfe::Service::Rps.new
|
@@ -261,8 +263,6 @@ describe BrNfe::Service::Rps do
|
|
261
263
|
subject.intermediario.wont_equal intermediario_old
|
262
264
|
subject.intermediario.must_equal intermediario
|
263
265
|
end
|
264
|
-
|
265
|
-
|
266
266
|
end
|
267
267
|
|
268
268
|
describe "#condicao_pagamento" do
|
@@ -366,7 +366,7 @@ describe BrNfe::Service::Rps do
|
|
366
366
|
end
|
367
367
|
|
368
368
|
it "posso utilizar o << para adicionar valores" do
|
369
|
-
subject.items
|
369
|
+
subject.items = item_1
|
370
370
|
subject.items << item_2
|
371
371
|
subject.items.must_equal [item_1,item_2]
|
372
372
|
end
|
@@ -434,7 +434,8 @@ describe BrNfe::Service::Rps do
|
|
434
434
|
subject.assign_attributes({
|
435
435
|
base_calculation: nil,
|
436
436
|
total_services: nil,
|
437
|
-
deductions: nil
|
437
|
+
deductions: nil,
|
438
|
+
items: []
|
438
439
|
})
|
439
440
|
|
440
441
|
subject.base_calculation.must_equal 0.0
|
@@ -500,4 +501,36 @@ describe BrNfe::Service::Rps do
|
|
500
501
|
end
|
501
502
|
end
|
502
503
|
|
504
|
+
describe "#net_value" do
|
505
|
+
it "Se setar um valor deve retornar o valor setado" do
|
506
|
+
subject.assign_attributes(total_services: 10.00, net_value: 9_999.55)
|
507
|
+
subject.net_value.must_equal 9_999.55
|
508
|
+
end
|
509
|
+
it "se não tiver valor setado manualmente em net_value deve realizar o calcula automaticamente" do
|
510
|
+
subject.assign_attributes({total_services: 100.00, valor_pis: 1.5, valor_cofins: 1.0,
|
511
|
+
valor_inss: 0.5, valor_ir: 0.0, valor_csll: 2.0, outras_retencoes: 3.0,
|
512
|
+
total_iss_retained: 4.0, desconto_incondicionado: 5.0, desconto_condicionado: 6.0,
|
513
|
+
net_value: nil
|
514
|
+
})
|
515
|
+
subject.net_value.must_equal 77.00
|
516
|
+
end
|
517
|
+
it "se todos os valores para o calculo estiverem nil não deve dar erro e retorna zero" do
|
518
|
+
subject.items = []
|
519
|
+
subject.assign_attributes({total_services: nil, valor_pis: nil, valor_cofins: nil,
|
520
|
+
valor_inss: nil, valor_ir: nil, valor_csll: nil, outras_retencoes: nil,
|
521
|
+
total_iss_retained: nil, desconto_incondicionado: nil, desconto_condicionado: nil,
|
522
|
+
net_value: nil
|
523
|
+
})
|
524
|
+
subject.net_value.must_equal 0.0
|
525
|
+
end
|
526
|
+
it "se alguns dos valores para o calculo estiverem nil não deve dar erro e considera esse valor como zero" do
|
527
|
+
subject.assign_attributes({total_services: 100.00, valor_pis: nil, valor_cofins: nil,
|
528
|
+
valor_inss: nil, valor_ir: 0.0, valor_csll: 2.0, outras_retencoes: 3.0,
|
529
|
+
total_iss_retained: 4.0, desconto_incondicionado: 5.0, desconto_condicionado: 6.0,
|
530
|
+
net_value: nil
|
531
|
+
})
|
532
|
+
subject.net_value.must_equal 80.0
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
503
536
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe BrNfe::Service::Simpliss::V1::Base do
|
4
|
+
subject { FactoryGirl.build(:service_simpliss_v1_base, 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::Service::Base }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#wsdl" do
|
14
|
+
before do
|
15
|
+
subject.env = :production
|
16
|
+
end
|
17
|
+
it "se o env for de test deve enviar a requisição para o ambinete de homologação da SIMPLISS" do
|
18
|
+
subject.ibge_code_of_issuer_city = '4202008'
|
19
|
+
subject.env = :test
|
20
|
+
subject.wsdl.must_equal 'http://wshomologacao.simplissweb.com.br/nfseservice.svc?wsdl'
|
21
|
+
end
|
22
|
+
it "se codigo da cidade emitente for 4202008 então deve pagar a URL de Balneário Camboriú" do
|
23
|
+
subject.ibge_code_of_issuer_city = '4202008'
|
24
|
+
subject.wsdl.must_equal 'http://wsbalneariocamboriu.simplissweb.com.br/nfseservice.svc?wsdl'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#canonicalization_method_algorithm" do
|
29
|
+
it { subject.canonicalization_method_algorithm.must_equal 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315' }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#message_namespaces" do
|
33
|
+
it "deve ter um valor" do
|
34
|
+
subject.message_namespaces.must_equal({})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#soap_namespaces" do
|
39
|
+
it "deve conter os namespaces padrões mais o namespace da mensagem" do
|
40
|
+
subject.soap_namespaces.must_equal({
|
41
|
+
'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
42
|
+
'xmlns:ins0' => 'http://www.w3.org/2000/09/xmldsig#',
|
43
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
44
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
45
|
+
'xmlns:ns1' => "http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd",
|
46
|
+
'xmlns:ns2' => "http://www.w3.org/2000/09/xmldsig#",
|
47
|
+
'xmlns:ns3' => "http://www.sistema.com.br/Sistema.Ws.Nfse",
|
48
|
+
'xmlns:ns4' => "http://www.sistema.com.br/Sistema.Ws.Nfse.Cn"
|
49
|
+
})
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#namespaces" do
|
54
|
+
it '-> namespace_identifier' do subject.namespace_identifier.must_equal 'ns3:' end
|
55
|
+
it '-> namespace_for_tags' do subject.namespace_for_tags.must_equal 'ns1:' end
|
56
|
+
it '-> namespace_for_signature' do subject.namespace_for_signature.must_equal 'ns2:' end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#soap_body_root_tag" do
|
60
|
+
it "por padrão deve dar um Raise pois é necessário que seja sobrescrito nas sublcasses" do
|
61
|
+
assert_raises RuntimeError do
|
62
|
+
subject.soap_body_root_tag
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#content_xml" do
|
68
|
+
let(:expected_xml) do
|
69
|
+
dados = "<ns3:rootTag>"
|
70
|
+
dados += '<xml>Builder</xml>'
|
71
|
+
dados += "</ns3:rootTag>"
|
72
|
+
dados
|
73
|
+
end
|
74
|
+
it "deve encapsular o XML de xml_builder em um CDATA mantendo o XML body no padrão da Simpliss" do
|
75
|
+
subject.expects(:soap_body_root_tag).returns('rootTag').twice
|
76
|
+
subject.expects(:xml_builder).returns('<xml>Builder</xml>')
|
77
|
+
subject.content_xml.must_equal expected_xml
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "#ts_item_lista_servico" do
|
82
|
+
it "se passar um valor já formatado deve retornar esse mesmo valor" do
|
83
|
+
subject.ts_item_lista_servico('7.90').must_equal '7.90'
|
84
|
+
end
|
85
|
+
it "se passar um valor inteiro deve formatar para NN.NN" do
|
86
|
+
subject.ts_item_lista_servico(1785).must_equal '17.85'
|
87
|
+
end
|
88
|
+
it "se passar um valor inteiro com apenas 1 caracter deve retornar esse unico caractere" do
|
89
|
+
subject.ts_item_lista_servico(1).must_equal '1'
|
90
|
+
end
|
91
|
+
it "se passar um valor com mais de 4 posições deve reotrnar apenas 4 numeros e 1 ponto" do
|
92
|
+
subject.ts_item_lista_servico(123456).must_equal '12.34'
|
93
|
+
end
|
94
|
+
it "se passar nil deve retornar o um valor em branco e não da erro" do
|
95
|
+
subject.ts_item_lista_servico(nil).must_be_nil
|
96
|
+
end
|
97
|
+
it "deve ignorar os Zeros da frente do número" do
|
98
|
+
subject.ts_item_lista_servico('0458').must_equal '4.58'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|