feat: updates subscription billing cycle on invoice.issued event#22
Merged
Conversation
kevcodez
reviewed
Oct 6, 2024
| billingCycleEnd: string; | ||
| } | ||
| ) { | ||
| return postgresClient.update( |
Collaborator
There was a problem hiding this comment.
I think it would be safer if this method ensures
- the billingCycleEnd date is in the future, otherwise skip
- the billingCycleStart date is in the past at the time of the check, otherwise skip
- the update statement should ideally have an additional condition in the where clause ensuring it only gets updated if the current end_date is in the past
I'd prefer having a very specific update SQL statement for this function instead of a generic upsert to ensure that
kevcodez
reviewed
Oct 6, 2024
kevcodez
reviewed
Oct 6, 2024
kevcodez
approved these changes
Oct 6, 2024
Orb currently has no webhook whenever a billing cycle is reset, so subscription billing cycle information may be outdated. As a workaround we check whether an issued invoice contains a plan line item. A plan line item bein present means that there was a billing cycle reset and you can find the billing cycle's start and end date in the line item.
ecktoteckto
force-pushed
the
feat/update-stale-subscriptions
branch
from
October 6, 2024 11:11
2556be2 to
f6793a2
Compare
|
🎉 This PR is included in version 1.6.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Orb currently has no webhook whenever a billing cycle is reset, so subscription billing cycle information may be outdated. As a workaround we check whether an issued invoice contains a plan line item. A plan line item bein present means that there was a billing cycle reset and you can find the billing cycle's start and end date in the line item.