Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brnunes-stripe committed May 24, 2021
1 parent c0dd78e commit dbb5c77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}
}
Expand Down

0 comments on commit dbb5c77

Please sign in to comment.