Skip to content

Commit

Permalink
Fix notifications, add contact details to rol
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Oct 9, 2024
1 parent fa6a882 commit 2e305b5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"title": "CreateCaseNotification",
"title": "CreateRolNotification",
"$id": "https://commongateway.nl/action/vrijbrp.createCaseNotification.action.json",
"$schema": "https://docs.commongateway.nl/schemas/Action.schema.json",
"version": "0.0.1",
"version": "0.0.2",
"description": "This is an example Action. This action is triggered when commongateway.object.create event is thrown and the data (object) of the event has entity = https://example.com/schema/example.schema.json. In order for this condition to work the ref https://example.com/schema/example.schema.json has to be translated to an id, see installation.json['actions']['fixConfigRef'] for how to do this.",
"listens": [
"commongateway.object.post.create"
Expand All @@ -12,7 +12,7 @@
"==": [
{
"var": "entity.reference"
}, "https://vng.opencatalogi.nl/schemas/zrc.zaak.schema.json"
}, "https://vng.opencatalogi.nl/schemas/zrc.rol.schema.json"
]
},
"class": "CommonGateway\\VrijBRPToZGWBundle\\ActionHandler\\NotificationCaseHandler",
Expand Down
8 changes: 6 additions & 2 deletions Installation/Mapping/vrijbrp.bsnToRol.mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
"title": "BSNToRol",
"$id": "https://commongateway.nl/mapping/vrijbrp.bsnToRol.mapping.json",
"$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json",
"version": "0.0.1",
"version": "0.0.2",
"passTrough": false,
"mapping": {
"_sourceId": "{% if dossierId|default and bsn|default %}{{ dossierId~' '~bsn }}{% endif %}",
"roltype": "roltypeUrl",
"roltoelichting": "persoon",
"contactpersoonRol.emailadres": "contactInformation.email",
"contactpersoonRol.telefoonnummer": "contactInformation.telephoneNumber",
"betrokkeneIdentificatie.inpBsn": "bsn",
"betrokkeneType": "natuurlijk_persoon"
},
"cast": {
"_sourceId": "unsetIfValue==",
"roltype": "unsetIfValue==roltypeUrl",
"betrokkeneIdentificatie.inpBsn": "unsetIfValue==bsn",
"betrokkeneIdentificatie": "unsetIfValue=="
"betrokkeneIdentificatie": "unsetIfValue==",
"contactpersoonRol.emailadres": "unsetIfValue==contactInformation.email",
"contactpersoonRol.telefoonnummer": "unsetIfValue==contactInformation.telephoneNumber"
}
}
4 changes: 2 additions & 2 deletions Installation/Mapping/vrijbrp.dossierToZaakDetail.mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "DossierToZaakDetail",
"$id": "https://commongateway.nl/mapping/vrijbrp.dossierToZaakDetail.mapping.json",
"$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json",
"version": "0.0.1",
"version": "0.0.2",
"passTrough": false,
"mapping": {
"_sourceId": "dossier.dossierId",
Expand All @@ -13,7 +13,7 @@
"zaaktype": "zaaktypeUrl",
"registratiedatum": "dossier.entryDateTime",
"startdatum": "startDate",
"rollen": "[{% if declarant.bsn|default %}{% set bsnArray = {'bsn': declarant.bsn, 'dossierId': dossier.dossierId} %}{% if roltypeUrl|default %}{% set bsnArray = bsnArray|merge({'roltypeUrl': roltypeUrl}) %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.bsnToRol.mapping.json', bsnArray)|json_encode }}{% endif %}]",
"rollen": "[{% if declarant.bsn|default %}{% set bsnArray = declarant|merge({'dossierId': dossier.dossierId}) %}{% if roltypeUrl|default %}{% set bsnArray = bsnArray|merge({'roltypeUrl': roltypeUrl}) %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.bsnToRol.mapping.json', bsnArray)|json_encode }}{% endif %}]",
"zaakinformatieobjecten": "[{% if documents|default %}{% set index = 0 %}{% for document in documents %}{% if index > 0 %}, {% endif %}{% if bronorganisatie|default %}{% set document = document|merge({'bronorganisatie': bronorganisatie}) %}{% endif %}{% if informatieobjecttypeUrl|default %}{% set document = document|merge({'informatieobjecttypeUrl': informatieobjecttypeUrl}) %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.documentToZaakInformatieObject.mapping.json', document)|json_encode }}{% set index = index + 1 %}{% endfor %}{% endif %}]",
"status": "{% if dossier.status|default %}{% if dossier.dossierId|default %}{% set status = dossier.status|merge({'dossierId': dossier.dossierId}) %}{% else %}{% set status = dossier.status %}{% endif %}{{ map('https:\/\/commongateway.nl\/mapping\/vrijbrp.statusToZGWStatus.mapping.json', status)|json_encode }}{% endif %}",
"eigenschappen": "[{\"naam\": \"VERHUISDATUM\", \"waarde\": \"{{ dossier.startDate }}\", \"eigenschap\": {\"_sourceId\": \"VERHUISDATUM\", \"naam\": \"VERHUISDATUM\"}},{\"naam\": \"STRAATNAAM_NIEUW\", \"waarde\": \"{{ newAddress.street }}\", \"eigenschap\": {\"_sourceId\": \"STRAATNAAM_NIEUW\", \"naam\": \"STRAATNAAM_NIEUW\"}},{\"naam\": \"HUISNUMMER_NIEUW\", \"waarde\": \"{{ newAddress.houseNumber }}\", \"eigenschap\": {\"_sourceId\": \"HUISNUMMER_NIEUW\", \"naam\": \"HUISNUMMER_NIEUW\"}},{\"naam\": \"HUISLETTER_NIEUW\", \"waarde\": \"{{ newAddress.houseLetter }}\", \"eigenschap\": {\"_sourceId\": \"HUISLETTER_NIEUW\", \"naam\": \"HUISLETTER_NIEUW\"}},{\"naam\": \"TOEVOEGINGHUISNUMMER_NIEUW\", \"waarde\": \"{{ newAddress.houseNumberAddition }}\", \"eigenschap\": {\"_sourceId\": \"TOEVOEGINGHUISNUMMER_NIEUW\", \"naam\": \"TOEVOEGINGHUISNUMMER_NIEUW\"}},{\"naam\": \"POSTCODE_NIEUW\", \"waarde\": \"{{ newAddress.postalCode }}\", \"eigenschap\": {\"_sourceId\": \"POSTCODE_NIEUW\", \"naam\": \"POSTCODE_NIEUW\"}},{\"naam\": \"WOONPLAATS_NIEUW\", \"waarde\": \"{{ newAddress.residence }}\", \"eigenschap\": {\"_sourceId\": \"WOONPLAATS_NIEUW\", \"naam\": \"WOONPLAATS_NIEUW\"}},{% if newAddress.mainOccupant|default and newAddress.mainOccupant.bsn|default %}{\"naam\": \"BSN_HOOFDBEWONER\", \"waarde\": \"{{ newAddress.mainOccupant.bsn }}\", \"eigenschap\": {\"_sourceId\": \"BSN_HOOFDBEWONER\", \"naam\": \"BSN_HOOFDBEWONER\"}},{% endif %}{% if previousMunicipality.code|default %}{\"naam\": \"GEMEENTECODE\", \"waarde\": \"{{ previousMunicipality.code }}\", \"eigenschap\": {\"_sourceId\": \"GEMEENTECODE\", \"naam\": \"GEMEENTECODE\"}},{% endif %}{% set index = 0 %}{% for relocator in relocators %}{\"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.BSN\", \"waarde\": \"{{ relocator.bsn }}\", \"eigenschap\": {\"_sourceId\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.BSN\", \"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.BSN\"}},{\"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.ROL\", \"waarde\": \"{{ relocator.declarationType }}\", \"eigenschap\": {\"_sourceId\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.ROL\", \"naam\": \"MEEVERHUIZENDE_GEZINSLEDEN.MEEVERHUIZEND_GEZINSLID.{{ index }}.ROL\"}},{% endfor %}{\"naam\": \"AANTAL_PERS_NIEUW_ADRES\", \"waarde\": \"{{ newAddress.numberOfResidents }}\", \"eigenschap\": {\"_sourceId\": \"AANTAL_PERS_NIEUW_ADRES\", \"naam\": \"AANTAL_PERS_NIEUW_ADRES\"}}]"
Expand Down
21 changes: 10 additions & 11 deletions src/Service/VrijBrpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public function createStatusNotification(array $data, array $config): array
$now = new DateTime();
$message = [
'kanaal' => 'zaken',
'hoofdObject' => $objectData['zaak'],
'hoofdObject' => $object->getValue('zaak')->getUri(),
'resource' => 'status',
'resourceUrl' => $objectData['url'],
'resourceUrl' => $object->getUri(),
'actie' => 'create',
'aanmaakdatum' => $now->format('c'),
];
Expand Down Expand Up @@ -154,23 +154,22 @@ public function createCaseNotification(array $data, array $config): array
$object = $data['object'];

if ($object instanceof ObjectEntity === true) {
$array = $object->toArray(['embedded' => true]);

if (in_array(needle: $array['toelichting'], haystack: ['intra_mun_relocation', 'inter_mun_relocation']) === true) {
$object = $this->extendSync($object, $array);
}

$array = $object->toArray(['embedded' => true]);
// $array = $object->toArray(['embedded' => true]);

Check failure on line 157 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Line indented incorrectly; expected at least 12 spaces, found 0

Check failure on line 157 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Expected 1 space before comment text but found 12; use block comment if you need indentation
//

Check failure on line 158 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Line indented incorrectly; expected at least 12 spaces, found 0
// if (in_array(needle: $array['toelichting'], haystack: ['intra_mun_relocation', 'inter_mun_relocation']) === true) {

Check warning on line 159 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 125 characters; contains 129 characters

Check failure on line 159 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Line indented incorrectly; expected at least 12 spaces, found 0
// $object = $this->extendSync($object, $array);
// }

$now = new DateTime();

Check warning on line 163 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Equals sign not aligned with surrounding assignments; expected 5 spaces but found 11 spaces
$message = [

Check warning on line 164 in src/Service/VrijBrpService.php

View workflow job for this annotation

GitHub Actions / build

Equals sign not aligned with surrounding assignments; expected 1 space but found 7 spaces
'kanaal' => 'zaken',
'hoofdObject' => $object->getUri(),
'hoofdObject' => $object->getValue('zaak')->getUri(),
'resource' => 'rol',
'resourceUrl' => $array['embedded']['rollen'][0]['url'],
'resourceUrl' => $object->getUri(),
'actie' => 'create',
'aanmaakdatum' => $now->format('c'),
];

$schema = $this->resourceService->getSchema(
reference: 'https://zgw.opencatalogi.nl/schema/nrc.message.schema.json',
pluginName: 'common-gateway/vrijbrp-to-zgw-bundle'
Expand Down

0 comments on commit 2e305b5

Please sign in to comment.