-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
intial SOAP support for NF-e #121
Open
rvalyi
wants to merge
38
commits into
master
Choose a base branch
from
soap2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #121 +/- ##
==========================================
- Coverage 91.40% 86.76% -4.65%
==========================================
Files 7 10 +3
Lines 291 423 +132
Branches 30 34 +4
==========================================
+ Hits 266 367 +101
- Misses 13 41 +28
- Partials 12 15 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
18f752a
to
3943749
Compare
60fc0ab
to
ea840e8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suporte inicial para transmissão SOAP dos documentos fiscais.
Isso é a inclusão na lib nfelib de um cliente SOAP para NFe que eu tinha prototipado 1 ano atras e compartilhado com algumas pessoas esclarecidas da comunidade Odoo no Brasil:
https://github.com/akretion/nfelib-client/tree/poc/nfelib_client/nfe
O cliente SOAP é derivado do cliente SOAP do xsdata e extendido com esse cliente genérico pro Brazil que usa requests com certificados pkcs12 para a criptografia:
https://github.com/akretion/brazil-fiscal-client
Se for comparar com a lib legacy erpbrasil.transmissao (usado pelo erpbrasil.edoc) por exemplo, o brazil-fiscal-client poupa a dependencia com a biblioteca Zeep.
(Ainda vale a pena dizer que o cliente SOAP do xsdata (que ja era dependencia da nfelib) extende bem pouco o transport requests e que na pior a gente poderia usar o requests direitamente caso houver algum problema de manutenço no xsdata).
Pode parecer um PR super grande, mas não é; pois continua na filosofia da nfelib de gerir o código o mais possível em vez de botar estagiários para mijar código assim como algumas alternativas estão fazendo por ai e onde a manutenção vai pro espaço depois como era de se prever.
basicamente para todos documentos fiscais NFe, CTe, MDFe... temos um scraper dos servidores da Fazendo. Por exemplo para a NFe:
Isso nos da a lista de servidores para usar nos clientes, no caso da NFe:
https://github.com/akretion/nfelib/pull/121/files#diff-558879768f0a497e61c99a412ee8785adde21b8540f470472f59eeb7e4ce659c
Ainda rodamos esse teste https://github.com/akretion/nfelib/pull/121/files#diff-ccfcf01d6e17f599dcc91d18dd0722a27e4c44a70da9aa3caa97667879c0d1ce que vai verificar se a lista ou o endereço de algum servidor mudou e assim dar um toque para publicar uma nova release e atualizar o sistemas que usam a lib em produção.
Da mesma forma temos esse downloader de WSDL:
https://github.com/akretion/nfelib/blob/6333c507eee8d84250487866296f0b39347e4988/nfelib/utils/wsdl_downloader.py
Esse downloader ja precisa assinar os requests com algum certificado valido.
Para a NFe por exemplo ele baixa os WSDLs aqui:
https://github.com/akretion/nfelib/tree/6333c507eee8d84250487866296f0b39347e4988/nfelib/nfe/wsdl/v4_0
Quando usado com a opção --generate, o wsdl_downloader também gera os bindings SOAP correspondentes, no caso da NFe por exemplo:
https://github.com/akretion/nfelib/tree/6333c507eee8d84250487866296f0b39347e4988/nfelib/nfe/soap/v4_0
Depois é so usar no cliente SOAP, como no caso da NFe:
https://github.com/akretion/nfelib/blob/6333c507eee8d84250487866296f0b39347e4988/nfelib/nfe/client/v4_0/__init__.py (WORK IN PROGRESS)