Skip to content

Commit

Permalink
Merge pull request #4530 from open-formulieren/issue/4191-more-issues
Browse files Browse the repository at this point in the history
Fix more ZGW registration backend issues
  • Loading branch information
sergei-maertens authored Jul 18, 2024
2 parents 2bb96af + 961122c commit f7c5e64
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 13 additions & 3 deletions src/openforms/registrations/contrib/zgw_apis/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ class ZGWRegistration(BasePlugin):
# "betrokkeneIdentificatie.emailadres": RegistrationAttribute.initiator_emailadres,
# Vestiging
"betrokkeneIdentificatie.vestigingsNummer": RegistrationAttribute.initiator_vestigingsnummer,
"betrokkeneIdentificatie.handelsnaam": RegistrationAttribute.initiator_handelsnaam,
"betrokkeneIdentificatie.handelsnaam": FieldConf(
attribute=RegistrationAttribute.initiator_handelsnaam,
transform=lambda v: [v],
),
# Niet Natuurlijk Persoon
"betrokkeneIdentificatie.statutaireNaam": RegistrationAttribute.initiator_handelsnaam,
"betrokkeneIdentificatie.innNnpId": FieldConf(
Expand Down Expand Up @@ -212,8 +215,15 @@ def register_submission(self, submission: Submission, options: dict) -> dict | N
rol_data["betrokkeneType"] = "natuurlijk_persoon"

if verblijfsadres := betrokkene_identificatie.get("verblijfsadres"):
# GH-4191: Required, can currently be empty.
verblijfsadres["aoaIdentificatie"] = ""
# GH-4191: Required and min length of 1 char, but we don't have a way to get
# this value without trying to look up the other details in the BAG API,
# which would make BAG integration mandatory... this doesn't seem
# intentional. An issue was opened with VNG:
# https://github.com/VNG-Realisatie/gemma-zaken/issues/2451
#
# So, we put a dummy value in here that can be ignored by the received
# party...
verblijfsadres["aoaIdentificatie"] = "OFWORKAROUND"

with (
get_documents_client(zgw) as documents_client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def test_submission_with_zgw_backend_with_natuurlijk_persoon_initiator(self, m):
"geslachtsnaam": "Bar",
"verblijfsadres": {
"aoaPostcode": "1000 AA",
"aoaIdentificatie": "",
"aoaIdentificatie": "OFWORKAROUND",
},
"voorletters": "J.W.",
"geslachtsaanduiding": "m",
Expand Down Expand Up @@ -568,13 +568,13 @@ def test_submission_with_zgw_backend_with_vestiging_and_kvk_initiator(self, m):
self.assertEqual(
create_rol_body["betrokkeneIdentificatie"],
{
"handelsnaam": "ACME",
"handelsnaam": ["ACME"],
"vestigingsNummer": "87654321",
"innNnpId": "12345678",
"statutaireNaam": "ACME",
"verblijfsadres": {
"aoaPostcode": "1000 AA",
"aoaIdentificatie": "",
"aoaIdentificatie": "OFWORKAROUND",
},
},
)
Expand Down Expand Up @@ -851,12 +851,12 @@ def test_submission_with_zgw_backend_with_vestiging_initiator_kvk_only(self, m):
self.assertEqual(
create_rol_body["betrokkeneIdentificatie"],
{
"handelsnaam": "ACME",
"handelsnaam": ["ACME"],
"innNnpId": "12345678",
"statutaireNaam": "ACME",
"verblijfsadres": {
"aoaPostcode": "1000 AA",
"aoaIdentificatie": "",
"aoaIdentificatie": "OFWORKAROUND",
},
},
)
Expand Down

0 comments on commit f7c5e64

Please sign in to comment.