[codex] Attach draft invoices to operator emails - #71
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the monthly POAI draft-invoice notification flow by (1) attaching generated draft invoice documents to node operator emails and (2) expanding notification recipients to confirmed primary + secondary notification emails (with a profile-email fallback). It also introduces deterministic, “safe” attachment filename formatting.
Changes:
- Generate and attach per-draft invoice documents to node operator draft-invoice emails.
- Send draft notifications to confirmed primary + secondary notification emails, falling back to the profile email when no confirmed emails exist.
- Add attachment filename formatting as
YYYYMM_SUPPLIER_BENEFICIARY_INVOICE-NO.docand tests for recipient selection + naming.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| service/monthlyPoaiInvoiceService.go | Groups drafts by owner, generates attachments, selects notification recipients, and formats safe attachment names. |
| service/monthlyPoaiInvoiceService_test.go | Adds tests for confirmed-email recipient selection and attachment filename formatting. |
| service/emailService.go | Adds attachment support to outbound email payloads and updates operator draft email sending to include attachments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
309
to
+313
| <col class="w-25mm-creation"> | ||
| <col class="w-20mm"> | ||
| <col class="w-25mm"> | ||
| <col class="w-35mm"> | ||
| <col class="w-60mm"> | ||
| <col class="w-20mm"> | ||
| <col class="w-30mm"> | ||
| <col class="w-30mm"> | ||
| <col class="w-70mm"> | ||
| <col class="w-30mm"> |
Comment on lines
+157
to
+164
| emails, err := getConfirmedAccountEmails(address) | ||
| if err != nil { | ||
| fmt.Println("error while retrieving draft notification emails: " + err.Error()) | ||
| return nil | ||
| } | ||
| if len(emails) > 0 { | ||
| return emails | ||
| } |
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
YYYYMM_SUPPLIER_BENEFICIARY_INVOICE-NO.docValidation
go test ./service -run 'TestNotifyOfflineLinkedNodes|TestFetchOracleNodesList|TestValidateOfflineNodesNotifierConfig|TestDraftNotificationEmailsUsesConfirmedPrimaryAndSecondary|TestDraftInvoiceAttachmentName|TestNotificationEmailsForAccount|TestConfirmPendingNotificationEmail'git diff --checkNotes
ProjectandJob ID - Namecolumns for draft documents.go test ./... -run ...is blocked by existing storage test DB initialization with empty config (lookup port=0).