diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/errors/DonationErrorParams.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/errors/DonationErrorParams.kt index 83b50fe5a3..c64bd97f82 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/errors/DonationErrorParams.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/errors/DonationErrorParams.kt @@ -25,7 +25,8 @@ class DonationErrorParams private constructor( ): DonationErrorParams { return when (throwable) { is DonationError.GiftRecipientVerificationError -> getVerificationErrorParams(context, throwable, callback) - is DonationError.PaymentSetupError.StripeDeclinedError -> getDeclinedErrorParams(context, throwable, callback) + is DonationError.PaymentSetupError.StripeDeclinedError -> getStripeDeclinedErrorParams(context, throwable, callback) + is DonationError.PaymentSetupError.PayPalDeclinedError -> getPayPalDeclinedErrorParams(context, throwable, callback) is DonationError.PaymentSetupError -> DonationErrorParams( title = R.string.DonationsErrors__error_processing_payment, message = R.string.DonationsErrors__your_payment, @@ -88,7 +89,14 @@ class DonationErrorParams private constructor( } } - private fun getDeclinedErrorParams(context: Context, declinedError: DonationError.PaymentSetupError.StripeDeclinedError, callback: Callback): DonationErrorParams { + private fun getPayPalDeclinedErrorParams(context: Context, declinedError: DonationError.PaymentSetupError.PayPalDeclinedError, callback: Callback): DonationErrorParams { + return when (declinedError.code) { + PayPalDeclineCode.KnownCode.DECLINED -> getLearnMoreParams(context, callback, R.string.DeclineCode__try_another_payment_method_or_contact_your_bank_for_more_information_if_this_was_a_paypal) + else -> getLearnMoreParams(context, callback, R.string.DeclineCode__try_another_payment_method_or_contact_your_bank) + } + } + + private fun getStripeDeclinedErrorParams(context: Context, declinedError: DonationError.PaymentSetupError.StripeDeclinedError, callback: Callback): DonationErrorParams { val getStripeDeclineCodePositiveActionParams: (Context, Callback, Int) -> DonationErrorParams = when (declinedError.method) { PaymentSourceType.Stripe.CreditCard -> this::getTryCreditCardAgainParams PaymentSourceType.Stripe.GooglePay -> this::getGoToGooglePayParams diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a47b5583be..2ae839f80c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4849,6 +4849,8 @@ Try another payment method or contact your bank for more information. + + Try another payment method or contact your bank for more information. If this was a PayPal transaction contact PayPal. Verify your payment method is up to date in Google Pay and try again.