Skip to content

Replace Price.country with Price.currency using ISO 4217 codes - #225

Merged
bpepple merged 2 commits into
masterfrom
currency
Apr 30, 2026
Merged

Replace Price.country with Price.currency using ISO 4217 codes#225
bpepple merged 2 commits into
masterfrom
currency

Conversation

@bpepple

@bpepple bpepple commented Apr 30, 2026

Copy link
Copy Markdown
Member

The Metron API provides currency codes rather than country codes, so Price.country has been replaced with Price.currency storing ISO 4217 codes (e.g. "USD", "CAD"), defaulting to "USD".

Two helper functions are added to darkseid.metadata:

  • currency_to_country(currency_code) — converts an ISO 4217 code to an ISO 3166-1 alpha-2 country code (e.g. "USD""US")
  • country_to_currency(country_code) — the reverse, used internally when parsing MetronInfo XML

The MetronInfo XML format still uses a country attribute on <Price> elements, so conversion is applied transparently on read and write. Schema validation confirms the output remains valid against the MetronInfo XSD.

The Metron API provides currency codes, not country codes, so Price now stores an ISO 4217 currency field (defaulting to "USD"). Two helpers, currency_to_country() and country_to_currency(), handle conversion when reading/writing MetronInfo XML, which still uses the country attribute.
@bpepple bpepple self-assigned this Apr 30, 2026
@bpepple bpepple added the breaking A breaking API change label Apr 30, 2026
@bpepple
bpepple merged commit e7bfc23 into master Apr 30, 2026
12 checks passed
@bpepple
bpepple deleted the currency branch April 30, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant