Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surabhi-mahawar committed Jul 15, 2022
1 parent 2d74080 commit 16d532d
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/main/java/com/uci/outbound/controller/MessageController.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,21 @@ public ResponseEntity<HttpApiResponse> 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<String, String> transformerMeta = new HashMap<>();
transformerMeta.put("templateId", request.getTo().getMeta().get("templateId"));
Transformer transformer = Transformer.builder().metaData(transformerMeta).build();
ArrayList<Transformer> 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<String, String> transformerMeta = new HashMap<>();
transformerMeta.put("templateId", request.getTo().getMeta().get("templateId"));
Transformer transformer = Transformer.builder().metaData(transformerMeta).build();
ArrayList<Transformer> transformers = new ArrayList<>();
transformers.add(transformer);

xmsg.setTransformers(transformers);
xmsg.setTransformers(transformers);
}
}

/* FCM token required check for firebase adapter */
Expand Down

0 comments on commit 16d532d

Please sign in to comment.