feat: add annual billing, free trial, upgrade/downgrade, and ACH invoice support
- Add monthly/annual billing toggle with 25% annual discount on pricing page - Implement 14-day no-card free trial (server-side Stripe subscription creation) - Enable upgrade/downgrade via Stripe Customer Portal - Add admin-initiated ACH/invoice billing for enterprise customers - Add billing card to Settings page with plan info and Manage Billing button - Handle past_due status with read-only grace period access - Add trial ending and trial expired email templates - Add DB migration for billing_interval and collection_method columns - Update ONBOARDING-AND-AUTH.md documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -96,6 +96,42 @@ export class EmailService {
|
||||
await this.send(email, subject, html, 'invite_member', { orgName, inviteUrl });
|
||||
}
|
||||
|
||||
async sendTrialEndingEmail(email: string, businessName: string, daysRemaining: number, settingsUrl: string): Promise<void> {
|
||||
const subject = `Your free trial ends in ${daysRemaining} days — ${businessName}`;
|
||||
const html = this.buildTemplate({
|
||||
preheader: `Your HOA LedgerIQ trial for ${businessName} is ending soon.`,
|
||||
heading: `Your Trial Ends in ${daysRemaining} Days`,
|
||||
body: `
|
||||
<p>Your free trial for <strong>${this.esc(businessName)}</strong> on HOA LedgerIQ ends in <strong>${daysRemaining} days</strong>.</p>
|
||||
<p>To continue using all features without interruption, add a payment method before your trial expires.</p>
|
||||
<p>If you don't add a payment method, your account will become read-only and you won't be able to make changes to your data.</p>
|
||||
`,
|
||||
ctaText: 'Add Payment Method',
|
||||
ctaUrl: settingsUrl,
|
||||
footer: 'If you have any questions about plans or pricing, just reply to this email.',
|
||||
});
|
||||
|
||||
await this.send(email, subject, html, 'trial_ending', { businessName, daysRemaining, settingsUrl });
|
||||
}
|
||||
|
||||
async sendTrialExpiredEmail(email: string, businessName: string): Promise<void> {
|
||||
const appUrl = this.configService.get<string>('APP_URL') || 'https://app.hoaledgeriq.com';
|
||||
const subject = `Your free trial has ended — ${businessName}`;
|
||||
const html = this.buildTemplate({
|
||||
preheader: `Your HOA LedgerIQ trial for ${businessName} has ended.`,
|
||||
heading: 'Your Trial Has Ended',
|
||||
body: `
|
||||
<p>The free trial for <strong>${this.esc(businessName)}</strong> on HOA LedgerIQ has ended.</p>
|
||||
<p>Your data is safe and your account is preserved. Subscribe to a plan to regain full access to your HOA financial management tools.</p>
|
||||
`,
|
||||
ctaText: 'Choose a Plan',
|
||||
ctaUrl: `${appUrl}/pricing`,
|
||||
footer: 'Your data will be preserved. You can reactivate your account at any time by subscribing to a plan.',
|
||||
});
|
||||
|
||||
await this.send(email, subject, html, 'trial_expired', { businessName });
|
||||
}
|
||||
|
||||
async sendPasswordResetEmail(email: string, resetUrl: string): Promise<void> {
|
||||
const subject = 'Reset your HOA LedgerIQ password';
|
||||
const html = this.buildTemplate({
|
||||
|
||||
Reference in New Issue
Block a user