Skip to content

Commit

Permalink
fix: filter non-iso currencies from currency output (#2131)
Browse files Browse the repository at this point in the history
  • Loading branch information
turip authored Jan 21, 2025
1 parent 5e89491 commit 891bcc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion openmeter/info/httpdriver/currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ func (h *handler) ListCurrencies() ListCurrenciesHandler {
func(ctx context.Context, request ListCurrenciesRequest) (ListCurrenciesResponse, error) {
defs := currency.Definitions()

return lo.Map(defs, func(def *currency.Def, _ int) api.Currency {
return lo.Map(lo.Filter(
defs,
func(def *currency.Def, _ int) bool {
// NOTE: this filters out non-iso currencies such as crypto
return def.ISONumeric != ""
},
), func(def *currency.Def, _ int) api.Currency {
return api.Currency{
Code: api.CurrencyCode(def.ISOCode),
Name: def.Name,
Expand Down

0 comments on commit 891bcc3

Please sign in to comment.