Skip to content

Commit 7ff0481

Browse files
committed
fix(subscription-reminders): Fix misconfigured subscription reminder args
Because: * the code to autogenerate the variable names changed, but the references did not commit: * Updates the references to the autogenerated variables, and includes an explicit check for these values Closes #N/A
1 parent 1f92bad commit 7ff0481

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

packages/fxa-auth-server/lib/payments/subscription-reminders.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ interface EndingRemindersOptions {
4040
}
4141

4242
interface RenewalRemindersOptions {
43+
monthlyReminderDays?: number;
4344
yearlyReminderDays?: number;
4445
}
4546

@@ -81,6 +82,11 @@ export class SubscriptionReminders {
8182
this.statsd = statsd;
8283
this.planDuration = Duration.fromObject({ days: planLength });
8384
this.reminderDuration = Duration.fromObject({ days: reminderLength });
85+
if (renewalRemindersOptions.monthlyReminderDays) {
86+
this.reminderDuration = Duration.fromObject({
87+
days: renewalRemindersOptions.monthlyReminderDays,
88+
});
89+
}
8490
if (renewalRemindersOptions.yearlyReminderDays) {
8591
this.yearlyRenewalReminderDuration = Duration.fromObject({
8692
days: renewalRemindersOptions.yearlyReminderDays,

packages/fxa-auth-server/scripts/subscription-reminders.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async function init() {
8787
const subscriptionReminders = new SubscriptionReminders(
8888
log,
8989
parseInt(program.planLength),
90-
parseInt(program.reminderLength),
90+
parseInt(program.monthlyRenewalReminderLength),
9191
{
9292
enabled: parseBooleanArg(program.enableEndingReminders),
9393
paymentsNextUrl: config.smtp.subscriptionSettingsUrl,
@@ -96,6 +96,7 @@ async function init() {
9696
yearlyReminderDays: parseInt(program.endingReminderYearlyLength),
9797
},
9898
{
99+
monthlyReminderDays: parseInt(program.monthlyRenewalReminderLength),
99100
yearlyReminderDays: parseInt(program.yearlyRenewalReminderLength),
100101
},
101102
database,

0 commit comments

Comments
 (0)