Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ private fun showOnRampFailure(resources: Resources, error: CoinbaseOnRampWebErro
)
}

is CoinbaseOnRampWebError.GuestRegionMismatch -> {
BottomBarManager.showAlert(
title = resources.getString(R.string.error_title_onrampRegionMismatch),
message = resources.getString(R.string.error_description_onrampRegionMismatch),
)
}

is CoinbaseOnRampWebError.GuestGooglePayError -> {
BottomBarManager.showError(
title = resources.getString(R.string.error_title_onrampTransactionFailed),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ sealed class CoinbaseOnRampWebError(val data: String? = null): Throwable() {
class GuestTransactionSendFailed(data: String? = null) : CoinbaseOnRampWebError(data), NotifiableError
class GuestTransactionAvsValidationFailed(data: String? = null) : CoinbaseOnRampWebError(data)
class GuestTransactionTransactionFailed(data: String? = null) : CoinbaseOnRampWebError(data), NotifiableError
class GuestRegionMismatch(data: String? = null) : CoinbaseOnRampWebError(data)
class GuestGooglePayNotReady(data: String? = null) : CoinbaseOnRampWebError(data)
class Internal(data: String? = null) : CoinbaseOnRampWebError(data), NotifiableError
class GooglePayButtonNotFound(data: String? = null) : CoinbaseOnRampWebError(data), NotifiableError
Expand All @@ -290,6 +291,7 @@ sealed class CoinbaseOnRampWebError(val data: String? = null): Throwable() {
"ERROR_CODE_GUEST_TRANSACTION_SEND_FAILED" -> GuestTransactionSendFailed(data)
"ERROR_CODE_GUEST_TRANSACTION_AVS_VALIDATION_FAILED" -> GuestTransactionAvsValidationFailed(data)
"ERROR_CODE_GUEST_TRANSACTION_TRANSACTION_FAILED" -> GuestTransactionTransactionFailed(data)
"ERROR_CODE_GUEST_REGION_MISMATCH" -> GuestRegionMismatch(data)
"ERROR_CODE_GUEST_GOOGLE_PAY_NOT_READY" -> GuestGooglePayNotReady(data)
"ERROR_CODE_INTERNAL" -> Internal(data)
"ERROR_CODE_GOOGLE_PAY_BUTTON_NOT_FOUND" -> GooglePayButtonNotFound(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class CoinbaseOnRampWebErrorTest {
"ERROR_CODE_GUEST_TRANSACTION_SEND_FAILED" to CoinbaseOnRampWebError.GuestTransactionSendFailed::class,
"ERROR_CODE_GUEST_TRANSACTION_AVS_VALIDATION_FAILED" to CoinbaseOnRampWebError.GuestTransactionAvsValidationFailed::class,
"ERROR_CODE_GUEST_TRANSACTION_TRANSACTION_FAILED" to CoinbaseOnRampWebError.GuestTransactionTransactionFailed::class,
"ERROR_CODE_GUEST_REGION_MISMATCH" to CoinbaseOnRampWebError.GuestRegionMismatch::class,
"ERROR_CODE_INTERNAL" to CoinbaseOnRampWebError.Internal::class,
"ERROR_CODE_GOOGLE_PAY_BUTTON_NOT_FOUND" to CoinbaseOnRampWebError.GooglePayButtonNotFound::class,
)
Expand Down Expand Up @@ -242,6 +243,12 @@ class CoinbaseOnRampWebErrorTest {
assertIs<Throwable>(error)
}

@Test
fun guestRegionMismatchIsNotNotifiable() {
val error = CoinbaseOnRampWebError.GuestRegionMismatch()
assertFalse(error is NotifiableError)
}

@Test
fun paymentSheetTimeoutIsNotNotifiable() {
val error = CoinbaseOnRampWebError.PaymentSheetTimeout()
Expand Down
Loading