Skip to content

Commit

Permalink
[#233] Fix values partij identificatoren
Browse files Browse the repository at this point in the history
[#233] Fix tests

[#233] Install django-digid-eherkenning

[#233] Fix tests

[#233] Improve Validator

[#233] Fix tests

[#233] Isort and Flake8

[#233] Improvements

[#233] Remove django-digid-eherkenning

[#233] Fix requirements

[#233] Fix requirements 2

[#233] Fix tests

[#233] Flake8

[#233] Fix validation errors

[#233] Update class

[#233] Remove unused import

[#233] Update klantinteracties.json and help_text in migrations

[#233] Update overig constants

[#233] Pass variables through constructor

[#233] Change PartijIdentificatorValidator call

[#233] Use validators from vng_api_commons

[#233] Fix import

[#233] Fix validate api

[#233] Fix REGISTERS structure

[#233] Fix tests

[#233] Improve validator

[#233] Fix messages

[#233] Fix Flake

[#233] Update kvk_nummer naming

[#233] Update vestigingsnummer naming

[#233] Update some names

[#233] Update some names

[#233] Update migration file

[#233] Update naming

[#233] Fix test messages

[#233] Fix some tests

[#233] Improve error message

[#233] Fix third level check

[#233] Fix partij_identificator_object_id message

[#233] Fix tests and pre-merge

[#233] Update migrations

[#233] bin/generate_schema_for_component.sh klantinteracties and contactgegevens

[#233] Fix test

[#233] Fix test messages and create new

[#233] Change dict in list
  • Loading branch information
danielmursa-dev committed Jan 17, 2025
1 parent f3aed0d commit dedd953
Show file tree
Hide file tree
Showing 11 changed files with 1,506 additions and 497 deletions.
32 changes: 8 additions & 24 deletions src/openklant/components/contactgegevens/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ components:
format: uri
readOnly: true
description: De unieke URL van deze actor binnen deze API.
minLength: 1
maxLength: 1000
handelsnaam:
type: string
description: De naam waaronder een bedrijf of vestiging handelt.
Expand Down Expand Up @@ -375,18 +377,6 @@ components:
- uuid
OrganisatieAdres:
type: object
description: |-
Generate a serializer out of a GegevensGroepType.
Usage::
>>> class VerlengingSerializer(GegevensGroepSerializer):
... class Meta:
... model = Zaak
... gegevensgroep = 'verlenging'
>>>
Where ``Zaak.verlenging`` is a :class:``GegevensGroepType``.
properties:
nummeraanduidingId:
type: string
Expand Down Expand Up @@ -477,6 +467,8 @@ components:
format: uri
readOnly: true
description: De unieke URL van deze actor binnen deze API.
minLength: 1
maxLength: 1000
handelsnaam:
type: string
description: De naam waaronder een bedrijf of vestiging handelt.
Expand Down Expand Up @@ -523,6 +515,8 @@ components:
format: uri
readOnly: true
description: De unieke URL van deze organisatie binnen deze API.
minLength: 1
maxLength: 1000
geboortedatum:
type: string
format: date
Expand Down Expand Up @@ -587,6 +581,8 @@ components:
format: uri
readOnly: true
description: De unieke URL van deze organisatie binnen deze API.
minLength: 1
maxLength: 1000
geboortedatum:
type: string
format: date
Expand Down Expand Up @@ -641,18 +637,6 @@ components:
- uuid
PersoonAdres:
type: object
description: |-
Generate a serializer out of a GegevensGroepType.
Usage::
>>> class VerlengingSerializer(GegevensGroepSerializer):
... class Meta:
... model = Zaak
... gegevensgroep = 'verlenging'
>>>
Where ``Zaak.verlenging`` is a :class:``GegevensGroepType``.
properties:
nummeraanduidingId:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
Vertegenwoordigden,
)
from openklant.components.klantinteracties.models.rekeningnummers import Rekeningnummer
from openklant.components.klantinteracties.models.validators import (
PartijIdentificatorValidator,
)
from openklant.utils.serializers import get_field_value


class PartijForeignkeyBaseSerializer(serializers.HyperlinkedModelSerializer):
Expand Down Expand Up @@ -399,6 +403,16 @@ class Meta:
},
}

def validate(self, attrs):
partij_identificator = get_field_value(self, attrs, "partij_identificator")
PartijIdentificatorValidator(
code_register=partij_identificator["code_register"],
code_objecttype=partij_identificator["code_objecttype"],
code_soort_object_id=partij_identificator["code_soort_object_id"],
object_id=partij_identificator["object_id"],
).validate()
return super().validate(attrs)

@transaction.atomic
def update(self, instance, validated_data):
if "partij" in validated_data:
Expand Down
29 changes: 17 additions & 12 deletions src/openklant/components/klantinteracties/api/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,16 +694,17 @@ def test_filter_vertegenwoordigde_partij_url(self):
def test_filter_partij_identificator_code_objecttype(self):
partij, partij2 = PartijFactory.create_batch(2)
PartijIdentificatorFactory.create(
partij=partij, partij_identificator_code_objecttype="one"
partij=partij, partij_identificator_code_objecttype="natuurlijk_persoon"
)
PartijIdentificatorFactory.create(
partij=partij2, partij_identificator_code_objecttype="two"
partij=partij2,
partij_identificator_code_objecttype="niet_natuurlijk_persoon",
)

with self.subTest("happy flow"):
response = self.client.get(
self.url,
{"partijIdentificator__codeObjecttype": "two"},
{"partijIdentificator__codeObjecttype": "niet_natuurlijk_persoon"},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)

Expand All @@ -724,16 +725,16 @@ def test_filter_partij_identificator_code_objecttype(self):
def test_filter_identificator_soort_object_id(self):
partij, partij2 = PartijFactory.create_batch(2)
PartijIdentificatorFactory.create(
partij=partij, partij_identificator_code_soort_object_id="one"
partij=partij, partij_identificator_code_soort_object_id="bsn"
)
PartijIdentificatorFactory.create(
partij=partij2, partij_identificator_code_soort_object_id="two"
partij=partij2, partij_identificator_code_soort_object_id="kvk_nummer"
)

with self.subTest("happy flow"):
response = self.client.get(
self.url,
{"partijIdentificator__codeSoortObjectId": "one"},
{"partijIdentificator__codeSoortObjectId": "bsn"},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)

Expand All @@ -756,16 +757,20 @@ def test_filter_identificator_soort_object_id(self):
def test_filter_identificator_object_id(self):
partij, partij2 = PartijFactory.create_batch(2)
PartijIdentificatorFactory.create(
partij=partij, partij_identificator_object_id="one"
partij=partij,
partij_identificator_code_soort_object_id="bsn",
partij_identificator_object_id="296648875",
)
PartijIdentificatorFactory.create(
partij=partij2, partij_identificator_object_id="two"
partij=partij2,
partij_identificator_code_soort_object_id="bsn",
partij_identificator_object_id="111222333",
)

with self.subTest("happy flow"):
response = self.client.get(
self.url,
{"partijIdentificator__objectId": "one"},
{"partijIdentificator__objectId": "296648875"},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)

Expand All @@ -786,16 +791,16 @@ def test_filter_identificator_object_id(self):
def test_filter_identificator_code_register(self):
partij, partij2 = PartijFactory.create_batch(2)
PartijIdentificatorFactory.create(
partij=partij, partij_identificator_code_register="one"
partij=partij, partij_identificator_code_register="brp"
)
PartijIdentificatorFactory.create(
partij=partij2, partij_identificator_code_register="two"
partij=partij2, partij_identificator_code_register="hr"
)

with self.subTest("happy flow"):
response = self.client.get(
self.url,
{"partijIdentificator__code_register": "two"},
{"partijIdentificator__code_register": "hr"},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)

Expand Down
Loading

0 comments on commit dedd953

Please sign in to comment.