jonahkh
2020-05-29 5eeffe88821b8fa7427a4d92b44a88cefec1e700
adding notification delivery for adoption service
3 files added
5 files modified
195 ■■■■■ changed files
adopt-a-pup/.idea/vcs.xml 1 ●●●● patch | view | raw | blame | history
adopt-a-pup/.idea/workspace.xml 116 ●●●●● patch | view | raw | blame | history
adopt-a-pup/adoption-service/pom.xml 6 ●●●●● patch | view | raw | blame | history
adopt-a-pup/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model/Email.java 13 ●●●●● patch | view | raw | blame | history
adopt-a-pup/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model/EmailNotificationRequest.java 14 ●●●●● patch | view | raw | blame | history
adopt-a-pup/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/service/AdoptionService.java 33 ●●●●● patch | view | raw | blame | history
adopt-a-pup/adoption-service/src/main/resources/templates/applicationApproval.st 7 ●●●●● patch | view | raw | blame | history
adopt-a-pup/animal-service/pom.xml 5 ●●●●● patch | view | raw | blame | history
adopt-a-pup/.idea/vcs.xml
@@ -2,6 +2,5 @@
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
    <mapping directory="$PROJECT_DIR$/maildev" vcs="Git" />
  </component>
</project>
adopt-a-pup/.idea/workspace.xml
@@ -2,12 +2,14 @@
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="f788b161-9af5-4988-b67e-058c2cc6689b" name="Default Changelist" comment="">
      <change afterPath="$PROJECT_DIR$/mongo-data/dog-photos/Harvey.jpg" afterDir="false" />
      <change afterPath="$PROJECT_DIR$/mongo-data/dog-photos/Theo.jpg" afterDir="false" />
      <change afterPath="$PROJECT_DIR$/mongo-data/dog-photos/Winston.jpg" afterDir="false" />
      <change afterPath="$PROJECT_DIR$/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model/Email.java" afterDir="false" />
      <change afterPath="$PROJECT_DIR$/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model/EmailNotificationRequest.java" afterDir="false" />
      <change afterPath="$PROJECT_DIR$/adoption-service/src/main/resources/templates/applicationApproval.st" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/Readme.MD" beforeDir="false" afterPath="$PROJECT_DIR$/Readme.MD" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/notification-service/src/main/resources/application.properties" beforeDir="false" afterPath="$PROJECT_DIR$/notification-service/src/main/resources/application.properties" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/adoption-service/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/adoption-service/pom.xml" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/service/AdoptionService.java" beforeDir="false" afterPath="$PROJECT_DIR$/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/service/AdoptionService.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/animal-service/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/animal-service/pom.xml" afterDir="false" />
    </list>
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -48,7 +50,7 @@
    <property name="aspect.path.notification.shown" value="true" />
    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1590076839070" />
    <property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="yaml&#10;JSON&#10;TEXT" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$/mongo-data/dog-photos" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$/adoption-service/src/main/resources" />
    <property name="node.js.detected.package.eslint" value="true" />
    <property name="node.js.detected.package.tslint" value="true" />
    <property name="node.js.path.for.package.eslint" value="project" />
@@ -61,22 +63,23 @@
    <property name="project.structure.last.edited" value="Project" />
    <property name="project.structure.proportion" value="0.0" />
    <property name="project.structure.side.proportion" value="0.0" />
    <property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
    <property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
  </component>
  <component name="RecentsManager">
    <key name="MoveFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$" />
    <key name="CreateClassDialog.RecentsKey">
      <recent name="com.redhat.do328.adoptApup.adoptionservice.model" />
    </key>
    <key name="CopyFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/adoption-service/src/main/resources" />
      <recent name="$PROJECT_DIR$/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model" />
      <recent name="$PROJECT_DIR$/mongo-data/dog-photos" />
      <recent name="$PROJECT_DIR$/animal-service/src/main/java/com/redhat/do328/adoptApup/animalservice/model" />
      <recent name="$PROJECT_DIR$/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model" />
    </key>
    <key name="CopyClassDialog.RECENTS_KEY">
      <recent name="com.redhat.do328.adoptApup.adoptionservice.model" />
    </key>
    <key name="CreateClassDialog.RecentsKey">
      <recent name="com.redhat.do328.adoptApup.adoptionservice.model" />
    <key name="MoveFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$" />
    </key>
  </component>
  <component name="RunManager" selected="Spring Boot.NotificationServiceApplication">
@@ -196,12 +199,19 @@
      <workItem from="1588956360362" duration="19495000" />
      <workItem from="1589905246888" duration="1329000" />
      <workItem from="1590077824497" duration="3732000" />
      <workItem from="1590698930822" duration="9128000" />
      <workItem from="1590698930822" duration="9514000" />
      <workItem from="1590709434555" duration="605000" />
      <workItem from="1590710087254" duration="671000" />
    </task>
    <servers />
  </component>
  <component name="TypeScriptGeneratedFilesManager">
    <option name="version" value="2" />
  </component>
  <component name="VcsManagerConfiguration">
    <ignored-roots>
      <path value="$PROJECT_DIR$/maildev" />
    </ignored-roots>
  </component>
  <component name="WindowStateProjectService">
    <state x="418" y="198" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1590708643787">
@@ -212,76 +222,88 @@
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state x="2663" y="311" width="424" height="491" key="FileChooserDialogImpl/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590699777617" />
    <state width="1874" height="241" key="GridCell.Tab.0.bottom" timestamp="1590700928961">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.0.bottom" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.0.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928961" />
    <state width="1874" height="241" key="GridCell.Tab.0.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590699972069" />
    <state width="1874" height="241" key="GridCell.Tab.0.center" timestamp="1590700928961">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.0.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.0.center" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.0.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928961" />
    <state width="1874" height="241" key="GridCell.Tab.0.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590699972069" />
    <state width="1874" height="241" key="GridCell.Tab.0.left" timestamp="1590700928961">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.0.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.0.left" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.0.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928961" />
    <state width="1874" height="241" key="GridCell.Tab.0.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590699972068" />
    <state width="1874" height="241" key="GridCell.Tab.0.right" timestamp="1590700928961">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.0.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.0.right" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.0.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928961" />
    <state width="1874" height="241" key="GridCell.Tab.0.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590699972069" />
    <state width="1874" height="241" key="GridCell.Tab.1.bottom" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.0.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.1.bottom" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.1.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.1.center" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.1.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.1.center" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.1.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.1.left" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.1.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.1.left" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.1.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.1.right" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.1.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.1.right" timestamp="1590709370936">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.1.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.2.bottom" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.1.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370936" />
    <state width="1874" height="309" key="GridCell.Tab.2.bottom" timestamp="1590709370937">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.2.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.2.center" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.2.bottom/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370937" />
    <state width="1874" height="309" key="GridCell.Tab.2.center" timestamp="1590709370937">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.2.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.2.left" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.2.center/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370937" />
    <state width="1874" height="309" key="GridCell.Tab.2.left" timestamp="1590709370937">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.2.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state width="1874" height="241" key="GridCell.Tab.2.right" timestamp="1590700928962">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.2.left/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370937" />
    <state width="1874" height="309" key="GridCell.Tab.2.right" timestamp="1590709370937">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state width="1874" height="241" key="GridCell.Tab.2.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590700928962" />
    <state x="397" y="225" width="1022" height="737" key="SettingsEditor" timestamp="1590703889140">
      <screen x="0" y="27" width="1920" height="1053" />
    <state width="1874" height="309" key="GridCell.Tab.2.right/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590709370937" />
    <state x="2369" y="188" width="1022" height="737" key="SettingsEditor" timestamp="1590710131010">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state x="397" y="225" width="1022" height="737" key="SettingsEditor/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590703889140" />
    <state x="2369" y="188" width="1022" height="737" key="SettingsEditor/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590698962228" />
    <state x="2369" y="188" width="1022" height="737" key="SettingsEditor/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590710131010" />
    <state x="742" y="211" width="426" height="665" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1590701688692">
      <screen x="0" y="27" width="1920" height="1053" />
    </state>
    <state x="742" y="211" width="426" height="665" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590701688692" />
    <state x="515" y="280" width="1405" height="752" maximized="true" key="dock-window-1" timestamp="1590710281788">
      <screen x="0" y="27" width="1920" height="1053" />
    </state>
    <state x="515" y="280" width="1405" height="752" maximized="true" key="dock-window-1/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590710281788" />
    <state x="652" y="117" width="615" height="846" key="find.popup" timestamp="1590702537638">
      <screen x="0" y="27" width="1920" height="1053" />
    </state>
    <state x="652" y="117" width="615" height="846" key="find.popup/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590702537638" />
    <state x="624" y="182" width="672" height="676" key="search.everywhere.popup" timestamp="1590708773084">
      <screen x="0" y="27" width="1920" height="1053" />
    <state x="2544" y="159" width="672" height="694" key="search.everywhere.popup" timestamp="1590710217008">
      <screen x="1920" y="0" width="1920" height="1080" />
    </state>
    <state x="624" y="182" width="672" height="676" key="search.everywhere.popup/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@0.27.1920.1053" timestamp="1590708773084" />
    <state x="2544" y="159" width="672" height="694" key="search.everywhere.popup/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590706435391" />
    <state x="2544" y="159" width="672" height="694" key="search.everywhere.popup/3840.0.1920.1080/1920.0.1920.1080/0.27.1920.1053@1920.0.1920.1080" timestamp="1590710217008" />
  </component>
  <component name="debuggerHistoryManager">
    <expressions id="evaluateCodeFragment">
adopt-a-pup/adoption-service/pom.xml
@@ -20,6 +20,12 @@
    <dependencies>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>ST4</artifactId>
            <version>4.3</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
adopt-a-pup/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model/Email.java
New file
@@ -0,0 +1,13 @@
package com.redhat.do328.adoptApup.adoptionservice.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Email {
    private String message;
    private String subject;
}
adopt-a-pup/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/model/EmailNotificationRequest.java
New file
@@ -0,0 +1,14 @@
package com.redhat.do328.adoptApup.adoptionservice.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class EmailNotificationRequest {
    private Map<String, Email> messagesByEmail;
}
adopt-a-pup/adoption-service/src/main/java/com/redhat/do328/adoptApup/adoptionservice/service/AdoptionService.java
@@ -1,13 +1,7 @@
package com.redhat.do328.adoptApup.adoptionservice.service;
import com.google.common.base.Joiner;
import com.redhat.do328.adoptApup.adoptionservice.model.AdoptionApplication;
import com.redhat.do328.adoptApup.adoptionservice.model.AdoptionApplicationResponse;
import com.redhat.do328.adoptApup.adoptionservice.model.Animal;
import com.redhat.do328.adoptApup.adoptionservice.model.AnimalStatusChangeRequest;
import com.redhat.do328.adoptApup.adoptionservice.model.Residency;
import com.redhat.do328.adoptApup.adoptionservice.model.Shelter;
import com.redhat.do328.adoptApup.adoptionservice.model.Status;
import com.redhat.do328.adoptApup.adoptionservice.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
@@ -16,21 +10,25 @@
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.server.ResponseStatusException;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STRawGroupDir;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class AdoptionService {
    private static final STRawGroupDir templateFile = new STRawGroupDir("templates");
    private static final String APPROVAL_SUBJECT = "CONGRATULATIONS! Your application has been approved";
    @Value("${animalService.host}")
    private String animalServiceHost;
    @Value("${shelterService.host}")
    private String shelterServiceHost;
    @Value("${notificationService.host}")
    private String notificationServiceHost;
    @Autowired
    private RestTemplate restTemplate;
@@ -95,10 +93,23 @@
            final String userEmail = application.getEmail();
            final String shelterEmail = shelter.getEmail();
            // TODO send email to shelter
            final String renderedTemplate = renderTemplate(application.getUsername(), animal.getAnimalName(), shelter.getShelterName(), shelterEmail, shelter.getPhoneNumber());
            final EmailNotificationRequest emailNotificationRequest = new EmailNotificationRequest(Collections.singletonMap(application.getEmail(), new Email(renderedTemplate, APPROVAL_SUBJECT)));
            restTemplate.postForEntity(notificationServiceHost + "/notifications/sendEmails", emailNotificationRequest, ResponseEntity.class );
            adoptionApplicationResponse.setStatus(Status.APPROVED);
            adoptionApplicationResponse.setMessage("Congratulations, your application to adopt " + animal.getAnimalName() + " has been approved! You should be receiving an email soon with further instructions");
        }
        return adoptionApplicationResponse;
    }
    private String renderTemplate(final String username, final String animalName, final String shelterName, final String shelterEmail, final String shelterPhone) {
        final ST template = templateFile.getInstanceOf("applicationApproval");
        template.add("username", username);
        template.add("animalName", animalName);
        template.add("shelterName", shelterName);
        template.add("shelterEmail", shelterEmail);
        template.add("shelterPhone", shelterPhone);
        return template.render();
    }
}
adopt-a-pup/adoption-service/src/main/resources/templates/applicationApproval.st
New file
@@ -0,0 +1,7 @@
Hello <username>,
Congratulations, your application for <animalName> has been approved!
You may contact the shelter <shelterName> at <shelterEmail> or <shelterPhone> to finalize the process.
<animalName> is waiting patiently for you. Thank you for using Adopt-A-Pup!
adopt-a-pup/animal-service/pom.xml
@@ -35,11 +35,6 @@
            <version>4.3</version>
            <scope>compile</scope>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.antlr</groupId>-->
            <!--<artifactId>stringtemplate</artifactId>-->
            <!--<version>4.0.2</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>