From 16d532dcc4977561d46cc1b2fe0e31f45510fd26 Mon Sep 17 00:00:00 2001 From: Surabhi Date: Fri, 15 Jul 2022 19:18:59 +0530 Subject: [PATCH] Changes --- .../controller/MessageController.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/uci/outbound/controller/MessageController.java b/src/main/java/com/uci/outbound/controller/MessageController.java index 694d585..e4fee24 100644 --- a/src/main/java/com/uci/outbound/controller/MessageController.java +++ b/src/main/java/com/uci/outbound/controller/MessageController.java @@ -98,20 +98,21 @@ public ResponseEntity apply(JsonNode adapter) { /* Template id required check for cdac sms adapter */ if(adapter.path("channel").asText().equalsIgnoreCase("sms") - && adapter.path("provider").asText().equalsIgnoreCase("cdac") - && (request.getTo().getMeta() == null || request.getTo().getMeta().get("templateId") == null || request.getTo().getMeta().get("templateId").isEmpty())) { - response.setStatus(HttpStatus.BAD_REQUEST.value()); - response.setError(HttpStatus.BAD_REQUEST.name()); - response.setMessage("Template id in meta of to is required for firebase adapter messaging."); - return ResponseEntity.badRequest().body(response); - } else { - HashMap transformerMeta = new HashMap<>(); - transformerMeta.put("templateId", request.getTo().getMeta().get("templateId")); - Transformer transformer = Transformer.builder().metaData(transformerMeta).build(); - ArrayList transformers = new ArrayList<>(); - transformers.add(transformer); + && adapter.path("provider").asText().equalsIgnoreCase("cdac")) { + if(request.getTo().getMeta() == null || request.getTo().getMeta().get("templateId") == null || request.getTo().getMeta().get("templateId").isEmpty()) { + response.setStatus(HttpStatus.BAD_REQUEST.value()); + response.setError(HttpStatus.BAD_REQUEST.name()); + response.setMessage("Template id in meta of to is required for firebase adapter messaging."); + return ResponseEntity.badRequest().body(response); + } else { + HashMap transformerMeta = new HashMap<>(); + transformerMeta.put("templateId", request.getTo().getMeta().get("templateId")); + Transformer transformer = Transformer.builder().metaData(transformerMeta).build(); + ArrayList transformers = new ArrayList<>(); + transformers.add(transformer); - xmsg.setTransformers(transformers); + xmsg.setTransformers(transformers); + } } /* FCM token required check for firebase adapter */