Skip to content

Keep significant zeros in the NFC-e CSC id - #465

Open
SashaMIT wants to merge 1 commit into
TadaSoftware:mainfrom
SashaMIT:codered-csc-id
Open

SashaMIT wants to merge 1 commit into
TadaSoftware:mainfrom
SashaMIT:codered-csc-id

Conversation

@SashaMIT

Copy link
Copy Markdown

Summary

The NFC-e QR builder removed every 0 from the CSC id. SEFAZ only drops zeros that are not significant (the ones on the left). Id 000100 was sent as 1, and the SHA-1 was taken over that wrong id, so the receipt QR does not match the token registered for that taxpayer. 000001 still becomes 1.

Test plan

  • tests/test_nfce_qrcode_csc.py: before this change the id came back as 1. After it, the parameter is 100 and the hash matches SHA-1 of that parameter plus the CSC.
  • 000001 still becomes 1.

Made with Cursor

SEFAZ drops only non-significant zeros. Removing every zero turned id 100 into 1, so the QR hash was for the wrong token.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant