From 37acd7c23bf074106a5731d387584a0dc9865d04 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Mon, 19 Feb 2024 09:12:28 +0100 Subject: [PATCH 01/11] Added some stopwatches --- src/Service/SimTaxService.php | 39 ++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index 8a5c9f8..f8cf96c 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -23,6 +23,7 @@ use DateTime; use DateInterval; use CommonGateway\OpenBelastingBundle\Service\SyncAanslagenService; +use Symfony\Component\Stopwatch\Stopwatch; class SimTaxService { @@ -105,6 +106,8 @@ class SimTaxService "Aanslagbiljet" => "https://openbelasting.nl/schemas/openblasting.aanslagbiljet.schema.json", "BezwaarAanvraag" => "https://openbelasting.nl/schemas/openblasting.bezwaaraanvraag.schema.json", ]; + + private Stopwatch $stopwatch; /** @@ -125,7 +128,8 @@ public function __construct( EntityManagerInterface $entityManager, SyncAanslagenService $syncAanslagenService, EventDispatcherInterface $eventDispatcher, - LoggerInterface $pluginLogger + LoggerInterface $pluginLogger, + Stopwatch $stopwatch ) { $this->resourceService = $resourceService; $this->cacheService = $cacheService; @@ -135,6 +139,7 @@ public function __construct( $this->syncAanslagenService = $syncAanslagenService; $this->logger = $pluginLogger; $this->eventDispatcher = $eventDispatcher; + $this->stopwatch = $stopwatch; $this->configuration = []; $this->data = []; @@ -152,6 +157,8 @@ public function __construct( */ public function simTaxHandler(array $data, array $configuration): array { + $this->stopwatch->start('simTaxHandler', 'sim-tax-to-zgw-bundle'); + $this->data = $data; $this->configuration = $configuration; @@ -184,6 +191,8 @@ public function simTaxHandler(array $data, array $configuration): array $this->logger->warning('Unknown berichtsoort & entiteittype combination, returning bad request error'); $response = $this->createResponse(['Error' => 'Unknown berichtsoort & entiteittype combination'], 400); } + + $this->stopwatch->stop('simTaxHandler'); return ['response' => $response]; @@ -199,6 +208,8 @@ public function simTaxHandler(array $data, array $configuration): array */ public function getAanslagen(array $vraagBericht): Response { + $this->stopwatch->start('getAanslagen', 'sim-tax-to-zgw-bundle'); + $mapping = $this->resourceService->getMapping($this::MAPPING_REFS['GetAanslagen'], $this::PLUGIN_NAME); if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslagen']}."], 501); @@ -246,10 +257,16 @@ public function getAanslagen(array $vraagBericht): Response } $aanslagen['vraagbericht'] = $vraagBericht; - + + $this->stopwatch->start('getAanslagen-mapping', 'sim-tax-to-zgw-bundle'); $responseContext = $this->mappingService->mapping($mapping, $aanslagen); + $this->stopwatch->stop('getAanslagen-mapping'); + + $response = $this->createResponse($responseContext, 200); + + $this->stopwatch->stop('getAanslagen'); - return $this->createResponse($responseContext, 200); + return $response; }//end getAanslagen() @@ -355,6 +372,8 @@ private function getMinMaxYearFilter(array $vraagBericht, string $minYear, ?stri */ public function getAanslag(array $vraagBericht): Response { + $this->stopwatch->start('getAanslag', 'sim-tax-to-zgw-bundle'); + $mapping = $this->resourceService->getMapping($this::MAPPING_REFS['GetAanslag'], $this::PLUGIN_NAME); if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslag']}."], 501); @@ -381,7 +400,11 @@ public function getAanslag(array $vraagBericht): Response $responseContext = $this->mappingService->mapping($mapping, $aanslagen); - return $this->createResponse($responseContext, 200); + $response = $this->createResponse($responseContext, 200); + + $this->stopwatch->stop('getAanslag'); + + return $response; }//end getAanslag() @@ -772,13 +795,19 @@ function (array $beschikkingsregel) use ($beschikkingSleutel) { */ public function createResponse(array $content, int $status): Response { + $this->stopwatch->start('createResponse', 'sim-tax-to-zgw-bundle'); + $this->logger->debug('Creating XML response'); $xmlEncoder = new XmlEncoder(['xml_root_node_name' => 'soapenv:Envelope']); $content['@xmlns:soapenv'] = 'http://schemas.xmlsoap.org/soap/envelope/'; $contentString = $xmlEncoder->encode($content, 'xml', ['xml_encoding' => 'utf-8', 'remove_empty_tags' => true]); $contentString = $this->replaceCdata($contentString); - return new Response($contentString, $status, ['Content-Type' => 'application/soap+xml']); + $response = new Response($contentString, $status, ['Content-Type' => 'application/soap+xml']); + + $this->stopwatch->stop('createResponse'); + + return $response; }//end createResponse() From 97fbf87f25e0f35996de2cbf32d8478a97db2b00 Mon Sep 17 00:00:00 2001 From: GitHub Actions <> Date: Mon, 19 Feb 2024 08:12:55 +0000 Subject: [PATCH 02/11] Update src from PHP Codesniffer --- src/Service/SimTaxService.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index f8cf96c..5ada584 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -106,7 +106,7 @@ class SimTaxService "Aanslagbiljet" => "https://openbelasting.nl/schemas/openblasting.aanslagbiljet.schema.json", "BezwaarAanvraag" => "https://openbelasting.nl/schemas/openblasting.bezwaaraanvraag.schema.json", ]; - + private Stopwatch $stopwatch; @@ -139,7 +139,7 @@ public function __construct( $this->syncAanslagenService = $syncAanslagenService; $this->logger = $pluginLogger; $this->eventDispatcher = $eventDispatcher; - $this->stopwatch = $stopwatch; + $this->stopwatch = $stopwatch; $this->configuration = []; $this->data = []; @@ -158,7 +158,7 @@ public function __construct( public function simTaxHandler(array $data, array $configuration): array { $this->stopwatch->start('simTaxHandler', 'sim-tax-to-zgw-bundle'); - + $this->data = $data; $this->configuration = $configuration; @@ -191,7 +191,7 @@ public function simTaxHandler(array $data, array $configuration): array $this->logger->warning('Unknown berichtsoort & entiteittype combination, returning bad request error'); $response = $this->createResponse(['Error' => 'Unknown berichtsoort & entiteittype combination'], 400); } - + $this->stopwatch->stop('simTaxHandler'); return ['response' => $response]; @@ -209,7 +209,7 @@ public function simTaxHandler(array $data, array $configuration): array public function getAanslagen(array $vraagBericht): Response { $this->stopwatch->start('getAanslagen', 'sim-tax-to-zgw-bundle'); - + $mapping = $this->resourceService->getMapping($this::MAPPING_REFS['GetAanslagen'], $this::PLUGIN_NAME); if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslagen']}."], 501); @@ -257,13 +257,13 @@ public function getAanslagen(array $vraagBericht): Response } $aanslagen['vraagbericht'] = $vraagBericht; - + $this->stopwatch->start('getAanslagen-mapping', 'sim-tax-to-zgw-bundle'); $responseContext = $this->mappingService->mapping($mapping, $aanslagen); $this->stopwatch->stop('getAanslagen-mapping'); - + $response = $this->createResponse($responseContext, 200); - + $this->stopwatch->stop('getAanslagen'); return $response; @@ -373,7 +373,7 @@ private function getMinMaxYearFilter(array $vraagBericht, string $minYear, ?stri public function getAanslag(array $vraagBericht): Response { $this->stopwatch->start('getAanslag', 'sim-tax-to-zgw-bundle'); - + $mapping = $this->resourceService->getMapping($this::MAPPING_REFS['GetAanslag'], $this::PLUGIN_NAME); if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslag']}."], 501); @@ -401,9 +401,9 @@ public function getAanslag(array $vraagBericht): Response $responseContext = $this->mappingService->mapping($mapping, $aanslagen); $response = $this->createResponse($responseContext, 200); - + $this->stopwatch->stop('getAanslag'); - + return $response; }//end getAanslag() @@ -796,7 +796,7 @@ function (array $beschikkingsregel) use ($beschikkingSleutel) { public function createResponse(array $content, int $status): Response { $this->stopwatch->start('createResponse', 'sim-tax-to-zgw-bundle'); - + $this->logger->debug('Creating XML response'); $xmlEncoder = new XmlEncoder(['xml_root_node_name' => 'soapenv:Envelope']); $content['@xmlns:soapenv'] = 'http://schemas.xmlsoap.org/soap/envelope/'; @@ -804,9 +804,9 @@ public function createResponse(array $content, int $status): Response $contentString = $this->replaceCdata($contentString); $response = new Response($contentString, $status, ['Content-Type' => 'application/soap+xml']); - + $this->stopwatch->stop('createResponse'); - + return $response; }//end createResponse() From 51aadc50aaf7ffa1c107056e8c7a7465dd66a1ab Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Tue, 20 Feb 2024 11:10:48 +0100 Subject: [PATCH 03/11] Improved performance for get aanslagen by removing sync logic --- ...mxml.get.aanslag.aanslagregel.mapping.json | 30 ++++----- ...get.aanslag.beschikkingsregel.mapping.json | 14 ++--- .../simxml.get.aanslagen.result.mapping.json | 8 +-- src/Service/SimTaxService.php | 61 ++++++++++++------- 4 files changed, 65 insertions(+), 48 deletions(-) diff --git a/Installation/Mapping/simxml.get.aanslag.aanslagregel.mapping.json b/Installation/Mapping/simxml.get.aanslag.aanslagregel.mapping.json index 9f6365c..881781c 100644 --- a/Installation/Mapping/simxml.get.aanslag.aanslagregel.mapping.json +++ b/Installation/Mapping/simxml.get.aanslag.aanslagregel.mapping.json @@ -2,30 +2,30 @@ "title": "GetAanslagAanslagregel", "$id": "https://dowr.simxml.nl/mapping/simxml.get.aanslag.aanslagregel.mapping.json", "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", - "version": "0.0.5", + "version": "0.0.6", "passTrough": false, "mapping": { "@soortEntiteit": "R", "ASL.@soortEntiteit": "F", - "ASL.belastingJaar": "{{ value.belastingJaar }}", - "ASL.ingangsDatumAanslagRegel": "{{ value.ingangsdatum|date(\"Ymd\") }}", - "ASL.afmeldDatumAanslagRegel": "{{ value.einddatum|date(\"Ymd\") }}", - "ASL.bedragAanslagRegel": "{{ value.bedrag|replace({',' : '.'}) }}", + "ASL.belastingJaar": "{{ belastingJaar }}", + "ASL.ingangsDatumAanslagRegel": "{{ ingangsdatum|date(\"Ymd\") }}", + "ASL.afmeldDatumAanslagRegel": "{{ einddatum|date(\"Ymd\") }}", + "ASL.bedragAanslagRegel": "{{ bedrag|replace({',' : '.'}) }}", "ASL.btwBedragAanslagRegel": "0.00", - "ASL.bedragAanslagRegelExclusiefBtw": "{{ value.bedrag|replace({',' : '.'}) }}", - "ASL.codeBelastingSoort": "{{ value.codeBelastingsoort }}", - "ASL.omschrijvingBelastingSoort": "{{ value.omschrijvingBelastingsoort }}", - "ASL.tariefSoort": "{{ value.codeBelastingtype }}", - "ASL.omschrijvingTariefSoort": "{{ value.omschrijvingBelastingtype }}", + "ASL.bedragAanslagRegelExclusiefBtw": "{{ bedrag|replace({',' : '.'}) }}", + "ASL.codeBelastingSoort": "{{ codeBelastingsoort }}", + "ASL.omschrijvingBelastingSoort": "{{ omschrijvingBelastingsoort }}", + "ASL.tariefSoort": "{{ codeBelastingtype }}", + "ASL.omschrijvingTariefSoort": "{{ omschrijvingBelastingtype }}", "ASL.omschrijvingBelastingObject.@xsi:nil": "true", "ASL.omschrijvingBelastingObject.@StUF:noValue": "geenWaarde", - "ASL.grondslag": "{{ value.heffingsgrondslag }}", + "ASL.grondslag": "{{ heffingsgrondslag }}", "ASL.omschrijvingGrondslag.@xsi:nil": "true", "ASL.omschrijvingGrondslag.@StUF:noValue": "geenWaarde", - "ASL.WOZObjectNummer": "{{ value.wozObjectnummer }}", - "ASL.indicatieBezwaar": "{% if value.bezwaarMogelijk == true %}J{% else %}N{% endif %}", - "ASL.belastingplichtnummer": "{{ value.belastingplichtnummer }}", - "ASL.ASLADR": "{% if value.embedded.adres is defined and value.embedded.adres is not empty %}{% set aanslagregelAdressen = [] %}{% set aanslagregelAdressen = aanslagregelAdressen|merge(value.embedded.adres) %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.adres.mapping.json\", aanslagregelAdressen, true)|json_encode }}{% else %}\"\"{% endif %}" + "ASL.WOZObjectNummer": "{{ wozObjectnummer }}", + "ASL.indicatieBezwaar": "{% if bezwaarMogelijk == true %}J{% else %}N{% endif %}", + "ASL.belastingplichtnummer": "{{ belastingplichtnummer }}", + "ASL.ASLADR": "{% if adres is defined and adres is not empty %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.adres.mapping.json\", adres, true)|json_encode }}{% else %}\"\"{% endif %}" }, "cast": { "ASL.ASLADR": ["jsonToArray", "unsetIfValue=="] diff --git a/Installation/Mapping/simxml.get.aanslag.beschikkingsregel.mapping.json b/Installation/Mapping/simxml.get.aanslag.beschikkingsregel.mapping.json index 80766f7..6cff30c 100644 --- a/Installation/Mapping/simxml.get.aanslag.beschikkingsregel.mapping.json +++ b/Installation/Mapping/simxml.get.aanslag.beschikkingsregel.mapping.json @@ -2,7 +2,7 @@ "title": "GetAanslagBeschikkingsregel", "$id": "https://dowr.simxml.nl/mapping/simxml.get.aanslag.beschikkingsregel.mapping.json", "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", - "version": "0.0.3", + "version": "0.0.4", "passTrough": false, "mapping": { "@soortEntiteit": "R", @@ -12,21 +12,21 @@ "BSK.beginDatumWOZTijdVak": "{{ aanslag.belastingJaar ~ '0101' }}", "BSK.eindDatumWOZTijdVak": "{% set belastingjaar = aanslag.belastingJaar ~ '-01-01' %}{{ belastingjaar|date_modify(\"+1 year\")|date(\"Ymd\") }}", "BSK.waardePeilJaar": "{% set belastingjaar = aanslag.belastingJaar ~ '-01-01' %}{{ belastingjaar|date_modify(\"-1 year\")|date(\"Y\") }}", - "BSK.indicatieBezwaar": "{% if value.bezwaarMogelijk == true %}J{% else %}N{% endif %}", + "BSK.indicatieBezwaar": "{% if bezwaarMogelijk == true %}J{% else %}N{% endif %}", "BSK.extraElementen.StUF:extraElement.0.@naam": "beschikkingSleutel", - "BSK.extraElementen.StUF:extraElement.0.#": "{{ value.sleutelBeschikkingsregel }}", + "BSK.extraElementen.StUF:extraElement.0.#": "{{ sleutelBeschikkingsregel }}", "BSK.BSKWRD.@soortEntiteit": "R", "BSK.BSKWRD.WRD.@soortEntiteit": "F", - "BSK.BSKWRD.WRD.heffingsmaatstafOZB": "{{ value.vastgesteldeWaarde }}", + "BSK.BSKWRD.WRD.heffingsmaatstafOZB": "{{ vastgesteldeWaarde }}", "BSK.BSKWRD.WRD.heffingsmaatstafOZBGebruikers": "0", - "BSK.BSKWRD.WRD.vastgesteldeWaarde": "{{ value.vastgesteldeWaarde }}", + "BSK.BSKWRD.WRD.vastgesteldeWaarde": "{{ vastgesteldeWaarde }}", "BSK.BSKWRD.WRD.waardePeilDatum": "{% set belastingjaar = aanslag.belastingJaar ~ '-01-01' %}{{ belastingjaar|date_modify(\"-1 year\")|date(\"Ymd\") }}", "BSK.BSKWRD.WRD.WRDWOZ.@soortEntiteit": "R", "BSK.BSKWRD.WRD.WRDWOZ.WOZ.@soortEntiteit": "F", - "BSK.BSKWRD.WRD.WRDWOZ.WOZ.WOZObjectNummer": "{{ value.wozObjectnummer }}", + "BSK.BSKWRD.WRD.WRDWOZ.WOZ.WOZObjectNummer": "{{ wozObjectnummer }}", "BSK.BSKWRD.WRD.WRDWOZ.WOZ.omschrijvingWOZObject.@xsi:nil": "true", "BSK.BSKWRD.WRD.WRDWOZ.WOZ.omschrijvingWOZObject.@StUF:noValue": "geenWaarde", - "BSK.BSKWRD.WRD.WRDWOZ.WOZ.WOZADRHFD": "{% if value.embedded.adres is defined and value.embedded.adres is not empty %}{% set beschikkingsregelAdres = [] %}{% set beschikkingsregelAdres = beschikkingsregelAdres|merge(value.embedded.adres) %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.adres.mapping.json\", beschikkingsregelAdres)|json_encode }}{% else %}\"\"{% endif %}" + "BSK.BSKWRD.WRD.WRDWOZ.WOZ.WOZADRHFD": "{% if adres is defined and adres is not empty %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.adres.mapping.json\", adres)|json_encode }}{% else %}\"\"{% endif %}" }, "cast": { "BSK.BSKWRD.WRD.WRDWOZ.WOZ.WOZADRHFD": ["jsonToArray", "unsetIfValue=="] diff --git a/Installation/Mapping/simxml.get.aanslagen.result.mapping.json b/Installation/Mapping/simxml.get.aanslagen.result.mapping.json index b6e5971..0fb7f76 100644 --- a/Installation/Mapping/simxml.get.aanslagen.result.mapping.json +++ b/Installation/Mapping/simxml.get.aanslagen.result.mapping.json @@ -2,7 +2,7 @@ "title": "GetAanslagenResult", "$id": "https://dowr.simxml.nl/mapping/simxml.get.aanslagen.result.mapping.json", "$schema": "https://docs.commongateway.nl/schemas/Mapping.schema.json", - "version": "0.0.7", + "version": "0.0.8", "passTrough": false, "mapping": { "@soortEntiteit": "F", @@ -40,9 +40,9 @@ "BLJARD.0.ARD.keuzeOmschrijvingRedenBezwaar": "Placeholder, to do, make showing bezwaren abstract", "BLJPRS.@soortEntiteit": "R", "BLJPRS.PRS.@soortEntiteit": "F", - "BLJPRS.PRS.bsn-nummer": "{{ value.embedded.belastingplichtige.burgerservicenummer }}", - "BLJASL": "{% if value.embedded.aanslagregels is defined %}{% set aanslagregels = [] %}{% set aanslagregels = aanslagregels|merge(value.embedded.aanslagregels) %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.get.aanslag.aanslagregel.mapping.json\", aanslagregels, true)|json_encode }}{% else %}\"\"{% endif %}", - "BLJBSK": "{% if value.embedded.beschikkingsregels is defined %}{% set beschikkingsregels = [] %}{% set beschikkingsregels = beschikkingsregels|merge(value.embedded.beschikkingsregels) %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.get.aanslag.beschikkingsregel.mapping.json\", {'listInput': beschikkingsregels, 'aanslag': value}, true)|json_encode }}{% else %}\"\"{% endif %}" + "BLJPRS.PRS.bsn-nummer": "{{ value.belastingplichtige.burgerservicenummer }}", + "BLJASL": "{% if value.aanslagregels is defined %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.get.aanslag.aanslagregel.mapping.json\", value.aanslagregels, true)|json_encode }}{% else %}\"\"{% endif %}", + "BLJBSK": "{% if value.beschikkingsregels is defined %}{{ map(\"https://dowr.simxml.nl/mapping/simxml.get.aanslag.beschikkingsregel.mapping.json\", {'listInput': value.beschikkingsregels, 'aanslag': value}, true)|json_encode }}{% else %}\"\"{% endif %}" }, "cast": { "BLJASL": ["jsonToArray", "unsetIfValue=="], diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index 5ada584..b5e4819 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -227,28 +227,37 @@ public function getAanslagen(array $vraagBericht): Response } $filter = $this->getAanslagenFilter($vraagBericht); - - if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { + + // Old gateway filter +// if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { + if (isset($filter['bsn']) === false) { return $this->createResponse(['Error' => "No bsn given."], 501); } - // Sync aanslagen from openbelasting api with given bsn. - $this->syncAanslagenService->fetchAndSyncAanslagen($filter['embedded.belastingplichtige.burgerservicenummer']); + // Sync aanslagen from openbelasting api with given bsn. (The old way didn't use the return value of this function) + $aanslagen['results'] = $this->syncAanslagenService->fetchAndSyncAanslagen($filter['bsn'], $filter['belastingjaar-vanaf']); + // Old filter +// $this->syncAanslagenService->fetchAndSyncAanslagen($filter['embedded.belastingplichtige.burgerservicenummer']); // Make sure we order correctly - $filter['_order']['belastingJaar'] = 'desc'; + // Old gateway filter +// $filter['_order']['belastingJaar'] = 'desc'; + // Old way of getting aanslagen from the gateway itself // Then fetch synced aanslagen through cacheService. - $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); +// $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); // TODO: this is a temporary workaround at the request of SIM // This will set the Aanslag "bezwaarMogelijk" to false if one of it's "aanslagregels" has "bezwaarMogelijk" set to false. foreach ($aanslagen['results'] as $aanslag) { - if (isset($aanslag['embedded']['aanslagregels']) === false) { + // Old gateway/not proxy version with embedded +// if (isset($aanslag['embedded']['aanslagregels']) === false) { + if (isset($aanslag['aanslagregels']) === false) { continue; } - - foreach ($aanslag['embedded']['aanslagregels'] as $aanslagregel) { + // Old gateway/not proxy version with embedded +// foreach ($aanslag['embedded']['aanslagregels'] as $aanslagregel) { + foreach ($aanslag['aanslagregels'] as $aanslagregel) { if ($aanslagregel['bezwaarMogelijk'] == false) { $aanslag['bezwaarMogelijk'] = false; break; @@ -299,30 +308,38 @@ private function getAanslagenFilter(array $vraagBericht): array $minYear = $blj['ns2:extraElementen']['ns1:extraElement']['#']; } + // Old gateway filter // Last key should be the max year - if ($key === array_key_last($vraagBericht['ns2:body']['ns2:BLJ'])) { - $maxYear = $blj['ns2:extraElementen']['ns1:extraElement']['#']; - } +// if ($key === array_key_last($vraagBericht['ns2:body']['ns2:BLJ'])) { +// $maxYear = $blj['ns2:extraElementen']['ns1:extraElement']['#']; +// } } }//end foreach if (isset($minYear) === true) { - $filter = $this->getMinMaxYearFilter($vraagBericht, $minYear, $maxYear); + $filter['belastingjaar-vanaf'] = $minYear; + // Old gateway filter +// $filter = $this->getMinMaxYearFilter($vraagBericht, $minYear, $maxYear); } else { - $this->logger->warning('Could not find a minimal year for bsn: '.($bsn ?? '').' Using current & last year instead for getting Aanslagen'); + // Old warning log +// $this->logger->warning('Could not find a minimal year for bsn: '.($bsn ?? '').' Using current & last year instead for getting Aanslagen'); $filter = []; } + // Old gateway filter, for now default value will be set in the OpenBelastingBundle // If we have no (min/max) belastingJaar filter in the request use this year and the last year for filtering instead. - if (isset($filter['belastingJaar']) === false) { - $dateTime = new DateTime(); - $filter['belastingJaar'][] = $dateTime->format('Y'); - $dateTime->add(DateInterval::createFromDateString('-1 year')); - $filter['belastingJaar'][] = $dateTime->format('Y'); - } - +// if (isset($filter['belastingJaar']) === false) { +// $dateTime = new DateTime(); +// $filter['belastingJaar'][] = $dateTime->format('Y'); +// $dateTime->add(DateInterval::createFromDateString('-1 year')); +// $filter['belastingJaar'][] = $dateTime->format('Y'); +// } + if (isset($bsn)) { - $filter['embedded.belastingplichtige.burgerservicenummer'] = $bsn; + $filter['bsn'] = $bsn; + + // Old gateway filter +// $filter['embedded.belastingplichtige.burgerservicenummer'] = $bsn; } return $filter; From 78ae11014539fe6cf070ebdc4506362fd42fbf48 Mon Sep 17 00:00:00 2001 From: GitHub Actions <> Date: Tue, 20 Feb 2024 10:11:13 +0000 Subject: [PATCH 04/11] Update src from PHP Codesniffer --- src/Service/SimTaxService.php | 45 ++++++++++++++++------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index b5e4819..4f3d0a6 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -227,9 +227,9 @@ public function getAanslagen(array $vraagBericht): Response } $filter = $this->getAanslagenFilter($vraagBericht); - + // Old gateway filter -// if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { + // if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { if (isset($filter['bsn']) === false) { return $this->createResponse(['Error' => "No bsn given."], 501); } @@ -237,26 +237,24 @@ public function getAanslagen(array $vraagBericht): Response // Sync aanslagen from openbelasting api with given bsn. (The old way didn't use the return value of this function) $aanslagen['results'] = $this->syncAanslagenService->fetchAndSyncAanslagen($filter['bsn'], $filter['belastingjaar-vanaf']); // Old filter -// $this->syncAanslagenService->fetchAndSyncAanslagen($filter['embedded.belastingplichtige.burgerservicenummer']); - + // $this->syncAanslagenService->fetchAndSyncAanslagen($filter['embedded.belastingplichtige.burgerservicenummer']); // Make sure we order correctly // Old gateway filter -// $filter['_order']['belastingJaar'] = 'desc'; - + // $filter['_order']['belastingJaar'] = 'desc'; // Old way of getting aanslagen from the gateway itself // Then fetch synced aanslagen through cacheService. -// $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); - + // $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); // TODO: this is a temporary workaround at the request of SIM // This will set the Aanslag "bezwaarMogelijk" to false if one of it's "aanslagregels" has "bezwaarMogelijk" set to false. foreach ($aanslagen['results'] as $aanslag) { // Old gateway/not proxy version with embedded -// if (isset($aanslag['embedded']['aanslagregels']) === false) { + // if (isset($aanslag['embedded']['aanslagregels']) === false) { if (isset($aanslag['aanslagregels']) === false) { continue; } + // Old gateway/not proxy version with embedded -// foreach ($aanslag['embedded']['aanslagregels'] as $aanslagregel) { + // foreach ($aanslag['embedded']['aanslagregels'] as $aanslagregel) { foreach ($aanslag['aanslagregels'] as $aanslagregel) { if ($aanslagregel['bezwaarMogelijk'] == false) { $aanslag['bezwaarMogelijk'] = false; @@ -310,36 +308,35 @@ private function getAanslagenFilter(array $vraagBericht): array // Old gateway filter // Last key should be the max year -// if ($key === array_key_last($vraagBericht['ns2:body']['ns2:BLJ'])) { -// $maxYear = $blj['ns2:extraElementen']['ns1:extraElement']['#']; -// } + // if ($key === array_key_last($vraagBericht['ns2:body']['ns2:BLJ'])) { + // $maxYear = $blj['ns2:extraElementen']['ns1:extraElement']['#']; + // } } }//end foreach if (isset($minYear) === true) { $filter['belastingjaar-vanaf'] = $minYear; // Old gateway filter -// $filter = $this->getMinMaxYearFilter($vraagBericht, $minYear, $maxYear); + // $filter = $this->getMinMaxYearFilter($vraagBericht, $minYear, $maxYear); } else { // Old warning log -// $this->logger->warning('Could not find a minimal year for bsn: '.($bsn ?? '').' Using current & last year instead for getting Aanslagen'); + // $this->logger->warning('Could not find a minimal year for bsn: '.($bsn ?? '').' Using current & last year instead for getting Aanslagen'); $filter = []; } // Old gateway filter, for now default value will be set in the OpenBelastingBundle // If we have no (min/max) belastingJaar filter in the request use this year and the last year for filtering instead. -// if (isset($filter['belastingJaar']) === false) { -// $dateTime = new DateTime(); -// $filter['belastingJaar'][] = $dateTime->format('Y'); -// $dateTime->add(DateInterval::createFromDateString('-1 year')); -// $filter['belastingJaar'][] = $dateTime->format('Y'); -// } - + // if (isset($filter['belastingJaar']) === false) { + // $dateTime = new DateTime(); + // $filter['belastingJaar'][] = $dateTime->format('Y'); + // $dateTime->add(DateInterval::createFromDateString('-1 year')); + // $filter['belastingJaar'][] = $dateTime->format('Y'); + // } if (isset($bsn)) { $filter['bsn'] = $bsn; - + // Old gateway filter -// $filter['embedded.belastingplichtige.burgerservicenummer'] = $bsn; + // $filter['embedded.belastingplichtige.burgerservicenummer'] = $bsn; } return $filter; From 6eb5a450fc17667f475bb77da2d0775550c9becf Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Tue, 20 Feb 2024 15:46:18 +0100 Subject: [PATCH 05/11] Fix for getting a single aanslag --- src/Service/SimTaxService.php | 56 +++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index 4f3d0a6..ba9c608 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -231,7 +231,7 @@ public function getAanslagen(array $vraagBericht): Response // Old gateway filter // if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { if (isset($filter['bsn']) === false) { - return $this->createResponse(['Error' => "No bsn given."], 501); + return $this->createResponse(['Error' => "No bsn given."], 400); } // Sync aanslagen from openbelasting api with given bsn. (The old way didn't use the return value of this function) @@ -285,9 +285,19 @@ public function getAanslagen(array $vraagBericht): Response * * @return array The filters we need to call cacheService->searchObjects with. */ - private function getAanslagenFilter(array $vraagBericht): array + private function getAanslagenFilter(array &$vraagBericht): array { $minYear = $maxYear = null; + + // Make sure ['ns2:body']['ns2:BLJ'] is always an array of items + if (isset($vraagBericht['ns2:body']['ns2:BLJ'][1]) === false) { + $BLJ = $vraagBericht['ns2:body']['ns2:BLJ']; + unset($vraagBericht['ns2:body']['ns2:BLJ']); + + $vraagBericht['ns2:body']['ns2:BLJ'][] = $BLJ; + $vraagBericht['ns2:body']['ns2:BLJ'][] = []; + } + foreach ($vraagBericht['ns2:body']['ns2:BLJ'] as $key => $blj) { if (isset($blj['ns2:BLJPRS']['ns2:PRS']['ns2:bsn-nummer']) === false) { continue; @@ -392,22 +402,50 @@ public function getAanslag(array $vraagBericht): Response if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslag']}."], 501); } + + // (new) Get correct filters for getting all aanslagen + $filter = $this->getAanslagenFilter($vraagBericht); + + // Old gateway filter +// if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { + if (isset($filter['bsn']) === false) { + // (new) We need to check if filter contains bsn + return $this->createResponse(['Error' => "No bsn given."], 400); + } + + // (new) get all aanslagen from source instead of syncing + $aanslagenFromSource = $this->syncAanslagenService->fetchAndSyncAanslagen($filter['bsn'], $filter['belastingjaar-vanaf']); - $filter = []; - if (isset($vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']) === true) { - $filter['aanslagbiljetnummer'] = $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']; +// $filter = []; + if (isset($vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetNummer']) === true || isset($vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']) === true) { + $filter['aanslagbiljetnummer'] = $vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetNummer'] ?? $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']; } - if (isset($vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']) === true) { - $filter['aanslagbiljetvolgnummer'] = $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']; + if (isset($vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetVolgNummer']) === true || isset($vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']) === true) { + $filter['aanslagbiljetvolgnummer'] = $vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetVolgNummer'] ?? $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']; } - $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); + // Old way of finding a single Aanslag object in the gateway +// $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); + + // (new) way of finding a single Aanslag object with aanslagbiljetnummer & aanslagbiljetvolgnummer filters + $aanslagen['count'] = 0; + foreach ($aanslagenFromSource as $aanslag) { + if (isset($filter['aanslagbiljetnummer']) === true + && $filter['aanslagbiljetnummer'] === $aanslag['aanslagbiljetnummer'] + && isset($filter['aanslagbiljetvolgnummer']) === true + && $filter['aanslagbiljetvolgnummer'] === $aanslag['aanslagbiljetvolgnummer'] + ){ + $aanslagen['results'][] = $aanslag; + $aanslagen['count'] = $aanslagen['count'] + 1; + } + } + if ($aanslagen['count'] > 1) { $this->logger->warning('Found more than 1 aanslag with these filters: ', $filter); return $this->createResponse(['Error' => 'Found more than 1 aanslag with these filters', 'Filters' => $filter], 500); } else if ($aanslagen['count'] === 1) { - $aanslagen['result'] = $aanslagen['results'][0]; + $aanslagen['result'] = $aanslagen['results'][0] ?? $aanslagen['results']; } $aanslagen['vraagbericht'] = $vraagBericht; From fdcba8e259676e25281675561193053162ee76a8 Mon Sep 17 00:00:00 2001 From: GitHub Actions <> Date: Tue, 20 Feb 2024 14:46:43 +0000 Subject: [PATCH 06/11] Update src from PHP Codesniffer --- src/Service/SimTaxService.php | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index ba9c608..1afd08c 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -288,16 +288,16 @@ public function getAanslagen(array $vraagBericht): Response private function getAanslagenFilter(array &$vraagBericht): array { $minYear = $maxYear = null; - + // Make sure ['ns2:body']['ns2:BLJ'] is always an array of items if (isset($vraagBericht['ns2:body']['ns2:BLJ'][1]) === false) { $BLJ = $vraagBericht['ns2:body']['ns2:BLJ']; unset($vraagBericht['ns2:body']['ns2:BLJ']); - + $vraagBericht['ns2:body']['ns2:BLJ'][] = $BLJ; $vraagBericht['ns2:body']['ns2:BLJ'][] = []; } - + foreach ($vraagBericht['ns2:body']['ns2:BLJ'] as $key => $blj) { if (isset($blj['ns2:BLJPRS']['ns2:PRS']['ns2:bsn-nummer']) === false) { continue; @@ -402,32 +402,31 @@ public function getAanslag(array $vraagBericht): Response if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslag']}."], 501); } - + // (new) Get correct filters for getting all aanslagen $filter = $this->getAanslagenFilter($vraagBericht); - + // Old gateway filter -// if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { + // if (isset($filter['embedded.belastingplichtige.burgerservicenummer']) === false) { if (isset($filter['bsn']) === false) { // (new) We need to check if filter contains bsn return $this->createResponse(['Error' => "No bsn given."], 400); } - + // (new) get all aanslagen from source instead of syncing $aanslagenFromSource = $this->syncAanslagenService->fetchAndSyncAanslagen($filter['bsn'], $filter['belastingjaar-vanaf']); -// $filter = []; + // $filter = []; if (isset($vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetNummer']) === true || isset($vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']) === true) { - $filter['aanslagbiljetnummer'] = $vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetNummer'] ?? $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']; + $filter['aanslagbiljetnummer'] = ($vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetNummer'] ?? $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetNummer']); } if (isset($vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetVolgNummer']) === true || isset($vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']) === true) { - $filter['aanslagbiljetvolgnummer'] = $vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetVolgNummer'] ?? $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']; + $filter['aanslagbiljetvolgnummer'] = ($vraagBericht['ns2:body']['ns2:OPO']['ns2:aanslagBiljetVolgNummer'] ?? $vraagBericht['ns2:body']['ns2:OPO'][0]['ns2:aanslagBiljetVolgNummer']); } // Old way of finding a single Aanslag object in the gateway -// $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); - + // $aanslagen = $this->cacheService->searchObjects(null, $filter, [$this::SCHEMA_REFS['Aanslagbiljet']]); // (new) way of finding a single Aanslag object with aanslagbiljetnummer & aanslagbiljetvolgnummer filters $aanslagen['count'] = 0; foreach ($aanslagenFromSource as $aanslag) { @@ -435,17 +434,17 @@ public function getAanslag(array $vraagBericht): Response && $filter['aanslagbiljetnummer'] === $aanslag['aanslagbiljetnummer'] && isset($filter['aanslagbiljetvolgnummer']) === true && $filter['aanslagbiljetvolgnummer'] === $aanslag['aanslagbiljetvolgnummer'] - ){ + ) { $aanslagen['results'][] = $aanslag; - $aanslagen['count'] = $aanslagen['count'] + 1; + $aanslagen['count'] = ($aanslagen['count'] + 1); } } - + if ($aanslagen['count'] > 1) { $this->logger->warning('Found more than 1 aanslag with these filters: ', $filter); return $this->createResponse(['Error' => 'Found more than 1 aanslag with these filters', 'Filters' => $filter], 500); } else if ($aanslagen['count'] === 1) { - $aanslagen['result'] = $aanslagen['results'][0] ?? $aanslagen['results']; + $aanslagen['result'] = ($aanslagen['results'][0] ?? $aanslagen['results']); } $aanslagen['vraagbericht'] = $vraagBericht; From 637103a11c784bb2b1f43e8c5801d28b763e58fc Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Tue, 20 Feb 2024 15:47:07 +0100 Subject: [PATCH 07/11] don't need this & here --- src/Service/SimTaxService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index ba9c608..3282699 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -285,7 +285,7 @@ public function getAanslagen(array $vraagBericht): Response * * @return array The filters we need to call cacheService->searchObjects with. */ - private function getAanslagenFilter(array &$vraagBericht): array + private function getAanslagenFilter(array $vraagBericht): array { $minYear = $maxYear = null; From 40bb14522cf93157583b132f01aadc403be4324b Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Tue, 20 Feb 2024 16:52:33 +0100 Subject: [PATCH 08/11] Remove stopwatches --- src/Service/SimTaxService.php | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index 168c420..3bbdffc 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -23,7 +23,6 @@ use DateTime; use DateInterval; use CommonGateway\OpenBelastingBundle\Service\SyncAanslagenService; -use Symfony\Component\Stopwatch\Stopwatch; class SimTaxService { @@ -107,8 +106,6 @@ class SimTaxService "BezwaarAanvraag" => "https://openbelasting.nl/schemas/openblasting.bezwaaraanvraag.schema.json", ]; - private Stopwatch $stopwatch; - /** * @param GatewayResourceService $resourceService The Gateway Resource Service. @@ -128,8 +125,7 @@ public function __construct( EntityManagerInterface $entityManager, SyncAanslagenService $syncAanslagenService, EventDispatcherInterface $eventDispatcher, - LoggerInterface $pluginLogger, - Stopwatch $stopwatch + LoggerInterface $pluginLogger ) { $this->resourceService = $resourceService; $this->cacheService = $cacheService; @@ -139,7 +135,6 @@ public function __construct( $this->syncAanslagenService = $syncAanslagenService; $this->logger = $pluginLogger; $this->eventDispatcher = $eventDispatcher; - $this->stopwatch = $stopwatch; $this->configuration = []; $this->data = []; @@ -157,8 +152,6 @@ public function __construct( */ public function simTaxHandler(array $data, array $configuration): array { - $this->stopwatch->start('simTaxHandler', 'sim-tax-to-zgw-bundle'); - $this->data = $data; $this->configuration = $configuration; @@ -192,8 +185,6 @@ public function simTaxHandler(array $data, array $configuration): array $response = $this->createResponse(['Error' => 'Unknown berichtsoort & entiteittype combination'], 400); } - $this->stopwatch->stop('simTaxHandler'); - return ['response' => $response]; }//end simTaxHandler() @@ -208,8 +199,6 @@ public function simTaxHandler(array $data, array $configuration): array */ public function getAanslagen(array $vraagBericht): Response { - $this->stopwatch->start('getAanslagen', 'sim-tax-to-zgw-bundle'); - $mapping = $this->resourceService->getMapping($this::MAPPING_REFS['GetAanslagen'], $this::PLUGIN_NAME); if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslagen']}."], 501); @@ -265,14 +254,10 @@ public function getAanslagen(array $vraagBericht): Response $aanslagen['vraagbericht'] = $vraagBericht; - $this->stopwatch->start('getAanslagen-mapping', 'sim-tax-to-zgw-bundle'); $responseContext = $this->mappingService->mapping($mapping, $aanslagen); - $this->stopwatch->stop('getAanslagen-mapping'); $response = $this->createResponse($responseContext, 200); - $this->stopwatch->stop('getAanslagen'); - return $response; }//end getAanslagen() @@ -396,8 +381,6 @@ private function getMinMaxYearFilter(array $vraagBericht, string $minYear, ?stri */ public function getAanslag(array $vraagBericht): Response { - $this->stopwatch->start('getAanslag', 'sim-tax-to-zgw-bundle'); - $mapping = $this->resourceService->getMapping($this::MAPPING_REFS['GetAanslag'], $this::PLUGIN_NAME); if ($mapping === null) { return $this->createResponse(['Error' => "No mapping found for {$this::MAPPING_REFS['GetAanslag']}."], 501); @@ -453,8 +436,6 @@ public function getAanslag(array $vraagBericht): Response $response = $this->createResponse($responseContext, 200); - $this->stopwatch->stop('getAanslag'); - return $response; }//end getAanslag() @@ -846,19 +827,13 @@ function (array $beschikkingsregel) use ($beschikkingSleutel) { */ public function createResponse(array $content, int $status): Response { - $this->stopwatch->start('createResponse', 'sim-tax-to-zgw-bundle'); - $this->logger->debug('Creating XML response'); $xmlEncoder = new XmlEncoder(['xml_root_node_name' => 'soapenv:Envelope']); $content['@xmlns:soapenv'] = 'http://schemas.xmlsoap.org/soap/envelope/'; $contentString = $xmlEncoder->encode($content, 'xml', ['xml_encoding' => 'utf-8', 'remove_empty_tags' => true]); $contentString = $this->replaceCdata($contentString); - - $response = new Response($contentString, $status, ['Content-Type' => 'application/soap+xml']); - - $this->stopwatch->stop('createResponse'); - - return $response; + + return new Response($contentString, $status, ['Content-Type' => 'application/soap+xml']); }//end createResponse() From eb096291c0b7d91c9e57c77771e491b5f30698cf Mon Sep 17 00:00:00 2001 From: GitHub Actions <> Date: Tue, 20 Feb 2024 15:52:58 +0000 Subject: [PATCH 09/11] Update src from PHP Codesniffer --- src/Service/SimTaxService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index 3bbdffc..c56b164 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -832,7 +832,7 @@ public function createResponse(array $content, int $status): Response $content['@xmlns:soapenv'] = 'http://schemas.xmlsoap.org/soap/envelope/'; $contentString = $xmlEncoder->encode($content, 'xml', ['xml_encoding' => 'utf-8', 'remove_empty_tags' => true]); $contentString = $this->replaceCdata($contentString); - + return new Response($contentString, $status, ['Content-Type' => 'application/soap+xml']); }//end createResponse() From 780cb4f4b0fd0675e3c0e9b244157e22e78a69b7 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Tue, 20 Feb 2024 17:07:38 +0100 Subject: [PATCH 10/11] inline some $response variables --- src/Service/SimTaxService.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index 3bbdffc..734dae8 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -255,10 +255,8 @@ public function getAanslagen(array $vraagBericht): Response $aanslagen['vraagbericht'] = $vraagBericht; $responseContext = $this->mappingService->mapping($mapping, $aanslagen); - - $response = $this->createResponse($responseContext, 200); - - return $response; + + return $this->createResponse($responseContext, 200); }//end getAanslagen() @@ -433,10 +431,8 @@ public function getAanslag(array $vraagBericht): Response $aanslagen['vraagbericht'] = $vraagBericht; $responseContext = $this->mappingService->mapping($mapping, $aanslagen); - - $response = $this->createResponse($responseContext, 200); - - return $response; + + return $this->createResponse($responseContext, 200); }//end getAanslag() From c4aabab2ba619ad4061bde4ef2932342a7cbebc7 Mon Sep 17 00:00:00 2001 From: GitHub Actions <> Date: Tue, 20 Feb 2024 16:08:02 +0000 Subject: [PATCH 11/11] Update src from PHP Codesniffer --- src/Service/SimTaxService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Service/SimTaxService.php b/src/Service/SimTaxService.php index b71ce2a..108c2e9 100644 --- a/src/Service/SimTaxService.php +++ b/src/Service/SimTaxService.php @@ -255,7 +255,7 @@ public function getAanslagen(array $vraagBericht): Response $aanslagen['vraagbericht'] = $vraagBericht; $responseContext = $this->mappingService->mapping($mapping, $aanslagen); - + return $this->createResponse($responseContext, 200); }//end getAanslagen() @@ -431,7 +431,7 @@ public function getAanslag(array $vraagBericht): Response $aanslagen['vraagbericht'] = $vraagBericht; $responseContext = $this->mappingService->mapping($mapping, $aanslagen); - + return $this->createResponse($responseContext, 200); }//end getAanslag()