30 lines
668 B
Go
30 lines
668 B
Go
package httpinvoce
|
|
|
|
import (
|
|
"io"
|
|
"log/slog"
|
|
"time"
|
|
|
|
"git.schreifuchs.ch/lou-taylor/accounting/internal/email"
|
|
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice"
|
|
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/model"
|
|
)
|
|
|
|
type Service struct {
|
|
log *slog.Logger
|
|
invoice invoicer
|
|
mail mailer
|
|
}
|
|
|
|
func New(log *slog.Logger, invoice invoicer, mail mailer) *Service {
|
|
return &Service{log: log, invoice: invoice, mail: mail}
|
|
}
|
|
|
|
type invoicer interface {
|
|
Generate(creditor, deptor model.Entity, mindur time.Duration, rate float64, repos []invoice.Repo) (document io.ReadCloser, err error)
|
|
}
|
|
|
|
type mailer interface {
|
|
Send(m email.Mail) (err error)
|
|
}
|