Implement CRA line 22215 deduction for CPP/QPP enhanced contributions#274
Open
xrendan wants to merge 2 commits into
Open
Implement CRA line 22215 deduction for CPP/QPP enhanced contributions#274xrendan wants to merge 2 commits into
xrendan wants to merge 2 commits into
Conversation
Models the deduction for the enhanced portion of CPP/QPP first-tier contributions plus the entire CPP2/QPP2 contribution, applied against taxable income for federal and provincial brackets per CRA line 22215. Configs gain a `baseRate` (4.95% CPP, 5.40% QPP); the calculator computes the enhanced share proportionally to the contribution and reduces the income used for bracket calculations. The tax-visualizer surfaces the deduction inline with the federal or provincial card depending on which plan applies. https://claude.ai/code/session_01DTfhD3S8sQTsuY5ggEQs26
Dokploy Preview Deployment
|
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
canadaspends | 9434e4e | May 01 2026, 08:32 PM |
Restructure each tax card so the line 22215 CPP/QPP enhanced deduction is visualized as a reduction to taxable income — not as a credit against total tax owing. Each card now leads with a "Total Taxable Income" line, with the gross income and per-contribution deduction details collapsed behind an expandable <details> summary. The deduction is computed once in TaxDetails and shared with both the Federal and Provincial cards so their bracket calculations apply to the same taxable income. https://claude.ai/code/session_01DTfhD3S8sQTsuY5ggEQs26
This file contains hidden or 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
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.
Summary
This PR implements the CRA line 22215 deduction for enhanced CPP/QPP contributions, which reduces taxable income for both federal and provincial income tax calculations. The enhanced portion (rate above the pre-2019 base) and the entire second-tier contribution (CPP2/QPP2) are now properly deducted from income before applying tax brackets.
Key Changes
Tax Calculation Logic: Modified
calculateWithConfig()to compute the line 22215 deduction and apply it to taxable income before calculating federal and provincial income taxesincome - cppQppEnhancedDeductionfor bracket calculationsUI Components: Enhanced
IncomeTaxBracketsSectionto accept optional deduction parameters and display them clearlydeductionanddeductionLabelpropsConfiguration Updates: Added
baseRatefield toCappedContributionConfigacross all years (2023-2026)Type System: Extended
DetailedTaxCalculationandTaxLineItemto include the new deduction categoryTest Coverage: Added comprehensive test suite (
calculator.deduction.test.ts) validating:Implementation Details
The deduction is calculated as:
For provinces with their own pension plan (Quebec), the deduction appears at the provincial level. For other provinces using federal CPP, it appears at the federal level. Both reduce the taxable income used for bracket calculations, resulting in lower income tax liability.
https://claude.ai/code/session_01DTfhD3S8sQTsuY5ggEQs26