nf-e 0.2.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +201 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +6 -0
- data/circle.yml +7 -0
- data/config/locales/commons.yml +15 -0
- data/config/locales/models/dest.yml +13 -0
- data/config/locales/models/emit.yml +14 -0
- data/config/locales/models/ender.yml +13 -0
- data/config/locales/models/envi_nfe.yml +7 -0
- data/config/locales/models/ide.yml +5 -0
- data/config/locales/models/nfe.yml +5 -0
- data/config/locales/operations/correction_letter.yml +4 -0
- data/config/locales/operations/nfe_cancel.yml +4 -0
- data/config/locales/operations/nfe_discard.yml +7 -0
- data/config/locales/pt-BR.yml +211 -0
- data/lib/nf-e.rb +20 -0
- data/lib/nfe/helpers/nfe_key.rb +103 -0
- data/lib/nfe/helpers/schema_validator.rb +24 -0
- data/lib/nfe/helpers/signer.rb +25 -0
- data/lib/nfe/helpers/uf_helper.rb +23 -0
- data/lib/nfe/helpers/xml_model/attribute_base.rb +60 -0
- data/lib/nfe/helpers/xml_model/attribute_bigdecimal.rb +16 -0
- data/lib/nfe/helpers/xml_model/attribute_collection.rb +37 -0
- data/lib/nfe/helpers/xml_model/attribute_date.rb +20 -0
- data/lib/nfe/helpers/xml_model/attribute_datetime.rb +20 -0
- data/lib/nfe/helpers/xml_model/attribute_enumerize.rb +12 -0
- data/lib/nfe/helpers/xml_model/attribute_float.rb +20 -0
- data/lib/nfe/helpers/xml_model/attribute_integer.rb +12 -0
- data/lib/nfe/helpers/xml_model/attribute_node.rb +17 -0
- data/lib/nfe/helpers/xml_model/attribute_nodeattribute.rb +16 -0
- data/lib/nfe/helpers/xml_model/attribute_text.rb +31 -0
- data/lib/nfe/helpers/xml_model/factory.rb +17 -0
- data/lib/nfe/helpers/xml_model/nfe_model.rb +120 -0
- data/lib/nfe/models/NFe.rb +47 -0
- data/lib/nfe/models/avulsa.rb +59 -0
- data/lib/nfe/models/bill/cobr.rb +23 -0
- data/lib/nfe/models/bill/dup.rb +23 -0
- data/lib/nfe/models/bill/fat.rb +36 -0
- data/lib/nfe/models/cane/bigdecimal_greater_than_validator.rb +11 -0
- data/lib/nfe/models/cane/bigdecimal_less_than_validator.rb +9 -0
- data/lib/nfe/models/cane/cana.rb +100 -0
- data/lib/nfe/models/cane/deduc.rb +24 -0
- data/lib/nfe/models/cane/forDia.rb +33 -0
- data/lib/nfe/models/compra.rb +21 -0
- data/lib/nfe/models/concerns/cnpj_cpf_validatable.rb +22 -0
- data/lib/nfe/models/concerns/ufable.rb +20 -0
- data/lib/nfe/models/det.rb +34 -0
- data/lib/nfe/models/emitter/emit.rb +56 -0
- data/lib/nfe/models/ender.rb +64 -0
- data/lib/nfe/models/entrega_retirada.rb +47 -0
- data/lib/nfe/models/evento.rb +71 -0
- data/lib/nfe/models/exporta.rb +19 -0
- data/lib/nfe/models/ide.rb +140 -0
- data/lib/nfe/models/infNFe.rb +82 -0
- data/lib/nfe/models/information/infAdic.rb +51 -0
- data/lib/nfe/models/information/obsContFisco.rb +21 -0
- data/lib/nfe/models/information/procRef.rb +25 -0
- data/lib/nfe/models/itens/CIDE.rb +32 -0
- data/lib/nfe/models/itens/DI.rb +55 -0
- data/lib/nfe/models/itens/adi.rb +34 -0
- data/lib/nfe/models/itens/arma.rb +31 -0
- data/lib/nfe/models/itens/comb.rb +41 -0
- data/lib/nfe/models/itens/med.rb +40 -0
- data/lib/nfe/models/itens/prod.rb +115 -0
- data/lib/nfe/models/itens/veicProd.rb +140 -0
- data/lib/nfe/models/nfeProc.rb +29 -0
- data/lib/nfe/models/procEventoNFe.rb +29 -0
- data/lib/nfe/models/procInutNFe.rb +28 -0
- data/lib/nfe/models/recipient/dest.rb +57 -0
- data/lib/nfe/models/referenced/NFref.rb +44 -0
- data/lib/nfe/models/referenced/refECF.rb +26 -0
- data/lib/nfe/models/referenced/refNF.rb +43 -0
- data/lib/nfe/models/referenced/refNFP.rb +40 -0
- data/lib/nfe/models/signature.rb +53 -0
- data/lib/nfe/models/taxes/ICMS.rb +100 -0
- data/lib/nfe/models/taxes/ICMS00.rb +39 -0
- data/lib/nfe/models/taxes/ICMS10.rb +82 -0
- data/lib/nfe/models/taxes/ICMS101.rb +26 -0
- data/lib/nfe/models/taxes/ICMS102.rb +10 -0
- data/lib/nfe/models/taxes/ICMS103.rb +13 -0
- data/lib/nfe/models/taxes/ICMS20.rb +46 -0
- data/lib/nfe/models/taxes/ICMS201.rb +67 -0
- data/lib/nfe/models/taxes/ICMS202.rb +53 -0
- data/lib/nfe/models/taxes/ICMS203.rb +13 -0
- data/lib/nfe/models/taxes/ICMS30.rb +55 -0
- data/lib/nfe/models/taxes/ICMS300.rb +13 -0
- data/lib/nfe/models/taxes/ICMS40.rb +24 -0
- data/lib/nfe/models/taxes/ICMS400.rb +13 -0
- data/lib/nfe/models/taxes/ICMS41.rb +13 -0
- data/lib/nfe/models/taxes/ICMS50.rb +13 -0
- data/lib/nfe/models/taxes/ICMS500.rb +28 -0
- data/lib/nfe/models/taxes/ICMS51.rb +48 -0
- data/lib/nfe/models/taxes/ICMS60.rb +28 -0
- data/lib/nfe/models/taxes/ICMS70.rb +89 -0
- data/lib/nfe/models/taxes/ICMS90.rb +90 -0
- data/lib/nfe/models/taxes/ICMS900.rb +100 -0
- data/lib/nfe/models/taxes/ICMSBase.rb +21 -0
- data/lib/nfe/models/taxes/ICMSNormalBase.rb +15 -0
- data/lib/nfe/models/taxes/ICMSPart.rb +112 -0
- data/lib/nfe/models/taxes/ICMSSNBase.rb +19 -0
- data/lib/nfe/models/taxes/ICMSST.rb +50 -0
- data/lib/nfe/models/taxes/ICMSTot.rb +124 -0
- data/lib/nfe/models/taxes/II.rb +39 -0
- data/lib/nfe/models/taxes/IPI.rb +133 -0
- data/lib/nfe/models/taxes/IPINT.rb +17 -0
- data/lib/nfe/models/taxes/IPITrib.rb +51 -0
- data/lib/nfe/models/taxes/ISSQN.rb +54 -0
- data/lib/nfe/models/taxes/ISSQNtot.rb +51 -0
- data/lib/nfe/models/taxes/PISCOFINS.rb +173 -0
- data/lib/nfe/models/taxes/PISCOFINSAliq.rb +62 -0
- data/lib/nfe/models/taxes/PISCOFINSNT.rb +20 -0
- data/lib/nfe/models/taxes/PISCOFINSOutr.rb +87 -0
- data/lib/nfe/models/taxes/PISCOFINSQtde.rb +56 -0
- data/lib/nfe/models/taxes/PISCOFINSST.rb +78 -0
- data/lib/nfe/models/taxes/imposto.rb +44 -0
- data/lib/nfe/models/taxes/retTrib.rb +67 -0
- data/lib/nfe/models/total.rb +23 -0
- data/lib/nfe/models/transport/lacres.rb +16 -0
- data/lib/nfe/models/transport/retTransp.rb +49 -0
- data/lib/nfe/models/transport/transp.rb +50 -0
- data/lib/nfe/models/transport/transporta.rb +42 -0
- data/lib/nfe/models/transport/veicTransp_reboque.rb +23 -0
- data/lib/nfe/models/transport/vol.rb +50 -0
- data/lib/nfe/operations/base.rb +101 -0
- data/lib/nfe/operations/consult_emitter.rb +62 -0
- data/lib/nfe/operations/correction_letter.rb +37 -0
- data/lib/nfe/operations/event.rb +117 -0
- data/lib/nfe/operations/nfe_cancel.rb +47 -0
- data/lib/nfe/operations/nfe_discard.rb +106 -0
- data/lib/nfe/operations/nfe_send.rb +125 -0
- data/lib/nfe/operations/nfe_situation.rb +46 -0
- data/lib/nfe/operations/service_status.rb +44 -0
- data/lib/nfe/schemas/CCe_v1.00.xsd +11 -0
- data/lib/nfe/schemas/consCad_v2.00.xsd +9 -0
- data/lib/nfe/schemas/consReciNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/consSitNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/consStatServ_v3.10.xsd +9 -0
- data/lib/nfe/schemas/envCCe_v1.00.xsd +10 -0
- data/lib/nfe/schemas/envEventoCancNFe_v1.00.xsd +9 -0
- data/lib/nfe/schemas/enviNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/inutNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/leiauteCCe_v1.00.xsd +423 -0
- data/lib/nfe/schemas/leiauteConsSitNFe_v3.10.xsd +502 -0
- data/lib/nfe/schemas/leiauteConsStatServ_v3.10.xsd +98 -0
- data/lib/nfe/schemas/leiauteConsultaCadastro_v2.00.xsd +404 -0
- data/lib/nfe/schemas/leiauteEventoCancNFe_v1.00.xsd +400 -0
- data/lib/nfe/schemas/leiauteInutNFe_v3.10.xsd +193 -0
- data/lib/nfe/schemas/leiauteNFe_v3.10.xsd +7212 -0
- data/lib/nfe/schemas/nfe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/procInutNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/procNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/retConsReciNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/retConsSitNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/retConsStatServ_v3.10.xsd +9 -0
- data/lib/nfe/schemas/retEnviNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/retInutNFe_v3.10.xsd +9 -0
- data/lib/nfe/schemas/tiposBasico_v1.03.xsd +791 -0
- data/lib/nfe/schemas/tiposBasico_v3.10.xsd +877 -0
- data/lib/nfe/schemas/xmldsig-core-schema_v1.01.xsd +98 -0
- data/lib/nfe/services/dispatch/consCad.rb +57 -0
- data/lib/nfe/services/dispatch/consSitNFe.rb +43 -0
- data/lib/nfe/services/dispatch/consStatServ.rb +42 -0
- data/lib/nfe/services/dispatch/detEventoCC.rb +55 -0
- data/lib/nfe/services/dispatch/detEventoCancel.rb +45 -0
- data/lib/nfe/services/dispatch/envEvento.rb +28 -0
- data/lib/nfe/services/dispatch/enviNFe.rb +45 -0
- data/lib/nfe/services/dispatch/inutNFe.rb +93 -0
- data/lib/nfe/services/regress/infCad.rb +34 -0
- data/lib/nfe/services/regress/protNFe.rb +54 -0
- data/lib/nfe/services/regress/retConsCad.rb +27 -0
- data/lib/nfe/services/regress/retConsSitNFe.rb +26 -0
- data/lib/nfe/services/regress/retConsStatServ.rb +25 -0
- data/lib/nfe/services/regress/retEnvEvento.rb +27 -0
- data/lib/nfe/services/regress/retEnviNFe.rb +23 -0
- data/lib/nfe/services/regress/retEvento.rb +60 -0
- data/lib/nfe/services/regress/retInutNFe.rb +56 -0
- data/lib/nfe/version.rb +3 -0
- data/lib/nfe/webservices/client_soap.rb +35 -0
- data/lib/nfe/webservices/sender.rb +42 -0
- data/lib/nfe/webservices/wsinfo/base.rb +35 -0
- data/lib/nfe/webservices/wsinfo/consult_emitter.rb +16 -0
- data/lib/nfe/webservices/wsinfo/event.rb +20 -0
- data/lib/nfe/webservices/wsinfo/factory.rb +31 -0
- data/lib/nfe/webservices/wsinfo/nfe_disenable.rb +16 -0
- data/lib/nfe/webservices/wsinfo/nfe_send.rb +16 -0
- data/lib/nfe/webservices/wsinfo/nfe_situation.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/am.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/ba.rb +21 -0
- data/lib/nfe/webservices/wsinfo/production/ce.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/go.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/mg.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/ms.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/mt.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/pe.rb +16 -0
- data/lib/nfe/webservices/wsinfo/production/pr.rb +22 -0
- data/lib/nfe/webservices/wsinfo/production/rs.rb +21 -0
- data/lib/nfe/webservices/wsinfo/production/sp.rb +21 -0
- data/lib/nfe/webservices/wsinfo/production/svan.rb +24 -0
- data/lib/nfe/webservices/wsinfo/production/svrs.rb +21 -0
- data/lib/nfe/webservices/wsinfo/service_status.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/am.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/ba.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/ce.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/go.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/mg.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/ms.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/mt.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/pe.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/pr.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/rs.rb +17 -0
- data/lib/nfe/webservices/wsinfo/test/sp.rb +16 -0
- data/lib/nfe/webservices/wsinfo/test/svan.rb +20 -0
- data/lib/nfe/webservices/wsinfo/test/svrs.rb +18 -0
- data/lib/nfe/webservices/wsinfo/wsdl_base.rb +46 -0
- data/lib/nfe/webservices/wsinfo/wsdl_finder.rb +31 -0
- data/lib/xmldsig/canonicalize.rb +22 -0
- data/lib/xmldsig/canonicalizer.rb +27 -0
- data/lib/xmldsig/enveloped_signature.rb +10 -0
- data/lib/xmldsig/namespaces.rb +6 -0
- data/lib/xmldsig/reference.rb +72 -0
- data/lib/xmldsig/signature.rb +106 -0
- data/lib/xmldsig/signed_document.rb +28 -0
- data/lib/xmldsig/transform.rb +10 -0
- data/lib/xmldsig/transforms.rb +28 -0
- data/lib/xmldsig/xmldsig.rb +12 -0
- data/nf-e.gemspec +42 -0
- data/spec/nfe/factories/models/NFe.rb +9 -0
- data/spec/nfe/factories/models/avulsa.rb +16 -0
- data/spec/nfe/factories/models/bill/cobr.rb +14 -0
- data/spec/nfe/factories/models/bill/dup.rb +9 -0
- data/spec/nfe/factories/models/bill/fat.rb +10 -0
- data/spec/nfe/factories/models/cane/cana.rb +26 -0
- data/spec/nfe/factories/models/cane/deduc.rb +6 -0
- data/spec/nfe/factories/models/cane/forDia.rb +8 -0
- data/spec/nfe/factories/models/compra.rb +7 -0
- data/spec/nfe/factories/models/det.rb +11 -0
- data/spec/nfe/factories/models/emitter/emit.rb +15 -0
- data/spec/nfe/factories/models/ender.rb +17 -0
- data/spec/nfe/factories/models/entrega_retirada.rb +14 -0
- data/spec/nfe/factories/models/evento.rb +15 -0
- data/spec/nfe/factories/models/exporta.rb +6 -0
- data/spec/nfe/factories/models/ide.rb +43 -0
- data/spec/nfe/factories/models/infNFe.rb +26 -0
- data/spec/nfe/factories/models/information/infAdic.rb +23 -0
- data/spec/nfe/factories/models/information/obsContFisco.rb +8 -0
- data/spec/nfe/factories/models/information/procRef.rb +8 -0
- data/spec/nfe/factories/models/itens/CIDE.rb +7 -0
- data/spec/nfe/factories/models/itens/DI.rb +17 -0
- data/spec/nfe/factories/models/itens/adi.rb +8 -0
- data/spec/nfe/factories/models/itens/arma.rb +8 -0
- data/spec/nfe/factories/models/itens/comb.rb +9 -0
- data/spec/nfe/factories/models/itens/med.rb +9 -0
- data/spec/nfe/factories/models/itens/prod.rb +48 -0
- data/spec/nfe/factories/models/itens/veicProd.rb +28 -0
- data/spec/nfe/factories/models/recipient/dest.rb +13 -0
- data/spec/nfe/factories/models/referenced/NFref.rb +13 -0
- data/spec/nfe/factories/models/referenced/refECF.rb +7 -0
- data/spec/nfe/factories/models/referenced/refNF.rb +10 -0
- data/spec/nfe/factories/models/referenced/refNFP.rb +12 -0
- data/spec/nfe/factories/models/signature.rb +10 -0
- data/spec/nfe/factories/models/taxes/ICMS.rb +203 -0
- data/spec/nfe/factories/models/taxes/ICMS00.rb +10 -0
- data/spec/nfe/factories/models/taxes/ICMS10.rb +16 -0
- data/spec/nfe/factories/models/taxes/ICMS101.rb +8 -0
- data/spec/nfe/factories/models/taxes/ICMS102.rb +6 -0
- data/spec/nfe/factories/models/taxes/ICMS103.rb +6 -0
- data/spec/nfe/factories/models/taxes/ICMS20.rb +11 -0
- data/spec/nfe/factories/models/taxes/ICMS201.rb +14 -0
- data/spec/nfe/factories/models/taxes/ICMS202.rb +12 -0
- data/spec/nfe/factories/models/taxes/ICMS203.rb +12 -0
- data/spec/nfe/factories/models/taxes/ICMS30.rb +12 -0
- data/spec/nfe/factories/models/taxes/ICMS300.rb +6 -0
- data/spec/nfe/factories/models/taxes/ICMS40.rb +8 -0
- data/spec/nfe/factories/models/taxes/ICMS400.rb +6 -0
- data/spec/nfe/factories/models/taxes/ICMS41.rb +8 -0
- data/spec/nfe/factories/models/taxes/ICMS50.rb +8 -0
- data/spec/nfe/factories/models/taxes/ICMS500.rb +8 -0
- data/spec/nfe/factories/models/taxes/ICMS51.rb +11 -0
- data/spec/nfe/factories/models/taxes/ICMS60.rb +8 -0
- data/spec/nfe/factories/models/taxes/ICMS70.rb +17 -0
- data/spec/nfe/factories/models/taxes/ICMS90.rb +17 -0
- data/spec/nfe/factories/models/taxes/ICMS900.rb +19 -0
- data/spec/nfe/factories/models/taxes/ICMSPart.rb +19 -0
- data/spec/nfe/factories/models/taxes/ICMSST.rb +9 -0
- data/spec/nfe/factories/models/taxes/ICMSTot.rb +20 -0
- data/spec/nfe/factories/models/taxes/II.rb +8 -0
- data/spec/nfe/factories/models/taxes/IPI.rb +24 -0
- data/spec/nfe/factories/models/taxes/IPINT.rb +5 -0
- data/spec/nfe/factories/models/taxes/IPITrib.rb +10 -0
- data/spec/nfe/factories/models/taxes/ISSQN.rb +10 -0
- data/spec/nfe/factories/models/taxes/ISSQNtot.rb +9 -0
- data/spec/nfe/factories/models/taxes/PISCOFINS.rb +72 -0
- data/spec/nfe/factories/models/taxes/PISCOFINSAliq.rb +21 -0
- data/spec/nfe/factories/models/taxes/PISCOFINSNT.rb +5 -0
- data/spec/nfe/factories/models/taxes/PISCOFINSOutr.rb +23 -0
- data/spec/nfe/factories/models/taxes/PISCOFINSQtde.rb +17 -0
- data/spec/nfe/factories/models/taxes/PISCOFINSST.rb +21 -0
- data/spec/nfe/factories/models/taxes/imposto.rb +15 -0
- data/spec/nfe/factories/models/taxes/retTrib.rb +11 -0
- data/spec/nfe/factories/models/total.rb +7 -0
- data/spec/nfe/factories/models/transport/lacres.rb +6 -0
- data/spec/nfe/factories/models/transport/retTransp.rb +10 -0
- data/spec/nfe/factories/models/transport/transp.rb +18 -0
- data/spec/nfe/factories/models/transport/transporta.rb +11 -0
- data/spec/nfe/factories/models/transport/veicTranspReboque.rb +8 -0
- data/spec/nfe/factories/models/transport/vol.rb +17 -0
- data/spec/nfe/factories/services/consCad.rb +10 -0
- data/spec/nfe/factories/services/consSitNFe.rb +12 -0
- data/spec/nfe/factories/services/consStatServ.rb +7 -0
- data/spec/nfe/factories/services/detEventoCC.rb +6 -0
- data/spec/nfe/factories/services/detEventoCancel.rb +7 -0
- data/spec/nfe/factories/services/envEvento.rb +7 -0
- data/spec/nfe/factories/services/enviNFe.rb +11 -0
- data/spec/nfe/factories/services/inutNFe.rb +15 -0
- data/spec/nfe/factories/services/protNFe.rb +14 -0
- data/spec/nfe/factories/services/retEvento.rb +15 -0
- data/spec/nfe/factories/services/retInutNFe.rb +19 -0
- data/spec/nfe/fixtures/cassettes/correction_letter/error_in_lot.yml +176 -0
- data/spec/nfe/fixtures/cassettes/correction_letter/invalid_response.yml +175 -0
- data/spec/nfe/fixtures/cassettes/correction_letter/rejected.yml +177 -0
- data/spec/nfe/fixtures/cassettes/correction_letter/success.yml +177 -0
- data/spec/nfe/fixtures/cassettes/nfe_cancel/error_in_lot.yml +176 -0
- data/spec/nfe/fixtures/cassettes/nfe_cancel/invalid_response.yml +174 -0
- data/spec/nfe/fixtures/cassettes/nfe_cancel/rejected.yml +177 -0
- data/spec/nfe/fixtures/cassettes/nfe_cancel/success.yml +177 -0
- data/spec/nfe/fixtures/cassettes/nfe_discard/invalid_response.yml +175 -0
- data/spec/nfe/fixtures/cassettes/nfe_discard/rejected.yml +176 -0
- data/spec/nfe/fixtures/cassettes/nfe_discard/success.yml +176 -0
- data/spec/nfe/fixtures/cassettes/nfe_send/authorized.yml +197 -0
- data/spec/nfe/fixtures/cassettes/nfe_send/denied.yml +198 -0
- data/spec/nfe/fixtures/cassettes/nfe_send/error_in_lot.yml +195 -0
- data/spec/nfe/fixtures/cassettes/nfe_send/invalid_response.yml +193 -0
- data/spec/nfe/fixtures/cassettes/nfe_send/rejected.yml +198 -0
- data/spec/nfe/fixtures/certificate.pem +16 -0
- data/spec/nfe/fixtures/invalid_nfe.xml +1 -0
- data/spec/nfe/fixtures/nfe.xml +1 -0
- data/spec/nfe/fixtures/private-key.pem +15 -0
- data/spec/nfe/helpers/nfe_key_spec.rb +87 -0
- data/spec/nfe/helpers/schema_validator_spec.rb +34 -0
- data/spec/nfe/helpers/signer_spec.rb +22 -0
- data/spec/nfe/helpers/uf_helper_spec.rb +331 -0
- data/spec/nfe/helpers/xml_model/attribute_base_spec.rb +63 -0
- data/spec/nfe/helpers/xml_model/attribute_bigdecimal_spec.rb +32 -0
- data/spec/nfe/helpers/xml_model/attribute_collection_spec.rb +46 -0
- data/spec/nfe/helpers/xml_model/attribute_date_spec.rb +40 -0
- data/spec/nfe/helpers/xml_model/attribute_datetime_spec.rb +41 -0
- data/spec/nfe/helpers/xml_model/attribute_enumerize_spec.rb +34 -0
- data/spec/nfe/helpers/xml_model/attribute_float_spec.rb +40 -0
- data/spec/nfe/helpers/xml_model/attribute_integer_spec.rb +33 -0
- data/spec/nfe/helpers/xml_model/attribute_node_spec.rb +44 -0
- data/spec/nfe/helpers/xml_model/attribute_nodeattribute_spec.rb +33 -0
- data/spec/nfe/helpers/xml_model/attribute_text_spec.rb +173 -0
- data/spec/nfe/helpers/xml_model/factory_spec.rb +102 -0
- data/spec/nfe/helpers/xml_model/nfe_model_spec.rb +225 -0
- data/spec/nfe/models/NFe_spec.rb +48 -0
- data/spec/nfe/models/avulsa_spec.rb +140 -0
- data/spec/nfe/models/bigdecimal_greater_than_validator_spec.rb +33 -0
- data/spec/nfe/models/bigdecimal_less_than_validator_spec.rb +33 -0
- data/spec/nfe/models/bill/cobr_spec.rb +98 -0
- data/spec/nfe/models/bill/dup_spec.rb +80 -0
- data/spec/nfe/models/bill/fat_spec.rb +129 -0
- data/spec/nfe/models/cane/cana_spec.rb +161 -0
- data/spec/nfe/models/cane/deduc_spec.rb +40 -0
- data/spec/nfe/models/cane/forDia_spec.rb +51 -0
- data/spec/nfe/models/compra_spec.rb +78 -0
- data/spec/nfe/models/det_spec.rb +94 -0
- data/spec/nfe/models/emitter/emit_spec.rb +150 -0
- data/spec/nfe/models/ender_spec.rb +129 -0
- data/spec/nfe/models/entrega_retirada_spec.rb +159 -0
- data/spec/nfe/models/evento_spec.rb +52 -0
- data/spec/nfe/models/exporta_spec.rb +54 -0
- data/spec/nfe/models/ide_spec.rb +215 -0
- data/spec/nfe/models/infNFe_spec.rb +292 -0
- data/spec/nfe/models/information/infAdic_spec.rb +126 -0
- data/spec/nfe/models/information/obsContFisco_spec.rb +37 -0
- data/spec/nfe/models/information/procRef_spec.rb +41 -0
- data/spec/nfe/models/itens/CIDE_spec.rb +57 -0
- data/spec/nfe/models/itens/DI_spec.rb +67 -0
- data/spec/nfe/models/itens/adi_spec.rb +79 -0
- data/spec/nfe/models/itens/arma_spec.rb +43 -0
- data/spec/nfe/models/itens/comb_spec.rb +103 -0
- data/spec/nfe/models/itens/med_spec.rb +52 -0
- data/spec/nfe/models/itens/prod_spec.rb +249 -0
- data/spec/nfe/models/itens/veicProd_spec.rb +173 -0
- data/spec/nfe/models/nfeProc_spec.rb +21 -0
- data/spec/nfe/models/procEventoNFe_spec.rb +21 -0
- data/spec/nfe/models/procInutNFe_spec.rb +21 -0
- data/spec/nfe/models/recipient/dest_spec.rb +152 -0
- data/spec/nfe/models/referenced/NFref_spec.rb +102 -0
- data/spec/nfe/models/referenced/refECF_spec.rb +59 -0
- data/spec/nfe/models/referenced/refNFP_spec.rb +115 -0
- data/spec/nfe/models/referenced/refNF_spec.rb +82 -0
- data/spec/nfe/models/shared_examples_for_tdec_0302.rb +35 -0
- data/spec/nfe/models/shared_examples_for_tdec_0803.rb +21 -0
- data/spec/nfe/models/shared_examples_for_tdec_1104.rb +38 -0
- data/spec/nfe/models/shared_examples_for_tdec_1204.rb +34 -0
- data/spec/nfe/models/shared_examples_for_tdec_1302.rb +34 -0
- data/spec/nfe/models/signature_spec.rb +56 -0
- data/spec/nfe/models/taxes/ICMS00_spec.rb +27 -0
- data/spec/nfe/models/taxes/ICMS101_spec.rb +21 -0
- data/spec/nfe/models/taxes/ICMS102_spec.rb +15 -0
- data/spec/nfe/models/taxes/ICMS103_spec.rb +15 -0
- data/spec/nfe/models/taxes/ICMS10_spec.rb +83 -0
- data/spec/nfe/models/taxes/ICMS201_spec.rb +67 -0
- data/spec/nfe/models/taxes/ICMS202_spec.rb +61 -0
- data/spec/nfe/models/taxes/ICMS203_spec.rb +61 -0
- data/spec/nfe/models/taxes/ICMS20_spec.rb +30 -0
- data/spec/nfe/models/taxes/ICMS300_spec.rb +16 -0
- data/spec/nfe/models/taxes/ICMS30_spec.rb +67 -0
- data/spec/nfe/models/taxes/ICMS400_spec.rb +15 -0
- data/spec/nfe/models/taxes/ICMS40_spec.rb +51 -0
- data/spec/nfe/models/taxes/ICMS41_spec.rb +51 -0
- data/spec/nfe/models/taxes/ICMS500_spec.rb +46 -0
- data/spec/nfe/models/taxes/ICMS50_spec.rb +51 -0
- data/spec/nfe/models/taxes/ICMS51_spec.rb +55 -0
- data/spec/nfe/models/taxes/ICMS60_spec.rb +52 -0
- data/spec/nfe/models/taxes/ICMS70_spec.rb +84 -0
- data/spec/nfe/models/taxes/ICMS900_spec.rb +80 -0
- data/spec/nfe/models/taxes/ICMS90_spec.rb +83 -0
- data/spec/nfe/models/taxes/ICMSPart_spec.rb +141 -0
- data/spec/nfe/models/taxes/ICMSST_spec.rb +60 -0
- data/spec/nfe/models/taxes/ICMSTot_spec.rb +119 -0
- data/spec/nfe/models/taxes/ICMS_spec.rb +159 -0
- data/spec/nfe/models/taxes/II_spec.rb +58 -0
- data/spec/nfe/models/taxes/IPINT_spec.rb +39 -0
- data/spec/nfe/models/taxes/IPITrib_spec.rb +55 -0
- data/spec/nfe/models/taxes/IPI_spec.rb +128 -0
- data/spec/nfe/models/taxes/ISSQN_spec.rb +62 -0
- data/spec/nfe/models/taxes/ISSQNtot_spec.rb +72 -0
- data/spec/nfe/models/taxes/PISCOFINSAliq_spec.rb +22 -0
- data/spec/nfe/models/taxes/PISCOFINSNT_spec.rb +12 -0
- data/spec/nfe/models/taxes/PISCOFINSOutr_spec.rb +37 -0
- data/spec/nfe/models/taxes/PISCOFINSQtde_spec.rb +21 -0
- data/spec/nfe/models/taxes/PISCOFINSST_spec.rb +60 -0
- data/spec/nfe/models/taxes/PISCOFINS_spec.rb +68 -0
- data/spec/nfe/models/taxes/imposto_spec.rb +159 -0
- data/spec/nfe/models/taxes/retTrib_spec.rb +78 -0
- data/spec/nfe/models/taxes/shared_examples_for_COFINSAliq.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_COFINSNT.rb +35 -0
- data/spec/nfe/models/taxes/shared_examples_for_COFINSOutr.rb +119 -0
- data/spec/nfe/models/taxes/shared_examples_for_COFINSQtde.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS00.rb +45 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS10.rb +57 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS101.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS102.rb +37 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS103.rb +37 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS20.rb +47 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS201.rb +53 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS202.rb +49 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS203.rb +49 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS30.rb +49 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS300.rb +37 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS40.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS400.rb +37 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS41.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS50.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS500.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS51.rb +47 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS60.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS70.rb +59 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS90.rb +59 -0
- data/spec/nfe/models/taxes/shared_examples_for_ICMS900.rb +63 -0
- data/spec/nfe/models/taxes/shared_examples_for_PISAliq.rb +41 -0
- data/spec/nfe/models/taxes/shared_examples_for_PISNT.rb +35 -0
- data/spec/nfe/models/taxes/shared_examples_for_PISOutr.rb +119 -0
- data/spec/nfe/models/taxes/shared_examples_for_PISQtde.rb +41 -0
- data/spec/nfe/models/total_spec.rb +144 -0
- data/spec/nfe/models/transport/lacres_spec.rb +35 -0
- data/spec/nfe/models/transport/retTransp_spec.rb +69 -0
- data/spec/nfe/models/transport/transp_spec.rb +149 -0
- data/spec/nfe/models/transport/transporta_spec.rb +128 -0
- data/spec/nfe/models/transport/veicTranspReboque_spec.rb +83 -0
- data/spec/nfe/models/transport/vol_spec.rb +97 -0
- data/spec/nfe/operations/consult_emitter_spec.rb +31 -0
- data/spec/nfe/operations/correction_letter_spec.rb +198 -0
- data/spec/nfe/operations/nfe_cancel_spec.rb +223 -0
- data/spec/nfe/operations/nfe_discard_spec.rb +172 -0
- data/spec/nfe/operations/nfe_send_spec.rb +220 -0
- data/spec/nfe/operations/nfe_situation_spec.rb +14 -0
- data/spec/nfe/operations/service_status_spec.rb +11 -0
- data/spec/nfe/operations/shared_examples_for_operations.rb +84 -0
- data/spec/nfe/services/dispatch/consCad_spec.rb +80 -0
- data/spec/nfe/services/dispatch/consSitNFe_spec.rb +29 -0
- data/spec/nfe/services/dispatch/consStatServ_spec.rb +25 -0
- data/spec/nfe/services/dispatch/detEventoCC_spec.rb +45 -0
- data/spec/nfe/services/dispatch/detEventoCancel_spec.rb +39 -0
- data/spec/nfe/services/dispatch/envEvento_spec.rb +33 -0
- data/spec/nfe/services/dispatch/enviNFe_spec.rb +27 -0
- data/spec/nfe/services/dispatch/inutNFe_spec.rb +51 -0
- data/spec/nfe/services/regress/infCad_spec.rb +61 -0
- data/spec/nfe/services/regress/protNFe_spec.rb +56 -0
- data/spec/nfe/services/regress/retConsCad_spec.rb +67 -0
- data/spec/nfe/services/regress/retConsSitNFe_spec.rb +46 -0
- data/spec/nfe/services/regress/retConsStatServ_spec.rb +34 -0
- data/spec/nfe/services/regress/retEnvEvento_spec.rb +44 -0
- data/spec/nfe/services/regress/retEnviNFe_spec.rb +44 -0
- data/spec/nfe/services/regress/retEvento_spec.rb +66 -0
- data/spec/nfe/services/regress/retInutNFe_spec.rb +70 -0
- data/spec/nfe/webservices/client_soap_spec.rb +32 -0
- data/spec/nfe/webservices/fixtures/nfe_status_servico2.wsdl +62 -0
- data/spec/nfe/webservices/fixtures/retConsCad.xml +1 -0
- data/spec/nfe/webservices/fixtures/retConsSitNFe.xml +1 -0
- data/spec/nfe/webservices/fixtures/retConsStatServ.xml +1 -0
- data/spec/nfe/webservices/fixtures/retEnvEventoCancNFe.xml +1 -0
- data/spec/nfe/webservices/fixtures/retEnviNFe.xml +1 -0
- data/spec/nfe/webservices/fixtures/retInutNFe.xml +1 -0
- data/spec/nfe/webservices/sender_spec.rb +65 -0
- data/spec/nfe/webservices/wsinfo/consult_emitter_spec.rb +37 -0
- data/spec/nfe/webservices/wsinfo/event_spec.rb +50 -0
- data/spec/nfe/webservices/wsinfo/factory_spec.rb +50 -0
- data/spec/nfe/webservices/wsinfo/nfe_disenable_spec.rb +37 -0
- data/spec/nfe/webservices/wsinfo/nfe_send_spec.rb +37 -0
- data/spec/nfe/webservices/wsinfo/nfe_situation_spec.rb +37 -0
- data/spec/nfe/webservices/wsinfo/production/am_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/ba_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/ce_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/go_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/mg_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/ms_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/mt_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/pe_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/pr_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/rs_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/sp_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/production/svan_spec.rb +26 -0
- data/spec/nfe/webservices/wsinfo/production/svrs_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/service_status_spec.rb +37 -0
- data/spec/nfe/webservices/wsinfo/shared_examples_for_wsdl.rb +39 -0
- data/spec/nfe/webservices/wsinfo/test/am_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/ba_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/ce_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/go_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/mg_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/ms_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/mt_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/pe_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/pr_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/rs_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/sp_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/test/svan_spec.rb +26 -0
- data/spec/nfe/webservices/wsinfo/test/svrs_spec.rb +21 -0
- data/spec/nfe/webservices/wsinfo/wsdl_finder_spec.rb +56 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/utilities.rb +3 -0
- data/spec/xmldsig/canonicalizer_spec.rb +43 -0
- data/spec/xmldsig/enveloped_signature_spec.rb +19 -0
- data/spec/xmldsig/fixtures/certificate.cer +16 -0
- data/spec/xmldsig/fixtures/certificate2.cer +16 -0
- data/spec/xmldsig/fixtures/key.pem +15 -0
- data/spec/xmldsig/fixtures/signed.xml +23 -0
- data/spec/xmldsig/fixtures/unsigned.xml +26 -0
- data/spec/xmldsig/fixtures/unsigned_multiple_references.xml +43 -0
- data/spec/xmldsig/fixtures/unsigned_nested_signature.xml +50 -0
- data/spec/xmldsig/reference_spec.rb +62 -0
- data/spec/xmldsig/signature_spec.rb +119 -0
- data/spec/xmldsig/signed_document_spec.rb +97 -0
- metadata +1201 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "../shared_examples_for_tdec_1302"
|
3
|
+
|
4
|
+
describe Nfe::Models::Taxes::ICMSST do
|
5
|
+
subject { build(:icmsST) }
|
6
|
+
|
7
|
+
it "has a valid factory" do
|
8
|
+
expect(subject).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it { is_expected.to validate_presence_of :orig }
|
12
|
+
it { is_expected.to validate_numericality_of(:orig) }
|
13
|
+
it { is_expected.to validate_inclusion_of(:orig).in_array([0, 1, 2]) }
|
14
|
+
|
15
|
+
it { is_expected.to respond_to "cst" }
|
16
|
+
|
17
|
+
describe "#CST" do
|
18
|
+
it "returns always 41" do
|
19
|
+
expect(subject.cst).to eql "41"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it_should_behave_like "a numeric TDec_1302 field", :vBCSTRet
|
24
|
+
it_should_behave_like "a numeric TDec_1302 field", :vICMSSTRet
|
25
|
+
it_should_behave_like "a numeric TDec_1302 field", :vBCSTDest
|
26
|
+
it_should_behave_like "a numeric TDec_1302 field", :vICMSSTDest
|
27
|
+
|
28
|
+
context "when xml has all tags" do
|
29
|
+
let(:xml) do
|
30
|
+
xml = "<orig>2</orig>"
|
31
|
+
xml += "<CST>41</CST>"
|
32
|
+
xml += "<vBCSTRet>12345.67</vBCSTRet>"
|
33
|
+
xml += "<vICMSSTRet>23456.78</vICMSSTRet>"
|
34
|
+
xml += "<vBCSTDest>34567.89</vBCSTDest>"
|
35
|
+
xml += "<vICMSSTDest>45678.90</vICMSSTDest>"
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#to_xml" do
|
39
|
+
it "returns a formatted xml" do
|
40
|
+
expect(subject.to_xml).to eql xml
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#parse!" do
|
45
|
+
subject { Nfe::Models::Taxes::ICMSST.new }
|
46
|
+
before { subject.parse!("<root>#{xml}</root>") }
|
47
|
+
|
48
|
+
it "parses xml values to itself" do
|
49
|
+
expect(subject.orig).to eql 2
|
50
|
+
expect(subject.cst).to eql "41"
|
51
|
+
expect(subject.vBCSTRet).to eql 12345.67
|
52
|
+
expect(subject.vICMSSTRet).to eql 23456.78
|
53
|
+
expect(subject.vBCSTDest).to eql 34567.89
|
54
|
+
expect(subject.vICMSSTDest).to eql 45678.90
|
55
|
+
end
|
56
|
+
|
57
|
+
it { is_expected.to be_valid }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "../shared_examples_for_tdec_1302"
|
3
|
+
|
4
|
+
describe Nfe::Models::Taxes::ICMSTot do
|
5
|
+
subject { build :icmsTot }
|
6
|
+
|
7
|
+
it "has a valid factory" do
|
8
|
+
expect(subject).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it_should_behave_like "a numeric TDec_1302 field", :vBC
|
12
|
+
it_should_behave_like "a numeric TDec_1302 field", :vICMS
|
13
|
+
it_should_behave_like "a numeric TDec_1302 field", :vICMSDeson
|
14
|
+
it_should_behave_like "a numeric TDec_1302 field", :vBCST
|
15
|
+
it_should_behave_like "a numeric TDec_1302 field", :vST
|
16
|
+
it_should_behave_like "a numeric TDec_1302 field", :vProd
|
17
|
+
it_should_behave_like "a numeric TDec_1302 field", :vFrete
|
18
|
+
it_should_behave_like "a numeric TDec_1302 field", :vSeg
|
19
|
+
it_should_behave_like "a numeric TDec_1302 field", :vDesc
|
20
|
+
it_should_behave_like "a numeric TDec_1302 field", :vII
|
21
|
+
it_should_behave_like "a numeric TDec_1302 field", :vIPI
|
22
|
+
it_should_behave_like "a numeric TDec_1302 field", :vPIS
|
23
|
+
it_should_behave_like "a numeric TDec_1302 field", :vCOFINS
|
24
|
+
it_should_behave_like "a numeric TDec_1302 field", :vOutro
|
25
|
+
it_should_behave_like "a numeric TDec_1302 field", :vNF
|
26
|
+
it_should_behave_like "a numeric TDec_1302Opc field", :vTotTrib
|
27
|
+
|
28
|
+
context "when xml has all tags" do
|
29
|
+
let(:xml) do
|
30
|
+
xml = "<vBC>12345.67</vBC>"
|
31
|
+
xml += "<vICMS>23456.78</vICMS>"
|
32
|
+
xml += "<vICMSDeson>23456.78</vICMSDeson>"
|
33
|
+
xml += "<vBCST>34567.89</vBCST>"
|
34
|
+
xml += "<vST>45678.90</vST>"
|
35
|
+
xml += "<vProd>12345.67</vProd>"
|
36
|
+
xml += "<vFrete>23456.78</vFrete>"
|
37
|
+
xml += "<vSeg>34567.89</vSeg>"
|
38
|
+
xml += "<vDesc>45678.90</vDesc>"
|
39
|
+
xml += "<vII>91234.56</vII>"
|
40
|
+
xml += "<vIPI>78901.23</vIPI>"
|
41
|
+
xml += "<vPIS>45678.90</vPIS>"
|
42
|
+
xml += "<vCOFINS>89123.45</vCOFINS>"
|
43
|
+
xml += "<vOutro>67890.12</vOutro>"
|
44
|
+
xml += "<vNF>34567.89</vNF>"
|
45
|
+
xml += "<vTotTrib>100.45</vTotTrib>"
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#to_xml" do
|
49
|
+
it "returns a formatted xml" do
|
50
|
+
expect(subject.to_xml).to eql xml
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#parse!" do
|
55
|
+
subject { described_class.new }
|
56
|
+
before { subject.parse!("<root>#{xml}</root>") }
|
57
|
+
|
58
|
+
it "parses xml values to itself" do
|
59
|
+
expect(subject.vBC).to eql 12345.67
|
60
|
+
expect(subject.vICMS).to eql 23456.78
|
61
|
+
expect(subject.vICMSDeson).to eql 23456.78
|
62
|
+
expect(subject.vBCST).to eql 34567.89
|
63
|
+
expect(subject.vST).to eql 45678.90
|
64
|
+
expect(subject.vProd).to eql 12345.67
|
65
|
+
expect(subject.vFrete).to eql 23456.78
|
66
|
+
expect(subject.vSeg).to eql 34567.89
|
67
|
+
expect(subject.vDesc).to eql 45678.90
|
68
|
+
expect(subject.vII).to eql 91234.56
|
69
|
+
expect(subject.vIPI).to eql 78901.23
|
70
|
+
expect(subject.vPIS).to eql 45678.90
|
71
|
+
expect(subject.vCOFINS).to eql 89123.45
|
72
|
+
expect(subject.vOutro).to eql 67890.12
|
73
|
+
expect(subject.vNF).to eql 34567.89
|
74
|
+
expect(subject.vTotTrib).to eql 100.45
|
75
|
+
end
|
76
|
+
|
77
|
+
it { is_expected.to be_valid }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "when xml doesn't have optional tags" do
|
82
|
+
let(:xml) do
|
83
|
+
xml = "<vBC>12345.67</vBC>"
|
84
|
+
xml += "<vICMS>23456.78</vICMS>"
|
85
|
+
xml += "<vICMSDeson>23456.78</vICMSDeson>"
|
86
|
+
xml += "<vBCST>34567.89</vBCST>"
|
87
|
+
xml += "<vST>45678.90</vST>"
|
88
|
+
xml += "<vProd>12345.67</vProd>"
|
89
|
+
xml += "<vFrete>23456.78</vFrete>"
|
90
|
+
xml += "<vSeg>34567.89</vSeg>"
|
91
|
+
xml += "<vDesc>45678.90</vDesc>"
|
92
|
+
xml += "<vII>91234.56</vII>"
|
93
|
+
xml += "<vIPI>78901.23</vIPI>"
|
94
|
+
xml += "<vPIS>45678.90</vPIS>"
|
95
|
+
xml += "<vCOFINS>89123.45</vCOFINS>"
|
96
|
+
xml += "<vOutro>67890.12</vOutro>"
|
97
|
+
xml += "<vNF>34567.89</vNF>"
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "#to_xml" do
|
101
|
+
subject { build :icmsTot, vTotTrib: nil }
|
102
|
+
|
103
|
+
it "returns a formatted xml" do
|
104
|
+
expect(subject.to_xml).to eql xml
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "#parse!" do
|
109
|
+
subject { described_class.new }
|
110
|
+
before { subject.parse!("<root>#{xml}</root>") }
|
111
|
+
|
112
|
+
it "parses xml values to itself" do
|
113
|
+
expect(subject.vTotTrib).to be_blank
|
114
|
+
end
|
115
|
+
|
116
|
+
it { is_expected.to be_valid }
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "shared_examples_for_ICMS00"
|
3
|
+
require_relative "shared_examples_for_ICMS10"
|
4
|
+
require_relative "shared_examples_for_ICMS20"
|
5
|
+
require_relative "shared_examples_for_ICMS30"
|
6
|
+
require_relative "shared_examples_for_ICMS40"
|
7
|
+
require_relative "shared_examples_for_ICMS41"
|
8
|
+
require_relative "shared_examples_for_ICMS50"
|
9
|
+
require_relative "shared_examples_for_ICMS51"
|
10
|
+
require_relative "shared_examples_for_ICMS60"
|
11
|
+
require_relative "shared_examples_for_ICMS70"
|
12
|
+
require_relative "shared_examples_for_ICMS90"
|
13
|
+
require_relative "shared_examples_for_ICMS101"
|
14
|
+
require_relative "shared_examples_for_ICMS102"
|
15
|
+
require_relative "shared_examples_for_ICMS103"
|
16
|
+
require_relative "shared_examples_for_ICMS300"
|
17
|
+
require_relative "shared_examples_for_ICMS400"
|
18
|
+
require_relative "shared_examples_for_ICMS201"
|
19
|
+
require_relative "shared_examples_for_ICMS202"
|
20
|
+
require_relative "shared_examples_for_ICMS203"
|
21
|
+
require_relative "shared_examples_for_ICMS500"
|
22
|
+
require_relative "shared_examples_for_ICMS900"
|
23
|
+
|
24
|
+
describe Nfe::Models::Taxes::ICMS do
|
25
|
+
describe "#present?" do
|
26
|
+
subject { Nfe::Models::Taxes::ICMS.new }
|
27
|
+
|
28
|
+
context "when any attribute is present" do
|
29
|
+
it { is_expected.to_not be_present }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when some attribute is present" do
|
33
|
+
before { subject.cst = 10 }
|
34
|
+
|
35
|
+
it { is_expected.to be_present }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#CSOSN" do
|
40
|
+
it "is an alias to CST" do
|
41
|
+
subject.csosn = 51
|
42
|
+
subject.cst = 10
|
43
|
+
expect(subject.csosn).to eq subject.cst
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#CSOSN=" do
|
48
|
+
it "is an alias to CST=" do
|
49
|
+
subject.cst = 51
|
50
|
+
subject.csosn = 10
|
51
|
+
expect(subject.cst).to eq subject.csosn
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "when ICMS00" do
|
56
|
+
it_should_behave_like "a ICMS00", :icms_when_ICMS00, :ICMS00,
|
57
|
+
Nfe::Models::Taxes::ICMS.new
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when ICMS10" do
|
61
|
+
it_should_behave_like "a ICMS10", :icms_when_ICMS10, :ICMS10,
|
62
|
+
Nfe::Models::Taxes::ICMS.new
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when ICMS20" do
|
66
|
+
it_should_behave_like "a ICMS20", :icms_when_ICMS20, :ICMS20,
|
67
|
+
Nfe::Models::Taxes::ICMS.new
|
68
|
+
end
|
69
|
+
|
70
|
+
context "when ICMS30" do
|
71
|
+
it_should_behave_like "a ICMS30", :icms_when_ICMS30, :ICMS30,
|
72
|
+
Nfe::Models::Taxes::ICMS.new
|
73
|
+
end
|
74
|
+
|
75
|
+
context "when ICMS40" do
|
76
|
+
it_should_behave_like "a ICMS40", :icms_when_ICMS40, :ICMS40,
|
77
|
+
Nfe::Models::Taxes::ICMS.new
|
78
|
+
end
|
79
|
+
|
80
|
+
context "when ICMS41" do
|
81
|
+
it_should_behave_like "a ICMS41", :icms_when_ICMS41, :ICMS40,
|
82
|
+
Nfe::Models::Taxes::ICMS.new
|
83
|
+
end
|
84
|
+
|
85
|
+
context "when ICMS50" do
|
86
|
+
it_should_behave_like "a ICMS50", :icms_when_ICMS50, :ICMS40,
|
87
|
+
Nfe::Models::Taxes::ICMS.new
|
88
|
+
end
|
89
|
+
|
90
|
+
context "when ICMS51" do
|
91
|
+
it_should_behave_like "a ICMS51", :icms_when_ICMS51, :ICMS51,
|
92
|
+
Nfe::Models::Taxes::ICMS.new
|
93
|
+
end
|
94
|
+
|
95
|
+
context "when ICMS60" do
|
96
|
+
it_should_behave_like "a ICMS60", :icms_when_ICMS60, :ICMS60,
|
97
|
+
Nfe::Models::Taxes::ICMS.new
|
98
|
+
end
|
99
|
+
|
100
|
+
context "when ICMS70" do
|
101
|
+
it_should_behave_like "a ICMS70", :icms_when_ICMS70, :ICMS70,
|
102
|
+
Nfe::Models::Taxes::ICMS.new
|
103
|
+
end
|
104
|
+
|
105
|
+
context "when ICMS90" do
|
106
|
+
it_should_behave_like "a ICMS90", :icms_when_ICMS90, :ICMS90,
|
107
|
+
Nfe::Models::Taxes::ICMS.new
|
108
|
+
end
|
109
|
+
|
110
|
+
context "when ICMS101" do
|
111
|
+
it_should_behave_like "a ICMS101", :icms_when_ICMS101, :ICMSSN101,
|
112
|
+
Nfe::Models::Taxes::ICMS.new
|
113
|
+
end
|
114
|
+
|
115
|
+
context "when ICMS102" do
|
116
|
+
it_should_behave_like "a ICMS102", :icms_when_ICMS102, :ICMSSN102,
|
117
|
+
Nfe::Models::Taxes::ICMS.new
|
118
|
+
end
|
119
|
+
|
120
|
+
context "when ICMS103" do
|
121
|
+
it_should_behave_like "a ICMS103", :icms_when_ICMS103, :ICMSSN102,
|
122
|
+
Nfe::Models::Taxes::ICMS.new
|
123
|
+
end
|
124
|
+
|
125
|
+
context "when ICMS300" do
|
126
|
+
it_should_behave_like "a ICMS300", :icms_when_ICMS300, :ICMSSN102,
|
127
|
+
Nfe::Models::Taxes::ICMS.new
|
128
|
+
end
|
129
|
+
|
130
|
+
context "when ICMS400" do
|
131
|
+
it_should_behave_like "a ICMS400", :icms_when_ICMS400, :ICMSSN102,
|
132
|
+
Nfe::Models::Taxes::ICMS.new
|
133
|
+
end
|
134
|
+
|
135
|
+
context "when ICMS201" do
|
136
|
+
it_should_behave_like "a ICMS201", :icms_when_ICMS201, :ICMSSN201,
|
137
|
+
Nfe::Models::Taxes::ICMS.new
|
138
|
+
end
|
139
|
+
|
140
|
+
context "when ICMS202" do
|
141
|
+
it_should_behave_like "a ICMS202", :icms_when_ICMS202, :ICMSSN202,
|
142
|
+
Nfe::Models::Taxes::ICMS.new
|
143
|
+
end
|
144
|
+
|
145
|
+
context "when ICMS203" do
|
146
|
+
it_should_behave_like "a ICMS203", :icms_when_ICMS203, :ICMSSN202,
|
147
|
+
Nfe::Models::Taxes::ICMS.new
|
148
|
+
end
|
149
|
+
|
150
|
+
context "when ICMS500" do
|
151
|
+
it_should_behave_like "a ICMS500", :icms_when_ICMS500, :ICMSSN500,
|
152
|
+
Nfe::Models::Taxes::ICMS.new
|
153
|
+
end
|
154
|
+
|
155
|
+
context "when ICMS900" do
|
156
|
+
it_should_behave_like "a ICMS900", :icms_when_ICMS900, :ICMSSN900,
|
157
|
+
Nfe::Models::Taxes::ICMS.new
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "../shared_examples_for_tdec_1302"
|
3
|
+
|
4
|
+
describe Nfe::Models::Taxes::II do
|
5
|
+
subject { build(:ii) }
|
6
|
+
|
7
|
+
it "has a valid factory" do
|
8
|
+
expect(subject).to be_valid
|
9
|
+
end
|
10
|
+
|
11
|
+
it_should_behave_like "a numeric TDec_1302 field", :vBC
|
12
|
+
it_should_behave_like "a numeric TDec_1302 field", :vDespAdu
|
13
|
+
it_should_behave_like "a numeric TDec_1302 field", :vII
|
14
|
+
it_should_behave_like "a numeric TDec_1302 field", :vIOF
|
15
|
+
|
16
|
+
describe "#present?" do
|
17
|
+
subject { Nfe::Models::Taxes::II.new }
|
18
|
+
|
19
|
+
context "when any attribute is present" do
|
20
|
+
it { is_expected.to_not be_present }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when some attribute is present" do
|
24
|
+
before { subject.vBC = 1 }
|
25
|
+
|
26
|
+
it { is_expected.to be_present }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "when xml has all tags" do
|
31
|
+
let(:xml) do
|
32
|
+
xml = "<vBC>12345.67</vBC>"
|
33
|
+
xml += "<vDespAdu>23456.78</vDespAdu>"
|
34
|
+
xml += "<vII>34567.89</vII>"
|
35
|
+
xml += "<vIOF>45678.90</vIOF>"
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#to_xml" do
|
39
|
+
it "returns a formatted xml" do
|
40
|
+
expect(subject.to_xml).to eql xml
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#parse!" do
|
45
|
+
subject { Nfe::Models::Taxes::II.new }
|
46
|
+
before { subject.parse!("<root>#{xml}</root>") }
|
47
|
+
|
48
|
+
it "parses xml values to itself" do
|
49
|
+
expect(subject.vBC).to eql 12345.67
|
50
|
+
expect(subject.vDespAdu).to eql 23456.78
|
51
|
+
expect(subject.vII).to eql 34567.89
|
52
|
+
expect(subject.vIOF).to eql 45678.90
|
53
|
+
end
|
54
|
+
|
55
|
+
it { is_expected.to be_valid }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Nfe::Models::Taxes::IPINT do
|
4
|
+
subject { build(:ipiNT) }
|
5
|
+
|
6
|
+
it "has a valid factory" do
|
7
|
+
expect(subject).to be_valid
|
8
|
+
end
|
9
|
+
|
10
|
+
it { is_expected.to validate_presence_of(:cst) }
|
11
|
+
|
12
|
+
it do
|
13
|
+
is_expected.to validate_inclusion_of(:cst).in_array(["01", "02", "03", "04", "05",
|
14
|
+
"51", "52", "53", "54", "55"])
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when xml has all tags" do
|
18
|
+
let(:xml) do
|
19
|
+
xml = "<CST>01</CST>"
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#to_xml" do
|
23
|
+
it "returns a formatted xml" do
|
24
|
+
expect(subject.to_xml).to eql xml
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#parse!" do
|
29
|
+
subject { Nfe::Models::Taxes::IPINT.new }
|
30
|
+
before { subject.parse!("<root>#{xml}</root>") }
|
31
|
+
|
32
|
+
it "parses xml values to itself" do
|
33
|
+
expect(subject.cst).to eql "01"
|
34
|
+
end
|
35
|
+
|
36
|
+
it { is_expected.to be_valid }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require_relative "../shared_examples_for_tdec_1302"
|
3
|
+
require_relative "../shared_examples_for_tdec_1204"
|
4
|
+
require_relative "../shared_examples_for_tdec_1104"
|
5
|
+
require_relative "../shared_examples_for_tdec_0302"
|
6
|
+
|
7
|
+
describe Nfe::Models::Taxes::IPITrib do
|
8
|
+
subject { build(:ipiTrib) }
|
9
|
+
|
10
|
+
it "has a valid factory" do
|
11
|
+
expect(subject).to be_valid
|
12
|
+
end
|
13
|
+
|
14
|
+
it { is_expected.to validate_presence_of(:cst) }
|
15
|
+
it { is_expected.to validate_inclusion_of(:cst).in_array(["00", "49", "50", "99"]) }
|
16
|
+
|
17
|
+
it_should_behave_like "a numeric TDec_1302 field", :vBC
|
18
|
+
it_should_behave_like "a numeric TDec_0302 field", :pIPI
|
19
|
+
it_should_behave_like "a numeric TDec_1204 field", :qUnid
|
20
|
+
it_should_behave_like "a numeric TDec_1104v field", :vUnid
|
21
|
+
it_should_behave_like "a numeric TDec_1302 field", :vIPI
|
22
|
+
|
23
|
+
context "when xml has all tags" do
|
24
|
+
let(:xml) do
|
25
|
+
xml = "<CST>50</CST>"
|
26
|
+
xml += "<vBC>12345.67</vBC>"
|
27
|
+
xml += "<pIPI>988.76</pIPI>"
|
28
|
+
xml += "<qUnid>123.6600</qUnid>"
|
29
|
+
xml += "<vUnid>78.6500</vUnid>"
|
30
|
+
xml += "<vIPI>23456.78</vIPI>"
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#to_xml" do
|
34
|
+
it "returns a formatted xml" do
|
35
|
+
expect(subject.to_xml).to eql xml
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#parse!" do
|
40
|
+
subject { Nfe::Models::Taxes::IPITrib.new }
|
41
|
+
before { subject.parse!("<root>#{xml}</root>") }
|
42
|
+
|
43
|
+
it "parses xml values to itself" do
|
44
|
+
expect(subject.cst).to eql "50"
|
45
|
+
expect(subject.vBC).to eql 12345.67
|
46
|
+
expect(subject.pIPI).to eql 988.76
|
47
|
+
expect(subject.qUnid).to eql 123.6600
|
48
|
+
expect(subject.vUnid).to eql 78.6500
|
49
|
+
expect(subject.vIPI).to eql 23456.78
|
50
|
+
end
|
51
|
+
|
52
|
+
it { is_expected.to be_valid }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|