Don't try to update a cancelled stripe subscription

This commit is contained in:
Ravi Khadiwala authored and ravi-signal committed 2024-08-30 12:47:26 -05:00
1 parent 176a15dace
commit 3b4d445ca8
1 file changed
+6
@@ -316,6 +316,12 @@ public class StripeManager implements SubscriptionPaymentProcessor {
final Subscription subscription = getSubscription(subscriptionObj);
if (getSubscriptionStatus(subscription.getStatus()) == SubscriptionStatus.CANCELED) {
// If the existing subscription is cancelled, just create a new subscription rather than trying to update a
// cancelled subscription (which stripe forbids)
return createSubscription(subscription.getCustomer(), priceId, level, subscription.getCreated());
}
return CompletableFuture.supplyAsync(() -> {
List<SubscriptionUpdateParams.Item> items = new ArrayList<>();
try {