Fix error routing for credit cards.

This commit is contained in:
Alex Hart 2022-12-02 11:00:22 -04:00
parent 9aca0af22c
commit ea08b59e6b
2 changed files with 5 additions and 6 deletions

View file

@ -14,7 +14,6 @@ import androidx.fragment.app.setFragmentResult
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.codewaves.stickyheadergrid.StickyHeaderGridLayoutManager.LayoutParams
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.ViewBinderDelegate
import org.thoughtcrime.securesms.components.settings.app.subscription.donate.DonateToSignalType
@ -67,7 +66,7 @@ class CreditCardFragment : Fragment(R.layout.credit_card_fragment) {
}
binding.cardCvv.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
if (actionId == EditorInfo.IME_ACTION_DONE && binding.continueButton.isEnabled) {
binding.continueButton.performClick()
true
} else {

View file

@ -90,8 +90,8 @@ class DonationErrorParams<V> private constructor(
private fun <V> getDeclinedErrorParams(context: Context, declinedError: DonationError.PaymentSetupError.StripeDeclinedError, callback: Callback<V>): DonationErrorParams<V> {
val getStripeDeclineCodePositiveActionParams: (Context, Callback<V>, Int) -> DonationErrorParams<V> = when (declinedError.method) {
PaymentSourceType.Stripe.GooglePay -> this::getTryCreditCardAgainParams
PaymentSourceType.Stripe.CreditCard -> this::getGoToGooglePayParams
PaymentSourceType.Stripe.CreditCard -> this::getTryCreditCardAgainParams
PaymentSourceType.Stripe.GooglePay -> this::getGoToGooglePayParams
}
return when (declinedError.declineCode) {
@ -99,8 +99,8 @@ class DonationErrorParams<V> private constructor(
StripeDeclineCode.Code.APPROVE_WITH_ID -> getStripeDeclineCodePositiveActionParams(
context, callback,
when (declinedError.method) {
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__verify_your_payment_method_is_up_to_date_in_google_pay_and_try_again
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__verify_your_card_details_are_correct_and_try_again
PaymentSourceType.Stripe.CreditCard -> R.string.DeclineCode__verify_your_card_details_are_correct_and_try_again
PaymentSourceType.Stripe.GooglePay -> R.string.DeclineCode__verify_your_payment_method_is_up_to_date_in_google_pay_and_try_again
}
)
StripeDeclineCode.Code.CALL_ISSUER -> getStripeDeclineCodePositiveActionParams(