Add espresso tests for donations flow.

This commit is contained in:
Alex Hart
2024-08-07 09:33:06 -03:00
committed by mtang-signal
parent 11d165a17b
commit ccabd9edd8
5 changed files with 143 additions and 4 deletions

View File

@@ -392,7 +392,13 @@ class DonateToSignalViewModel(
if (selectedCurrency !in priceCurrencies) {
Log.w(TAG, "Unsupported currency selection. Defaulting to USD. $selectedCurrency isn't supported.")
val usd = PlatformCurrencyUtil.USD
val newSubscriber = InAppPaymentsRepository.getSubscriber(usd, InAppPaymentSubscriberRecord.Type.DONATION) ?: InAppPaymentSubscriberRecord(SubscriberId.generate(), usd, InAppPaymentSubscriberRecord.Type.DONATION, false, InAppPaymentData.PaymentMethodType.UNKNOWN)
val newSubscriber = InAppPaymentsRepository.getSubscriber(usd, InAppPaymentSubscriberRecord.Type.DONATION) ?: InAppPaymentSubscriberRecord(
subscriberId = SubscriberId.generate(),
currency = usd,
type = InAppPaymentSubscriberRecord.Type.DONATION,
requiresCancel = false,
paymentMethodType = InAppPaymentData.PaymentMethodType.UNKNOWN
)
InAppPaymentsRepository.setSubscriber(newSubscriber)
RecurringInAppPaymentRepository.syncAccountRecord().subscribe()
}