Repository navigation
Conversation
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.
Overview
Closes #83, closes #84, closes #85
The goal is to generate the official tax receipt PDF given to donors, with the mandatory CRA mentions, and to make sure a receipt never changes once it is issued.
GET /api/receipts/{id}/pdfreturns the receipt on letter paper, in French with English, with the font embedded so accents print correctly. Long names and descriptions wrap, and long receipts continue on more pages with the table header repeated. An issued receipt is printed from its frozen data, a cancelled one with a "cancelled" banner, and a receipt not issued yet as a preview with no number.POST /api/receipts/{id}/replacecancels an issued receipt (it keeps its number) and creates a Draft replacement that references it. Once issued, the replacement's PDF states which receipt it cancels and replaces.20261204154702_AddReceiptIssueDetails: adds the new columns and fills them in for receipts already issued. The SQL script is0015_add_receipt_issue_details.sql, and the docs and diagrams are updated.For reviewers
*.Designer.csandMoissonDbContextModelSnapshot.cs.20261204154702_AddReceiptIssueDetails.cs.BackupTestData.sqlalso fixes a test-data bug already on develop (see Testing).Still to confirm with Moisson Montréal
ReceiptIssuersettings (legal name, address, registration number, signatory). They are empty for now, so issuing is refused until they are filled.Full details:
docs/receipts/tax-receipt-pdf.mdTesting
Automated tests: all 1,081 tests pass (
dotnet test, with Docker running for the integration tests).ReceiptPdfRendererTests: checks each CRA mention in the text extracted from the PDF. The expected wording is written separately in the test so a removed mention fails it. Also covers accents and special characters, letter size, embedded fonts, pagination with 120 lines, long text wrapping, cancelled and preview banners, and the replacement statement.ReceiptIssueCheckTests: each refusal reason and its message.ReceiptDocumentEndpointTests: end to end from a real price-grid calculation through approval, issue and PDF download; a donor change after issue doesn't change the PDF; refusals when data is missing; cancel and replace; permissions; the database triggers; and simultaneous replace requests.ReceiptIssueDetailsMigrationTests: receipts issued before the migration get their frozen data.Manual: rendered sample receipts and checked the layout visually (header, donor block, table, totals, signature, page footer).
Backup tests were already failing on develop
develop(before any of this PR's changes), all 39 backup tests (BackupRestoreTests, from Feature/71 db backup restore #99) failed during setup.tests/MoissonMontreal.Tests/Fixtures/BackupTestData.sql) inserts donors withoutsearch_name. The donor search PR (feat(donors): add the paginated donor list with search by name #98) made that column required (NOT NULL), and the two PRs were merged separately, so the seed never got updated. Setup fails withnull value in column "search_name" of relation "donors" violates not-null constraint.search_namefor each donor ('donor ' || i, which is what the app's normalization gives for those ASCII names).pg_restoreloads the data before it creates triggers.Screenshots / Screencasts
No frontend changes (backend and API only).
Checklist
Notes
Deployment
ReceiptIssuersettings section. It must be set in the App Service configuration (for exampleReceiptIssuer__RegistrationNumber) with Moisson Montréal's real values, or every issue is refused with a message naming the missing setting.New dependencies
QuestPDF(API) for the PDF. Free under its Community license for registered charities, to be confirmed by Moisson Montréal.PdfPig(tests only) to extract and check the PDF text.Behavior change for other features
Open questions for the client, beyond the list in the Overview
Team follow-up