diff --git a/backend/coins/btc/handlers/handlers.go b/backend/coins/btc/handlers/handlers.go index decf55002b..1b55a99f16 100644 --- a/backend/coins/btc/handlers/handlers.go +++ b/backend/coins/btc/handlers/handlers.go @@ -875,7 +875,7 @@ func (handlers *Handlers) getHasPaymentRequest(r *http.Request) (interface{}, er if !ok { return response{ Success: false, - ErrorMessage: "An account must be BTC based to support payment requests.", + ErrorMessage: "", }, nil } diff --git a/frontends/web/src/locales/en/app.json b/frontends/web/src/locales/en/app.json index 10d29c96c5..ab94530c73 100644 --- a/frontends/web/src/locales/en/app.json +++ b/frontends/web/src/locales/en/app.json @@ -637,7 +637,6 @@ }, "device": { "appUpradeRequired": "Your BitBox is not compatible with this desktop application. Please download and install the latest version.", - "firmwareUpgradeRequired": "A firmware update is required to make use of this feature.", "keystoreConnected": "Connected wallet", "unsupportedFeature": "This feature is not available on this device." }, @@ -759,6 +758,7 @@ "exchange": { "buySell": { "coinNotSupported": "No options available for this coin type.", + "firmwareUpgradeRequired": "A firmware update is required to use all options.", "regionNotSupported": "No options available for this region.", "updateNow": "Update now" }, diff --git a/frontends/web/src/routes/exchange/components/buysell.tsx b/frontends/web/src/routes/exchange/components/buysell.tsx index 3780d1c337..8a8f0c5b21 100644 --- a/frontends/web/src/routes/exchange/components/buysell.tsx +++ b/frontends/web/src/routes/exchange/components/buysell.tsx @@ -70,7 +70,6 @@ export const BuySell = ({ setPaymentRequestError(action === 'sell' && hasPaymentRequestResponse?.success === false); }, [hasPaymentRequestResponse, action]); - useEffect(() => { if (config) { setAgreedBTCDirectOTCTerms(config.frontend.skipBTCDirectOTCDisclaimer); @@ -84,9 +83,12 @@ export const BuySell = ({ } return exchangeDealsResponse.errorMessage; } else if (paymentRequestError) { - if (hasPaymentRequestResponse?.errorCode) { - return t('device.' + hasPaymentRequestResponse.errorCode); - } else { + switch (hasPaymentRequestResponse?.errorCode) { + case 'firmwareUpgradeRequired': + return t('exchange.buySell.firmwareUpgradeRequired'); + case 'unsupportedFeature': + return t('device.unsupportedFeature'); + default: return hasPaymentRequestResponse?.errorMessage || ''; } } @@ -106,24 +108,7 @@ export const BuySell = ({
{!exchangeDealsResponse && } - {exchangeDealsResponse?.success === false || paymentRequestError ? ( -
-

{constructErrorMessage()}

- {exchangeDealsResponse?.success && - paymentRequestError && - hasPaymentRequestResponse?.errorCode === 'firmwareUpgradeRequired' && ( - - )} -
- ) : ( + {exchangeDealsResponse?.success && (
{exchangeDealsResponse?.exchanges // skip the exchanges that have only hidden deals. @@ -146,6 +131,28 @@ export const BuySell = ({ ))}
)} + + {(exchangeDealsResponse?.success === false || paymentRequestError) && ( +
+

+ {constructErrorMessage()} +

+ {exchangeDealsResponse?.success && + paymentRequestError && + hasPaymentRequestResponse?.errorCode === 'firmwareUpgradeRequired' && ( + + )} +
+ )} + {btcDirectOTCSupported?.success && btcDirectOTCSupported?.supported && (
}>