br_nfe 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +12 -2
- data/README.markdown +3 -1
- data/Rakefile +20 -1
- data/lib/br_nfe/active_model/associations.rb +11 -0
- data/lib/br_nfe/active_model/has_many.rb +65 -0
- data/lib/br_nfe/active_model/has_one.rb +57 -0
- data/lib/br_nfe/active_model_base.rb +38 -1
- data/lib/br_nfe/base.rb +9 -0
- data/lib/br_nfe/calculos/fatores_de_multiplicacao.rb +67 -0
- data/lib/br_nfe/calculos/modulo11.rb +54 -0
- data/lib/br_nfe/calculos/modulo11_fator_de2a9.rb +83 -0
- data/lib/br_nfe/calculos/modulo11_fator_de2a9_resto_zero.rb +29 -0
- data/lib/br_nfe/constants.rb +46 -1
- data/lib/br_nfe/endereco.rb +6 -2
- data/lib/br_nfe/helper/cpf_cnpj.rb +8 -1
- data/lib/br_nfe/person.rb +32 -3
- data/lib/br_nfe/product/destinatario.rb +45 -0
- data/lib/br_nfe/product/emitente.rb +14 -1
- data/lib/br_nfe/product/evento/base.rb +146 -0
- data/lib/br_nfe/product/evento/cancelamento.rb +46 -0
- data/lib/br_nfe/product/gateway/base.rb +16 -43
- data/lib/br_nfe/product/gateway/web_service_am.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_ba.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_ce.rb +162 -0
- data/lib/br_nfe/product/gateway/web_service_go.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_mg.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_ms.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_mt.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_pe.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_pr.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_rs.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_sp.rb +140 -0
- data/lib/br_nfe/product/gateway/web_service_svan.rb +162 -0
- data/lib/br_nfe/product/gateway/web_service_svc_an.rb +131 -0
- data/lib/br_nfe/product/gateway/web_service_svc_rs.rb +20 -0
- data/lib/br_nfe/product/gateway/web_service_svrs.rb +111 -10
- data/lib/br_nfe/product/nf_xml_value.rb +278 -0
- data/lib/br_nfe/product/nfe/adicao_importacao.rb +76 -0
- data/lib/br_nfe/product/nfe/cobranca/duplicata.rb +44 -0
- data/lib/br_nfe/product/nfe/cobranca/fatura.rb +64 -0
- data/lib/br_nfe/product/nfe/cobranca/pagamento.rb +99 -0
- data/lib/br_nfe/product/nfe/declaracao_importacao.rb +221 -0
- data/lib/br_nfe/product/nfe/detalhe_exportacao.rb +89 -0
- data/lib/br_nfe/product/nfe/item.rb +678 -0
- data/lib/br_nfe/product/nfe/item_tax/cofins.rb +138 -0
- data/lib/br_nfe/product/nfe/item_tax/cofins_st.rb +68 -0
- data/lib/br_nfe/product/nfe/item_tax/icms.rb +593 -0
- data/lib/br_nfe/product/nfe/item_tax/icms_uf_destino.rb +169 -0
- data/lib/br_nfe/product/nfe/item_tax/importacao.rb +62 -0
- data/lib/br_nfe/product/nfe/item_tax/ipi.rb +179 -0
- data/lib/br_nfe/product/nfe/item_tax/issqn.rb +256 -0
- data/lib/br_nfe/product/nfe/item_tax/pis.rb +138 -0
- data/lib/br_nfe/product/nfe/item_tax/pis_st.rb +68 -0
- data/lib/br_nfe/product/nfe/processo_referencia.rb +48 -0
- data/lib/br_nfe/product/nfe/transporte/base.rb +264 -0
- data/lib/br_nfe/product/nfe/transporte/transportador.rb +15 -0
- data/lib/br_nfe/product/nfe/transporte/veiculo.rb +53 -0
- data/lib/br_nfe/product/nfe/transporte/volume.rb +89 -0
- data/lib/br_nfe/product/nota_fiscal.rb +1173 -0
- data/lib/br_nfe/product/operation/base.rb +255 -0
- data/lib/br_nfe/product/operation/nfe_autorizacao.rb +118 -0
- data/lib/br_nfe/product/operation/nfe_consulta_protocolo.rb +61 -0
- data/lib/br_nfe/product/operation/nfe_download_nf.rb +86 -0
- data/lib/br_nfe/product/operation/nfe_inutilizacao.rb +168 -0
- data/lib/br_nfe/product/operation/nfe_recepcao_evento.rb +70 -0
- data/lib/br_nfe/product/operation/nfe_ret_autorizacao.rb +63 -0
- data/lib/br_nfe/product/operation/nfe_status_servico.rb +46 -0
- data/lib/br_nfe/product/response/base.rb +97 -0
- data/lib/br_nfe/product/response/build/base.rb +287 -0
- data/lib/br_nfe/product/response/build/nfe_autorizacao.rb +102 -0
- data/lib/br_nfe/product/response/build/nfe_consulta_protocolo.rb +133 -0
- data/lib/br_nfe/product/response/build/nfe_inutilizacao.rb +53 -0
- data/lib/br_nfe/product/response/build/nfe_ret_autorizacao.rb +65 -0
- data/lib/br_nfe/product/response/build/nfe_status_servico.rb +43 -0
- data/lib/br_nfe/product/response/event.rb +89 -0
- data/lib/br_nfe/product/response/nfe_autorizacao.rb +12 -0
- data/lib/br_nfe/product/response/nfe_consulta_protocolo.rb +13 -0
- data/lib/br_nfe/product/response/nfe_inutilizacao.rb +89 -0
- data/lib/br_nfe/product/response/nfe_ret_autorizacao.rb +9 -0
- data/lib/br_nfe/product/response/nfe_status_servico.rb +31 -0
- data/lib/br_nfe/product/xml/_signed_info_sh1.xml.slim +9 -0
- data/lib/br_nfe/product/xml/_tc_cpf_cnpj.xml.slim +7 -0
- data/lib/br_nfe/product/xml/signature_sh1.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v1_00/evento/infEventoCancelamento.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v1_00/root/NfeDownloadNf.xml.slim +5 -0
- data/lib/br_nfe/product/xml/v1_00/root/NfeRecepcaoEvento.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/_tc_endereco.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v2_00/_tc_infNFe.xml.slim +39 -0
- data/lib/br_nfe/product/xml/v2_00/infInut.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/NFe.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_cobr.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_dest.xml.slim +14 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_det.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_emit.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_entrega.xml.slim +11 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_exporta.xml.slim +2 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_ide.xml.slim +24 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_infAdic.xml.slim +13 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_retirada.xml.slim +11 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_total.xml.slim +50 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/_tc_transp.xml.slim +35 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/_tc_imposto.xml.slim +31 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/_tc_prod.xml.slim +37 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS00.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS10.xml.slim +16 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS101.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS102.xml.slim +3 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS20.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS201.xml.slim +15 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS202.xml.slim +14 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS30.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS40.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS500.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS51.xml.slim +13 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS60.xml.slim +5 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS70.xml.slim +18 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS90.xml.slim +21 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/ICMS/_tc_ICMS900.xml.slim +25 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_COFINS.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_COFINS_ST.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_ICMS.xml.slim +45 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_II.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_IPI.xml.slim +30 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_PIS.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/imposto/_tc_PIS_ST.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/det/prod/_tc_di.xml.slim +13 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_retTransp.xml.slim +6 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_transporta.xml.slim +17 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe/transp/_tc_vol.xml.slim +15 -0
- data/lib/br_nfe/product/xml/v2_00/infNFe.xml.slim +3 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeAutorizacao.xml.slim +5 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeInutilizacao.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeRetAutorizacao.xml.slim +3 -0
- data/lib/br_nfe/product/xml/v2_00/root/NfeStatusServico.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v2_01/root/NfeConsultaProtocolo.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v3_10/_tc_infNFe.xml.slim +44 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_dest.xml.slim +25 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_det.xml.slim +14 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_exporta.xml.slim +4 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_ide.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_pag.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/_tc_total.xml.slim +78 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/_tc_imposto.xml.slim +37 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/_tc_prod.xml.slim +48 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS20.xml.slim +12 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS30.xml.slim +17 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS40.xml.slim +7 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS51.xml.slim +19 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS70.xml.slim +23 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/ICMS/_tc_ICMS90.xml.slim +26 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/_tc_ICMSUFDest.xml.slim +8 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/imposto/_tc_ISSQN.xml.slim +35 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/prod/_tc_det_export.xml.slim +8 -0
- data/lib/br_nfe/product/xml/v3_10/infNFe/det/prod/_tc_di.xml.slim +28 -0
- data/lib/br_nfe/product/xml/v3_10/root/NfeAutorizacao.xml.slim +6 -0
- data/lib/br_nfe/service/base.rb +1 -105
- data/lib/br_nfe/service/betha/v1/cancela_nfse.rb +1 -1
- data/lib/br_nfe/service/response/default.rb +1 -1
- data/lib/br_nfe/service/simpliss/v1/base.rb +2 -0
- data/lib/br_nfe/version.rb +2 -2
- data/lib/br_nfe.rb +180 -22
- data/lib/config/locales/br_nfe/en/product/nfe/cobranca/fatura.yml +6 -0
- data/lib/config/locales/br_nfe/en/product/nfe/declaracao_importacao.yml +10 -0
- data/lib/config/locales/br_nfe/en/product/nfe/item.yml +20 -0
- data/lib/config/locales/br_nfe/en/product/nfe/item_tax/icms_uf_destino.yml +8 -0
- data/lib/config/locales/br_nfe/en/product/nfe/transporte/base.yml +9 -0
- data/lib/config/locales/br_nfe/en/product/nota_fiscal.yml +21 -0
- data/lib/config/locales/br_nfe/en/product/operation/nfe_autorizacao.yml +10 -0
- data/lib/config/locales/br_nfe/en/product/operation/nfe_recepcao_evento.yml +6 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/cobranca/fatura.yml +6 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/declaracao_importacao.yml +10 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/item.yml +20 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/item_tax/icms_uf_destino.yml +8 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nfe/transporte/base.yml +9 -0
- data/lib/config/locales/br_nfe/pt-BR/product/nota_fiscal.yml +21 -0
- data/lib/config/locales/br_nfe/pt-BR/product/operation/nfe_autorizacao.yml +10 -0
- data/lib/config/locales/br_nfe/pt-BR/product/operation/nfe_recepcao_evento.yml +6 -0
- data/test/br_nfe/association/have_destinatario_test.rb +8 -8
- data/test/br_nfe/association/have_emitente_test.rb +6 -6
- data/test/br_nfe/base_test.rb +15 -4
- data/test/br_nfe/endereco_test.rb +15 -0
- data/test/br_nfe/person_test.rb +55 -6
- data/test/br_nfe/product/destinatario_test.rb +26 -0
- data/test/br_nfe/product/emitente_test.rb +1 -2
- data/test/br_nfe/product/evento/base_test.rb +58 -0
- data/test/br_nfe/product/evento/cancelamento_test.rb +32 -0
- data/test/br_nfe/product/gateway/web_service_am_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_ba_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_ce_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_go_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_mg_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_ms_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_mt_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_pe_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_pr_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_rs_test.rb +407 -0
- data/test/br_nfe/product/gateway/web_service_sp_test.rb +408 -0
- data/test/br_nfe/product/gateway/web_service_svan_test.rb +242 -0
- data/test/br_nfe/product/gateway/web_service_svc_an_test.rb +185 -0
- data/test/br_nfe/product/gateway/web_service_svc_rs_test.rb +185 -0
- data/test/br_nfe/product/gateway/web_service_svrs_test.rb +208 -2
- data/test/br_nfe/product/nfe/adicao_importacao_test.rb +19 -0
- data/test/br_nfe/product/nfe/cobranca/duplicata_test.rb +19 -0
- data/test/br_nfe/product/nfe/cobranca/fatura_test.rb +32 -0
- data/test/br_nfe/product/nfe/cobranca/pagamento_test.rb +105 -0
- data/test/br_nfe/product/nfe/declaracao_importacao_test.rb +116 -0
- data/test/br_nfe/product/nfe/detalhe_exportacao_test.rb +97 -0
- data/test/br_nfe/product/nfe/item_tax/cofins_st_test.rb +22 -0
- data/test/br_nfe/product/nfe/item_tax/cofins_test.rb +113 -0
- data/test/br_nfe/product/nfe/item_tax/icms_test.rb +1011 -0
- data/test/br_nfe/product/nfe/item_tax/icms_uf_destino_test.rb +99 -0
- data/test/br_nfe/product/nfe/item_tax/importacao_test.rb +23 -0
- data/test/br_nfe/product/nfe/item_tax/ipi_test.rb +160 -0
- data/test/br_nfe/product/nfe/item_tax/issqn_test.rb +84 -0
- data/test/br_nfe/product/nfe/item_tax/pis_st_test.rb +22 -0
- data/test/br_nfe/product/nfe/item_tax/pis_test.rb +113 -0
- data/test/br_nfe/product/nfe/item_test.rb +381 -0
- data/test/br_nfe/product/nfe/processo_referencia_test.rb +30 -0
- data/test/br_nfe/product/nfe/transporte/base_test.rb +182 -0
- data/test/br_nfe/product/nfe/transporte/transportador_test.rb +13 -0
- data/test/br_nfe/product/nfe/transporte/veiculo_test.rb +13 -0
- data/test/br_nfe/product/nfe/transporte/volume_test.rb +42 -0
- data/test/br_nfe/product/nota_fiscal_test.rb +662 -0
- data/test/br_nfe/product/operation/base_test.rb +538 -0
- data/test/br_nfe/product/operation/nfe_autorizacao_test.rb +378 -0
- data/test/br_nfe/product/operation/nfe_consulta_protocolo_test.rb +349 -0
- data/test/br_nfe/product/operation/nfe_download_nf_test.rb +93 -0
- data/test/br_nfe/product/operation/nfe_inutilizacao_test.rb +210 -0
- data/test/br_nfe/product/operation/nfe_recepcao_evento_test.rb +84 -0
- data/test/br_nfe/product/operation/nfe_ret_autorizacao_test.rb +309 -0
- data/test/br_nfe/product/operation/nfe_status_servico_test.rb +122 -0
- data/test/br_nfe/product/response/base_test.rb +75 -0
- data/test/br_nfe/product/response/build/base_test.rb +34 -0
- data/test/br_nfe/product/response/nfe_ret_autorizacao_test.rb +14 -0
- data/test/br_nfe/service/association/have_intermediario_test.rb +10 -10
- data/test/br_nfe/service/base_test.rb +9 -206
- data/test/br_nfe/service/betha/v1/cancela_nfse_test.rb +8 -6
- data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +6 -3
- data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +7 -4
- data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +12 -9
- data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/rps_test.rb +2 -2
- data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +6 -3
- data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +7 -4
- data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +7 -4
- data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +8 -5
- data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +9 -6
- data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +8 -5
- data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +9 -6
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +6 -3
- data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +6 -3
- data/test/factories/person.rb +1 -1
- data/test/factories/product/destinatario.rb +11 -0
- data/test/factories/product/emitente.rb +1 -1
- data/test/factories/product/evento/base.rb +9 -0
- data/test/factories/product/evento/cancelamento.rb +10 -0
- data/test/factories/product/gateway/web_service_am.rb +5 -0
- data/test/factories/product/gateway/web_service_ba.rb +5 -0
- data/test/factories/product/nfe/adicao_importacao.rb +7 -0
- data/test/factories/product/nfe/cobranca/duplicata.rb +7 -0
- data/test/factories/product/nfe/cobranca/fatura.rb +8 -0
- data/test/factories/product/nfe/cobranca/pagamento.rb +9 -0
- data/test/factories/product/nfe/declaracao_importacao.rb +10 -0
- data/test/factories/product/nfe/detalhe_exportacao.rb +5 -0
- data/test/factories/product/nfe/item.rb +24 -0
- data/test/factories/product/nfe/item_tax/cofins.rb +5 -0
- data/test/factories/product/nfe/item_tax/cofins_st.rb +5 -0
- data/test/factories/product/nfe/item_tax/icms.rb +9 -0
- data/test/factories/product/nfe/item_tax/icms_uf_destino.rb +11 -0
- data/test/factories/product/nfe/item_tax/importacao.rb +8 -0
- data/test/factories/product/nfe/item_tax/ipi.rb +6 -0
- data/test/factories/product/nfe/item_tax/issqn.rb +9 -0
- data/test/factories/product/nfe/item_tax/pis.rb +5 -0
- data/test/factories/product/nfe/item_tax/pis_st.rb +5 -0
- data/test/factories/product/nfe/processo_referencia.rb +6 -0
- data/test/factories/product/nfe/transporte/base.rb +5 -0
- data/test/factories/product/nfe/transporte/transportador.rb +7 -0
- data/test/factories/product/nfe/transporte/veiculo.rb +7 -0
- data/test/factories/product/nfe/transporte/volume.rb +5 -0
- data/test/factories/product/nota_fiscal.rb +22 -0
- data/test/factories/product/{base.rb → operation/base.rb} +1 -1
- data/test/factories/product/operation/nfe_autorizacao.rb +590 -0
- data/test/factories/product/operation/nfe_consulta_protocolo.rb +13 -0
- data/test/factories/product/operation/nfe_download_nf.rb +15 -0
- data/test/factories/product/operation/nfe_inutilizacao.rb +19 -0
- data/test/factories/product/operation/nfe_recepcao_evento.rb +14 -0
- data/test/factories/product/operation/nfe_ret_autorizacao.rb +13 -0
- data/test/factories/product/{consulta_status_servico.rb → operation/nfe_status_servico.rb} +1 -1
- data/test/factories/product/response/base.rb +12 -0
- data/test/factories/product/response/build/base.rb +6 -0
- data/test/factories/product/response/nfe_ret_autorizacao.rb +13 -0
- data/test/factories/service/emitente.rb +1 -1
- data/test/fixtures/product/operation/nfe_autorizacao/nfe_signed.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/async_fail.xml +21 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/async_success.xml +25 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/nfe/with_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/nfe/without_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/original_xml.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/sync_fail.xml +32 -0
- data/test/fixtures/product/response/v3.10/nfe_autorizacao/sync_success.xml +33 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_1.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_2.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_3.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/event_cancel.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/event_xml/one_event.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/fail.xml +22 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/nfe_original/with_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/nfe_original/without_proc.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_many_with_cancel.xml +198 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_many_without_cancel.xml +199 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_one.xml +89 -0
- data/test/fixtures/product/response/v3.10/nfe_consulta_protocolo/success_without.xml +34 -0
- data/test/fixtures/product/response/v3.10/nfe_inutilizacao/fail.xml +29 -0
- data/test/fixtures/product/response/v3.10/nfe_inutilizacao/success.xml +30 -0
- data/test/fixtures/product/response/v3.10/nfe_recepcao_evento/cancelamento/fail.xml +34 -0
- data/test/fixtures/product/response/v3.10/nfe_recepcao_evento/cancelamento/success.xml +36 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_fail.xml +22 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_fail.xml +33 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_fail_and_one_ok.xml +46 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_one_invoice_ok.xml +34 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_two_invoice_fail.xml +46 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/lot_ok_two_invoice_ok.xml +46 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_2_with_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_2_without_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_3_with_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/nfe/nf_3_without_protocol.xml +1 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/lot.xml +2 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/nfe.xml +2 -0
- data/test/fixtures/product/response/v3.10/nfe_ret_autorizacao/original_xml/nfeProc.xml +4 -0
- data/test/fixtures/product/response/v3.10/nfe_status_servico/fail.xml +23 -0
- data/test/fixtures/product/response/v3.10/nfe_status_servico/success.xml +22 -0
- data/test/fixtures/product/schemas/CCe_v1.00.xsd +11 -0
- data/test/fixtures/product/schemas/EPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/LeiauteCadastroEmissorDFe_v1.01.xsd +234 -0
- data/test/fixtures/product/schemas/SuframaInternaliza_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/SuframaVistoria_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/atuCadEmiDFe_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/cabecMsg_v1.02.xsd +29 -0
- data/test/fixtures/product/schemas/cadEmiDFe_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/cancNFe_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/confRecebto_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/consCad_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/consDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/consNFeDest_v1.01.xsd +10 -0
- data/test/fixtures/product/schemas/consReciNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consReciNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/consSitNFe_v2.01.xsd +10 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consSitNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/consStatServ_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/consStatServ_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/distDFeInt_v1.00.xsd +71 -0
- data/test/fixtures/product/schemas/downloadNFe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/e110110_v1.00.xsd +58 -0
- data/test/fixtures/product/schemas/e110111_v1.00.xsd +42 -0
- data/test/fixtures/product/schemas/e110140_v1.00.xsd +124 -0
- data/test/fixtures/product/schemas/e111500_v1.00.xsd +69 -0
- data/test/fixtures/product/schemas/e111501_v1.00.xsd +69 -0
- data/test/fixtures/product/schemas/e111502_v1.00.xsd +50 -0
- data/test/fixtures/product/schemas/e111503_v1.00.xsd +50 -0
- data/test/fixtures/product/schemas/e210200_v1.00.xsd +32 -0
- data/test/fixtures/product/schemas/e210210_v1.00.xsd +32 -0
- data/test/fixtures/product/schemas/e210220_v1.00.xsd +45 -0
- data/test/fixtures/product/schemas/e210240_v1.00.xsd +44 -0
- data/test/fixtures/product/schemas/e411500_v1.00.xsd +134 -0
- data/test/fixtures/product/schemas/e411501_v1.00.xsd +134 -0
- data/test/fixtures/product/schemas/e411502_v1.00.xsd +95 -0
- data/test/fixtures/product/schemas/e411503_v1.00.xsd +95 -0
- data/test/fixtures/product/schemas/e990900_v1.00.xsd +87 -0
- data/test/fixtures/product/schemas/e990910_v1.00.xsd +81 -0
- data/test/fixtures/product/schemas/envCCe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/envCancelPProrrogNFe_v1.0.xsd +50 -0
- data/test/fixtures/product/schemas/envConfRecebto_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/envEPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envEventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envEvento_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envFiscoNfe_v1.0.xsd +179 -0
- data/test/fixtures/product/schemas/envPProrrogNFe_v1.0.xsd +65 -0
- data/test/fixtures/product/schemas/envRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/envSuframaInternaliza_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/envSuframaVistoria_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/enviNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/enviNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/eventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/eventoEPEC_v0.01.xsd +267 -0
- data/test/fixtures/product/schemas/eventoEPEC_v1.00.xsd +267 -0
- data/test/fixtures/product/schemas/eventoRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/inutNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/inutNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/leiauteCCe_v1.00.xsd +418 -0
- data/test/fixtures/product/schemas/leiauteCancNFe_v2.00.xsd +143 -0
- data/test/fixtures/product/schemas/leiauteConfRecebto_v1.00.xsd +406 -0
- data/test/fixtures/product/schemas/leiauteConsNFeDest_v1.01.xsd +483 -0
- data/test/fixtures/product/schemas/leiauteConsSitNFe_v2.01.xsd +548 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteConsSitNFe_v3.10.xsd +502 -502
- data/test/fixtures/product/schemas/leiauteConsStatServ_v2.00.xsd +98 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteConsStatServ_v3.10.xsd +97 -97
- data/test/fixtures/product/schemas/leiauteConsultaCadastro_v1.01.xsd +355 -0
- data/test/fixtures/product/schemas/leiauteConsultaCadastro_v2.00.xsd +404 -0
- data/test/fixtures/product/schemas/leiauteDPEC_v1.01.xsd +464 -0
- data/test/fixtures/product/schemas/leiauteDownloadNFe_v1.00.xsd +149 -0
- data/test/fixtures/product/schemas/leiauteEPEC_v1.00.xsd +459 -0
- data/test/fixtures/product/schemas/leiauteEventoCancNFe_v1.00.xsd +394 -0
- data/test/fixtures/product/schemas/leiauteEvento_v1.00.xsd +373 -0
- data/test/fixtures/product/schemas/leiauteInutNFe_v2.00.xsd +193 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteInutNFe_v3.10.xsd +192 -192
- data/test/fixtures/product/schemas/leiauteNFe_v2.00.xsd +6661 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/leiauteNFe_v3.10.xsd +6060 -6060
- data/test/fixtures/product/schemas/leiauteRemIndus_v1.00.xsd +382 -0
- data/test/fixtures/product/schemas/leiauteSRE_v1.00.xsd +372 -0
- data/test/fixtures/product/schemas/leiauteSuframaInternaliza_v1.00.xsd +642 -0
- data/test/fixtures/product/schemas/leiauteSuframaVistoria_v1.00.xsd +648 -0
- data/test/fixtures/product/schemas/nfe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/nfe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/procCCeNFe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/procCancNFe_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/procConfRecebtoNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEventoNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/procEventoNFe_v99.99.xsd +37 -0
- data/test/fixtures/product/schemas/procInutNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/procInutNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/procNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/procNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/procRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/resEvento_v1.00.xsd +94 -0
- data/test/fixtures/product/schemas/resNFe_v1.00.xsd +110 -0
- data/test/fixtures/product/schemas/retAtuCadEmiDFe_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/retCancNFe_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/retConsCad_v2.00.xsd +9 -0
- data/test/fixtures/product/schemas/retConsDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/retConsReciNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsReciNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retConsSitNFe_v2.01.xsd +10 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsSitNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retConsStatServ_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retConsStatServ_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retDPEC_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/retDistDFeInt_v1.00.xsd +84 -0
- data/test/fixtures/product/schemas/retDownloadNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvCCe_v1.00.xsd +10 -0
- data/test/fixtures/product/schemas/retEnvCancelPProrrogNFe_v1.0.xsd +231 -0
- data/test/fixtures/product/schemas/retEnvConfRecebto_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvEPEC_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvEventoCancNFe_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvEvento_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvFiscoNFe_v1.0.xsd +234 -0
- data/test/fixtures/product/schemas/retEnvRemIndus_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvSuframaInternaliza_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnvSuframaVistoria_v1.00.xsd +9 -0
- data/test/fixtures/product/schemas/retEnviNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retEnviNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retEventoEPEC_v0.01.xsd +207 -0
- data/test/fixtures/product/schemas/retInutNFe_v2.00.xsd +9 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/retInutNFe_v3.10.xsd +8 -8
- data/test/fixtures/product/schemas/retPProrrogNFe_v1.0.xsd +233 -0
- data/test/fixtures/product/schemas/retconsNFeDest_v1.01.xsd +9 -0
- data/test/fixtures/product/schemas/tiposBasico_v1.03.xsd +816 -0
- data/test/fixtures/product/schemas/tiposBasico_v1.03_OPENSSL.xsd +816 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/tiposBasico_v3.10.xsd +571 -571
- data/test/fixtures/product/schemas/tiposBasico_v3.10_OPENSSL.xsd +877 -0
- data/test/fixtures/product/schemas/tiposDistDFe_v1.00.xsd +217 -0
- data/{lib/br_nfe/product/xml/v3_10/XSD → test/fixtures/product/schemas}/xmldsig-core-schema_v1.01.xsd +97 -97
- data/test/fixtures/product/wsdl/NFeRetAutorizacao.xml +80 -0
- data/test/fixtures/product/wsdl/NfeAutorizacao.xml +107 -0
- data/test/fixtures/product/wsdl/NfeConsulta2.xml +80 -0
- data/test/fixtures/product/wsdl/NfeStatusServico2.xml +70 -0
- data/test/fixtures/product/wsdl/nfeinutilizacao2.xml +80 -0
- data/test/fixtures/service/wsdl/betha/v1/cancelar_nfse.xml +178 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_lote_rps.xml +339 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_nfse.xml +348 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_nfse_por_rps.xml +365 -0
- data/test/fixtures/service/wsdl/betha/v1/consultar_situacao_lote_rps.xml +74 -0
- data/test/fixtures/service/wsdl/betha/v1/recepcionar_lote_rps.xml +299 -0
- data/test/fixtures/service/wsdl/simpliss/v1/nfseservice.xml +1 -0
- data/test/fixtures/service/wsdl/thema/v1/nfse_cancelamento.xml +82 -0
- data/test/fixtures/service/wsdl/thema/v1/nfse_consulta.xml +235 -0
- data/test/fixtures/service/wsdl/thema/v1/nfse_remessa.xml +185 -0
- data/test/test_helper.rb +369 -1
- metadata +711 -33
- data/lib/br_nfe/product/base.rb +0 -82
- data/lib/br_nfe/product/consulta_status_servico.rb +0 -35
- data/lib/br_nfe/product/value_nf.rb +0 -9
- data/lib/br_nfe/product/xml/v3_10/consulta_status_servico.xml.slim +0 -4
- data/test/br_nfe/product/base_test.rb +0 -150
- data/test/br_nfe/product/consulta_status_servico_test.rb +0 -59
@@ -0,0 +1,185 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://server.nfse.thema.inf.br" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://server.nfse.thema.inf.br">
|
2
|
+
<wsdl:documentation>
|
3
|
+
Serviço destinado a remessa de notas fiscais eletrônicas.
|
4
|
+
</wsdl:documentation>
|
5
|
+
<wsdl:types>
|
6
|
+
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://server.nfse.thema.inf.br">
|
7
|
+
<xs:element name="recepcionarLoteRpsDocumento">
|
8
|
+
<xs:complexType>
|
9
|
+
<xs:sequence>
|
10
|
+
<xs:element minOccurs="0" name="xml" nillable="true" type="xs:string"/>
|
11
|
+
<xs:element minOccurs="0" name="numeroDocumento" type="xs:long"/>
|
12
|
+
</xs:sequence>
|
13
|
+
</xs:complexType>
|
14
|
+
</xs:element>
|
15
|
+
<xs:element name="recepcionarLoteRpsDocumentoResponse">
|
16
|
+
<xs:complexType>
|
17
|
+
<xs:sequence>
|
18
|
+
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
|
19
|
+
</xs:sequence>
|
20
|
+
</xs:complexType>
|
21
|
+
</xs:element>
|
22
|
+
<xs:element name="recepcionarLoteRpsLimitado">
|
23
|
+
<xs:complexType>
|
24
|
+
<xs:sequence>
|
25
|
+
<xs:element minOccurs="0" name="xml" nillable="true" type="xs:string"/>
|
26
|
+
</xs:sequence>
|
27
|
+
</xs:complexType>
|
28
|
+
</xs:element>
|
29
|
+
<xs:element name="recepcionarLoteRpsLimitadoResponse">
|
30
|
+
<xs:complexType>
|
31
|
+
<xs:sequence>
|
32
|
+
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
|
33
|
+
</xs:sequence>
|
34
|
+
</xs:complexType>
|
35
|
+
</xs:element>
|
36
|
+
<xs:element name="recepcionarLoteRps">
|
37
|
+
<xs:complexType>
|
38
|
+
<xs:sequence>
|
39
|
+
<xs:element minOccurs="0" name="xml" nillable="true" type="xs:string"/>
|
40
|
+
</xs:sequence>
|
41
|
+
</xs:complexType>
|
42
|
+
</xs:element>
|
43
|
+
<xs:element name="recepcionarLoteRpsResponse">
|
44
|
+
<xs:complexType>
|
45
|
+
<xs:sequence>
|
46
|
+
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
|
47
|
+
</xs:sequence>
|
48
|
+
</xs:complexType>
|
49
|
+
</xs:element>
|
50
|
+
</xs:schema>
|
51
|
+
</wsdl:types>
|
52
|
+
<wsdl:message name="recepcionarLoteRpsRequest">
|
53
|
+
<wsdl:part name="parameters" element="ns:recepcionarLoteRps"/>
|
54
|
+
</wsdl:message>
|
55
|
+
<wsdl:message name="recepcionarLoteRpsResponse">
|
56
|
+
<wsdl:part name="parameters" element="ns:recepcionarLoteRpsResponse"/>
|
57
|
+
</wsdl:message>
|
58
|
+
<wsdl:message name="recepcionarLoteRpsDocumentoRequest">
|
59
|
+
<wsdl:part name="parameters" element="ns:recepcionarLoteRpsDocumento"/>
|
60
|
+
</wsdl:message>
|
61
|
+
<wsdl:message name="recepcionarLoteRpsDocumentoResponse">
|
62
|
+
<wsdl:part name="parameters" element="ns:recepcionarLoteRpsDocumentoResponse"/>
|
63
|
+
</wsdl:message>
|
64
|
+
<wsdl:message name="recepcionarLoteRpsLimitadoRequest">
|
65
|
+
<wsdl:part name="parameters" element="ns:recepcionarLoteRpsLimitado"/>
|
66
|
+
</wsdl:message>
|
67
|
+
<wsdl:message name="recepcionarLoteRpsLimitadoResponse">
|
68
|
+
<wsdl:part name="parameters" element="ns:recepcionarLoteRpsLimitadoResponse"/>
|
69
|
+
</wsdl:message>
|
70
|
+
<wsdl:portType name="NFSEremessaPortType">
|
71
|
+
<wsdl:operation name="recepcionarLoteRps">
|
72
|
+
<wsdl:input message="ns:recepcionarLoteRpsRequest" wsaw:Action="urn:recepcionarLoteRps"/>
|
73
|
+
<wsdl:output message="ns:recepcionarLoteRpsResponse" wsaw:Action="urn:recepcionarLoteRpsResponse"/>
|
74
|
+
</wsdl:operation>
|
75
|
+
<wsdl:operation name="recepcionarLoteRpsDocumento">
|
76
|
+
<wsdl:input message="ns:recepcionarLoteRpsDocumentoRequest" wsaw:Action="urn:recepcionarLoteRpsDocumento"/>
|
77
|
+
<wsdl:output message="ns:recepcionarLoteRpsDocumentoResponse" wsaw:Action="urn:recepcionarLoteRpsDocumentoResponse"/>
|
78
|
+
</wsdl:operation>
|
79
|
+
<wsdl:operation name="recepcionarLoteRpsLimitado">
|
80
|
+
<wsdl:input message="ns:recepcionarLoteRpsLimitadoRequest" wsaw:Action="urn:recepcionarLoteRpsLimitado"/>
|
81
|
+
<wsdl:output message="ns:recepcionarLoteRpsLimitadoResponse" wsaw:Action="urn:recepcionarLoteRpsLimitadoResponse"/>
|
82
|
+
</wsdl:operation>
|
83
|
+
</wsdl:portType>
|
84
|
+
<wsdl:binding name="NFSEremessaSoap11Binding" type="ns:NFSEremessaPortType">
|
85
|
+
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
|
86
|
+
<wsdl:operation name="recepcionarLoteRps">
|
87
|
+
<soap:operation soapAction="urn:recepcionarLoteRps" style="document"/>
|
88
|
+
<wsdl:input>
|
89
|
+
<soap:body use="literal"/>
|
90
|
+
</wsdl:input>
|
91
|
+
<wsdl:output>
|
92
|
+
<soap:body use="literal"/>
|
93
|
+
</wsdl:output>
|
94
|
+
</wsdl:operation>
|
95
|
+
<wsdl:operation name="recepcionarLoteRpsDocumento">
|
96
|
+
<soap:operation soapAction="urn:recepcionarLoteRpsDocumento" style="document"/>
|
97
|
+
<wsdl:input>
|
98
|
+
<soap:body use="literal"/>
|
99
|
+
</wsdl:input>
|
100
|
+
<wsdl:output>
|
101
|
+
<soap:body use="literal"/>
|
102
|
+
</wsdl:output>
|
103
|
+
</wsdl:operation>
|
104
|
+
<wsdl:operation name="recepcionarLoteRpsLimitado">
|
105
|
+
<soap:operation soapAction="urn:recepcionarLoteRpsLimitado" style="document"/>
|
106
|
+
<wsdl:input>
|
107
|
+
<soap:body use="literal"/>
|
108
|
+
</wsdl:input>
|
109
|
+
<wsdl:output>
|
110
|
+
<soap:body use="literal"/>
|
111
|
+
</wsdl:output>
|
112
|
+
</wsdl:operation>
|
113
|
+
</wsdl:binding>
|
114
|
+
<wsdl:binding name="NFSEremessaSoap12Binding" type="ns:NFSEremessaPortType">
|
115
|
+
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
|
116
|
+
<wsdl:operation name="recepcionarLoteRps">
|
117
|
+
<soap12:operation soapAction="urn:recepcionarLoteRps" style="document"/>
|
118
|
+
<wsdl:input>
|
119
|
+
<soap12:body use="literal"/>
|
120
|
+
</wsdl:input>
|
121
|
+
<wsdl:output>
|
122
|
+
<soap12:body use="literal"/>
|
123
|
+
</wsdl:output>
|
124
|
+
</wsdl:operation>
|
125
|
+
<wsdl:operation name="recepcionarLoteRpsDocumento">
|
126
|
+
<soap12:operation soapAction="urn:recepcionarLoteRpsDocumento" style="document"/>
|
127
|
+
<wsdl:input>
|
128
|
+
<soap12:body use="literal"/>
|
129
|
+
</wsdl:input>
|
130
|
+
<wsdl:output>
|
131
|
+
<soap12:body use="literal"/>
|
132
|
+
</wsdl:output>
|
133
|
+
</wsdl:operation>
|
134
|
+
<wsdl:operation name="recepcionarLoteRpsLimitado">
|
135
|
+
<soap12:operation soapAction="urn:recepcionarLoteRpsLimitado" style="document"/>
|
136
|
+
<wsdl:input>
|
137
|
+
<soap12:body use="literal"/>
|
138
|
+
</wsdl:input>
|
139
|
+
<wsdl:output>
|
140
|
+
<soap12:body use="literal"/>
|
141
|
+
</wsdl:output>
|
142
|
+
</wsdl:operation>
|
143
|
+
</wsdl:binding>
|
144
|
+
<wsdl:binding name="NFSEremessaHttpBinding" type="ns:NFSEremessaPortType">
|
145
|
+
<http:binding verb="POST"/>
|
146
|
+
<wsdl:operation name="recepcionarLoteRps">
|
147
|
+
<http:operation location="recepcionarLoteRps"/>
|
148
|
+
<wsdl:input>
|
149
|
+
<mime:content type="application/xml" part="parameters"/>
|
150
|
+
</wsdl:input>
|
151
|
+
<wsdl:output>
|
152
|
+
<mime:content type="application/xml" part="parameters"/>
|
153
|
+
</wsdl:output>
|
154
|
+
</wsdl:operation>
|
155
|
+
<wsdl:operation name="recepcionarLoteRpsDocumento">
|
156
|
+
<http:operation location="recepcionarLoteRpsDocumento"/>
|
157
|
+
<wsdl:input>
|
158
|
+
<mime:content type="application/xml" part="parameters"/>
|
159
|
+
</wsdl:input>
|
160
|
+
<wsdl:output>
|
161
|
+
<mime:content type="application/xml" part="parameters"/>
|
162
|
+
</wsdl:output>
|
163
|
+
</wsdl:operation>
|
164
|
+
<wsdl:operation name="recepcionarLoteRpsLimitado">
|
165
|
+
<http:operation location="recepcionarLoteRpsLimitado"/>
|
166
|
+
<wsdl:input>
|
167
|
+
<mime:content type="application/xml" part="parameters"/>
|
168
|
+
</wsdl:input>
|
169
|
+
<wsdl:output>
|
170
|
+
<mime:content type="application/xml" part="parameters"/>
|
171
|
+
</wsdl:output>
|
172
|
+
</wsdl:operation>
|
173
|
+
</wsdl:binding>
|
174
|
+
<wsdl:service name="NFSEremessa">
|
175
|
+
<wsdl:port name="NFSEremessaHttpSoap11Endpoint" binding="ns:NFSEremessaSoap11Binding">
|
176
|
+
<soap:address location="http://nfsehml.gaspar.sc.gov.br/nfse/services/NFSEremessa.NFSEremessaHttpSoap11Endpoint/"/>
|
177
|
+
</wsdl:port>
|
178
|
+
<wsdl:port name="NFSEremessaHttpSoap12Endpoint" binding="ns:NFSEremessaSoap12Binding">
|
179
|
+
<soap12:address location="http://nfsehml.gaspar.sc.gov.br/nfse/services/NFSEremessa.NFSEremessaHttpSoap12Endpoint/"/>
|
180
|
+
</wsdl:port>
|
181
|
+
<wsdl:port name="NFSEremessaHttpEndpoint" binding="ns:NFSEremessaHttpBinding">
|
182
|
+
<http:address location="http://nfsehml.gaspar.sc.gov.br/nfse/services/NFSEremessa.NFSEremessaHttpEndpoint/"/>
|
183
|
+
</wsdl:port>
|
184
|
+
</wsdl:service>
|
185
|
+
</wsdl:definitions>
|
data/test/test_helper.rb
CHANGED
@@ -11,6 +11,9 @@ require 'minitest/matchers_vaccine'
|
|
11
11
|
require 'shoulda/matchers'
|
12
12
|
require "minitest/reporters"
|
13
13
|
require 'mocha/mini_test'
|
14
|
+
require 'webmock/minitest'
|
15
|
+
|
16
|
+
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
14
17
|
|
15
18
|
require "codeclimate-test-reporter"
|
16
19
|
CodeClimate::TestReporter.start
|
@@ -22,6 +25,9 @@ require 'pry'
|
|
22
25
|
|
23
26
|
require "savon/mock/spec_helper"
|
24
27
|
|
28
|
+
ENV['TZ'] = 'UTC'
|
29
|
+
Time.zone = 'Brasilia'
|
30
|
+
|
25
31
|
Minitest::Reporters.use!
|
26
32
|
|
27
33
|
if ActiveSupport.version >= Gem::Version.new('4.2')
|
@@ -39,9 +45,371 @@ class Object
|
|
39
45
|
alias context describe
|
40
46
|
end
|
41
47
|
|
48
|
+
|
49
|
+
class Shoulda::Matchers::ActiveModel::ValidateLengthOfMatcher
|
50
|
+
def string_of_length(length)
|
51
|
+
MiniTest::Spec.string_for_validation_length * length
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
42
55
|
class MiniTest::Spec
|
43
56
|
include Savon::SpecHelper
|
44
57
|
include Shoulda::Matchers::ActiveModel
|
45
58
|
include FactoryGirl::Syntax::Methods
|
46
|
-
|
59
|
+
|
60
|
+
# Utilizado para que seja possível cusotmizar o valor utilizado
|
61
|
+
# na validação de length
|
62
|
+
mattr_accessor :string_for_validation_length
|
63
|
+
@@string_for_validation_length = 'x'
|
64
|
+
|
65
|
+
|
66
|
+
let(:sequence_1) { sequence('sequence_1') }
|
67
|
+
|
68
|
+
def open_fixture(path)
|
69
|
+
file_path = File.expand_path('../fixtures', __FILE__) + '/'+ path
|
70
|
+
File.open(file_path)
|
71
|
+
end
|
72
|
+
|
73
|
+
def read_fixture(path)
|
74
|
+
file_path = File.expand_path('../fixtures', __FILE__) + '/'+ path
|
75
|
+
File.read(file_path)
|
76
|
+
end
|
77
|
+
|
78
|
+
def wont_be_message_error(column, message=nil, msg_params={}, exec_valid = true)
|
79
|
+
message = get_message(message, msg_params, column) if message
|
80
|
+
subject.valid? if exec_valid
|
81
|
+
messages = subject.errors.messages[column.to_sym]
|
82
|
+
if message.nil?
|
83
|
+
messages.nil?.must_equal true, "Não deveria ter mensagem de erro para o atributo #{column}, mas foi encontrado os erros: \n -> #{messages ? messages.join("\n -> ") : '' }"
|
84
|
+
elsif messages.blank?
|
85
|
+
assert true
|
86
|
+
elsif messages.include?(message)
|
87
|
+
flunk "Não deveria ter o erro \"#{message}\" para o atributo \"#{column}\""
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def must_be_message_error(column, message=nil, msg_params={}, exec_valid = true)
|
92
|
+
message = get_message(message, msg_params, column) if message
|
93
|
+
subject.valid? if exec_valid
|
94
|
+
messages = subject.errors.messages[column.to_sym]
|
95
|
+
if message.nil?
|
96
|
+
messages.nil?.must_equal false, "Deveria ter alguma mensagem de erro para o atributo #{column}"
|
97
|
+
elsif messages.blank?
|
98
|
+
flunk "Deveria ter o erro \"#{message}\" para o atributo \"#{column}\", porém não há erro algum."
|
99
|
+
elsif messages.include?(message)
|
100
|
+
assert true
|
101
|
+
else
|
102
|
+
flunk "Deveria ter o erro \"#{message}\" para o atributo \"#{column}\", mas foi encontrado apenas os erros: \n -> #{messages.join("\n -> ") }"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def must_have_alias_attribute(alias_name, attribute, test_value=1, expect_value=nil)
|
107
|
+
expect_value ||= test_value
|
108
|
+
if test_value.is_a?(Time)
|
109
|
+
expect_value = test_value = Time.zone.parse('10/05/2017 03:58:47.000')
|
110
|
+
subject.send("#{attribute}=", test_value)
|
111
|
+
subject.send(alias_name).must_be_close_to expect_value
|
112
|
+
|
113
|
+
subject.send("#{alias_name}=", test_value)
|
114
|
+
subject.send(attribute).must_be_close_to expect_value
|
115
|
+
else
|
116
|
+
subject.send("#{attribute}=", test_value)
|
117
|
+
subject.send(alias_name).must_equal expect_value
|
118
|
+
|
119
|
+
subject.send("#{alias_name}=", test_value)
|
120
|
+
subject.send(attribute).must_equal expect_value
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def must_accept_only_numbers attribute, opts={}
|
125
|
+
options = {size: 5, set: '1'}
|
126
|
+
options.merge!(opts)
|
127
|
+
|
128
|
+
set_numbers = ''.rjust(options[:size], options[:set])
|
129
|
+
|
130
|
+
subject.send("#{attribute}=", "AB$#{set_numbers}-CD".insert(5, '.'))
|
131
|
+
subject.send(attribute).must_equal set_numbers
|
132
|
+
end
|
133
|
+
|
134
|
+
def must_returns_an_array attribute, opts={}
|
135
|
+
options = {set1: '1', set2: '2', init_how_array: true}
|
136
|
+
options.merge!(opts)
|
137
|
+
set1 = options[:set1]
|
138
|
+
set2 = options[:set2]
|
139
|
+
|
140
|
+
if options[:init_how_array]
|
141
|
+
# deve inicializar com um array vazio
|
142
|
+
subject.class.new.send(attribute).must_be_kind_of Array
|
143
|
+
subject.class.new.send(attribute).must_be_empty
|
144
|
+
end
|
145
|
+
|
146
|
+
# mesmo que setar um valor qualquer deve sempre retornar um array
|
147
|
+
subject.send("#{attribute}=", set1)
|
148
|
+
subject.send(attribute).must_equal([set1])
|
149
|
+
subject.send("#{attribute}=", set2)
|
150
|
+
subject.send(attribute).must_equal([set2])
|
151
|
+
subject.send("#{attribute}=", [set2,set1])
|
152
|
+
subject.send(attribute).must_equal([set2,set1])
|
153
|
+
|
154
|
+
# deve desconsiderar os valores nil
|
155
|
+
subject.send("#{attribute}=", [nil,set1,nil,set2,nil])
|
156
|
+
subject.send(attribute).must_equal([set1,set2])
|
157
|
+
subject.send("#{attribute}=", nil)
|
158
|
+
subject.send(attribute).must_equal([])
|
159
|
+
subject.send("#{attribute}=", [nil])
|
160
|
+
subject.send(attribute).must_equal([])
|
161
|
+
end
|
162
|
+
|
163
|
+
def must_validate_length_has_many attribute, klass, *args
|
164
|
+
options = {
|
165
|
+
condition: false, inverse_of: :reference
|
166
|
+
}.merge(args.extract_options!)
|
167
|
+
|
168
|
+
MiniTest::Spec.string_for_validation_length = [klass.new]
|
169
|
+
if options[:condition]
|
170
|
+
subject.stubs(options[:condition]).returns(true)
|
171
|
+
end
|
172
|
+
|
173
|
+
must(validate_length_of(attribute).is_at_most(options[:maximum])) if options[:maximum]
|
174
|
+
must(validate_length_of(attribute).is_at_least(options[:minimum])) if options[:minimum]
|
175
|
+
must(validate_length_of(attribute).is_at_least(options[:in].min).is_at_most(options[:in].max)) if options[:in]
|
176
|
+
|
177
|
+
validate_have_many_inverse_of(attribute, klass, options)
|
178
|
+
|
179
|
+
if options[:condition]
|
180
|
+
subject.stubs(options[:condition]).returns(false)
|
181
|
+
wont(validate_length_of(attribute).is_at_most(options[:maximum])) if options[:maximum]
|
182
|
+
wont(validate_length_of(attribute).is_at_least(options[:minimum])) if options[:minimum]
|
183
|
+
wont(validate_length_of(attribute).is_at_least(options[:in].min).is_at_most(options[:in].max)) if options[:in]
|
184
|
+
end
|
185
|
+
MiniTest::Spec.string_for_validation_length = 'x'
|
186
|
+
end
|
187
|
+
|
188
|
+
def must_validates_has_many attribute, klass, translation, *args
|
189
|
+
options = {
|
190
|
+
condition: false
|
191
|
+
}.merge(args.extract_options!)
|
192
|
+
|
193
|
+
object1 = klass.new
|
194
|
+
object2 = klass.new
|
195
|
+
object3 = klass.new
|
196
|
+
object1.stubs(:valid?).returns(true)
|
197
|
+
|
198
|
+
object2.errors.add(:base, 'Erro do object 2')
|
199
|
+
object2.stubs(:valid?).returns(false)
|
200
|
+
|
201
|
+
object3.errors.add(:base, 'Erro do object 3')
|
202
|
+
object3.stubs(:valid?).returns(false)
|
203
|
+
|
204
|
+
subject.send("#{attribute}=", [object1, object2, object3])
|
205
|
+
|
206
|
+
if options[:condition]
|
207
|
+
subject.stubs(options[:condition]).returns(true)
|
208
|
+
end
|
209
|
+
|
210
|
+
must_be_message_error :base, translation, {index: 2, error_message: 'Erro do object 2'}
|
211
|
+
must_be_message_error :base, translation, {index: 3, error_message: 'Erro do object 3'}, false
|
212
|
+
|
213
|
+
if options[:condition]
|
214
|
+
subject.stubs(options[:condition]).returns(false)
|
215
|
+
wont_be_message_error :base, translation, {index: 2, error_message: 'Erro do object 2'}
|
216
|
+
wont_be_message_error :base, translation, {index: 3, error_message: 'Erro do object 3'}, false
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def must_have_many attribute, klass, attrs={}
|
221
|
+
subject.class.new.send(attribute).must_be_kind_of Array, 'deve inicializar o objeto com um Array'
|
222
|
+
|
223
|
+
new_object = klass.new
|
224
|
+
|
225
|
+
subject.send("#{attribute}=", [new_object, 1, 'string', nil, {}, [], :symbol, attrs, true])
|
226
|
+
subject.send(attribute).size.must_equal 2
|
227
|
+
subject.send(attribute)[0].must_equal new_object
|
228
|
+
|
229
|
+
attrs.each do |attr_key, value|
|
230
|
+
subject.send(attribute)[1].send(attr_key).must_equal value, 'Deveria setar o attributo se passar um hash'
|
231
|
+
end
|
232
|
+
|
233
|
+
subject.send("#{attribute}=", [])
|
234
|
+
# posso adicionar valores com <<
|
235
|
+
new_subject = subject.class.new
|
236
|
+
new_subject.send(attribute) << new_object
|
237
|
+
new_subject.send(attribute) << 1
|
238
|
+
new_subject.send(attribute) << nil
|
239
|
+
new_subject.send(attribute) << attrs
|
240
|
+
|
241
|
+
new_subject.send(attribute).size.must_equal 2
|
242
|
+
new_subject.send(attribute)[0].must_equal new_object
|
243
|
+
|
244
|
+
attrs.each do |attr_key, value|
|
245
|
+
new_subject.send(attribute)[1].send(attr_key).must_equal value, 'Deveria setar o attributo se passar um hash'
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def must_have_one attribute, klass, hash_attributes, *args
|
250
|
+
options = {null: true, inverse_of: :reference}.merge(args.extract_options!)
|
251
|
+
validate_have_one_accept_only_object_of_class(attribute, klass, options)
|
252
|
+
validate_have_one_set_hash_values(attribute, klass, hash_attributes, options)
|
253
|
+
validate_have_one_set_block_values(attribute, klass, hash_attributes, options)
|
254
|
+
validate_have_one_inverse_of(attribute, klass, options)
|
255
|
+
|
256
|
+
if options[:null]
|
257
|
+
subject.send("#{attribute}=", hash_attributes)
|
258
|
+
subject.send(attribute).must_be_kind_of klass
|
259
|
+
|
260
|
+
subject.send("#{attribute}=", nil)
|
261
|
+
subject.send(attribute).must_be_nil "Deveria aceitar setar nil no atributo #{attribute}"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
def must_validate_have_one attribute, klass, i18n_message
|
266
|
+
msg_erro_1 = "Mensagem 1"
|
267
|
+
msg_erro_2 = "Mensagem 2"
|
268
|
+
object = klass.new
|
269
|
+
object.errors.add :base, msg_erro_1
|
270
|
+
object.errors.add :base, msg_erro_2
|
271
|
+
object.expects(:invalid?).returns(true)
|
272
|
+
subject.send("#{attribute}=", object)
|
273
|
+
|
274
|
+
must_be_message_error(:base, i18n_message, {error_message: msg_erro_1})
|
275
|
+
must_be_message_error(:base, i18n_message, {error_message: msg_erro_2}, false) # Para não executar mais o valid?
|
276
|
+
end
|
277
|
+
|
278
|
+
def wont_validate_have_one attribute, klass, i18n_message
|
279
|
+
msg_erro_1 = "Mensagem 1"
|
280
|
+
msg_erro_2 = "Mensagem 2"
|
281
|
+
object = klass.new
|
282
|
+
object.errors.add :base, msg_erro_1
|
283
|
+
object.errors.add :base, msg_erro_2
|
284
|
+
object.stubs(:invalid?).returns(true)
|
285
|
+
subject.send("#{attribute}=", object)
|
286
|
+
|
287
|
+
wont_be_message_error(:base, i18n_message, {error_message: msg_erro_1})
|
288
|
+
wont_be_message_error(:base, i18n_message, {error_message: msg_erro_2}, false) # Para não executar mais o valid?
|
289
|
+
end
|
290
|
+
|
291
|
+
def must_returns_a_integer_for attribute
|
292
|
+
subject.send("#{attribute}=", 1)
|
293
|
+
subject.send(attribute).must_equal 1
|
294
|
+
subject.send("#{attribute}=", '2')
|
295
|
+
subject.send(attribute).must_equal 2
|
296
|
+
subject.send("#{attribute}=", '')
|
297
|
+
subject.send(attribute).must_be_nil
|
298
|
+
end
|
299
|
+
def must_returns_a_boolean_for attribute
|
300
|
+
######### TRUE validations #########
|
301
|
+
subject.send("#{attribute}=", 1)
|
302
|
+
subject.send(attribute).must_equal true
|
303
|
+
subject.send("#{attribute}=", '1')
|
304
|
+
subject.send(attribute).must_equal true
|
305
|
+
subject.send("#{attribute}=", 't')
|
306
|
+
subject.send(attribute).must_equal true
|
307
|
+
subject.send("#{attribute}=", true)
|
308
|
+
subject.send(attribute).must_equal true
|
309
|
+
######### FALSE validations #########
|
310
|
+
subject.send("#{attribute}=", 0)
|
311
|
+
subject.send(attribute).must_equal false
|
312
|
+
subject.send("#{attribute}=", '0')
|
313
|
+
subject.send(attribute).must_equal false
|
314
|
+
subject.send("#{attribute}=", 'f')
|
315
|
+
subject.send(attribute).must_equal false
|
316
|
+
subject.send("#{attribute}=", false)
|
317
|
+
subject.send(attribute).must_equal false
|
318
|
+
end
|
319
|
+
|
320
|
+
def must_have_default_value_for attribute, default_value
|
321
|
+
msg = "O atributo #{attribute} deveria ter por padrão o valor #{default_value}."
|
322
|
+
subject.class.new.send(attribute).must_equal default_value, msg
|
323
|
+
end
|
324
|
+
|
325
|
+
def nfe_must_be_valid_by_schema schema_name
|
326
|
+
Dir.chdir(BrNfe.root+'/test/fixtures/product/schemas') do
|
327
|
+
schema = Nokogiri::XML::Schema(IO.read(schema_name))
|
328
|
+
document = Nokogiri::XML(subject.xml_builder)
|
329
|
+
errors = schema.validate(document)
|
330
|
+
errors.must_be_empty
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
private
|
335
|
+
|
336
|
+
################################################################################
|
337
|
+
####################### VALIDAÇÕES PARA HAVE_ONE #############################
|
338
|
+
def validate_have_one_accept_only_object_of_class attribute, klass, options
|
339
|
+
subject.send("#{attribute}=", nil)
|
340
|
+
subject.send("#{attribute}=", 123456)
|
341
|
+
validate_have_one_different_object_class(attribute, klass, options)
|
342
|
+
subject.send("#{attribute}=", 'aaaa')
|
343
|
+
validate_have_one_different_object_class(attribute, klass, options)
|
344
|
+
|
345
|
+
new_obj = klass.new
|
346
|
+
subject.send("#{attribute}=", new_obj)
|
347
|
+
subject.send(attribute).must_equal new_obj
|
348
|
+
end
|
349
|
+
def validate_have_one_different_object_class attribute, klass, options
|
350
|
+
if options[:null]
|
351
|
+
subject.send(attribute).must_be_nil
|
352
|
+
else
|
353
|
+
subject.send(attribute).must_be_kind_of klass
|
354
|
+
end
|
355
|
+
end
|
356
|
+
def validate_have_one_set_hash_values(attribute, klass, hash_attributes, options)
|
357
|
+
subject.send("#{attribute}=", nil)
|
358
|
+
subject.send("#{attribute}=", hash_attributes)
|
359
|
+
subject.send(attribute).must_be_kind_of klass
|
360
|
+
|
361
|
+
hash_attributes.each do |key, value|
|
362
|
+
subject.send(attribute).send("#{key}").must_equal value
|
363
|
+
end
|
364
|
+
end
|
365
|
+
def validate_have_one_set_block_values(attribute, klass, hash_attributes, options)
|
366
|
+
subject.send("#{attribute}=", nil)
|
367
|
+
subject.send(attribute) do |e|
|
368
|
+
hash_attributes.each do |key, value|
|
369
|
+
e.send("#{key}=", value)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
subject.send(attribute).must_be_kind_of klass
|
374
|
+
hash_attributes.each do |key, value|
|
375
|
+
subject.send(attribute).send("#{key}").must_equal value
|
376
|
+
end
|
377
|
+
end
|
378
|
+
def validate_have_one_inverse_of(attribute, klass, options)
|
379
|
+
new_object = klass.new
|
380
|
+
subject.instance_variable_set("@#{attribute}", new_object)
|
381
|
+
new_object.send(options[:inverse_of]).must_be_nil
|
382
|
+
subject.send(attribute).send(options[:inverse_of]).must_equal subject, "Deve setar o atributo #{options[:inverse_of]} do objeto #{attribute} no método get"
|
383
|
+
new_object.send(options[:inverse_of]).must_equal subject
|
384
|
+
end
|
385
|
+
################################################################################
|
386
|
+
####################### VALIDAÇÕES PARA HAVE_ONE #############################
|
387
|
+
def validate_have_many_inverse_of(attribute, klass, options)
|
388
|
+
subject.send("#{attribute}=",[])
|
389
|
+
new_object = klass.new
|
390
|
+
new_object.send(options[:inverse_of]).must_be_nil
|
391
|
+
subject.send(attribute) << new_object
|
392
|
+
subject.send(attribute)[0].send(options[:inverse_of]).must_equal subject, "Deve setar o atributo #{options[:inverse_of]} para o registro da associação #{attribute} no método get"
|
393
|
+
new_object.send(options[:inverse_of]).must_equal subject
|
394
|
+
end
|
395
|
+
|
396
|
+
def get_message(msg, msg_params, column=:base)
|
397
|
+
if !msg.is_a?(Symbol)
|
398
|
+
msg
|
399
|
+
else
|
400
|
+
if I18n.exists?("activemodel.errors.models.#{subject.class.model_name.i18n_key}.attributes.#{column}.#{msg}")
|
401
|
+
I18n.t("activemodel.errors.models.#{subject.class.model_name.i18n_key}.#{msg}", msg_params)
|
402
|
+
elsif I18n.exists?("activemodel.errors.models.#{subject.class.model_name.i18n_key}.#{msg}")
|
403
|
+
I18n.t("activemodel.errors.models.#{subject.class.model_name.i18n_key}.#{msg}", msg_params)
|
404
|
+
elsif I18n.exists?("activemodel.errors.models.#{subject.class.superclass.model_name.i18n_key}.#{msg}")
|
405
|
+
I18n.t("activemodel.errors.models.#{subject.class.superclass.model_name.i18n_key}.#{msg}", msg_params)
|
406
|
+
elsif I18n.exists?("errors.messages.#{subject.class.model_name.i18n_key}.#{msg}")
|
407
|
+
I18n.t("errors.messages.#{subject.class.model_name.i18n_key}.#{msg}", msg_params)
|
408
|
+
elsif I18n.exists?("activemodel.errors.messages.#{msg}")
|
409
|
+
I18n.t("activemodel.errors.messages.#{msg}", msg_params)
|
410
|
+
else
|
411
|
+
I18n.t("errors.messages.#{msg}", msg_params)
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
47
415
|
end
|