Skip to content

Develop - #72

Merged
aledefra merged 2 commits into
mainfrom
develop
Jul 1, 2026
Merged

Develop#72
aledefra merged 2 commits into
mainfrom
develop

Conversation

@aledefra

@aledefra aledefra commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

aledefra added 2 commits June 25, 2026 16:43
* Attach draft invoices to operator emails

* Hide project and job names in draft invoices

* Address draft email review comments
Copilot AI review requested due to automatic review settings 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

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 CreateOrUpdateUserInfo and 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 thread storage/userInfoStorer.go
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 thread service/sumsubService.go
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())
}
}
@aledefra
aledefra merged commit 286fa01 into main Jul 1, 2026
2 checks passed
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.

3 participants