Skip to content

Commit

Permalink
[#233] Update overig constants
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Dec 30, 2024
1 parent e727954 commit cedf302
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2217,8 +2217,8 @@ def test_valid_validation_partij_identificator(self):
"brp",
)

def test_valid_overige_validation_partij_identificator(self):
# Overige no validation
def test_valid_overig_validation_partij_identificator(self):
# Overig no validation
url = reverse("klantinteracties:partijidentificator-list")
partij = PartijFactory.create()
data = {
Expand All @@ -2228,7 +2228,7 @@ def test_valid_overige_validation_partij_identificator(self):
"codeObjecttype": "natuurlijk_persoon",
"codeSoortObjectId": "bsn",
"objectId": 296648875,
"codeRegister": "overige",
"codeRegister": "overig",
},
}
response = self.client.post(url, data)
Expand All @@ -2246,7 +2246,7 @@ def test_valid_overige_validation_partij_identificator(self):
)
self.assertEqual(
response.data["partij_identificator"]["code_register"],
"overige",
"overig",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Migration(migrations.Migration):
("natuurlijk_persoon", "NatuurlijkPersoon"),
("niet_natuurlijk_persoon", "NietNatuurlijkPersoon"),
("vestiging", "Vestiging"),
("overige", "Overige"),
("overig", "Overig"),
],
help_text="Type van het object, bijvoorbeeld: 'NATUURLIJK PERSOON'.",
max_length=200,
Expand All @@ -32,7 +32,7 @@ class Migration(migrations.Migration):
name="partij_identificator_code_register",
field=models.CharField(
blank=True,
choices=[("brp", "BRP"), ("hr", "HR"), ("overige", "Overige")],
choices=[("brp", "BRP"), ("hr", "HR"), ("overig", "Overig")],
help_text="Binnen het landschap van registers unieke omschrijving van het register waarin het object is geregistreerd, bijvoorbeeld: 'BRP'.",
max_length=200,
verbose_name="register",
Expand All @@ -48,7 +48,7 @@ class Migration(migrations.Migration):
("vestigingsnummer", "VestigingsNummer"),
("kvknummer", "KvkNummer"),
("rsin", "Rsin"),
("overige", "Overige"),
("overig", "Overig"),
],
help_text="Naam van de eigenschap die het object identificeert, bijvoorbeeld: 'Bsn'.",
max_length=200,
Expand Down
6 changes: 3 additions & 3 deletions src/openklant/components/klantinteracties/models/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ class PartijIdentificatorCodeSoortObjectId(TextChoices):
vestigingsnummer = "vestigingsnummer", _("VestigingsNummer")
kvknummer = "kvknummer", _("KvkNummer")
rsin = "rsin", _("Rsin")
overige = "overige", _("Overige")
overig = "overig", _("Overig")


class PartijIdentificatorCodeObjectType(TextChoices):
natuurlijk_persoon = "natuurlijk_persoon", _("NatuurlijkPersoon")
niet_natuurlijk_persoon = "niet_natuurlijk_persoon", _("NietNatuurlijkPersoon")
vestiging = "vestiging", _("Vestiging")
overige = "overige", _("Overige")
overig = "overig", _("Overig")


class PartijIdentificatorCodeRegister(TextChoices):
brp = "brp", _("BRP")
hr = "hr", _("HR")
overige = "overige", _("Overige")
overig = "overig", _("Overig")
18 changes: 9 additions & 9 deletions src/openklant/components/klantinteracties/models/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ class PartijIdentificatorValidator:
PartijIdentificatorCodeRegister.brp: {
PartijIdentificatorCodeObjectType.natuurlijk_persoon: [
PartijIdentificatorCodeSoortObjectId.bsn,
PartijIdentificatorCodeSoortObjectId.overige,
PartijIdentificatorCodeSoortObjectId.overig,
],
PartijIdentificatorCodeObjectType.overige: [],
PartijIdentificatorCodeObjectType.overig: [],
},
PartijIdentificatorCodeRegister.hr: {
PartijIdentificatorCodeObjectType.vestiging: [
PartijIdentificatorCodeSoortObjectId.vestigingsnummer,
PartijIdentificatorCodeSoortObjectId.overige,
PartijIdentificatorCodeSoortObjectId.overig,
],
PartijIdentificatorCodeObjectType.niet_natuurlijk_persoon: [
PartijIdentificatorCodeSoortObjectId.rsin,
PartijIdentificatorCodeSoortObjectId.kvknummer,
PartijIdentificatorCodeSoortObjectId.overige,
PartijIdentificatorCodeSoortObjectId.overig,
],
PartijIdentificatorCodeObjectType.overige: [],
PartijIdentificatorCodeObjectType.overig: [],
},
PartijIdentificatorCodeRegister.overige: {},
PartijIdentificatorCodeRegister.overig: {},
}

def __init__(
Expand Down Expand Up @@ -100,7 +100,7 @@ def validate_code_objecttype(self) -> None:

if (
not self.code_register
or self.code_register == PartijIdentificatorCodeRegister.overige
or self.code_register == PartijIdentificatorCodeRegister.overig
):
return

Expand All @@ -120,7 +120,7 @@ def validate_code_soort_object_id(self) -> None:

if (
not self.code_objecttype
or self.code_objecttype == PartijIdentificatorCodeObjectType.overige
or self.code_objecttype == PartijIdentificatorCodeObjectType.overig
):
return

Expand All @@ -143,7 +143,7 @@ def validate_object_id(self) -> None:

if (
not self.code_soort_object_id
or self.code_soort_object_id == PartijIdentificatorCodeSoortObjectId.overige
or self.code_soort_object_id == PartijIdentificatorCodeSoortObjectId.overig
):
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ def test_empty_code_register_ok_code_objecttype(self):
validator = PartijIdentificatorValidator(**data)
validator.validate_code_objecttype()

def test_overige_code_register_ok_code_objecttype(self):
def test_overig_code_register_ok_code_objecttype(self):
data = {
"code_objecttype": PartijIdentificatorCodeObjectType.natuurlijk_persoon.value,
"code_soort_object_id": PartijIdentificatorCodeSoortObjectId.bsn.value,
"object_id": "296648875",
"code_register": PartijIdentificatorCodeRegister.overige.value,
"code_register": PartijIdentificatorCodeRegister.overig.value,
}
validator = PartijIdentificatorValidator(**data)
validator.validate_code_objecttype()
Expand Down Expand Up @@ -147,7 +147,7 @@ def test_code_soort_object_id_not_found_in_code_objecttype(self):

def test_oveirige_code_objecttype_ok_code_soort_object_id(self):
data = {
"code_objecttype": PartijIdentificatorCodeObjectType.overige.value,
"code_objecttype": PartijIdentificatorCodeObjectType.overig.value,
"code_soort_object_id": PartijIdentificatorCodeSoortObjectId.bsn.value,
"object_id": "296648875",
"code_register": PartijIdentificatorCodeRegister.brp.value,
Expand Down Expand Up @@ -177,10 +177,10 @@ def test_empty_code_soort_object_id_ok_object_id(self):
validator = PartijIdentificatorValidator(**data)
validator.validate_object_id()

def test_overige_code_soort_object_id_ok_object_id(self):
def test_overig_code_soort_object_id_ok_object_id(self):
data = {
"code_objecttype": PartijIdentificatorCodeObjectType.natuurlijk_persoon.value,
"code_soort_object_id": "overige",
"code_soort_object_id": "overig",
"object_id": "1123",
"code_register": PartijIdentificatorCodeRegister.brp.value,
}
Expand Down

0 comments on commit cedf302

Please sign in to comment.