fix(eims): resolve Addis Ababa addresses against MoR's sub-city tier

MoR's location master has no zone level in a chartered city: CITY_NAME is the
sub-city and LOCALITY_DESC is the numbered woreda. e-Trade fills the gap by
repeating the region in ZONE, pushing the sub-city into CITY_NAME and the
woreda number into LOCALITY_DESC, so every Addis Ababa buyer failed CITY_NAME
lookup and could not be filed at all.

Retry one level down when ZONE repeats the region, accepting it only when
both shifted levels resolve exactly — an unknown zone still fails with its own
message. Match a zero-padded 07 against MoR's own WOREDA 7 spelling, and
add the reviewed AMAHARA / KOLFIE KERANIYO / MISRAK SHOA aliases.

Verified against the dev database: 2 of 40 companies resolved before, 31 after.
This commit is contained in:
Hagernesh
2026-09-01 03:01:56 +00:00
parent 3721ac1ef0
commit dd9f597e01
7 changed files with 269 additions and 17 deletions

View File

@@ -126,6 +126,7 @@ export class EimsInvoiceRegistrationService {
region: invoice.company?.region,
zone: invoice.company?.zone,
woreda: invoice.company?.woreda,
kebele: invoice.company?.kebele,
});
// Authenticate before reserving: the source system comes from the token, and the state row is