fix(migrate): revoking an already ended subscription is success - #408
Merged
Merged
Conversation
Polar's subscriptions.revoke throws AlreadyCanceledSubscription (or ResourceNotFound) when an operator already refunded the subscription or an earlier call revoked it but marking the grant fell through. That made the revoke endpoint answer 502 forever while the grant stayed live. The plugin now returns 'already_ended' for those two errors; the endpoint marks the grant revoked and answers subscription_canceled:false. Other failures still throw.
Member
Author
|
t6 review @ a89c436 — ONAY (merge when the Local evidence at this head: What I checked:
Note (non-blocking): |
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.
What
t6 note 2 on #406:
subscriptions.revokethrows for a subscription Polar already ended, so the revoke endpoint looped on 502 with the grant still live.PaymentProvider.cancelSubscriptionreturns'canceled' | 'already_ended'; Polar mapsAlreadyCanceledSubscription/ResourceNotFoundtoalready_ended, anything else still throws.subscription_canceled:false(no 502, jti kept used).Tests
Route test for the already-ended case; plugin tests for canceled / already_ended (both errors) / other failure rethrown. Unit, delete-routes and billing-webhook integration, eslint, typecheck green.