Add retry when user resubscribes after canceling.

fork-5.53.8
Alex Hart 2022-04-28 14:33:30 -03:00
rodzic a6f1e0e972
commit 33236ea8e6
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -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());

Wyświetl plik

@ -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;