Save and Manage Quotes API
Save and Manage Quotes API
controller;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].slf4j.Slf4j;
import [Link];
@Slf4j
@RestController
@RequestMapping("/v1")
public class QuoteController {
@Autowired
private QuoteService quoteService;
@Autowired
private ProductDDService productService;
@Autowired
private EmailUtil emailUtils;
@Autowired
private CategoryBulletRepo categoryBulletRepo;
@Autowired
private Environment env;
@Autowired
AuthUtil authUtil;
@Autowired
SecurityKeysService sksService;
[Link]("prevInsCreditYears",
[Link]("prevInsCreditYears", 0));
[Link]("prevInsCreditDays",
[Link]("prevInsCreditDays", 0));
[Link]("lcrExposureYears",
[Link]("lcrExposureYears", 0));
[Link]("lcrCreditYears",
[Link]("lcrCreditYears", 0));
[Link]("lcrExemption", [Link]("lcrExemption",
false));
[Link]("lcrExemptionReason",
[Link]("lcrExemptionReason", ""));
[Link]("hasLivingAbroad",
[Link]("hasLivingAbroad", false));
[Link]("PrincipalResidence_Dt",
[Link]("PrincipalResidence_Dt", ""));
[Link]("defenseForcesMember",
[Link]("defenseForcesMember", false));
[Link]("lcrPaidDays", [Link]("lcrPaidDays",
0));
[Link]("lcrPaidYears", [Link]("lcrPaidYears",
0));
[Link]("totalCreditYears",
[Link]("totalCreditYears", 0));
[Link]("breakCoverPeriods",
[Link]("breakCoverPeriods", new ArrayList<>()));
[Link]("breaks", [Link]("breaks", new
ArrayList<>()));
[Link]("insuranceHistory",
[Link]("insuranceHistory", new ArrayList<>()));
[Link]("prevCoverPeriods",
[Link]("prevCoverPeriods", new ArrayList<>()));
try {
policyStartDate =
[Link]([Link]([Link]()));
} catch (ParseException e) {
[Link](" Exception " + [Link]());
}
[Link](new Date());
[Link](policyStartDate);
Quote saveQuote = [Link](quote);
startDate = [Link](policyStartDate);
validDate = formatDateWithSuffix([Link]());
if (statusCode == 1) {
return new ResponseEntity<>([Link](),
[Link]);
} else {
return new ResponseEntity<>([Link](),
HttpStatus.INTERNAL_SERVER_ERROR);
}
}
return new
ResponseEntity<>([Link]([Link](sksService,
new
ObjectMapper().writeValueAsString([Link](id)), "")),
[Link]);
// return new ResponseEntity<>([Link](id),
[Link]);
}
if (savedQuote != null) {
if ([Link]() == id) {
return new ResponseEntity<>([Link](id,
quote, ns_sync), [Link]);
}
}
return new ResponseEntity<>("NO DATA FOUND WITH QUOTE ID: " + id,
HttpStatus.NOT_FOUND);
}
[Link]("productId: -------------->" +
[Link]());
planName = [Link](); // taking category as plan name for
customer convenience
String hospitalText = "";
if ([Link]("A")) {
hospitalText = "Semi-private hospital cover in public hospitals";
} else if ([Link]("D")) {
hospitalText = "Private hospital cover in private hospital & high
tech hospitals";
} else {
hospitalText = "Semi-private hospital cover in private
hospitals";
}
if ([Link]("\\d+")) {
excessValue = "€" + excessValue;
excessValueComponentParent = excessValueComponent;
} else {
excessValueComponentParent = "";
}
[Link]();
DecimalFormat decimalFormat = new DecimalFormat("#,##0.00");
String yearlyAmountFormatted =
[Link]([Link]());
String monthlyAmountFormatted =
[Link]([Link]());
if (D2D) {
day2day = " <tr>\r\n" + " <td\r\n"
+ " colspan=\"2\"\r\n" + "
style=\"\r\n"
+ " padding-top: 10px;\
r\n"
+ " border-top: 1px
solid #d1d1d1;\r\n"
+ " \"\r\n" + "
>\r\n"
+ " <h4\r\n" + "
style=\"\r\n"
+ " color: #191919;\r\
n"
+ " font-size: 18px;\
r\n"
+ " font-weight:
bold;\r\n"
+ " margin: 0;\r\n"
+ " margin-bottom:
10px;\r\n"
+ " \"\r\n" + "
>\r\n"
+ " Includes day-to-day\
r\n" + " </h4>\r\n"
+ " </td>\r\n" + "
</tr>";
}
// if ([Link]("\\d+")) {
excessValueComponent = " <tr>\r\n" + "
<td\r\n"
+ " colspan=\"2\"\r\n" + "
style=\"\r\n"
+ " padding-top: 10px;\r\n"
+ " padding-bottom: 10px;\r\n"
+ " border-top: 1px solid
#d1d1d1;\r\n"
+ " \"\r\n" + "
>\r\n"
+ " <h4\r\n" + "
style=\"\r\n"
+ " color: #191919;\r\n"
+ " font-size: 18px;\r\n"
+ " font-weight: bold;\r\n"
+ " margin: 0;\r\n"
+ " margin-bottom: 10px;\r\
n" + " \"\r\n"
+ " >\r\n" + "
Excess: " + excessValue + "\r\n"
+ " </h4>\r\n" + "
<p\r\n"
+ " style=\"color: #535353;
font-size: 14px; margin: 0\"\r\n"
+ " >\r\n"
+ " (Amount I will pay per
private hospital stay)\r\n"
+ " </p>\r\n" + "
</td>\r\n"
+ " </tr>\r\n";
// }
CategoryBullet categoryBullet =
[Link]([Link]()).get();
+ " href=" +
[Link](ApplicationConstant.ENV_URL)
+ "/web-portals/plan-details/" +
[Link]() + "\r\n"
+ " style=\"text-decoration:
underline; color: #ff1754\"\r\n"
+ " >Details</a\r\n" + "
>\r\n"
+ " </td>\r\n" + "
</tr>\r\n"
+ " <tr>\r\n" + "
<td\r\n"
+ " colspan=\"2\"\r\n" + "
style=\"\r\n"
+ " border-top: 1px solid
#b2b2b2;\r\n"
+ " padding-top: 10px;\r\n" +
" \"\r\n"
+ " >\r\n" + "
<p\r\n"
+ " style=\"\r\n" + "
color: #191919;\r\n"
+ " font-size: 16px;\r\n"
+ " margin: 0;\r\n"
+ " line-height: 24px;\r\n"
+ " \"\r\n"
+ " >\r\n"
+ " The perfect plan to cover
all of your hospital and\r\n"
+ " day-to-day needs for your
family.\r\n"
+ " </p>\r\n" + "
</td>\r\n"
+ " </tr>\r\n" + "
<tr>\r\n"
+ " <td colspan=\"2\">\r\n" + "
<ul\r\n"
+ " style=\"\r\n" + "
color: #191919;\r\n"
+ " font-size: 16px;\r\n"
+ " list-style: none;\r\n"
+ " padding: 0;\r\n"
+ " margin-top: 10px;\r\n" +
" \"\r\n"
+ " >\r\n"
+ " <li style=\"margin-bottom:
10px\">\r\n"
// + " <img\r\n"
// + "
src=\"[Link]
%2F801cbc4ea7fd40bc831a9bfff6064b1b\"\r\n"
// + " alt=\"Icon\"\r\n"
// + " style=\"\r\n"
// + " vertical-align:
middle;\r\n"
// + " margin-right: 10px;\
r\n"
// + " display: inline;\r\
n"
// + " \"\r\n" + "
/>\r\n"
+ " <p\r\n" + "
style=\"\r\n"
+ " display: inline;\r\
n"
+ " vertical-align:
middle;\r\n"
+ " \"\r\n" + "
>\r\n"
+ " " + features + "\r\n"
+ " </p>\r\n"
+ " </li>\r\n" + "
</ul>\r\n"
+ " </td>\r\n" + "
</tr>\r\n"
+ " <tr>\r\n" + "
<td\r\n"
+ " colspan=\"2\"\r\n" + "
style=\"\r\n"
+ " padding-top: 10px;\r\n"
+ " padding-bottom: 10px;\r\n"
+ " border-top: 1px solid
#d1d1d1;\r\n"
+ " \"\r\n" + "
>\r\n"
+ " <table>\r\n" + "
<tr>\r\n"
+ " <td width=\"250\">\r\n"
+ " <h4\r\n"
+ " style=\"\r\n"
+ " color: #191919;\r\
n"
+ " font-size: 18px;\
r\n"
+ " font-weight:
bold;\r\n"
+ " margin: 0;\r\n"
+ " margin-bottom:
10px;\r\n"
+ " \"\r\n" + "
>\r\n"
+ " Hospital\r\n" + "
</h4>\r\n"
+ " </td>\r\n" + "
<td>\r\n"
+ " <p\r\n" + "
style=\"\r\n"
+ " color: #191919;\r\
n"
+ " font-size: 14px;\
r\n"
+ " margin: 0;\r\n" +
" \"\r\n"
+ " >\r\n" + hospitalText
+ " </p>\r\n" + "
</td>\r\n"
+ " </tr>\r\n" + "
</table>\r\n"
+ " </td>\r\n" + "
</tr>\r\n"
// + " <tr>\r\n" + "
<td\r\n"
// + " colspan=\"2\"\r\n" + "
style=\"\r\n"
// + " padding-top: 10px;\r\n"
// + " padding-bottom: 10px;\r\n"
// + " border-top: 1px solid
#d1d1d1;\r\n"
// + " \"\r\n" + "
>\r\n"
// + " <h4\r\n" + "
style=\"\r\n"
// + " color: #191919;\r\n"
// + " font-size: 18px;\r\n"
// + " font-weight: bold;\r\n"
// + " margin: 0;\r\n"
// + " margin-bottom: 10px;\r\
n" + " \"\r\n"
// + " >\r\n" + "
Excess: " + excessValue + "\r\n"
// + " </h4>\r\n" + "
<p\r\n"
// + " style=\"color: #535353;
font-size: 14px; margin: 0\"\r\n"
// + " >\r\n"
// + " (Amount I will pay per
private hospital stay)\r\n"
// + " </p>\r\n" + "
</td>\r\n"
// + " </tr>\r\n"
+ excessValueComponentParent
// + "" +excessValueComponent+ ""
+ day2day;
+ "></a>\r\n"
+ " <a
href="+"[Link] style=\"text-decoration:
none\"\r\n"
+ " ><img\r\n"
+ "
src=\"[Link]
+ " alt=\"Youtube\"\r\n"
+ " style=\"height: 32px; min-
width: 32px; width: 32px; margin-right: 8px\"\r\n"
+ " /></a>\r\n"
+ " <a
href="+"[Link] style=\"text-decoration:
none\"\r\n"
+ " ><img\r\n"
+ "
src=\"[Link]
+ " alt=\"Instagram\"\r\n"
+ " style=\"height: 32px; min-
width: 32px; width: 32px; margin-right: 8px\"\r\n"
+ " /></a>\r\n"
+ " <a
href="+"[Link] style=\"text-decoration:
none\"\r\n"
+ " ><img\r\n"
+ "
src=\"[Link]
+ " alt=\"LinkedIn\"\r\n"
+ " style=\"height: 32px; min-
width: 32px; width: 32px; margin-right: 8px\"\r\n"
+ " /></a>\r\n" + "
</div>\r\n"
+ " <img\r\n"
+ "
src=\"[Link]
%2Fe15634eac86f4f059f42b9cdb1f7eb1d\"\r\n"
+ " alt=\"Level Health logo\"\r\n"
+ " style=\"width: 100px; margin-
top: 20px; display: block\"\r\n"
+ " />\r\n" + "
<img\r\n"
+ "
src=\"[Link]
%2F105f4d48b8cd47aea161a6e337e267b5\"\r\n"
+ " alt=\"Aviva logo\"\r\n"
+ " style=\"width: 60px; margin-top:
20px; display: block\"\r\n"
+ " />\r\n" + "
<p\r\n"
+ " style=\"\r\n" + "
color: #999999;\r\n"
+ " font-size: 12px;\r\n" + "
text-align: center;\r\n"
+ " margin-top: 30px;\r\n" + "
\"\r\n"
+ " >\r\n"
+ " Copyright © 2024
Levelhealth Insurance.\r\n"
+ " </p>\r\n" + "
</td>\r\n" + " </tr>\r\n"
+ " </table>\r\n" + " </td>\r\
n" + " </tr>\r\n"
+ " </table>\r\n" + " </td>\r\n" + "
</tr>\r\n" + " </table>\r\n"
+ " </body>\r\n" + "</html>\r\n";
[Link] dobLocalDate =
[Link]().atZone([Link]()).toLocalDate();
[Link] currentDate = [Link]();
int ageOfDependant = [Link](dobLocalDate,
currentDate).getYears();
// [Link](person -> {
// String dobString = [Link]();
// Date dob =null;
// try {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// dob = [Link](dobString);
// } catch (ParseException e) {
// [Link](" Exception " + [Link]());; // Handle
exception
// }
// [Link] dobLocalDate =
[Link]().atZone([Link]()).toLocalDate();
// [Link] currentDate = [Link]();
// int ageOfDependant = [Link](dobLocalDate,
currentDate).getYears();
// String displayName = [Link]();
// if (displayName == null || [Link]().isEmpty()) {
// if (ageOfDependant >= 18) {
// displayName = "Adult " + [Link]();
// } else {
// displayName = "Child " + [Link]();
// }
// }
// [Link](" <li style=\"margin-bottom: 10px\">\r\n" +
// " <img\r\n" +
// "
src=\"[Link]
%2F291ffc19d2a242a888f2340704d6af25\"\r\n" +
// " alt=\"Person\"\r\n" +
// " style=\"\r\n" +
// " vertical-align: middle;\r\n" +
// " margin-right: 10px;\r\n" +
// " display: inline;\r\n" +
// " \"\r\n" +
// " />\r\n" +
// " <p\r\n" +
// " style=\"\r\n" +
// " margin: 0;\r\n" +
// " display: inline;\r\n" +
// " vertical-align: middle;\r\n" +
// " \"\r\n" +
// " >\r\n" +
// " " + displayName + " (" + ageOfDependant + ")\r\
n" +
// " </p>\r\n" +
// " </li>");
// });
if ()) {
setFeatures(categoryBullet.getBullet1(), build);
}
if ()) {
setFeatures(categoryBullet.getBullet2(), build);
}
if ()) {
setFeatures(categoryBullet.getBullet3(), build);
}
if ()) {
setFeatures(categoryBullet.getBullet4(), build);
}
if ()) {
setFeatures(categoryBullet.getBullet5(), build);
}
return [Link]();
}