From 156e6685da9abdd471119cb31cccffd79d652c0b Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Mon, 27 Nov 2023 16:15:34 +0100 Subject: [PATCH] Change notification action to zaak create notification action --- ...tifications.NotificationAction.action.json | 23 ++++++++++++++++--- src/Service/NotificationsService.php | 9 ++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Installation/Action/notifications.NotificationAction.action.json b/Installation/Action/notifications.NotificationAction.action.json index 31f19d5..36e7025 100644 --- a/Installation/Action/notifications.NotificationAction.action.json +++ b/Installation/Action/notifications.NotificationAction.action.json @@ -1,12 +1,29 @@ { - "title": "NotificationAction", - "$id": "https://commongateway.nl/action/notifications.NotificationAction.action.json", + "title": "ZaakCreatedAction", + "$id": "https://commongateway.nl/action/notifications.ZaakCreatedAction.action.json", "$schema": "https://docs.commongateway.nl/schemas/Action.schema.json", "version": "0.0.1", "listens": ["notifications.notification.created"], "conditions": { - "==": [1, 1] + "and": [ + { + "==": [ + { + "var": "kanaal" + }, + "zaken" + ] + }, + { + "==": [ + { + "var": "actie" + }, + "create" + ] + } + ] }, "class": "CommonGateway\\CustomerNotificationsBundle\\ActionHandler\\NotificationsHandler", "configuration": { diff --git a/src/Service/NotificationsService.php b/src/Service/NotificationsService.php index 88f2c38..b7ddca6 100644 --- a/src/Service/NotificationsService.php +++ b/src/Service/NotificationsService.php @@ -57,7 +57,8 @@ public function __construct( /** - * @todo + * Handles incoming notification api-call and is responsible for generating a response. + * Might also send an email and/or sms after, etc. * * @param array $data The data array * @param array $configuration The configuration array @@ -66,10 +67,14 @@ public function __construct( */ public function notificationsHandler(array $data, array $configuration): array { + if ($data['method'] !== 'POST') { + return $data; + } + $this->data = $data; $this->configuration = $configuration; - $this->logger->debug("NotificationsService -> notificationsHandler()"); + $this->logger->debug("NotificationsBundler -> NotificationsService -> notificationsHandler()"); return ['response' => 'Hello. Your CustomerNotificationsBundle works'];