From dbb5c77b19b27b293742996a0627340561b579d2 Mon Sep 17 00:00:00 2001 From: "Bruno R. Nunes" Date: Mon, 24 May 2021 10:38:05 -0700 Subject: [PATCH] Comments --- .../stripe/android/googlepay/StripeGooglePayContract.kt | 9 +++++---- .../stripe/android/paymentsheet/PaymentSheetViewModel.kt | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stripe/src/main/java/com/stripe/android/googlepay/StripeGooglePayContract.kt b/stripe/src/main/java/com/stripe/android/googlepay/StripeGooglePayContract.kt index bcb44ccd9d9..c7c74763245 100644 --- a/stripe/src/main/java/com/stripe/android/googlepay/StripeGooglePayContract.kt +++ b/stripe/src/main/java/com/stripe/android/googlepay/StripeGooglePayContract.kt @@ -131,12 +131,13 @@ internal class StripeGooglePayContract : } } -internal fun Status.getErrorResourceID(): Int? { - return when (this) { +internal fun StripeGooglePayContract.Result.Error.getErrorResourceID(): Int? { + return when (googlePayStatus) { Status.RESULT_SUCCESS -> null - Status.RESULT_INTERNAL_ERROR, Status.RESULT_CANCELED, Status.RESULT_DEAD_CLIENT -> R.string.stripe_google_pay_error_internal + Status.RESULT_INTERNAL_ERROR, Status.RESULT_CANCELED, Status.RESULT_DEAD_CLIENT, null -> + R.string.stripe_google_pay_error_internal else -> { - when (this.statusCode) { + when (googlePayStatus.statusCode) { CommonStatusCodes.API_NOT_CONNECTED, // "The client attempted to call a method from an API that failed to connect." CommonStatusCodes.CANCELED, // -> "The result was canceled either due to client disconnect or PendingResult.cancel()." CommonStatusCodes.DEVELOPER_ERROR, // -> "The application is misconfigured." diff --git a/stripe/src/main/java/com/stripe/android/paymentsheet/PaymentSheetViewModel.kt b/stripe/src/main/java/com/stripe/android/paymentsheet/PaymentSheetViewModel.kt index db21cdd5b80..e2fdb9e002e 100644 --- a/stripe/src/main/java/com/stripe/android/paymentsheet/PaymentSheetViewModel.kt +++ b/stripe/src/main/java/com/stripe/android/paymentsheet/PaymentSheetViewModel.kt @@ -339,8 +339,7 @@ internal class PaymentSheetViewModel internal constructor( paymentIntent.value?.let { it -> resetViewState( it, - googlePayResult.googlePayStatus?.getErrorResourceID() - ?: R.string.stripe_google_pay_error_internal + googlePayResult.getErrorResourceID() ) } }