@@ -62,83 +62,119 @@ fun CoinbaseOnRampHandler(
6262
6363private fun showOnRampFailure (resources : Resources , error : CoinbaseOnRampWebError ) {
6464 when (error) {
65- is CoinbaseOnRampWebError .Unknown ,
66- is CoinbaseOnRampWebError .MissingTransactionUuid -> {
65+ // --- Grouped errors ---
66+
67+ is CoinbaseOnRampWebError .UnknownFailure -> {
6768 BottomBarManager .showError(
6869 title = resources.getString(R .string.error_title_onrampUnknownFailure),
6970 message = resources.getString(R .string.error_description_onrampUnknownFailure),
7071 )
7172 }
7273
74+ is CoinbaseOnRampWebError .CardDeclined -> {
75+ BottomBarManager .showAlert(
76+ title = resources.getString(R .string.error_title_onrampCardSoftDeclined),
77+ message = resources.getString(R .string.error_description_onrampCardSoftDeclined),
78+ )
79+ }
80+
81+ is CoinbaseOnRampWebError .BillingAddressInvalid -> {
82+ BottomBarManager .showAlert(
83+ title = resources.getString(R .string.error_title_onrampTransactionAvsValidationFailed),
84+ message = resources.getString(R .string.error_description_onrampTransactionAvsValidationFailed),
85+ )
86+ }
87+
88+ is CoinbaseOnRampWebError .InternalFailure -> {
89+ BottomBarManager .showError(
90+ title = resources.getString(R .string.error_title_onrampInternal),
91+ message = resources.getString(R .string.error_description_onrampInternal),
92+ )
93+ }
94+
95+ is CoinbaseOnRampWebError .TransactionFailed -> {
96+ BottomBarManager .showError(
97+ title = resources.getString(R .string.error_title_onrampTransactionFailed),
98+ message = resources.getString(R .string.error_description_onrampTransactionFailed),
99+ )
100+ }
101+
102+ // --- Single-variant errors ---
103+
73104 is CoinbaseOnRampWebError .GuestCardNotDebit -> {
74105 BottomBarManager .showAlert(
75106 title = resources.getString(R .string.error_title_onrampInvalidCard),
76107 message = resources.getString(R .string.error_description_onrampInvalidCard),
77108 )
78109 }
79110
80- is CoinbaseOnRampWebError .GuestRegionMismatch -> {
111+ is CoinbaseOnRampWebError .GuestCardRiskDeclined -> {
81112 BottomBarManager .showAlert(
82- title = resources.getString(R .string.error_title_onrampRegionMismatch),
83- message = resources.getString(R .string.error_description_onrampRegionMismatch),
113+ title = resources.getString(R .string.error_title_onrampCardRiskDeclined),
114+ message = resources.getString(R .string.error_description_onrampCardRiskDeclined),
115+ )
116+ }
117+
118+ is CoinbaseOnRampWebError .GuestPermissionDenied -> {
119+ BottomBarManager .showAlert(
120+ title = resources.getString(R .string.error_title_onrampCardPermissionDenied),
121+ message = resources.getString(R .string.error_description_onrampCardPermissionDenied),
84122 )
85123 }
86124
87- is CoinbaseOnRampWebError .AssetNotTradableInRegion -> {
125+ is CoinbaseOnRampWebError .RegionNotSupported -> {
88126 BottomBarManager .showAlert(
89127 title = resources.getString(R .string.error_title_onrampRegionMismatch),
90128 message = resources.getString(R .string.error_description_onrampRegionMismatch),
91129 )
92130 }
93131
94- is CoinbaseOnRampWebError .GuestGooglePayError -> {
95- BottomBarManager .showError (
96- title = resources.getString(R .string.error_title_onrampTransactionFailed ),
97- message = resources.getString(R .string.error_description_onrampTransactionFailed ),
132+ is CoinbaseOnRampWebError .GuestWeeklyTransactionLimitReached -> {
133+ BottomBarManager .showAlert (
134+ title = resources.getString(R .string.error_title_onrampTransactionLimit ),
135+ message = resources.getString(R .string.error_description_onrampTransactionLimit ),
98136 )
99137 }
100138
101- is CoinbaseOnRampWebError .GuestGooglePayNotReady -> {
139+ is CoinbaseOnRampWebError .GuestTransactionMaxLimitReached -> {
102140 BottomBarManager .showAlert(
103- title = resources.getString(R .string.error_title_onrampGooglePayNotReady ),
104- message = resources.getString(R .string.error_description_onrampGooglePayNotReady ),
141+ title = resources.getString(R .string.error_title_onrampTransactionCount ),
142+ message = resources.getString(R .string.error_description_onrampTransactionCount ),
105143 )
106144 }
107145
108- is CoinbaseOnRampWebError .GuestTransactionBuyFailed -> {
109- BottomBarManager .showError (
110- title = resources.getString(R .string.error_title_onrampTransactionBuyFailed ),
111- message = resources.getString(R .string.error_description_onrampTransactionBuyFailed ),
146+ is CoinbaseOnRampWebError .GuestGooglePayNotReady -> {
147+ BottomBarManager .showAlert (
148+ title = resources.getString(R .string.error_title_onrampGooglePayNotReady ),
149+ message = resources.getString(R .string.error_description_onrampGooglePayNotReady ),
112150 )
113151 }
114152
115- is CoinbaseOnRampWebError .GuestTransactionSendFailed -> {
116- BottomBarManager .showError (
117- title = resources.getString(R .string.error_title_onrampTransactionSendFailed ),
118- message = resources.getString(R .string.error_description_onrampTransactionSendFailed ),
153+ is CoinbaseOnRampWebError .GuestGooglePayNotSupported -> {
154+ BottomBarManager .showAlert (
155+ title = resources.getString(R .string.error_title_onrampGooglePayNotSupported ),
156+ message = resources.getString(R .string.error_description_onrampGooglePayNotSupported ),
119157 )
120158 }
121159
122- is CoinbaseOnRampWebError .GuestTransactionAvsValidationFailed -> {
123- BottomBarManager .showError (
124- title = resources.getString(R .string.error_title_onrampTransactionAvsValidationFailed ),
125- message = resources.getString(R .string.error_description_onrampTransactionAvsValidationFailed ),
160+ is CoinbaseOnRampWebError .GuestCardInsufficientBalance -> {
161+ BottomBarManager .showAlert (
162+ title = resources.getString(R .string.error_title_onrampCardInsufficientBalance ),
163+ message = resources.getString(R .string.error_description_onrampCardInsufficientBalance ),
126164 )
127165 }
128166
129- is CoinbaseOnRampWebError .GuestTransactionTransactionFailed -> {
130- BottomBarManager .showError (
131- title = resources.getString(R .string.error_title_onrampTransactionFailed ),
132- message = resources.getString(R .string.error_description_onrampTransactionFailed ),
167+ is CoinbaseOnRampWebError .GuestCardPrepaidDeclined -> {
168+ BottomBarManager .showAlert (
169+ title = resources.getString(R .string.error_title_onrampCardPrepaidDeclined ),
170+ message = resources.getString(R .string.error_description_onrampCardPrepaidDeclined ),
133171 )
134172 }
135173
136- is CoinbaseOnRampWebError .Internal ,
137- is CoinbaseOnRampWebError .GooglePayButtonNotFound ,
138- is CoinbaseOnRampWebError .WebViewTimeout -> {
139- BottomBarManager .showError(
140- title = resources.getString(R .string.error_title_onrampInternal),
141- message = resources.getString(R .string.error_description_onrampInternal),
174+ is CoinbaseOnRampWebError .InvalidBillingName -> {
175+ BottomBarManager .showAlert(
176+ title = resources.getString(R .string.error_title_onrampInvalidBillingName),
177+ message = resources.getString(R .string.error_description_onrampInvalidBillingName),
142178 )
143179 }
144180
0 commit comments