Add Canada VAT rules with province-specific rates#10
Add Canada VAT rules with province-specific rates#10johngathure wants to merge 9 commits intomasterfrom
Conversation
Implements CaVatRules class to support Canadian GST/HST/PST rates for all provinces and territories. The first letter of the postal code determines the region and corresponding tax rate (5%-15%). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
⏯️ Merge only after knowing the exact Canadian tax values and follow steps above. Putting as QA done. QA will be done with Monies. |
|
@johngathure Mathieu updated the issue description with the values depending on each Canada state.
⏯️ Make this PR in a ready state and wait for signal for release |
|
Hi @nicomollet 👋 I've made the changes to use the rates shared by Mathieu and added some tests. Whenever we are ready to QA, I will update monies to use the last commit on this pr, so it picks the newly updated Canadian VAT rates. |
nicomollet
left a comment
There was a problem hiding this comment.
Approved, let's move to QA in progress until more news in the issue
@johngathure Prepare a PR on Monies side (linked to this issue) matching this (unreleased) version of Pyvat. So that we can eventually deploy to staging for testing.
|
Add update the doc https://www.notion.so/wpmedia/VAT-Tax-rates-Exemption-for-all-countries-2beed22a22f080658719c05700236045 as post release actions please in the PR |
62b26d5 to
b46fdc3
Compare
Summary
Implements Canadian province-specific VAT rates (GST/HST/PST) based on postal code prefixes, addressing issue #9.
pyvat/vat_rules.py—CanadaVatRulesCanadaVatRulesclass extendingNonEuVatRuleswith full province-level rate logicPROVINCE_VAT_RATESmaps each postal code prefix (A–Y) to the correct combined rateget_vat_rate(item_type, postal_code)resolves rate from the first character of the postal codepyvat/region_rules.py—RegionRules/CanadaRegionRulesRegionRulesabstract base class to support future region-level rules for other countries (e.g. US states, Swiss cantons)CanadaRegionRulesexposesget_rate(postal_code)andget_region(postal_code)for consumers that need more than just a rateget_region()returns aProvinceRate(nestedNamedTuple) containing the prefix, province name, combined rate, and atax_typestuple (e.g.(HST,)or(GST, PST)) — useful for rendering invoice line items correctlyGST,HST,PST,QST,RST) are scoped toCanadaRegionRulessince they are Canada-specificCanadaRegionRulesreads directly fromCanadaVatRules.PROVINCE_VAT_RATESsetup.pypackageslist withfind_packages()so any future sub-packages are picked up automatically without touchingsetup.pyProvincial rate table
Test plan
get_sale_vat_chargeend-to-endgst_numberandpst_numberregistration numbers once available (post-release)Related Issues
Closes #9
🤖 Generated with Claude Code