Conversation
* Attach draft invoices to operator emails * Hide project and job names in draft invoices * Address draft email review comments
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves invoice drafting notifications by attaching generated draft invoices to node-owner emails and using confirmed account emails (primary + secondary) for notifications, while also making KYC “approved” user info persistence idempotent via an upsert.
Changes:
- Add Postmark email attachment support and send draft invoice documents as attachments to node owners.
- Update monthly draft notification logic to group drafts per node owner and resolve notification recipients from confirmed account emails.
- Add
CreateOrUpdateUserInfoand refactor Sumsub KYC approval handling to use it.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/html/invoice.draft.html | Simplifies allocations table columns (removes project/job name details). |
| storage/userInfoStorer.go | Adds an upsert-style CreateOrUpdateUserInfo using GORM OnConflict. |
| service/sumsubService.go | Refactors approved-flow to upsert user info and centralizes confirmation email sending. |
| service/monthlyPoaiInvoiceService.go | Generates draft invoice attachments and sends them to confirmed notification emails per owner/CSP. |
| service/monthlyPoaiInvoiceService_test.go | Adds unit tests for confirmed-email selection and attachment filename sanitization. |
| service/emailService.go | Adds attachment payload support and helper for base64-encoded attachments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+53
to
+77
| txUpdate := db.Clauses(clause.OnConflict{ | ||
| Columns: []clause.Column{{Name: "blockchain_address"}}, | ||
| DoUpdates: clause.AssignmentColumns([]string{ | ||
| "email", | ||
| "name", | ||
| "surname", | ||
| "company_name", | ||
| "identification_code", | ||
| "address", | ||
| "state", | ||
| "city", | ||
| "country", | ||
| "is_company", | ||
| }), | ||
| }).Create(userInfo) | ||
| if txUpdate.Error != nil { | ||
| txUpdate.Rollback() | ||
| return txUpdate.Error | ||
| } | ||
| if txUpdate.RowsAffected == 0 { | ||
| txUpdate.Rollback() | ||
| return gorm.ErrRecordNotFound | ||
| } | ||
|
|
||
| return nil |
Comment on lines
+129
to
+134
| if (event.Type == model.ApplicantReviewed || event.Type == model.ApplicantOnHold) && event.ReviewResult.ReviewAnswer == "GREEN" { | ||
| err = SendKycConfirmedEmail(kyc.Email) | ||
| if err != nil { | ||
| log.Warn("error while sending kyc confirmed email: " + err.Error()) | ||
| } | ||
| } |
toderian
approved these changes
Jul 1, 2026
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.
No description provided.