Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat: add support for AZN - Azerbaijani Manat currency and Azerbaijani date, amount format, jurisdiction validation rules (#722)

Turkelc16307b19e34
diff --git a/backend/app/api/currencies.py b/backend/app/api/currencies.py
index 4a2193c3..b6603cb4 100644
--- a/backend/app/api/currencies.py
+++ b/backend/app/api/currencies.py
@@ -5,6 +5,7 @@ from app.core.config import get_settings
router = APIRouter(prefix="/api/currencies", tags=["currencies"])
CURRENCY_META = {
+ "AZN": {"symbol": "₼", "name": "Azerbaijani Manat", "flag": "\U0001F1E6\U0001F1FF"},
"BRL": {"symbol": "R$", "name": "Real Brasileiro", "flag": "\U0001F1E7\U0001F1F7"},
"USD": {"symbol": "$", "name": "US Dollar", "flag": "\U0001F1FA\U0001F1F8"},
"EUR": {"symbol": "\u20ac", "name": "Euro", "flag": "\U0001F1EA\U0001F1FA"},
diff --git a/backend/app/core/config.py b/backend/app/core/config.py
index d1868726..ba6961c7 100644
--- a/backend/app/core/config.py
+++ b/backend/app/core/config.py
@@ -66,7 +66,7 @@ class Settings(BaseSettings):
# FX Rates
openexchangerates_app_id: str = ""
- supported_currencies: str = "USD,EUR,GBP,BRL,CAD,AUD,CHF,ARS,JPY,MXN,INR,SEK,DKK,NOK,PLN,CZK,HUF,RON,CRC,IDR,COP,CLP,DOP,RUB,GTQ,PHP,UAH,NZD,VND,SGD" # comma-separated list
+ supported_currencies: str = "USD,EUR,GBP,BRL,CAD,AUD,CHF,ARS,JPY,MXN,INR,SEK,DKK,NOK,PLN,CZK,HUF,RON,CRC,IDR,COP,CLP,DOP,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN" # comma-separated list
fx_sync_mode: str = "on_demand" # "on_demand" or "scheduled"
# Storage
diff --git a/backend/app/fiscal/jurisdictions/az.toml b/backend/app/fiscal/jurisdictions/az.toml
new file mode 100644
index 00000000..83603f3d
--- /dev/null
+++ b/backend/app/fiscal/jurisdictions/az.toml
@@ -0,0 +1,4 @@
+# Azerbaijan. The VÖEN is the taxpayer identification number, issued to
+# companies and individuals alike; ten digits, with no checksum to verify.
+code = "AZ"
+kinds = ["az_voen"]
diff --git a/backend/app/fiscal/registry.py b/backend/app/fiscal/registry.py
index fcca84a5..9e82dda8 100644
--- a/backend/app/fiscal/registry.py
+++ b/backend/app/fiscal/registry.py
@@ -113,6 +113,7 @@ class TaxIdKind(str, Enum):
VN_MST = "vn_mst"
SG_UEN = "sg_uen"
USCC = "uscc"
+ AZ_VOEN = "az_voen"
# The escape hatch. Always offered, never validated.
OTHER = "other"
@@ -209,6 +210,7 @@ KIND_SPECS: dict[TaxIdKind, KindSpec] = {
TaxIdKind.PH_TIN: _spec(TaxIdKind.PH_TIN, "digits", "ph_tin"),
TaxIdKind.VN_MST: _spec(TaxIdKind.VN_MST, "digits", "vn_mst"),
TaxIdKind.SG_UEN: _spec(TaxIdKind.SG_UEN, "upper_alnum", "sg_uen"),
+ TaxIdKind.AZ_VOEN: _spec(TaxIdKind.AZ_VOEN, "digits", "az_voen", "##########"),
TaxIdKind.USCC: _spec(TaxIdKind.USCC, "upper_alnum", "cn_uscc"),
TaxIdKind.OTHER: _spec(TaxIdKind.OTHER, "trim"),
}
diff --git a/backend/app/fiscal/validators.py b/backend/app/fiscal/validators.py
index b2af4347..98fa6487 100644
--- a/backend/app/fiscal/validators.py
+++ b/backend/app/fiscal/validators.py
@@ -490,6 +490,10 @@ def validate_sg_uen(value: str) -> str | None:
return None
return "invalid"
+def validate_az_voen(value: str) -> str | None:
+ """Ten digits. Check for a valid 10-digit format without checksum validation."""
+ return _digits_len(value, 10)
+
def validate_cn_uscc(value: str) -> str | None:
"""Eighteen characters from a restricted alphabet: I, O, S, V and Z are
@@ -541,4 +545,5 @@ VALIDATORS: dict[str, Callable[[str], str | None]] = {
"in_pan": validate_in_pan,
"cn_uscc": validate_cn_uscc,
"sg_uen": validate_sg_uen,
+ "az_voen": validate_az_voen,
}
diff --git a/backend/tests/test_currencies_api.py b/backend/tests/test_currencies_api.py
index db133c86..8f5c6a14 100644
--- a/backend/tests/test_currencies_api.py
+++ b/backend/tests/test_currencies_api.py
@@ -94,3 +94,16 @@ async def test_currencies_include_sgd_with_metadata(client: AsyncClient):
assert sgd["symbol"] == "S$"
assert sgd["name"] == "Singapore Dollar"
assert sgd["flag"] == "🇸🇬"
+
+
+async def test_currencies_include_azn_with_metadata(client: AsyncClient):
+ response = await client.get("/api/currencies")
+ data = response.json()
+
+ azn = next((currency for currency in data if currency["code"] == "AZN"), None)
+
+ assert azn is not None
+ assert azn["symbol"] == "₼"
+ assert azn["name"] == "Azerbaijani Manat"
+ assert azn["flag"] == "🇦🇿"
\ No newline at end of file
diff --git a/backend/tests/test_fiscal_packs_intl.py b/backend/tests/test_fiscal_packs_intl.py
index 1d549046..670bebc5 100644
--- a/backend/tests/test_fiscal_packs_intl.py
+++ b/backend/tests/test_fiscal_packs_intl.py
@@ -99,7 +99,7 @@ def test_the_currencies_the_product_supports_have_a_pack():
# the dollar are shared by many, so they are covered by their members'
# own packs rather than mapped here.
country_of = {
- "BRL": "BR", "GBP": "GB", "JPY": "JP", "CAD": "CA", "AUD": "AU",
+ "AZN": "AZ", "BRL": "BR", "GBP": "GB", "JPY": "JP", "CAD": "CA", "AUD": "AU",
"CHF": "CH", "CNY": "CN", "ARS": "AR", "MXN": "MX", "CLP": "CL",
"COP": "CO", "PEN": "PE", "UYU": "UY", "INR": "IN", "SEK": "SE",
"DKK": "DK", "NOK": "NO", "PLN": "PL", "CZK": "CZ", "HUF": "HU",
diff --git a/backend/tests/test_fiscal_validators_intl.py b/backend/tests/test_fiscal_validators_intl.py
index b889d295..b0361854 100644
--- a/backend/tests/test_fiscal_validators_intl.py
+++ b/backend/tests/test_fiscal_validators_intl.py
@@ -103,6 +103,7 @@ SHAPE_ONLY = [
("ua_edrpou", "00032129", "0003212", "the rule differs by registration range"),
("hu_adoszam", "12345678142", "1234567814", "the published rule covers some years"),
("id_npwp", "012345678901234", "01234567890123", "15 and 16 both circulate"),
+ ("az_voen", "1234567890", "123456789", "the VÖEN check rule is not published"),
]
diff --git a/frontend/src/components/currency-select.tsx b/frontend/src/components/currency-select.tsx
index 8e0f7164..58075862 100644
--- a/frontend/src/components/currency-select.tsx
+++ b/frontend/src/components/currency-select.tsx
@@ -13,6 +13,7 @@ export const CURRENCIES = [
{ code: 'USD', flag: '\u{1F1FA}\u{1F1F8}', symbol: '$' },
{ code: 'EUR', flag: '\u{1F1EA}\u{1F1FA}', symbol: '€' },
{ code: 'GBP', flag: '\u{1F1EC}\u{1F1E7}', symbol: '£' },
+ { code: 'AZN', flag: '\u{1F1E6}\u{1F1FF}', symbol: '₼' },
{ code: 'BRL', flag: '\u{1F1E7}\u{1F1F7}', symbol: 'R$' },
{ code: 'CAD', flag: '\u{1F1E8}\u{1F1E6}', symbol: 'C$' },
{ code: 'AUD', flag: '\u{1F1E6}\u{1F1FA}', symbol: 'A$' },
diff --git a/frontend/src/lib/format.ts b/frontend/src/lib/format.ts
index 87c0e7e7..e07a8e79 100644
--- a/frontend/src/lib/format.ts
+++ b/frontend/src/lib/format.ts
@@ -63,6 +63,7 @@ const CURRENCY_LOCALE: Record<string, string> = {
NZD: 'en-NZ',
VND: 'vi-VN',
SGD: 'en-SG',
+ AZN: 'az-AZ',
}
/**
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index ac8bbf6c..207e5bc4 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -1445,6 +1445,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Andere Länder",
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index 399b06b5..0b12f95b 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -1444,6 +1444,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Other countries",
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index be227178..1b4f3223 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -1445,6 +1445,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Otros países",
diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json
index beb51ba7..83d6f470 100644
--- a/frontend/src/locales/fr.json
+++ b/frontend/src/locales/fr.json
@@ -1445,6 +1445,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Autres pays",
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index 6e5b5f83..360ca3e8 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -1445,6 +1445,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Altri paesi",
diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json
index f9f571c9..7ae49588 100644
--- a/frontend/src/locales/nl.json
+++ b/frontend/src/locales/nl.json
@@ -1445,6 +1445,7 @@
"ph_tin": "FIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Andere landen",
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index 9ac35e95..45d1e563 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -1531,6 +1531,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Inne kraje",
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index a434c369..cc131ad7 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -1445,6 +1445,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Outros países",
diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.json
index 9b552207..080166f7 100644
--- a/frontend/src/locales/pt-PT.json
+++ b/frontend/src/locales/pt-PT.json
@@ -1445,6 +1445,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Outros países",
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index bad6bbae..1f2c3a51 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -1453,6 +1453,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Другие страны",
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index dcf4df8a..1a31367f 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -1453,6 +1453,7 @@
"ph_tin": "TIN",
"vn_mst": "MST",
"sg_uen": "UEN",
+ "az_voen": "VÖEN",
"uscc": "USCC"
},
"otherCountries": "Інші країни",