Fix/invoice delivery and payment accounts (#1116)
* fix: reconcile annual reports with final closing entries * test: cover annual report depreciation and VAT balances * Merge remote-tracking branch 'origin/main' into fix/usr-fdbck-ch * fix: show exact invoice delivery details * fix: use currency account in invoice emails * fix: address invoice delivery review feedback * fix: harden invoice delivery and payment accounts * test: assert RLS-denied zero-row updates * fix: close remaining invoice compliance gaps * fix: harden invoice archive authorization * fix: close invoice delivery review findings * fix: verify delivery finalization results * fix: cap combined invoice email recipients * fix: close final invoice compliance findings * fix: prevent stale payment account saves * test: prove invoice delivery isolation * fix: close invoice privacy review findings * test: normalize delivery retention dates
This commit is contained in:
@@ -17,6 +17,12 @@ function sanitizeHeaderPart(s: string): string {
|
||||
return s.replace(/[\r\n<>]/g, '').trim()
|
||||
}
|
||||
|
||||
function optionalAddressList(addresses: string | string[] | undefined): string[] | undefined {
|
||||
if (!addresses) return undefined
|
||||
const list = Array.isArray(addresses) ? addresses : [addresses]
|
||||
return list.length > 0 ? list : undefined
|
||||
}
|
||||
|
||||
let resendClient: Resend | null = null
|
||||
|
||||
function getResendClient(): Resend {
|
||||
@@ -35,7 +41,7 @@ function isResendConfigured(): boolean {
|
||||
|
||||
export class ResendEmailService implements EmailService {
|
||||
async sendEmail(options: SendEmailOptions): Promise<SendEmailResult> {
|
||||
const { to, cc, subject, html, text, replyTo, fromName, attachments } = options
|
||||
const { to, cc, bcc, subject, html, text, replyTo, fromName, attachments } = options
|
||||
|
||||
if (!this.isConfigured()) {
|
||||
return { success: false, error: 'Email service is not configured' }
|
||||
@@ -56,7 +62,8 @@ export class ResendEmailService implements EmailService {
|
||||
const response = await resend.emails.send({
|
||||
from,
|
||||
to: Array.isArray(to) ? to : [to],
|
||||
cc: cc ? (Array.isArray(cc) ? cc : [cc]) : undefined,
|
||||
cc: optionalAddressList(cc),
|
||||
bcc: optionalAddressList(bcc),
|
||||
subject,
|
||||
html,
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user