Skip to content

Instantly share code, notes, and snippets.

@NuckChorris
Forked from vikhyat/gist:ec0f4c27ed21b092ca12
Created January 13, 2015 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NuckChorris/022eabfb59a1c88d7ba5 to your computer and use it in GitHub Desktop.
Save NuckChorris/022eabfb59a1c88d7ba5 to your computer and use it in GitHub Desktop.

Here's how it's going to look like from the end user perspective:

1 hour before my PRO membership ends, if I am on a recurring plan Hummingbird will try to charge my credit card. If it succeeds everything is good. If it fails my subscription will run out and Hummingbird will try to charge my credit card again tomorrow, 3 days from now and 5 days from now. I will receive an email from Hummingbird if the charge is successful, and a different email every time charging my card fails.

If I am not on a recurring plan I will get an email 1 day before my subscription runs out urging me to get on a recurring plan.

From an implementation point of view:

We will be adding Sidetiq for recurring jobs. There will be a number of jobs to handle this logic.

  1. Hourly job that extends the subscription of every user whose subscription runs out in the next hour.
  2. Daily job that will handle credit card processing failure. It will pick up users whose subscription ran out 1 day ago, 3 days ago and 5 days ago.
  3. Daily job that sends an email to all PRO members who are not on a recurring plan, and whose subscription runs out in the next 24 hours.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment