diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/InAppPaymentKeepAliveJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/InAppPaymentKeepAliveJob.kt index b71e98868c..c41337f88c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/InAppPaymentKeepAliveJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/InAppPaymentKeepAliveJob.kt @@ -10,6 +10,7 @@ import org.signal.core.util.logging.Log import org.thoughtcrime.securesms.badges.Badges import org.thoughtcrime.securesms.components.settings.app.subscription.DonationSerializationHelper.toDecimalValue import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository +import org.thoughtcrime.securesms.components.settings.app.subscription.InAppPaymentsRepository.toPaymentSourceType import org.thoughtcrime.securesms.components.settings.app.subscription.manage.DonationRedemptionJobStatus import org.thoughtcrime.securesms.components.settings.app.subscription.manage.DonationRedemptionJobWatcher import org.thoughtcrime.securesms.database.InAppPaymentTable @@ -281,6 +282,19 @@ class InAppPaymentKeepAliveJob private constructor( ) ) + SignalDatabase.inAppPayments.getById(current.id) + } else if (current.state == InAppPaymentTable.State.END && current.data.error != null && current.data.paymentMethodType == InAppPaymentData.PaymentMethodType.UNKNOWN && subscriber.paymentMethodType.toPaymentSourceType().isBankTransfer) { + info(type, "Found failed SEPA payment but there's no payment method assigned. Assigning payment method and retrying.") + SignalDatabase.inAppPayments.update( + current.copy( + state = InAppPaymentTable.State.PENDING, + data = current.data.copy( + paymentMethodType = subscriber.paymentMethodType, + error = null + ) + ) + ) + SignalDatabase.inAppPayments.getById(current.id) } else { current