diff --git a/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/DefaultEventNotificationGenerator.java b/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/DefaultEventNotificationGenerator.java index 1a62cc22..4ec4c6d4 100644 --- a/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/DefaultEventNotificationGenerator.java +++ b/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/DefaultEventNotificationGenerator.java @@ -28,7 +28,6 @@ import org.wso2.financial.services.accelerator.event.notifications.service.model.Notification; import org.wso2.financial.services.accelerator.event.notifications.service.model.NotificationEvent; import org.wso2.financial.services.accelerator.event.notifications.service.model.NotificationResponse; -import org.wso2.financial.services.accelerator.event.notifications.service.util.EventNotificationServiceUtil; import java.time.Instant; import java.util.List; @@ -67,9 +66,8 @@ public NotificationResponse generateEventNotificationBody(Notification notificat @Generated(message = "Excluded from tests as using a util method from a different package") public String generateEventNotification(JsonNode jsonNode) throws FSEventNotificationException { - String payload = EventNotificationServiceUtil.getCustomNotificationPayload(jsonNode); try { - return JWTUtils.signJWTWithDefaultKey(payload); + return JWTUtils.signJWTWithDefaultKey(jsonNode.toString()); } catch (Exception e) { log.error("Error while signing the JWT token", e); throw new FSEventNotificationException("Error while signing the JWT token", e); diff --git a/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/handler/DefaultEventSubscriptionServiceHandler.java b/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/handler/DefaultEventSubscriptionServiceHandler.java index 6c2fe760..7488ec42 100644 --- a/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/handler/DefaultEventSubscriptionServiceHandler.java +++ b/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/handler/DefaultEventSubscriptionServiceHandler.java @@ -70,7 +70,7 @@ public EventSubscriptionResponse createEventSubscription(EventSubscriptionDTO ev return eventSubscriptionResponse; } catch (FSEventNotificationException e) { log.error("Error occurred while creating event subscription", e); - throw new FSEventNotificationException(HttpStatus.SC_BAD_REQUEST, e.getMessage(), e); + throw new FSEventNotificationException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage(), e); } } @@ -204,7 +204,7 @@ public EventSubscriptionResponse updateEventSubscription(EventSubscriptionDTO ev return eventSubscriptionResponse; } catch (FSEventNotificationException e) { log.error("Error occurred while updating event subscription", e); - throw new FSEventNotificationException(HttpStatus.SC_BAD_REQUEST, e.getMessage(), e); + throw new FSEventNotificationException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage(), e); } } @@ -234,7 +234,7 @@ public EventSubscriptionResponse deleteEventSubscription(String clientId, String return eventSubscriptionResponse; } catch (FSEventNotificationException e) { log.error("Error occurred while deleting event subscription", e); - throw new FSEventNotificationException(HttpStatus.SC_BAD_REQUEST, e.getMessage(), e); + throw new FSEventNotificationException(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage(), e); } } diff --git a/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/util/EventNotificationServiceUtil.java b/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/util/EventNotificationServiceUtil.java index 94427176..b3916f14 100644 --- a/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/util/EventNotificationServiceUtil.java +++ b/financial-services-accelerator/components/org.wso2.financial.services.accelerator.event.notifications.service/src/main/java/org/wso2/financial/services/accelerator/event/notifications/service/util/EventNotificationServiceUtil.java @@ -18,7 +18,6 @@ package org.wso2.financial.services.accelerator.event.notifications.service.util; -import com.fasterxml.jackson.databind.JsonNode; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -72,17 +71,6 @@ public static EventNotificationGenerator getEventNotificationGenerator() { // return realtimeEventNotificationRequestGenerator; // } - /** - * Method to modify event notification payload with custom eventValues. - * - * @param jsonNode Json Node to convert - * @return String eventNotificationPayload - */ - public static String getCustomNotificationPayload(JsonNode jsonNode) { - - return jsonNode.toString(); - } - /** * Method to get event JSON from eventInformation payload string. * @param eventInformation String event Information