diff --git a/Installation/Action/ZgwZaakToZdsXmlEncodeAction.action.json b/Installation/Action/ZgwZaakToZdsXmlEncodeAction.action.json new file mode 100644 index 0000000..bcaf9b5 --- /dev/null +++ b/Installation/Action/ZgwZaakToZdsXmlEncodeAction.action.json @@ -0,0 +1,13 @@ +{ + "title": "ZgwZaakToZdsXmlEncodeAction.action.json", + "$id": "https://dowr.simxml.nl/action/ZgwZaakToZdsXmlEncodeAction.action.json.action.json", + "$schema": "https://docs.commongateway.nl/schemas/Action.schema.json", + "version": "0.0.1", + "listens": [ + "zgwToZds.xmlEncode" + ], + "conditions": { + "==": [1,1] + }, + "class": "CommonGateway\\ZGWToZDSBundle\\ActionHandler\\ZgwToZDSXMLEncodeHandler" +} diff --git a/Installation/Mapping/ZdsLv01ToZgwGeoSearch.mapping.json b/Installation/Mapping/ZdsLv01ToZgwGeoSearch.mapping.json new file mode 100644 index 0000000..9ff5865 --- /dev/null +++ b/Installation/Mapping/ZdsLv01ToZgwGeoSearch.mapping.json @@ -0,0 +1,18 @@ +{ + "$id": "https://zds.vng.nl/mappings/zdsLv01ToZGWGeoSearch.mapping.json", + "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version": "0.0.1", + "title": "ZDS Lv01 to ZGW GeoSearch", + "description": "", + "mapping": { + "rol__betrokkeneIdentificatie__natuurlijkPersoon__inpBsn": "SOAP-ENV:Body.ns2:zakLv01.ns2:gelijk.ns2:heeftAlsInitiator.ns2:gerelateerde.ns2:identificatie", + "identificatie": "SOAP-ENV:Body.ns2:zakLv01.ns2:gelijk.ns2:identificatie", + "expand": "zaaktype,status,resultaat,resultaat.resultaattype,zaakinformatieobjecten,status.statustype" + }, + "unset": [], + "cast": { + "rol__betrokkeneIdentificatie__natuurlijkPersoon__inpBsn": "unsetIfValue==SOAP-ENV:Body.ns2:zakLv01.ns2:gelijk.ns2:heeftAlsInitiator.ns2:gerelateerde.ns2:identificatie", + "identificatie": "unsetIfValue==SOAP-ENV:Body.ns2:zakLv01.ns2:gelijk.ns2:identificatie" + }, + "passTrough": false +} \ No newline at end of file diff --git a/Installation/Mapping/ZgwZaakToZdsResponse.json b/Installation/Mapping/ZgwZaakToZdsResponse.json new file mode 100644 index 0000000..46dba8d --- /dev/null +++ b/Installation/Mapping/ZgwZaakToZdsResponse.json @@ -0,0 +1,32 @@ +{ + "title": "ZgwZaakToZdsResponse", + "$id": "https://zds.nl/mapping/zds.ZgwZaakToZdsResponse.mapping.json", + "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version": "0.0.1", + "passTrough": false, + "mapping": { + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:berichtcode": "La01", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:zender.StUF:organisatie": "SIM", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:zender.StUF:applicatie": "SIMsite", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:zender.StUF:administratie": "", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:zender.StUF:gebruiker": "", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:ontvanger.StUF:organisatie": "1892", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:ontvanger.StUF:applicatie": "Liber", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:ontvanger.StUF:administratie": "", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:ontvanger.StUF:gebruiker": "", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:referentienummer": "identificatie", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:tijdstipBericht": "{{ 'now'|date('YmdHisv') }}", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:stuurgegevens.StUF:entiteittype": "ZAK", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:parameters.StUF:mutatiesoort": "T", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:parameters.StUF:indicatorOvername": "V", + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:antwoord.ZKN:object": "{{ map(\"https://zds.nl/mapping/zds.ZgwZaakToZdsResponseItem.mapping.json\", results, true)|json_encode }}", + "@xmlns:SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/", + "@xmlns:StUF": "http://www.egem.nl/StUF/StUF0301", + "@xmlns:ZKN": "http://www.egem.nl/StUF/sector/zkn/0310", + "@xmlns:ns3": "http://www.egem.nl/StUF/sector/bg/0310", + "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance" + }, + "cast": { + "SOAP-ENV:Body.ZKN:zakLa01.ZKN:antwoord.ZKN:object": ["jsonToArray"] + } +} diff --git a/Installation/Mapping/ZgwZaakToZdsResponseItem.json b/Installation/Mapping/ZgwZaakToZdsResponseItem.json new file mode 100644 index 0000000..be33a0e --- /dev/null +++ b/Installation/Mapping/ZgwZaakToZdsResponseItem.json @@ -0,0 +1,37 @@ +{ + "title": "ZgwZaakToZdsResponseItem", + "$id": "https://zds.nl/mapping/zds.ZgwZaakToZdsResponseItem.mapping.json", + "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version": "0.0.1", + "passTrough": false, + "mapping": { + "@StUF:entiteittype": "ZAK", + "@StUF:sleutelVerzendend": "12004", + "@StUF:sleutelGegevensbeheer": "12004", + "ZKN:identificatie": "identificatie", + "ZKN:omschrijving": "omschrijving", + "ZKN:toelichting": "toelichting", + "ZKN:startdatum": "startdatum", + "ZKN:registratiedatum": "registratiedatum", + "ZKN:publicatiedatum": "publicatiedatum", + "ZKN:einddatumGepland": "einddatumGepland", + "ZKN:uiterlijkeEinddatum": "uiterlijkeEinddatumAfdoening", + "ZKN:betalingsIndicatie": "betalingsindicatie", + "ZKN:laatsteBetaaldatum": "laatsteBetaaldatum", + "ZKN:zaakniveau": "1", + "ZKN:deelzakenIndicatie": "N", + "StUF:extraElementen.StUF:extraElement": "[{% for eigenschap in eigenschappen %}{% if not loop.first %},{% endif %}{{ map('https://zds.nl/mapping/zds.ZgwEigenschapToZds.mapping.json', eigenschap)|json_encode }}{% endfor %}]", + "ZKN:isVan.@StUF:entiteittype": "ZAKZKT", + "ZKN:isVan.@StUF:verwerkingssoort": "T", + "ZKN:isVan.ZKN:gerelateerde.@StUF:entiteittype": "ZKT", + "ZKN:isVan.ZKN:gerelateerde.@StUF:sleutelOntvangend": "5700000000000000000000000000000000000001", + "ZKN:isVan.ZKN:gerelateerde.@StUF:verwerkingssoort": "T", + "ZKN:isVan.ZKN:gerelateerde.ZKN:omschrijving": "Verhuizing doorgeven", + "ZKN:isVan.ZKN:gerelateerde.ZKN:code": "VERDOOR", + "ZKN:heeftAlsInitiator": "{% if rollen.0 is defined %}{{ map(\"https://zds.nl/mapping/zds.ZgwZaakToZdsResponseItemInitiator.mapping.json\", rollen.0)|json_encode }}{% else %}\"\"{% endif %}" + }, + "cast": { + "StUF:extraElementen.StUF:extraElement": "jsonToArray", + "ZKN:heeftAlsInitiator": ["jsonToArray", "unsetIfValue=="] + } +} \ No newline at end of file diff --git a/Installation/Mapping/ZgwZaakToZdsResponseItemInitiator.json b/Installation/Mapping/ZgwZaakToZdsResponseItemInitiator.json new file mode 100644 index 0000000..f636768 --- /dev/null +++ b/Installation/Mapping/ZgwZaakToZdsResponseItemInitiator.json @@ -0,0 +1,32 @@ +{ + "title": "ZgwZaakToZdsResponseItemInitiator", + "$id": "https://zds.nl/mapping/zds.ZgwZaakToZdsResponseItemInitiator.mapping.json", + "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", + "version": "0.0.1", + "passTrough": false, + "mapping": { + "@StUF:entiteittype": "ZAKBTRINI", + "@StUF:verwerkingssoort": "T", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.@StUF:entiteittype": "NPS", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.@StUF:verwerkingssoort": "T", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:inp.bsn": "betrokkeneIdentificatie.inpBsn", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:authentiek.@StUF:metagegeven": "true", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:authentiek": "J", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:geslachtsnaam": "betrokkeneIdentificatie.geslachtsnaam", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:voorvoegselGeslachtsnaam.@xsi:nil": "true", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:voorvoegselGeslachtsnaam": "betrokkeneIdentificatie.voorvoegselGeslachtsnaam", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:voorletters.@xsi:nil": "true", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:voorletters": "betrokkeneIdentificatie.voorletters", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:voornamen": "betrokkeneIdentificatie.voornamen", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:geslachtsaanduiding.@xsi:nil": "true", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:geslachtsaanduiding": "betrokkeneIdentificatie.geslachtsaanduiding", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:geboortedatum": "betrokkeneIdentificatie.geboortedatum", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:wpl.woonplaatsNaam": "betrokkeneIdentificatie.verblijfsadres.wplWoonplaatsNaam", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:gor.openbareRuimteNaam": "betrokkeneIdentificatie.verblijfsadres.gorOpenbareRuimteNaam", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:gor.straatnaam.@xsi:nil": "true", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:aoa.postcode": "betrokkeneIdentificatie.verblijfsadres.aoaPostcode", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:aoa.huisnummer": "betrokkeneIdentificatie.verblijfsadres.aoaHuisnummer", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:aoa.huisletter": "betrokkeneIdentificatie.verblijfsadres.aoaHuisletter", + "ZKN:gerelateerde.ZKN:natuurlijkPersoon.BG:verblijfsadres.BG:aoa.huisnummertoevoeging": "betrokkeneIdentificatie.verblijfsadres.aoaHuisnummertoevoeging" + } +} \ No newline at end of file diff --git a/Installation/Source/zgw.zrc.source.json b/Installation/Source/zgw.zrc.source.json new file mode 100644 index 0000000..3d75af4 --- /dev/null +++ b/Installation/Source/zgw.zrc.source.json @@ -0,0 +1,32 @@ +{ + "title": "ZGW ZRC API", + "$id": "https://zds.vng.nl/endpoints/zgw.zrc.source.json", + "$schema": "https://docs.commongateway.nl/schemas/Gateway.schema.json", + "version": "0.0.1", + "description": "ZGW ZRC source for ZDS proxies", + "location": "!ChangeMe!", + "isEnabled" : false, + "headers": { + "accept" : "application/json", + "Accept-Crs": "EPSG:4326", + "Content-Crs": "EPSG:4326" + }, + "auth": "none", + "configuration": { + "verify": false + }, + "endpointsConfig": { + "/zaken/_zoek": { + "out": { + "body": { + "mapping": "https://zds.vng.nl/mappings/zdsLv01ToZGWGeoSearch.mapping.json" + } + }, + "in": { + "body": { + "mapping": "https://zds.nl/mapping/zds.ZgwZaakToZdsResponse.mapping.json" + } + } + } + } +} \ No newline at end of file diff --git a/Installation/installation.json b/Installation/installation.json index de826dc..470963e 100644 --- a/Installation/installation.json +++ b/Installation/installation.json @@ -1,5 +1,20 @@ { "installationService": "CommonGateway\\ZGWToZDSBundle\\Service\\InstallationService", + "endpoints": { + "sources": [ + { + "name": "ZDS Request Endpoint", + "reference": "https://zds.vng.nl/endpoints/zgw.zrc.source.json", + "path": "stuf/zds/requests", + "methods": [ + "POST" + ], + "throws": [ + "zgwToZds.xmlEncode" + ] + } + ] + }, "actions": { "handlers": [ { diff --git a/README.md b/README.md index 887d789..8ad7f21 100644 --- a/README.md +++ b/README.md @@ -50,21 +50,21 @@ Basic knowledge of the [Common Gateway](https://github.com/CommonGateway) This template is for rapid Symfony bundle development and meant as a model to base your custom plugin on. Follow the next steps to create your plugin within 45 minutes or less -1. Login on [GitHub](https://github.com) -2. Use [this template](https://github.com/CommonGateway/ZGW-to-ZDSBundle/generate) -3. Name your Bundle (CamelCase). The bundle needs to end with `Bundle` as per Symfony [naming](https://symfony.com/doc/current/bundles/best_practices.html#bundles-naming-conventions) conventions. -4. Press the green button `Create repository from template` -5. Update file names and namespace to your fitting : +1. Login on [GitHub](https://github.com) +2. Use [this template](https://github.com/CommonGateway/ZGW-to-ZDSBundle/generate) +3. Name your Bundle (CamelCase). The bundle needs to end with `Bundle` as per Symfony [naming](https://symfony.com/doc/current/bundles/best_practices.html#bundles-naming-conventions) conventions. +4. Press the green button `Create repository from template` +5. Update file names and namespace to your fitting : - * Open composer.json, and change the name to your fitting. The first word should be the namespace, and the second the bundle's name. + * Open composer.json, and change the name to your fitting. The first word should be the namespace, and the second the bundle's name. - > Note: this is kebab-case. Also read: [naming your package](https://packagist.org/about#naming-your-package) + > Note: this is kebab-case. Also read: [naming your package](https://packagist.org/about#naming-your-package) - * Check the autoload field to be set accordingly. - * Open PetStoreBundle.php and change the Bundle `name` and `namespace`. The namespace should be the same as your package name in `composer.json` but in CamelCase. So `common-gateway/pet-store-bundle` becomes `CommonGateway/ZGW-to-ZDSBundle` - * Rename the `/Service` and `/ActionHandler` accordingly (or delete if not used). - * Rename the `/DependencyInjection/PetStoreExtension.php` to your `BundleNameExtension.php` - * Rename the `/Resources/config/services.yaml` namespaces + * Check the autoload field to be set accordingly. + * Open PetStoreBundle.php and change the Bundle `name` and `namespace`. The namespace should be the same as your package name in `composer.json` but in CamelCase. So `common-gateway/pet-store-bundle` becomes `CommonGateway/ZGW-to-ZDSBundle` + * Rename the `/Service` and `/ActionHandler` accordingly (or delete if not used). + * Rename the `/DependencyInjection/PetStoreExtension.php` to your `BundleNameExtension.php` + * Rename the `/Resources/config/services.yaml` namespaces ### Adding schemas @@ -74,16 +74,22 @@ You can add existing schemas or create your own and add them to the`/Schema` fol The following properties are required, and without them, the Gateway won't recognize the schema as valid: - - `version` can start on '0.1.0.' +``` +- `version` can start on '0.1.0.' +``` > without this property, you can't update schemes - - `$schema` (https://docs.commongateway.nl/schemas/Entity.schema.json) - - `$id` (https://example.com/schema/{Your scheme name}.schema.json) +``` +- `$schema` (https://docs.commongateway.nl/schemas/Entity.schema.json) +- `$id` (https://example.com/schema/{Your scheme name}.schema.json) +``` > Unique `$id` to be relatable to other schemas. - - `type` must be 'object' - - `properties` must be schema properties +``` +- `type` must be 'object' +- `properties` must be schema properties +``` Once you add schemas to the repository, you can also add objects/data for those schemas. There is an example shown in the [`/Data`](https://github.com/CommonGateway/ZGW-to-ZDSBundle/tree/main/Data) folder. diff --git a/docs/classes/README.md b/docs/classes/README.md index 87f39f1..c27427b 100644 --- a/docs/classes/README.md +++ b/docs/classes/README.md @@ -1,4 +1,4 @@ # CommonGateway\ZGWToZDSBundle -* [Service\InstallationService](Service/InstallationService.md) -* [Service\ZGWToZDSService](Service/ZGWToZDSService.md) +* [Service\InstallationService](Service/InstallationService.md) +* [Service\ZGWToZDSService](Service/ZGWToZDSService.md) diff --git a/docs/classes/Service/InstallationService.md b/docs/classes/Service/InstallationService.md index 9211ae7..9792b14 100644 --- a/docs/classes/Service/InstallationService.md +++ b/docs/classes/Service/InstallationService.md @@ -1,20 +1,26 @@ -# CommonGateway\ZGWToZDSBundle\Service\InstallationService +# CommonGateway\ZGWToZDSBundle\Service\InstallationService + -## Implements: +## Implements: CommonGateway\CoreBundle\Installer\InstallerInterface + + ## Methods | Name | Description | |------|-------------| -|[\_\_construct](#installationservice__construct)|The constructor| +|[__construct](#installationservice__construct)|The constructor| |[checkDataConsistency](#installationservicecheckdataconsistency)|The actual code run on update and installation of this bundle| |[install](#installationserviceinstall)|Every installation service should implement an install function| |[uninstall](#installationserviceuninstall)|Every installation service should implement an uninstall function| |[update](#installationserviceupdate)|Every installation service should implement an update function| -### InstallationService::\_\_construct + + + +### InstallationService::__construct **Description** @@ -22,22 +28,26 @@ CommonGateway\CoreBundle\Installer\InstallerInterface public __construct (\EntityManagerInterface $entityManager, \LoggerInterface $installationLogger) ``` -The constructor +The constructor + + **Parameters** -* `(\EntityManagerInterface) $entityManager` - : The entity manager. -* `(\LoggerInterface) $installationLogger` - : The installation logger. +* `(\EntityManagerInterface) $entityManager` +: The entity manager. +* `(\LoggerInterface) $installationLogger` +: The installation logger. **Return Values** `void` +
-### InstallationService::checkDataConsistency + +### InstallationService::checkDataConsistency **Description** @@ -45,7 +55,9 @@ The constructor public checkDataConsistency (void) ``` -The actual code run on update and installation of this bundle +The actual code run on update and installation of this bundle + + **Parameters** @@ -55,9 +67,13 @@ The actual code run on update and installation of this bundle `void` + + +
-### InstallationService::install + +### InstallationService::install **Description** @@ -65,7 +81,9 @@ The actual code run on update and installation of this bundle public install (void) ``` -Every installation service should implement an install function +Every installation service should implement an install function + + **Parameters** @@ -75,9 +93,13 @@ Every installation service should implement an install function `void` + + +
-### InstallationService::uninstall + +### InstallationService::uninstall **Description** @@ -85,7 +107,9 @@ Every installation service should implement an install function public uninstall (void) ``` -Every installation service should implement an uninstall function +Every installation service should implement an uninstall function + + **Parameters** @@ -95,9 +119,13 @@ Every installation service should implement an uninstall function `void` + + +
-### InstallationService::update + +### InstallationService::update **Description** @@ -105,7 +133,9 @@ Every installation service should implement an uninstall function public update (void) ``` -Every installation service should implement an update function +Every installation service should implement an update function + + **Parameters** @@ -115,4 +145,8 @@ Every installation service should implement an update function `void` + + +
+ diff --git a/docs/classes/Service/PetStoreService.md b/docs/classes/Service/PetStoreService.md index 659c277..232ba68 100644 --- a/docs/classes/Service/PetStoreService.md +++ b/docs/classes/Service/PetStoreService.md @@ -37,10 +37,10 @@ An example handler that is triggered by an action. **Parameters** -* `(array) $data` - : The data array -* `(array) $configuration` - : The configuration array +* `(array) $data` + : The data array +* `(array) $configuration` + : The configuration array **Return Values** diff --git a/docs/classes/Service/ZGWToZDSService.md b/docs/classes/Service/ZGWToZDSService.md index 4ea0f1d..c293a4c 100644 --- a/docs/classes/Service/ZGWToZDSService.md +++ b/docs/classes/Service/ZGWToZDSService.md @@ -1,16 +1,26 @@ -# CommonGateway\ZGWToZDSBundle\Service\ZGWToZDSService +# CommonGateway\ZGWToZDSBundle\Service\ZGWToZDSService + + + + + + ## Methods | Name | Description | |------|-------------| -|[\_\_construct](#zgwtozdsservice__construct)|| +|[__construct](#zgwtozdsservice__construct)|| |[zgwToZdsHandler](#zgwtozdsservicezgwtozdshandler)|An example handler that is triggered by an action.| |[zgwToZdsIdentificationHandler](#zgwtozdsservicezgwtozdsidentificationhandler)|Creates a ZDS Di02 call to the ZDS source, and takes the identification in the respons as case identifier| |[zgwToZdsInformationObjectHandler](#zgwtozdsservicezgwtozdsinformationobjecthandler)|Translate information objects to Lk01 messages and send them to a source.| |[zgwToZdsObjectIdentificationHandler](#zgwtozdsservicezgwtozdsobjectidentificationhandler)|Creates a ZDS Di02 call to the ZDS source, and takes the identification in the respons as case identifier| +|[zgwToZdsXmlEncodeHandler](#zgwtozdsservicezgwtozdsxmlencodehandler)|Does an xmlEncode on the response data. (temporary solution)| -### ZGWToZDSService::\_\_construct + + + +### ZGWToZDSService::__construct **Description** @@ -18,6 +28,10 @@ __construct (void) ``` + + + + **Parameters** `This function has no parameters.` @@ -26,9 +40,11 @@ `void` +
-### ZGWToZDSService::zgwToZdsHandler + +### ZGWToZDSService::zgwToZdsHandler **Description** @@ -36,14 +52,16 @@ public zgwToZdsHandler (array $data, array $configuration) ``` -An example handler that is triggered by an action. +An example handler that is triggered by an action. + + **Parameters** -* `(array) $data` - : The data array -* `(array) $configuration` - : The configuration array +* `(array) $data` +: The data array +* `(array) $configuration` +: The configuration array **Return Values** @@ -51,9 +69,11 @@ An example handler that is triggered by an action. > A handler must ALWAYS return an array +
-### ZGWToZDSService::zgwToZdsIdentificationHandler + +### ZGWToZDSService::zgwToZdsIdentificationHandler **Description** @@ -61,14 +81,16 @@ An example handler that is triggered by an action. public zgwToZdsIdentificationHandler (array $data, array $configuration) ``` -Creates a ZDS Di02 call to the ZDS source, and takes the identification in the respons as case identifier +Creates a ZDS Di02 call to the ZDS source, and takes the identification in the respons as case identifier + + **Parameters** -* `(array) $data` - : The data from the response. -* `(array) $configuration` - : The configuration for this action. +* `(array) $data` +: The data from the response. +* `(array) $configuration` +: The configuration for this action. **Return Values** @@ -76,9 +98,11 @@ Creates a ZDS Di02 call to the ZDS source, and takes the identification in the r > The resulting data array. +
-### ZGWToZDSService::zgwToZdsInformationObjectHandler + +### ZGWToZDSService::zgwToZdsInformationObjectHandler **Description** @@ -86,14 +110,16 @@ Creates a ZDS Di02 call to the ZDS source, and takes the identification in the r public zgwToZdsInformationObjectHandler (array $data, array $configuration) ``` -Translate information objects to Lk01 messages and send them to a source. +Translate information objects to Lk01 messages and send them to a source. + + **Parameters** -* `(array) $data` - : The data array -* `(array) $configuration` - : The configuration array +* `(array) $data` +: The data array +* `(array) $configuration` +: The configuration array **Return Values** @@ -101,9 +127,11 @@ Translate information objects to Lk01 messages and send them to a source. > The updated data array +
-### ZGWToZDSService::zgwToZdsObjectIdentificationHandler + +### ZGWToZDSService::zgwToZdsObjectIdentificationHandler **Description** @@ -111,14 +139,16 @@ Translate information objects to Lk01 messages and send them to a source. public zgwToZdsObjectIdentificationHandler (array $data, array $configuration) ``` -Creates a ZDS Di02 call to the ZDS source, and takes the identification in the respons as case identifier +Creates a ZDS Di02 call to the ZDS source, and takes the identification in the respons as case identifier + + **Parameters** -* `(array) $data` - : The data from the response. -* `(array) $configuration` - : The configuration for this action. +* `(array) $data` +: The data from the response. +* `(array) $configuration` +: The configuration for this action. **Return Values** @@ -126,4 +156,35 @@ Creates a ZDS Di02 call to the ZDS source, and takes the identification in the r > The resulting data array. + +
+ + +### ZGWToZDSService::zgwToZdsXmlEncodeHandler + +**Description** + +```php +public zgwToZdsXmlEncodeHandler (array $data, array $configuration) +``` + +Does an xmlEncode on the response data. (temporary solution) + + + +**Parameters** + +* `(array) $data` +: The data array. +* `(array) $configuration` +: The configuration array. + +**Return Values** + +`array` + +> The updated data array. + +
+ diff --git a/src/ActionHandler/ZgwToZDSXMLEncodeHandler.php b/src/ActionHandler/ZgwToZDSXMLEncodeHandler.php new file mode 100644 index 0000000..47743c9 --- /dev/null +++ b/src/ActionHandler/ZgwToZDSXMLEncodeHandler.php @@ -0,0 +1,76 @@ +, Wilco Louwerse + * @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 + */ +class ZgwToZDSXMLEncodeHandler implements ActionHandlerInterface +{ + + /** + * The zgw to zds service used by the handler + * + * @var ZGWToZDSService + */ + private ZGWToZDSService $service; + + + /** + * The constructor + * + * @param ZGWToZDSService $service The zgw to zds service + */ + public function __construct(ZGWToZDSService $service) + { + $this->service = $service; + + }//end __construct() + + + /** + * Returns the required configuration as a https://json-schema.org array. + * + * @return array The configuration that this action should comply to + */ + public function getConfiguration(): array + { + return [ + '$id' => 'https://example.com/ActionHandler/ZGWToZDSHandler.ActionHandler.json', + '$schema' => 'https://docs.commongateway.nl/schemas/ActionHandler.schema.json', + 'title' => 'ZGW Zaak to ZDS XmlEncode ActionHandler', + 'description' => 'ZGW Zaak to ZDS XmlEncode ActionHandler', + 'required' => [], + 'properties' => [], + ]; + + }//end getConfiguration() + + + /** + * This function runs the service. + * + * @param array $data The data from the call + * @param array $configuration The configuration of the action + * + * @return array + * + * @SuppressWarnings("unused") Handlers ara strict implementations + */ + public function run(array $data, array $configuration): array + { + + return $this->service->zgwToZdsXmlEncodeHandler($data, $configuration); + + }//end run() + + +}//end class diff --git a/src/Service/ZGWToZDSService.php b/src/Service/ZGWToZDSService.php index 2be65e4..b99e03b 100644 --- a/src/Service/ZGWToZDSService.php +++ b/src/Service/ZGWToZDSService.php @@ -332,4 +332,27 @@ public function zgwToZdsInformationObjectHandler(array $data, array $configurati }//end zgwToZdsInformationObjectHandler() + /** + * Does an xmlEncode on the response data. (temporary solution) + * + * @param array $data The data array. + * @param array $configuration The configuration array. + * + * @return array The updated data array. + */ + public function zgwToZdsXmlEncodeHandler(array $data, array $configuration): array + { + $response = $data['response']; + $responseBody = json_decode($response->getContent(), true); + + $encoder = new XmlEncoder(['xml_root_node_name' => 'SOAP-ENV:Envelope']); + $responseBody = $encoder->encode($responseBody, 'xml'); + + $data['response'] = new Response($responseBody, $response->getStatusCode(), ['content-type' => 'text/xml']); + + return $data; + + }//end zgwToZdsXmlEncodeHandler() + + }//end class