Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNTOR-4028: Allow renewing after receiving an expiration email #5587

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

Vinnl
Copy link
Collaborator

@Vinnl Vinnl commented Feb 4, 2025

References:

Jira: MNTOR-4028
Figma:

Description

We email people that their subscription is about to expire, then mark them as having received the email. We check whether we have marked someone as having received the email when collecting the list of subscribers to email, which means that we shouldn't use that list when determining whether someone can renew.

I've updated it to use a similar check, but to skip the check for churn_prevention_email_sent_at.

How to test

Create a .csv file with the following contents:

userid,customer,created,nickname,intervl,intervl_count,plan_id,product_id,current_period_end
18b8ea3c9b12427893ded71fda0cb8aa,cus_custom,2/6/2024 10:57:57,Yearly Production Pricing ($8.99 per month: $107.88),year,1,price_1Nv4ODJNcmPzuWtRoYpoFHXd,prod_OiV9RSaatywSRy,2/6/2025 13:37:00

Replace 18b8ea3c9b12427893ded71fda0cb8aa with the fxa_uid of the subscriber you want to email. (This subscriber should have Plus; you can give them Plus via /admin/dev.) Then upload that file via /admin/churn-subscribers/. It should say that there's one customer to email in the next cron run.

Then, run that cron job through npm run dev:cron:churn-discount. The customer should receive an email.

If you click the CTA in that email with main checked out, you should see "Your ⁨Monitor Plus⁩ subscription is still active", whereas on this branch, you should be able to renew successfully.

Checklist (Definition of Done)

  • Localization strings (if needed) have been added.
  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments
  • I've added a unit test to test for potential regressions of this bug. - No, because it involves a DB query, which we don't have a good way to test for.
  • If this PR implements a feature flag or experimentation, I've checked that it still works with the flag both on, and with the flag off.
  • If this PR implements a feature flag or experimentation, the Ship Behind Feature Flag status in Jira has been set
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.

We email people that their subscription is about to expire, then
mark them as having received the email. We check whether we have
marked someone as having received the email when collecting the
list of subscribers to email, which means that we shouldn't use
that list when determining whether someone can renew.

I've updated it to use a similar check, but to skip the check for
`churn_prevention_email_sent_at`.
@Vinnl Vinnl added the Review: XS Code review time: up to 30min label Feb 4, 2025
@Vinnl Vinnl requested review from flozia and mansaj February 4, 2025 11:58
@Vinnl Vinnl self-assigned this Feb 4, 2025
@@ -59,6 +59,29 @@ async function getAllSubscriberChurns(): Promise<SubscriberChurnRow[]> {
}
}

async function getUpcomingChurns(): Promise<Array<SubscriberChurnRow>> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as the getChurnsToEmail query, with the join and churn_prevention_email_sent_at check removed.

Copy link

github-actions bot commented Feb 4, 2025

@Vinnl Vinnl merged commit 0a13f8e into main Feb 4, 2025
16 checks passed
@Vinnl Vinnl deleted the MNTOR-4028-allow-emailed-coupons branch February 4, 2025 12:38
Copy link

github-actions bot commented Feb 4, 2025

Cleanup completed - database 'blurts-server-pr-5587' destroyed, cloud run service 'blurts-server-pr-5587' destroyed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review: XS Code review time: up to 30min
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants