Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend: add isHidden property in exchange deals #3178

Merged

Conversation

Beerosagos
Copy link
Collaborator

This allows to hide specific deals in the frontend deals list. e.g. when the exchange offers several payment methods with different fees. The deals are still used to show all the payments and fees in the info box.

label = 'buy.exchange.creditCard';
break;
// case 'sofort':
// case 'bancontact':
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to add icons for sofort and bancontact 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't show them at the moment, lets rethink the badges first before spending time on icons etc.

@Beerosagos Beerosagos marked this pull request as ready for review February 13, 2025 10:37
{isDarkMode ? <Bank /> : <BankDark />}
{t('buy.exchange.bankTransfer')}
</span>
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the return style.

when reading the code, I find it much easier to read also see next comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, I just thought that with other payment methods, it would duplicate too much code, but since we are not adding any other method that's absolutely fine.

return (
<span className={style.paymentMethodName}>
{icon}
{label && t(label)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost the entire codebase uses t('keyname' so it is easy to find again.

but see my other comment, then this variable isn't needed anyway.

label = 'buy.exchange.creditCard';
break;
// case 'sofort':
// case 'bancontact':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't show them at the moment, lets rethink the badges first before spending time on icons etc.

This allows to hide specific deals in the frontend deals list. e.g. when
the exchange offers several payment methods with different fees. The
deals are still used to show all the payments and fees in the info box.
@Beerosagos
Copy link
Collaborator Author

@thisconnect updated, PTAL 🙏

Copy link
Collaborator

@bznein bznein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (mostly looked at the backend, but the frontend looks good to me as well)

@@ -236,7 +239,7 @@ func GetExchangeDeals(account accounts.Interface, regionCode string, action Exch
bestDealIndex := 0
for i, deal := range deals {
oldBestDeal := deals[bestDealIndex]
if deal.Fee < oldBestDeal.Fee {
if !deal.IsHidden && deal.Fee < oldBestDeal.Fee {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[out of scope for this PR] I still think that if we keep the "best" badge we need to decide how to deal with multiple deals offering the same fee

Copy link
Collaborator

@thisconnect thisconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!! tested LGTM

@Beerosagos Beerosagos merged commit 38aeb8e into BitBoxSwiss:staging-btcdirect Feb 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants