Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a pdf generator for invoices #665

Open
wants to merge 9 commits into
base: development_flat_payment
Choose a base branch
from

Conversation

rawdaGastan
Copy link
Collaborator

@rawdaGastan rawdaGastan force-pushed the development_invoices_pdf branch from cb24c71 to 70768d9 Compare January 13, 2025 12:34
@rawdaGastan rawdaGastan force-pushed the development_flat_payment branch from 26ced02 to 8f86730 Compare January 14, 2025 13:58
startX float64 = 25
startY float64 = 30

logoPath = "internal/img/codescalers.png"
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we make this name more generic so it can be replaced e.g with threefold logo or any other company?

@@ -40,7 +41,7 @@ var (
)

// SendMail sends verification mails
func SendMail(sender, sendGridKey, receiver, subject, body string) error {
func SendMail(sender, sendGridKey, receiver, subject, body, attachmentName string, attachmentBytes ...[]byte) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can make it a Mailer that can be initialized with a Key e.g NewMailer(sendGridKey)

And then We can SendMail(sender, receiver, subject, body, attachments []Attachment)

and Attachments to be a struct of a name and bytes

CreatedAt time.Time `json:"created_at"`
PaidAt time.Time `json:"paid_at"`
FileData []byte `json:"file_data" gorm:"type:blob"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer the option of storing the invoices paths instead of storing the data itself, but if the size of the blob is quite small, then maybe we should go with that

return nil, InternalServerError(errors.New(internalServerErrorMsg))
}

downloadsDir := filepath.Join(homeDir, "Downloads")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make the full downloads home directory configurable and fallback to this if not defined, this allows the operator of the service to e.g mount external drives or use nfs directories .. etc

@rawdaGastan rawdaGastan force-pushed the development_invoices_pdf branch 2 times, most recently from 38f00f7 to fd0e22b Compare January 15, 2025 12:46
@rawdaGastan rawdaGastan force-pushed the development_invoices_pdf branch from fd0e22b to 262861a Compare January 15, 2025 12:49
@rawdaGastan rawdaGastan force-pushed the development_flat_payment branch from da94fa0 to c75afcd Compare February 12, 2025 15:05
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