Skip to content

[codex] Attach draft invoices to operator emails - #71

Merged
aledefra merged 3 commits into
developfrom
codex/draft-invoice-email-attachments
Jul 1, 2026
Merged

[codex] Attach draft invoices to operator emails#71
aledefra merged 3 commits into
developfrom
codex/draft-invoice-email-attachments

Conversation

@aledefra

@aledefra aledefra commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • attach generated draft invoice documents to node operator draft invoice emails
  • send draft notification emails to confirmed primary and secondary account notification emails, with profile email fallback
  • add filename formatting for draft invoice attachments as YYYYMM_SUPPLIER_BENEFICIARY_INVOICE-NO.doc

Validation

  • go test ./service -run 'TestNotifyOfflineLinkedNodes|TestFetchOracleNodesList|TestValidateOfflineNodesNotifierConfig|TestDraftNotificationEmailsUsesConfirmedPrimaryAndSecondary|TestDraftInvoiceAttachmentName|TestNotificationEmailsForAccount|TestConfirmPendingNotificationEmail'
  • git diff --check

Notes

  • Current draft invoice template still renders Project and Job ID - Name columns for draft documents.
  • Repo-wide go test ./... -run ... is blocked by existing storage test DB initialization with empty config (lookup port=0).

@aledefra
aledefra marked this pull request as ready for review July 1, 2026 13:44
Copilot AI review requested due to automatic review settings July 1, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.doc and 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 thread service/monthlyPoaiInvoiceService.go
Comment thread service/monthlyPoaiInvoiceService.go
Comment thread service/monthlyPoaiInvoiceService.go
Comment thread service/monthlyPoaiInvoiceService.go
Copilot AI review requested due to automatic review settings July 1, 2026 13:52
@aledefra
aledefra merged commit 1d14244 into develop Jul 1, 2026
1 check passed
@aledefra
aledefra deleted the codex/draft-invoice-email-attachments branch July 1, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

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