Add retry when user resubscribes after canceling.

This commit is contained in:
Alex Hart
2022-04-28 14:33:30 -03:00
parent a6f1e0e972
commit 33236ea8e6
2 changed files with 7 additions and 1 deletions

View File

@@ -161,6 +161,9 @@ public class SubscriptionReceiptRequestResponseJob extends BaseJob {
Log.w(TAG, "Subscription is not yet active. Status: " + subscription.getStatus(), true);
throw new RetryableException();
} else if (subscription.isCanceled()) {
Log.w(TAG, "Subscription is marked as cancelled, but it's possible that the user cancelled and then later tried to resubscribe. Scheduling a retry.", true);
throw new RetryableException();
} else {
Log.i(TAG, "Recording end of period from active subscription: " + subscription.getStatus(), true);
SignalStore.donationsValues().setLastEndOfPeriod(subscription.getEndOfCurrentPeriod());

View File

@@ -57,7 +57,6 @@ public final class ActiveSubscription {
private static final Set<Status> FAILURE_STATUSES = new HashSet<>(Arrays.asList(
INCOMPLETE_EXPIRED,
PAST_DUE,
CANCELED,
UNPAID
));
@@ -197,6 +196,10 @@ public final class ActiveSubscription {
return Status.isPaymentFailed(getStatus());
}
public boolean isCanceled() {
return Status.getStatus(getStatus()) == Status.CANCELED;
}
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;