diff --git a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt index e7354ee9b1..620038bf9a 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/notifications/NotificationUM.kt @@ -228,9 +228,13 @@ sealed class NotificationUM(val config: NotificationConfig) { ), ) - data class OnrampErrorNotification(val onRefresh: () -> Unit) : Warning( + data class OnrampErrorNotification(val errorCode: String?, val onRefresh: () -> Unit) : Warning( title = resourceReference(R.string.common_error), - subtitle = resourceReference(R.string.common_unknown_error), + subtitle = if (errorCode != null) { + resourceReference(R.string.express_error_code, wrappedList(errorCode)) + } else { + resourceReference(R.string.common_unknown_error) + }, buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig( text = resourceReference(R.string.warning_button_refresh), onClick = onRefresh, diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt index 6736beb593..8cd1890fbb 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/entity/factory/OnrampStateFactory.kt @@ -49,9 +49,8 @@ internal class OnrampStateFactory( fun getOnrampErrorState(onrampError: OnrampError): OnrampMainComponentUM { return when (onrampError) { OnrampError.PairsNotFound -> getNoPairsErrorState() - is OnrampError.DataError, - is OnrampError.DomainError, - -> getErrorState() + is OnrampError.DataError -> getErrorState(onrampError.code) + is OnrampError.DomainError -> getErrorState() is OnrampError.AmountError.TooBigError, is OnrampError.AmountError.TooSmallError, OnrampError.RedirectError.VerificationFailed, @@ -75,7 +74,7 @@ internal class OnrampStateFactory( ) } - private fun getErrorState(): OnrampMainComponentUM { + private fun getErrorState(errorCode: String? = null): OnrampMainComponentUM { val state = currentStateProvider() val endButton = state.topBarConfig.endButtonUM.copy(enabled = true) @@ -87,10 +86,16 @@ internal class OnrampStateFactory( amountFieldModel = state.amountBlockState.amountFieldModel.copy(isError = true), ), providerBlockState = OnrampProviderBlockUM.Empty, - errorNotification = NotificationUM.Warning.OnrampErrorNotification(onrampIntents::onRefresh), + errorNotification = NotificationUM.Warning.OnrampErrorNotification( + errorCode = errorCode, + onRefresh = onrampIntents::onRefresh, + ), ) is OnrampMainComponentUM.InitialLoading -> state.copy( - errorNotification = NotificationUM.Warning.OnrampErrorNotification(onrampIntents::onRefresh), + errorNotification = NotificationUM.Warning.OnrampErrorNotification( + errorCode = errorCode, + onRefresh = onrampIntents::onRefresh, + ), ) } } diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/model/OnrampMainComponentModel.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/model/OnrampMainComponentModel.kt index b58214cc02..45d142a862 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/model/OnrampMainComponentModel.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/model/OnrampMainComponentModel.kt @@ -202,6 +202,7 @@ internal class OnrampMainComponentModel @Inject constructor( val bestProvider = quote as? OnrampQuote.Data val isMultipleQuotes = !quotes.isSingleItem() val isOtherQuotesHasData = quotes + .filter { it.paymentMethod == quote.paymentMethod } .filterNot { it == bestProvider } .any { it is OnrampQuote.Data } val hasBestProvider = isMultipleQuotes && isOtherQuotesHasData