I am working on a SaaS project that will have a trial when the trial is ending I get a webhook notification when 3 days are remaining. I do some stuff with this and one of the things is I update
user.company.stripe.trialEnd to the value Stripe tells me for the ending time.
When a trial ends I'd like some cron/Lambda job that runs once per hour and updates the correct things for when a trial ends.
Currently, when a payment fails a webhook takes that and marks the user unable to log in properly (redirects to billing) and forces them to stay on that page until they pay so as to prevent them from using the site.
Also when this happens the webhook service sends API calls to my serviceA and serviceB which then do some things like disabling certain things that cost me extra and then updates their user with some new values.
I want pretty much the exact same thing to happen when a trial has ended.
My question comes in how to do this? Currently, I have two thoughts on options,
have the lambda call my Consul cluster and then send API calls to the correct services
move the logic I need into a Lambda (and remove from the two services) which would then work off a SQS queue where my webhook service would publish a message to the queue and my Lambda would do the work there and only run when needed.
Issues I see with the options...
I currently have no clue how to connect Lambda to Consul to get the right IP/port for what I need
My other services are running inside Kubernetes
Introduces an extra point of failure
Potentially increases cost
Means I now have to keep my data (mongoose) models up to date in multiple git repos and services which I can see being an issue as I scale.
An option I came up with after typing this was using a Kubernetes cron job that would be in the same cluster and run Node.js like the rest of my microservices. This seems like a simple option but not sure how good it is from a design perspective.