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

Add a currency selection management #330

Open
Tirodem opened this issue Jul 14, 2023 · 10 comments
Open

Add a currency selection management #330

Tirodem opened this issue Jul 14, 2023 · 10 comments
Labels
coyote-review need coyote review / estimation before going further

Comments

@Tirodem
Copy link
Contributor

Tirodem commented Jul 14, 2023

Context

Bootik owners can actually choose their currency in backoffice.
image
image
In order to make future adoption easier, it'll be great to be able to add every currency.
But, in term of usability, it's better not to have a too long selector on these UIs.

Proposition

Allow Bootik's owners to choose what currency they want to be displayed on their UI.

Source

https://en.wikipedia.org/wiki/ISO_4217#Active_codes_(List_One)
with https://en.wikipedia.org/wiki/List_of_circulating_currencies#List_of_circulating_currencies_by_state_or_territory for currency symbol to display

UI

On /admin/config/currencies, make this table + a "SAVE" and a "CANCEL" button :
image

  • Put the already selected lines at the top of the table (but don't do it dynamically if you check new currencies, only at the load of the page)
  • Put a 🔒 icon near the currencies used as Main / Secondary / Price reference currency (remove them from selectors as they're actively used could be bothersome & buggy)
    • for them, checkbox will be checked and disabled (no possible interaction from this page)

Rules

  • On currency selector, list selected currencies
    • Order is BTC then alphabetic
@Tirodem Tirodem added the coyote-review need coyote review / estimation before going further label Jul 14, 2023
@coyotte508
Copy link
Collaborator

coyotte508 commented Jul 17, 2023

ok, so, add "backOfficeCurrency" config param

Shouldn't be hard after all the work of #325 , which refactored the codebase to handle multiple currencies easily

@coyotte508
Copy link
Collaborator

Note that we use https://api.coingate.com/v2/rates/merchant/BTC/[CURRENCY] to get the exchange rate, so we're limited by coingate's api

For example https://api.coingate.com/v2/rates/merchant/BTC/XAF doesn't exist, but https://api.coingate.com/v2/rates/merchant/BTC/AED does exist

Same with another API: https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=xaf doesn't exist

@Tirodem
Copy link
Contributor Author

Tirodem commented Jul 17, 2023

Can we use a "rebound" currency ?
If we don't have BTC > XAF conversion, take the BTC > USD then USD > XAF ?

@coyotte508
Copy link
Collaborator

coyotte508 commented Jul 17, 2023

Currently, BTC is our central currency. (eg we do conversions to and from BTC, to convert between EUR & USD for example)

Ideally we'd find another free API with BTC/XAF conversion: https://www.coinbase.com/graphql/query?&operationName=ConversionToolFragmentRefetchQuery&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%22956400996ae3d34bc3dd32796f787226bf7b6e4db19d55e0b0797703b5386cea%22%7D%7D&variables=%7B%22baseSymbol%22%3A%22BTC%22%2C%22country%22%3A%22FR%22%2C%22targetCurrency%22%3A%22XAF%22%7D maybe we could use coinbase's API instead (but it's much less cleaner to query)

@coyotte508
Copy link
Collaborator

coyotte508 commented Jul 17, 2023

Regarding table : it may be better instead to add an autocomplete:

Would probably be the same amount of work and it'd be a component we can reuse later on

@Tirodem
Copy link
Contributor Author

Tirodem commented Jul 17, 2023

Nice & better !
Can it be mixed easily with #32 ?

@coyotte508
Copy link
Collaborator

Nice & better ! Can it be mixed easily with #32 ?

So the bootik owner would be able to select any language, even unsupported, and add product descriptions for them? In that case yes, the component could be reused in the admin interface for the bootik owner to choose additional languages.

@Tirodem
Copy link
Contributor Author

Tirodem commented Jul 17, 2023

That's nice, I wasn't expecting this much.
So far I was juste speaking for the country's name in the selector.
But what you say is fabulous.

@Tirodem
Copy link
Contributor Author

Tirodem commented Jul 17, 2023

Note that we use https://api.coingate.com/v2/rates/merchant/BTC/[CURRENCY] to get the exchange rate, so we're limited by coingate's api

For example https://api.coingate.com/v2/rates/merchant/BTC/XAF doesn't exist, but https://api.coingate.com/v2/rates/merchant/BTC/AED does exist

Same with another API: https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=xaf doesn't exist

Can you take a look to this ? https://yadio.io/api.html
Found it by checking Phoenix wallet code on Github ( https://github.com/ACINQ/phoenix/blob/406895f2430fbe2f93df55018ebf28c9e2aaf627/phoenix-shared/src/commonMain/kotlin/fr.acinq.phoenix/data/ExchangeRates.kt )

@ffmad any opinion about Yadio or a good "light side" API ?

@Tirodem
Copy link
Contributor Author

Tirodem commented Jul 17, 2023

Concerning Yadio, here's their way of processing the BTC rate:
image
So as it's BTC to USD and the reverse, we might be able to do a chain with conversion from USD to any other currency with a non-BTC currency API, but the one I found are paying after a certain amount of request.
BTW, Yadio also tells this :
image
Maybe we can make a shortlist of currencies, check and ask them for the missing ones...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coyote-review need coyote review / estimation before going further
Projects
None yet
Development

No branches or pull requests

2 participants