public static Result updateGift(String giftId) {
   if (!Utils.checkCredentials(request())) {
     return unauthorized();
   }
   if (!Utils.checkJsonInput(request())) {
     Logger.info("Bad request data for Invite Code " + request().body());
     return generateBadRequest("Bad input json" + request().body());
   }
   Logger.info("Updating Gift Card. GiftId" + giftId);
   Gift gift;
   String giftStatus = "";
   try {
     gift = GiftDAO.getInstance().findGiftById(giftId);
     JsonNode jsonReq = request().body().asJson();
     giftStatus = jsonReq.get("giftStatus").asText();
     gift.setGiftStatus(Gift.GiftStatus.valueOf(giftStatus));
     GiftDAO.getInstance().updateGift(gift);
     Logger.info("Gift Card Updated. GiftId" + giftId);
   } catch (Exception e) {
     Logger.info("Gift Card Update Failed. GiftId" + giftId);
     return generateBadRequest("Invalid Gift Status. Details:" + e);
   }
   // send email to merchant who has challenge with this gift card.
   try {
     if (giftStatus.equals("FUNDED")) {
       EmailService.sendMail(giftId);
     }
   } catch (Exception e) {
     Logger.error("Failed to send Email. GiftId" + giftId);
   }
   return ok(gift.toJson());
 }
 public static Result sendMailToMerchant(String giftId) {
   try {
     EmailService.sendMail(giftId);
   } catch (Exception e) {
     Logger.error("Failed to send Email. GiftId" + giftId);
   }
   return ok();
 }