Skip to content

Implement CRA line 22215 deduction for CPP/QPP enhanced contributions#274

Open
xrendan wants to merge 2 commits into
mainfrom
claude/add-cpp-qpp-deduction-Pvqi0
Open

Implement CRA line 22215 deduction for CPP/QPP enhanced contributions#274
xrendan wants to merge 2 commits into
mainfrom
claude/add-cpp-qpp-deduction-Pvqi0

Conversation

@xrendan
Copy link
Copy Markdown
Member

@xrendan xrendan commented May 1, 2026

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 taxes

    • Deduction is attributed to the appropriate level (federal for CPP, provincial for QPP)
    • Taxable income is now income - cppQppEnhancedDeduction for bracket calculations
  • UI Components: Enhanced IncomeTaxBracketsSection to accept optional deduction parameters and display them clearly

    • Added deduction and deductionLabel props
    • Shows a note explaining how taxable income is calculated when deductions apply
    • Displays detailed breakdown of CPP/CPP2 and QPP/QPP2 enhanced deductions in separate sections
  • Configuration Updates: Added baseRate field to CappedContributionConfig across all years (2023-2026)

    • CPP: baseRate of 4.95% (pre-2019 enhancement threshold)
    • QPP: baseRate of 5.40% (pre-2019 enhancement threshold)
  • Type System: Extended DetailedTaxCalculation and TaxLineItem to include the new deduction category

  • Test Coverage: Added comprehensive test suite (calculator.deduction.test.ts) validating:

    • Correct deduction calculation for both CPP and QPP scenarios
    • Proportional scaling for low-income earners
    • Proper attribution to federal vs. provincial levels
    • Impact on income tax reduction

Implementation Details

The deduction is calculated as:

  • Enhanced portion = CPP/QPP contribution × (enhanced rate / total rate)
  • Total deduction = enhanced portion + CPP2/QPP2 contribution (fully deductible)

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

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
@build-canada-deploy-bot
Copy link
Copy Markdown

build-canada-deploy-bot Bot commented May 1, 2026

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
nextjs ✅ Done Preview URL 2026-05-01T20:49:39.492Z

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 1, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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
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