Skip to content
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

Add initial Brazil NFSe addon #402

Merged
merged 5 commits into from
Oct 29, 2024
Merged

Add initial Brazil NFSe addon #402

merged 5 commits into from
Oct 29, 2024

Conversation

cavalle
Copy link
Contributor

@cavalle cavalle commented Oct 25, 2024

Describe your changes

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added thorough tests with at least 90% code coverage.
  • I've modified or created example GOBL documents the show my changes in use, if appropriate.
  • When adding or modifying a tax regime or addon, I've added links to the source of the changes either structured or in the comments.
  • I've run go generate . to ensure that Schemas and Regime data are up to date.
  • All linter warnings have been reviewed and fixed.
  • I've been obsessive with pointer nil checks to avoid panics.
  • The CHANGELOG.md has been updated with an overview of my changes.
  • Requested a review from @samlown.

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.97%. Comparing base (834477c) to head (e3f6a2a).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
addons/br/nfse/nfse.go 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #402      +/-   ##
==========================================
+ Coverage   78.88%   78.97%   +0.09%     
==========================================
  Files         217      221       +4     
  Lines       10722    10773      +51     
==========================================
+ Hits         8458     8508      +50     
- Misses       1909     1910       +1     
  Partials      355      355              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cavalle cavalle force-pushed the br-nfse-v1 branch 3 times, most recently from 5659155 to fefe7d5 Compare October 25, 2024 10:22
@cavalle cavalle marked this pull request as ready for review October 25, 2024 10:25
@cavalle cavalle requested a review from samlown October 25, 2024 10:25
Copy link
Collaborator

@samlown samlown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Some observations. Do the Charges and Discounts also need to be covered?


* https://www.planalto.gov.br/ccivil_03/leis/lcp/lcp116.htm
`),
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is possible to add a Pattern flag perhaps to validate the codes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose not to validate anything since every municipality can define their own list of codes without restrictions on the format. The list in LEI116 is commonly used, apparently, but there's no guarantee those will be the codes in the municipality.

}

return validation.Validate(line,
bill.RequireLineTaxCategory(br.TaxCategoryISS),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also need to be repeated for Discount and Charge and lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't think it makes sense to support either Charges or Discounts: it doesn't seem possible to map them to an NFSe. So, I've added validations to ensure those aren't present in 177eb69

addons/br/nfse/item_test.go Show resolved Hide resolved
@cavalle
Copy link
Contributor Author

cavalle commented Oct 25, 2024

@samlown Thanks for your feedback! I think I addressed all your points and made an additional change (derived from your feedback as well) that let me get to 98% coverage.

@cavalle cavalle merged commit 6812cfc into main Oct 29, 2024
7 checks passed
@cavalle cavalle deleted the br-nfse-v1 branch October 29, 2024 14:11
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.

2 participants