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,278 @@
|
|
1
|
+
module BrNfe
|
2
|
+
module Product
|
3
|
+
module NfXmlValue
|
4
|
+
def nf_xml_value_codigo_nf value
|
5
|
+
only_numbers(value, {min_size: 8, max_size: 8})
|
6
|
+
end
|
7
|
+
def nf_xml_value_tipo_ambiente value, xml_version=:v3_10
|
8
|
+
value == :production ? '1' : '2'
|
9
|
+
end
|
10
|
+
def nf_xml_value_cpf value, xml_version=:v3_10
|
11
|
+
only_numbers value, {min_size: 11, max_size: 11}
|
12
|
+
end
|
13
|
+
def nf_xml_value_cnpj value, xml_version=:v3_10
|
14
|
+
only_numbers value, {min_size: 14, max_size: 14}
|
15
|
+
end
|
16
|
+
def nf_xml_value_indicador_sincrono value
|
17
|
+
value ? '1' : '0'
|
18
|
+
end
|
19
|
+
|
20
|
+
def nf_xml_value_id_estrangeiro value, xml_version=:v3_10
|
21
|
+
"#{value}".max_size(20)
|
22
|
+
end
|
23
|
+
|
24
|
+
def nf_xml_value_fone value, xml_version=:v3_10
|
25
|
+
only_numbers value, {min_size: 6, max_size: 14}
|
26
|
+
end
|
27
|
+
|
28
|
+
def nf_xml_value_text value, max=60, xml_version=:v3_10
|
29
|
+
"#{value}".strip.max_size(max).br_nfe_escape_html.remove_accents.gsub(/\r\n/,' ').gsub(/\n/,' ')
|
30
|
+
end
|
31
|
+
|
32
|
+
def nf_xml_value_codigo_ibge_municipio value, xml_version=:v3_10
|
33
|
+
only_numbers value, {min_size: 7, max_size: 7}
|
34
|
+
end
|
35
|
+
|
36
|
+
def nf_xml_value_UF value, xml_version=:v3_10
|
37
|
+
"#{value}".max_size(2)
|
38
|
+
end
|
39
|
+
|
40
|
+
def nf_xml_value_CEP value, xml_version=:v3_10
|
41
|
+
only_numbers value, {min_size: 8, max_size: 8}
|
42
|
+
end
|
43
|
+
|
44
|
+
def nf_xml_value_codigo_pais value, xml_version=:v3_10
|
45
|
+
only_numbers value, {min_size: 4, max_size: 4}
|
46
|
+
end
|
47
|
+
|
48
|
+
def nf_xml_value_IE value, xml_version=:v3_10
|
49
|
+
if value.blank?
|
50
|
+
'ISENTO'
|
51
|
+
else
|
52
|
+
"#{value}".gsub(/[^\w]/,'').rjust(2, '0').max_size(14)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def nf_xml_value_IM value, xml_version=:v3_10
|
57
|
+
"#{value}".max_size(15)
|
58
|
+
end
|
59
|
+
|
60
|
+
def nf_xml_value_CNAE value, xml_version=:v3_10
|
61
|
+
only_numbers value, {min_size: 7, max_size: 7}
|
62
|
+
end
|
63
|
+
|
64
|
+
def nf_xml_value_CRT value, xml_version=:v3_10
|
65
|
+
"#{value}".max_size(1)
|
66
|
+
end
|
67
|
+
|
68
|
+
# E16a - Indicador da IE do Destinatário
|
69
|
+
# 1 = Contribuinte ICMS (informar a IE do destinatário);
|
70
|
+
# 2 = Contribuinte isento de Inscrição no cadastro de Contribuintes do ICMS;
|
71
|
+
# 9 = Não Contribuinte, que pode ou não possuir Inscrição Estadual no Cadastro de
|
72
|
+
# Contribuintes do ICMS.
|
73
|
+
#
|
74
|
+
# Nota 1: No caso de NFC-e informar indIEDest=9 e não informar
|
75
|
+
# a tag IE do destinatário;
|
76
|
+
# Nota 2: No caso de operação com o Exterior informar indIEDest=9 e
|
77
|
+
# não informar a tag IE do destinatário;
|
78
|
+
# Nota 3: No caso de Contribuinte Isento de Inscrição (indIEDest=2),
|
79
|
+
# não informar a tag IE do destinatário.
|
80
|
+
#
|
81
|
+
def nf_xml_value_indicador_IE indicador_ie, nfe, xml_version=:v3_10
|
82
|
+
if nfe.nfce? # 65 NFC-e
|
83
|
+
'9'
|
84
|
+
else
|
85
|
+
indicador_ie
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Obrigatório, nas operações que se beneficiam de incentivos
|
90
|
+
# fiscais existentes nas áreas sob controle da SUFRAMA. A
|
91
|
+
# omissão desta informação impede o processamento da
|
92
|
+
# operação pelo Sistema de Mercadoria Nacional da SUFRAMA e
|
93
|
+
# a liberação da Declaração de Ingresso, prejudicando a
|
94
|
+
# comprovação do ingresso / internamento da mercadoria nestas
|
95
|
+
# áreas.
|
96
|
+
# Min: 8 Max: 9
|
97
|
+
def nf_xml_value_inscricao_suframa v_suframa, xml_version=:v3_10
|
98
|
+
only_numbers v_suframa, {min_size: 8, max_size: 9}
|
99
|
+
end
|
100
|
+
|
101
|
+
def nf_xml_value_email v_email, xml_version=:v3_10
|
102
|
+
nf_xml_value_text(v_email, 60)
|
103
|
+
end
|
104
|
+
|
105
|
+
# 1=Operação interna;
|
106
|
+
# 2=Operação interestadual;
|
107
|
+
# 3=Operação com exterior.
|
108
|
+
def nf_xml_value_id_local_destino v_endereco_destino, xml_version=:v3_10
|
109
|
+
if v_endereco_destino.exterior?
|
110
|
+
3
|
111
|
+
elsif emitente.endereco.codigo_ibge_uf == v_endereco_destino.codigo_ibge_uf
|
112
|
+
1
|
113
|
+
else
|
114
|
+
2
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# Indica operação com Consumidor final
|
119
|
+
# 0=Normal;
|
120
|
+
# 1=Consumidor final;
|
121
|
+
def nf_xml_value_consumidor_final value, xml_version=:v3_10
|
122
|
+
value ? '1' : '0'
|
123
|
+
end
|
124
|
+
|
125
|
+
def nf_xml_value_date_time time, xml_version=:v3_10
|
126
|
+
if time.is_a?(Time) || time.is_a?(DateTime)
|
127
|
+
time.to_s(:iso8601)
|
128
|
+
elsif time.is_a?(Date)
|
129
|
+
time.to_time.to_s(:iso8601)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def nf_xml_value_time time, xml_version=:v3_10
|
134
|
+
if time.is_a?(Time) || time.is_a?(DateTime)
|
135
|
+
time.strftime('%H:%M:%S')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def nf_xml_value_date value, xml_version=:v3_10
|
140
|
+
if value.is_a?(Date)
|
141
|
+
value.to_s(:iso8601)
|
142
|
+
elsif value.is_a?(Time) || value.is_a?(DateTime)
|
143
|
+
value.to_date.to_s(:iso8601)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def nf_xml_value_monetary value, xml_version=:v3_10
|
148
|
+
"%.2f" % value.to_f.round(2)
|
149
|
+
end
|
150
|
+
|
151
|
+
def nf_xml_value_percent value, xml_version=:v3_10
|
152
|
+
"%.4f" % value.to_f.round(4)
|
153
|
+
end
|
154
|
+
|
155
|
+
def nf_xml_value_quantidade value, xml_version=:v3_10
|
156
|
+
"%.4f" % value.to_f.round(4)
|
157
|
+
end
|
158
|
+
|
159
|
+
def nf_xml_value_peso value, xml_version=:v3_10
|
160
|
+
"%.3f" % value.to_f.round(3)
|
161
|
+
end
|
162
|
+
|
163
|
+
def nf_xml_value_float value, precision, xml_version=:v3_10
|
164
|
+
"%.#{precision}f" % value.to_f.round(precision)
|
165
|
+
end
|
166
|
+
|
167
|
+
def nf_xml_value_CFOP value, xml_version=:v3_10
|
168
|
+
only_numbers value, {min_size: 4, max_size: 4}
|
169
|
+
end
|
170
|
+
|
171
|
+
def nf_xml_value_placa placa, xml_version=:v3_10
|
172
|
+
"#{placa}".gsub(/[^\w]/,'').rjust(7, '0').max_size(7)
|
173
|
+
end
|
174
|
+
|
175
|
+
# Registro Nacional de Transportador de Carga (ANTT)
|
176
|
+
#
|
177
|
+
def nf_xml_value_RNTC rntc, xml_version=:v3_10
|
178
|
+
nf_xml_value_text rntc, 20
|
179
|
+
end
|
180
|
+
|
181
|
+
def nf_xml_fixed_code code, options={}, xml_version=:v3_10
|
182
|
+
options = {size: 2}.merge(options)
|
183
|
+
"#{code.to_i}".rjust(options[:size], '0')
|
184
|
+
end
|
185
|
+
|
186
|
+
def nf_xml_value_CEST cest, xml_version=:v3_10
|
187
|
+
"#{cest.to_i}".rjust(7, '0') if cest.present?
|
188
|
+
end
|
189
|
+
|
190
|
+
def nf_xml_value_EAN ean, xml_version=:v3_10
|
191
|
+
if ean.to_i > 0
|
192
|
+
if "#{ean}".strip.size > 8
|
193
|
+
"#{ean}".strip.rjust(12, '0')
|
194
|
+
else
|
195
|
+
"#{ean}".strip.rjust(8, '0')
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def nf_xml_value_NCM ncm, xml_version=:v3_10
|
201
|
+
ncm = ncm.to_i
|
202
|
+
if ncm > 0
|
203
|
+
"#{ncm}".rjust(8, '0')
|
204
|
+
else
|
205
|
+
"#{ncm}".rjust(2, '0')
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
def nf_xml_value_EXTIPI value, xml_version=:v3_10
|
210
|
+
"#{value}".rjust(2, '0')
|
211
|
+
end
|
212
|
+
|
213
|
+
def nf_xml_value_boolean value, xml_version=:v3_10
|
214
|
+
value ? '1' : '0'
|
215
|
+
end
|
216
|
+
|
217
|
+
def nf_xml_value_NVE value, xml_version=:v3_10
|
218
|
+
"#{value}".max_size(6)
|
219
|
+
end
|
220
|
+
|
221
|
+
def nf_xml_value_number value, max_size, xml_version=:v3_10
|
222
|
+
only_numbers value, {max_size: max_size}
|
223
|
+
end
|
224
|
+
|
225
|
+
def nf_xml_value_drawback value, xml_version=:v3_10
|
226
|
+
if "#{value}".strip.size <= 9
|
227
|
+
only_numbers value, min_size: 9, max_size: 9
|
228
|
+
else
|
229
|
+
only_numbers value, min_size: 11, max_size: 11
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
def nf_xml_value_chave_nfe value, xml_version=:v3_10
|
234
|
+
only_numbers value, {min_size: 44, max_size: 44}
|
235
|
+
end
|
236
|
+
|
237
|
+
def nf_xml_value_number_fixed_size value, size, xml_version=:v3_10
|
238
|
+
only_numbers value, {min_size: size, max_size: size}
|
239
|
+
end
|
240
|
+
|
241
|
+
def nf_xml_value_codigo_enquadramento_IPI value
|
242
|
+
if value.blank?
|
243
|
+
'999'
|
244
|
+
else
|
245
|
+
nf_xml_value_text value, 3
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def nf_xml_value_ISSQN_incentivo_fiscal value
|
250
|
+
value ? 1 : 2
|
251
|
+
end
|
252
|
+
|
253
|
+
def nf_xml_value_numero_recibo value
|
254
|
+
only_numbers "#{value}".strip, max_size: 15
|
255
|
+
end
|
256
|
+
|
257
|
+
def nf_xml_value_orgao_emissor evento
|
258
|
+
if evento.codigo_orgao.present?
|
259
|
+
evento.codigo_orgao
|
260
|
+
else
|
261
|
+
if gateway.is_a?(BrNfe::Product::Gateway::WebServiceSVAN) && evento.is_a?(BrNfe.cancelamento_product_class)
|
262
|
+
91
|
263
|
+
else
|
264
|
+
"#{evento.chave_nfe}"[0..1]
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
private
|
270
|
+
|
271
|
+
def only_numbers value, options={}
|
272
|
+
options[:min_size] ||= 0
|
273
|
+
options[:max_size] ||= 1
|
274
|
+
"#{value}".gsub(/[^\d]/,'').rjust(options[:min_size], '0').max_size(options[:max_size])
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module BrNfe
|
2
|
+
module Product
|
3
|
+
module Nfe
|
4
|
+
class AdicaoImportacao < BrNfe::ActiveModelBase
|
5
|
+
# Numero da Adição
|
6
|
+
#
|
7
|
+
# <b>Type: </b> _Number_
|
8
|
+
# <b>Required: </b> _Yes_
|
9
|
+
# <b>Example: </b> _123_
|
10
|
+
# <b>Length: </b> _max: 3_
|
11
|
+
# <b>tag: </b> nAdicao
|
12
|
+
#
|
13
|
+
attr_accessor :numero_adicao
|
14
|
+
alias_attribute :nAdicao, :numero_adicao
|
15
|
+
|
16
|
+
# Numero sequencial do item dentro da Adição
|
17
|
+
#
|
18
|
+
# <b>Type: </b> _Number_
|
19
|
+
# <b>Required: </b> _Yes_
|
20
|
+
# <b>Example: </b> _2_
|
21
|
+
# <b>Length: </b> _max: 3_
|
22
|
+
# <b>tag: </b> nSeqAdic
|
23
|
+
#
|
24
|
+
attr_accessor :sequencial
|
25
|
+
alias_attribute :nSeqAdic, :sequencial
|
26
|
+
|
27
|
+
# Código do fabricante estrangeiro
|
28
|
+
# Código do fabricante estrangeiro, usado nos sistemas internos
|
29
|
+
# de informação do emitente da NF-e
|
30
|
+
#
|
31
|
+
# <b>Type: </b> _String_
|
32
|
+
# <b>Required: </b> _Yes_
|
33
|
+
# <b>Example: </b> _XINGLING_
|
34
|
+
# <b>Length: </b> _max: 60_
|
35
|
+
# <b>tag: </b> cFabricante
|
36
|
+
#
|
37
|
+
attr_accessor :codigo_fabricante
|
38
|
+
alias_attribute :cFabricante, :codigo_fabricante
|
39
|
+
|
40
|
+
# Valor do desconto do item da DI – Adição
|
41
|
+
#
|
42
|
+
# <b>Type: </b> _Float_
|
43
|
+
# <b>Required: </b> _No_
|
44
|
+
# <b>Example: </b> _35.50_
|
45
|
+
# <b>Length: </b> _precision: 2_
|
46
|
+
# <b>tag: </b> vDescDI
|
47
|
+
#
|
48
|
+
attr_accessor :valor_desconto
|
49
|
+
alias_attribute :vDescDI, :valor_desconto
|
50
|
+
|
51
|
+
# Número do ato concessório de Drawback
|
52
|
+
# O número do Ato Concessório de Suspensão deve ser
|
53
|
+
# preenchido com 11 dígitos (AAAANNNNNND) e o número do
|
54
|
+
# Ato Concessório de Drawback Isenção deve ser preenchido
|
55
|
+
# com 9 dígitos (AANNNNNND). (Observação incluída na NT
|
56
|
+
# 2013/005 v. 1.10)
|
57
|
+
#
|
58
|
+
# <b>Type: </b> _Float_
|
59
|
+
# <b>Required: </b> _No_
|
60
|
+
# <b>Example: </b> _20160000012_
|
61
|
+
# <b>Length: </b> _min: 9, max: 11_
|
62
|
+
# <b>tag: </b> nDraw
|
63
|
+
#
|
64
|
+
attr_accessor :numero_drawback
|
65
|
+
alias_attribute :nDraw, :numero_drawback
|
66
|
+
|
67
|
+
validates :numero_adicao, presence: true
|
68
|
+
validates :sequencial, presence: true
|
69
|
+
validates :codigo_fabricante, presence: true
|
70
|
+
validates :numero_drawback, length: {in: 9..11 }, allow_blank: true
|
71
|
+
validates :codigo_fabricante, length: {maximum: 60}, allow_blank: true
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module BrNfe
|
2
|
+
module Product
|
3
|
+
module Nfe
|
4
|
+
module Cobranca
|
5
|
+
class Duplicata < BrNfe::ActiveModelBase
|
6
|
+
# Número da duplicata
|
7
|
+
#
|
8
|
+
# <b>Type: </b> _String_
|
9
|
+
# <b>Required: </b> _No_
|
10
|
+
# <b>Length: </b> _Max: 60_
|
11
|
+
# <b>Exemplo: </b> _DUP646498_
|
12
|
+
# <b>tag: </b> nDup
|
13
|
+
#
|
14
|
+
attr_accessor :numero_duplicata
|
15
|
+
alias_attribute :nDup, :numero_duplicata
|
16
|
+
|
17
|
+
# Valor da duplicata
|
18
|
+
#
|
19
|
+
# <b>Type: </b> _Float_
|
20
|
+
# <b>Required: </b> _No_
|
21
|
+
# <b>Exemplo: </b> _1500.50_
|
22
|
+
# <b>tag: </b> vDup
|
23
|
+
#
|
24
|
+
attr_accessor :total
|
25
|
+
alias_attribute :vDup, :total
|
26
|
+
|
27
|
+
# Data do vencimento da duplicata
|
28
|
+
#
|
29
|
+
# <b>Type: </b> _Date_
|
30
|
+
# <b>Required: </b> _Yes_
|
31
|
+
# <b>Exemplo: </b> _Date.tomorrow_
|
32
|
+
# <b>tag: </b> dVenc
|
33
|
+
#
|
34
|
+
attr_accessor :vencimento
|
35
|
+
alias_attribute :dVenc, :vencimento
|
36
|
+
|
37
|
+
validates :total, presence: true
|
38
|
+
validates :total, numericality: {greater_than_or_equal_to: 0.0}
|
39
|
+
validates :numero_duplicata, length: {maximum: 60}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module BrNfe
|
2
|
+
module Product
|
3
|
+
module Nfe
|
4
|
+
module Cobranca
|
5
|
+
class Fatura < BrNfe::ActiveModelBase
|
6
|
+
# Número da fatura
|
7
|
+
#
|
8
|
+
# <b>Type: </b> _String_
|
9
|
+
# <b>Required: </b> _No_
|
10
|
+
# <b>Length: </b> _Max: 60_
|
11
|
+
# <b>Exemplo: </b> _FAT646498_
|
12
|
+
# <b>tag: </b> nFat
|
13
|
+
#
|
14
|
+
attr_accessor :numero_fatura
|
15
|
+
alias_attribute :nFat, :numero_fatura
|
16
|
+
|
17
|
+
# Valor original da fatura
|
18
|
+
#
|
19
|
+
# <b>Type: </b> _Float_
|
20
|
+
# <b>Required: </b> _No_
|
21
|
+
# <b>Exemplo: </b> _1500.50_
|
22
|
+
# <b>tag: </b> vOrig
|
23
|
+
#
|
24
|
+
attr_accessor :valor_original
|
25
|
+
alias_attribute :vOrig, :valor_original
|
26
|
+
|
27
|
+
# Valor do desconto da fatura
|
28
|
+
#
|
29
|
+
# <b>Type: </b> _Float_
|
30
|
+
# <b>Required: </b> _No_
|
31
|
+
# <b>Exemplo: </b> _100.25_
|
32
|
+
# <b>tag: </b> vDesc
|
33
|
+
#
|
34
|
+
attr_accessor :valor_desconto
|
35
|
+
alias_attribute :vDesc, :valor_desconto
|
36
|
+
|
37
|
+
# Valor do liquido da fatura
|
38
|
+
#
|
39
|
+
# <b>Type: </b> _Float_
|
40
|
+
# <b>Required: </b> _No_
|
41
|
+
# <b>Default: </b> _Auto_
|
42
|
+
# <b>Exemplo: </b> _1400.25_
|
43
|
+
# <b>tag: </b> vLiq
|
44
|
+
#
|
45
|
+
attr_accessor :valor_liquido
|
46
|
+
def valor_liquido
|
47
|
+
@valor_liquido || calculate_valor_liquido
|
48
|
+
end
|
49
|
+
alias_attribute :vLiq, :valor_liquido
|
50
|
+
|
51
|
+
has_many :duplicatas, 'BrNfe.duplicata_product_class'
|
52
|
+
|
53
|
+
validate_has_many :duplicatas, message: :invalid_duplicata
|
54
|
+
validates :duplicatas, length: {maximum: 120}
|
55
|
+
|
56
|
+
private
|
57
|
+
def calculate_valor_liquido
|
58
|
+
valor_original.to_f - valor_desconto.to_f
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module BrNfe
|
2
|
+
module Product
|
3
|
+
module Nfe
|
4
|
+
module Cobranca
|
5
|
+
class Pagamento < BrNfe::ActiveModelBase
|
6
|
+
# Forma de pagamento
|
7
|
+
# 01=Dinheiro
|
8
|
+
# 02=Cheque
|
9
|
+
# 03=Cartão de Crédito
|
10
|
+
# 04=Cartão de Débito
|
11
|
+
# 05=Crédito Loja
|
12
|
+
# 10=Vale Alimentação
|
13
|
+
# 11=Vale Refeição
|
14
|
+
# 12=Vale Presente
|
15
|
+
# 13=Vale Combustível
|
16
|
+
# 99=Outros
|
17
|
+
#
|
18
|
+
# <b>Type: </b> _Number_
|
19
|
+
# <b>Required: </b> _Yes_
|
20
|
+
# <b>Exemplo: </b> _1_ ou _'01'_
|
21
|
+
# <b>Length: </b> _2_
|
22
|
+
# <b>tag: </b> tPag
|
23
|
+
#
|
24
|
+
attr_accessor :forma_pagamento
|
25
|
+
alias_attribute :tPag, :forma_pagamento
|
26
|
+
|
27
|
+
# Valor do pagamento
|
28
|
+
#
|
29
|
+
# <b>Type: </b> _Float_
|
30
|
+
# <b>Required: </b> _Yes_
|
31
|
+
# <b>Exemplo: </b> _1500.50_
|
32
|
+
# <b>tag: </b> vPag
|
33
|
+
#
|
34
|
+
attr_accessor :total
|
35
|
+
alias_attribute :vPag, :total
|
36
|
+
|
37
|
+
# CNPJ da Credenciadora de cartão de crédito e/ou débito
|
38
|
+
# Informar o CNPJ da Credenciadora de cartão de crédito / débito
|
39
|
+
#
|
40
|
+
# <b>Type: </b> _String_
|
41
|
+
# <b>Required: </b> _Yes_ (if forma_pagamento IN [3, 4] )
|
42
|
+
# <b>Exemplo: </b> _12.123.456/0001-88_ ou _12345678901234_
|
43
|
+
# <b>tag: </b> CNPJ
|
44
|
+
#
|
45
|
+
attr_accessor :cartao_cnpj
|
46
|
+
def cartao_cnpj
|
47
|
+
return unless @cartao_cnpj.present?
|
48
|
+
BrNfe::Helper::CpfCnpj.new(@cartao_cnpj).sem_formatacao
|
49
|
+
end
|
50
|
+
alias_attribute :CNPJ, :cartao_cnpj
|
51
|
+
|
52
|
+
# Bandeira da operadora de cartão de crédito e/ou débito
|
53
|
+
# 01=Visa
|
54
|
+
# 02=Mastercard
|
55
|
+
# 03=American Express
|
56
|
+
# 04=Sorocred
|
57
|
+
# 99=Outros
|
58
|
+
#
|
59
|
+
# <b>Type: </b> _Number_
|
60
|
+
# <b>Required: </b> _Yes_ (if forma_pagamento IN [3, 4] )
|
61
|
+
# <b>Exemplo: </b> _1_ ou _'02'_
|
62
|
+
# <b>tag: </b> tBand
|
63
|
+
#
|
64
|
+
attr_accessor :cartao_bandeira
|
65
|
+
alias_attribute :tBand, :cartao_bandeira
|
66
|
+
|
67
|
+
# Número de autorização da operação cartão de crédito e/ou débito.
|
68
|
+
# Identifica o número da autorização da transação da operação com
|
69
|
+
# cartão de crédito e/ou débito
|
70
|
+
#
|
71
|
+
# <b>Type: </b> _String_
|
72
|
+
# <b>Required: </b> _Yes_ (if forma_pagamento IN [3, 4] )
|
73
|
+
# <b>Exemplo: </b> _'9799844646'_
|
74
|
+
# <b>tag: </b> cAut
|
75
|
+
#
|
76
|
+
attr_accessor :cartao_autorizacao
|
77
|
+
alias_attribute :cAut, :cartao_autorizacao
|
78
|
+
|
79
|
+
validates :forma_pagamento, :total, presence: true
|
80
|
+
validates :forma_pagamento, inclusion: {in: BrNfe::Constants::FORMAS_PAGAMENTO}
|
81
|
+
validates :total, numericality: {greater_than_or_equal_to: 0.0}
|
82
|
+
|
83
|
+
with_options if: :cartao? do |record|
|
84
|
+
record.validates :cartao_cnpj, :cartao_bandeira, :cartao_autorizacao, presence: true
|
85
|
+
record.validates :cartao_cnpj, length: {maximum: 14}
|
86
|
+
record.validates :cartao_autorizacao, length: {maximum: 20}
|
87
|
+
record.validates :cartao_bandeira, inclusion: {in: [1, 2, 3, 4, 99, '1', '2', '3', '4', '01', '02', '03', '04', '99']}
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
def cartao?
|
92
|
+
forma_pagamento.to_i.in?([3, 4])
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|