Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#3524] Ignore family members without BSN #3561

Merged
merged 6 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/manual/forms/form_fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Gezinsleden
===========

De *Gezinsledenscomponent* toont de namen van alle gezinsleden (partners en/of kinderen) als selectievakjes.
Gezinsleden zonder BSN **worden niet getoond**.
De waarden die naar de registratie backend worden gestuurd zijn de BSNs.

De gegevens voor de gezinsleden worden opgehaald van Haal Centraal BRP Personen Bevragen of StUF-BG. Dit kan in de Admin
Expand Down
7 changes: 7 additions & 0 deletions src/openforms/contrib/haal_centraal/clients/brp.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def _get_children(self, bsn: str) -> list[Person]:

persons = []
for kind in response_data["kinderen"]:
if "burgerservicenummer" not in kind:
continue

name_data = kind["naam"]
person = Person(
bsn=kind["burgerservicenummer"],
Expand All @@ -102,6 +105,9 @@ def _get_partner(self, bsn: str) -> list[Person]:

persons = []
for partner in response_data["partners"]:
if "burgerservicenummer" not in partner:
continue

name_data = partner["naam"]
person = Person(
bsn=partner["burgerservicenummer"],
Expand Down Expand Up @@ -209,6 +215,7 @@ def get_family_members(
),
)
for family_member in family_data
if "burgerservicenummer" in family_member
]
return family_members

Expand Down
121 changes: 121 additions & 0 deletions src/openforms/contrib/haal_centraal/tests/test_brp_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def test_get_kinderen(self):
self.assertEqual(child.name.voorvoegsel, "") # type: ignore
self.assertEqual(child.name.geslachtsnaam, "Kroket") # type: ignore

def test_get_kinderen_no_bsn(self):
with get_brp_client() as client:
children = client.get_family_members(
bsn="999990676", include_children=True, include_partner=False
)

self.assertEqual(len(children), 0) # type: ignore

def test_get_partners(self):
with get_brp_client() as client:
partners = client.get_family_members(
Expand All @@ -116,6 +124,14 @@ def test_get_partners(self):
self.assertEqual(partner.name.voorvoegsel, "") # type: ignore
self.assertEqual(partner.name.geslachtsnaam, "Kroket") # type: ignore

def test_partner_without_bsn(self):
with get_brp_client() as client:
partners = client.get_family_members(
bsn="999990676", include_children=False, include_partner=True
)

self.assertEqual(len(partners), 0) # type: ignore

def test_get_family_members(self):
with get_brp_client() as client:
family_members = client.get_family_members(
Expand Down Expand Up @@ -197,6 +213,36 @@ def test_get_kinderen(self):
)
super().test_get_kinderen()

def test_get_kinderen_no_bsn(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v1/redoc#tag/Ingeschreven-Personen/operation/GetKinderen
self.requests_mock.get(
"https://personen/api/ingeschrevenpersonen/999990676/kinderen",
json={
"_links": {
"self": {
"href": "https://personen/api/ingeschrevenpersonen/999990676/kinderen",
"templated": False,
"title": "",
}
},
"_embedded": {
"kinderen": [
{
"leeftijd": 12,
"naam": {
"geslachtsnaam": "Kroket",
"voorletters": "F.",
"voornamen": "Frieda",
"voorvoegsel": "",
},
"geheimhoudingPersoonsgegevens": True,
}
],
},
},
)
super().test_get_kinderen_no_bsn()

def test_get_partners(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v1/redoc#tag/Ingeschreven-Personen/operation/GetPartners
self.requests_mock.get(
Expand Down Expand Up @@ -226,6 +272,34 @@ def test_get_partners(self):
)
super().test_get_partners()

def test_partner_without_bsn(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v1/redoc#tag/Ingeschreven-Personen/operation/GetPartners
self.requests_mock.get(
"https://personen/api/ingeschrevenpersonen/999990676/partners",
json={
"_links": {
"self": {
"href": "https://personen/api/ingeschrevenpersonen/999990676/partners",
"templated": False,
"title": "",
}
},
"_embedded": {
"partners": [
{
"naam": {
"geslachtsnaam": "Kroket",
"voorletters": "F.",
"voornamen": "Frieda",
"voorvoegsel": "",
},
}
],
},
},
)
super().test_partner_without_bsn()

def test_get_family_members(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v1/redoc#tag/Ingeschreven-Personen/operation/GetPartners
self.requests_mock.get(
Expand Down Expand Up @@ -337,6 +411,30 @@ def test_get_kinderen(self):
)
super().test_get_kinderen()

def test_get_kinderen_no_bsn(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v2/redoc#tag/Personen/operation/Personen
self.requests_mock.post(
"https://personen/api/personen",
json={
"type": "RaadpleegMetBurgerservicenummer",
"personen": [
{
"kinderen": [
{
"naam": {
"voornamen": "Frieda",
"voorvoegsel": "",
"geslachtsnaam": "Kroket",
"voorletters": "F.",
},
}
],
}
],
},
)
super().test_get_kinderen_no_bsn()

def test_get_kinderen_person_not_found_results(self):
# TODO: replace this with VCR and the Docker container of BRP v2
self.requests_mock.post(
Expand Down Expand Up @@ -378,6 +476,29 @@ def test_get_partners(self):
)
super().test_get_partners()

def test_partner_without_bsn(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v2/redoc#tag/Personen/operation/Personen
self.requests_mock.post(
"https://personen/api/personen",
json={
"type": "RaadpleegMetBurgerservicenummer",
"personen": [
{
"partners": [
{
"naam": {
"voornamen": "Jean Marie",
"geslachtsnaam": "Beaudelaire",
"voorletters": "J.M.",
}
}
],
}
],
},
)
super().test_partner_without_bsn()

def test_get_family_members(self):
# https://brp-api.github.io/Haal-Centraal-BRP-bevragen/v2/redoc#tag/Personen/operation/Personen
self.requests_mock.post(
Expand Down
5 changes: 5 additions & 0 deletions src/openforms/js/components/form/np-family-members.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class NpFamilyMembers extends SelectBoxes {
key: 'basic',
label: 'Basic',
components: [
{
type: 'htmlelement',
tag: 'div',
content: 'Note that any family member without a BSN will not be displayed.',
},
SilviaAmAm marked this conversation as resolved.
Show resolved Hide resolved
LABEL_REQUIRED,
KEY,
DESCRIPTION,
Expand Down
1 change: 1 addition & 0 deletions src/openforms/js/lang/formio/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,6 @@
"Translation": "Vertaling",
"The uploaded file is not of an allowed type. It must be: {{ pattern }}.": "Het geuploaded bestand is niet van een toegestaan type. Het moet {{ pattern }} zijn.",
"{{ labels }} or {{ lastLabel }}": "{{ labels }} of {{ lastLabel }}",
"Note that any family member without a BSN will not be displayed.": "Let op, gezinsleden zonder BSN worden niet getoond.",
"": ""
}
Loading