export interface Mailer { send(to: string, subject: string, body: string): Promise; } export class NotificationService { constructor(private readonly mailer: Mailer) {} async paymentReceipt(email: string, amountCents: number, currency: string): Promise { const amount = (amountCents / 100).toFixed(2); await this.mailer.send(email, "Payment received", `We received ${amount} ${currency}.`); } async welcome(email: string, displayName: string): Promise { await this.mailer.send(email, "Welcome", `Hi ${displayName}, your account is ready.`); } }