mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 12:08:34 +00:00
Suppress dialog if error is regarding user cancellation.
This commit is contained in:
committed by
Cody Henthorne
parent
0940c88c20
commit
76b28593ea
@@ -149,7 +149,8 @@ sealed class DonationError(val source: DonationErrorSource, cause: Throwable) :
|
|||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getPaymentSetupError(source: DonationErrorSource, throwable: Throwable, method: PaymentSourceType): DonationError {
|
fun getPaymentSetupError(source: DonationErrorSource, throwable: Throwable, method: PaymentSourceType): DonationError {
|
||||||
return if (throwable is StripeError.PostError) {
|
return when (throwable) {
|
||||||
|
is StripeError.PostError -> {
|
||||||
val declineCode: StripeDeclineCode? = throwable.declineCode
|
val declineCode: StripeDeclineCode? = throwable.declineCode
|
||||||
val errorCode: String? = throwable.errorCode
|
val errorCode: String? = throwable.errorCode
|
||||||
|
|
||||||
@@ -158,10 +159,17 @@ sealed class DonationError(val source: DonationErrorSource, cause: Throwable) :
|
|||||||
errorCode != null && method is PaymentSourceType.Stripe -> PaymentSetupError.StripeCodedError(source, throwable, errorCode)
|
errorCode != null && method is PaymentSourceType.Stripe -> PaymentSetupError.StripeCodedError(source, throwable, errorCode)
|
||||||
else -> PaymentSetupError.GenericError(source, throwable)
|
else -> PaymentSetupError.GenericError(source, throwable)
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
is UserCancelledPaymentError -> {
|
||||||
|
return throwable
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
PaymentSetupError.GenericError(source, throwable)
|
PaymentSetupError.GenericError(source, throwable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun oneTimeDonationAmountTooSmall(source: DonationErrorSource): DonationError = OneTimeDonationError.AmountTooSmallError(source)
|
fun oneTimeDonationAmountTooSmall(source: DonationErrorSource): DonationError = OneTimeDonationError.AmountTooSmallError(source)
|
||||||
|
|||||||
Reference in New Issue
Block a user