diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/model/codes/Country.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/model/codes/Country.kt index b96aa0e..7555736 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/model/codes/Country.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/model/codes/Country.kt @@ -250,6 +250,6 @@ enum class Country(val alpha2Code: String, val alpha3Code: String?, val englishN Yemen("YE", "YEM", "Yemen"), Zambia("ZM", "ZMB", "Zambia"), Zimbabwe("ZW", "ZWE", "Zimbabwe"), - _1A("1A", null, "Kosovo"), - XI("XI", null, "United Kingdom (Northern Ireland)"), + Kosovo("1A", null, "Kosovo"), + NorthernIreland("XI", null, "United Kingdom (Northern Ireland)"), } \ No newline at end of file diff --git a/e-invoice-spec-parser/src/main/kotlin/net/codinux/invoicing/parser/CodeGenerator.kt b/e-invoice-spec-parser/src/main/kotlin/net/codinux/invoicing/parser/CodeGenerator.kt index 50225ed..f556a6b 100644 --- a/e-invoice-spec-parser/src/main/kotlin/net/codinux/invoicing/parser/CodeGenerator.kt +++ b/e-invoice-spec-parser/src/main/kotlin/net/codinux/invoicing/parser/CodeGenerator.kt @@ -197,7 +197,7 @@ class CodeGenerator { else if (firstColumn == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") return "ExcelSpreadsheet" else if (firstColumn == "application/vnd.oasis.opendocument.spreadsheet") return "OpenDocumentSpreadsheet" - val column = if (type == CodeListType.IsoCountryCodes) i18nRegionsByCode[firstColumn]?.name ?: firstColumn + val column = if (type == CodeListType.IsoCountryCodes) i18nRegionsByCode[firstColumn]?.name ?: fixCountryName(row[2]) else if (type == CodeListType.IsoCurrencyCodes) i18nCurrenciesByCode[firstColumn]?.name ?: fixCurrencyName(row[2]) // as fallback use currency's English name from Zugferd list else if (columns.first().name == "Scheme ID") row[1] // ISO 6523 Scheme Identifier codes else row[0] // default case: the code is in the first column @@ -211,6 +211,11 @@ class CodeGenerator { else name } + private fun fixCountryName(countryName: Any?): String = when (countryName) { + "United Kingdom (Northern Ireland)" -> "NorthernIreland" + else -> countryName.toString() + } + private fun fixCurrencyName(currencyName: Any?): String = when (currencyName) { "Sierra Leone (new valuation 2022)" -> "SierraLeone_NewValuation2022" "BolĂ­var Soberano, new valuation" -> "BolivarSoberano_NewValuation"