Skip to content

Commit

Permalink
[#233] Update naming
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Jan 7, 2025
1 parent 2e39f09 commit 4d6c91d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/openklant/components/klantinteracties/models/validators.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _

from vng_api_common.validators import BaseValidator, validate_bsn, validate_rsin
from vng_api_common.validators import (
BaseIdentifierValidator,
validate_bsn,
validate_rsin,
)

from .constants import (
PartijIdentificatorCodeObjectType,
PartijIdentificatorCodeRegister,
PartijIdentificatorCodeSoortObjectId,
)

VESTIGINGSNUMMER_LENGTH = 12
KVK_NUMMER_LENGTH = 8


class PartijIdentificatorValidator:

Expand Down Expand Up @@ -115,12 +122,18 @@ def validate_object_id(self) -> None:
case PartijIdentificatorCodeSoortObjectId.bsn:
validate_bsn(self.object_id)
case PartijIdentificatorCodeSoortObjectId.vestigingsnummer:
validator = BaseValidator(self.object_id, list_size=[12])
validator = BaseIdentifierValidator(
self.object_id,
identifier_length=VESTIGINGSNUMMER_LENGTH,
)
validator.validate()
case PartijIdentificatorCodeSoortObjectId.rsin:
validate_rsin(self.object_id)
case PartijIdentificatorCodeSoortObjectId.kvk_nummer:
validator = BaseValidator(self.object_id, list_size=[8])
validator = BaseIdentifierValidator(
self.object_id,
identifier_length=KVK_NUMMER_LENGTH,
)
validator.validate()
case PartijIdentificatorCodeSoortObjectId.overig:
return
Expand Down

0 comments on commit 4d6c91d

Please sign in to comment.