public static Result getGiftImage(String giftId) {
   if (!Utils.checkCredentials(request())) {
     return unauthorized();
   }
   try {
     Gift gift = GiftDAO.getInstance().findGiftById(giftId);
     String merchantURL = MerchantDAO.getInstance().getMerchantURLLogo(gift.getMerchantId());
     return ok(merchantURL);
   } catch (Exception e) {
     return generateBadRequest("Invalid giftID");
   }
 }
  public static Result addGiftCard() {
    if (!Utils.checkCredentials(request())) {
      return unauthorized();
    }
    if (!Utils.checkJsonInput(request())) {
      Logger.info("Add Gift Card : Bad request data for watch request " + request().body());
      return generateBadRequest("Bad input json");
    }
    Logger.info("Adding Gift Card");
    JsonNode jsonReq = request().body().asJson();
    Gift gift = new Gift();
    gift.setGiftName(jsonReq.get("giftName").asText());
    gift.setAmount(jsonReq.get("amount").asDouble());
    gift.setDescription(jsonReq.get("description").asText());
    gift.setMaxGifts(jsonReq.get("maxGift").asInt());
    // gift.setGiftLogoUrl(jsonReq.get("giftUrl").asText());
    gift.setGiftStatus(GiftStatus.ADDED);
    gift.setGivenGiftCount(0);
    String merchantId = "";
    try {
      merchantId = Utils.safeStringFromJson(jsonReq, "merchantId");
      if (StringUtils.isNotEmpty(merchantId)) {
        MerchantDAO.getInstance().findMerchantById(merchantId);
        gift.setMerchantId(merchantId);
        gift.setGiftLogoUrl(MerchantDAO.getInstance().getMerchantURLLogo(gift.getMerchantId()));
      }
    } catch (Exception e) {
      return generateBadRequest("Invalid merchant Id");
    }

    String giftId = GiftDAO.getInstance().insertGift(gift);
    try {
      gift = GiftDAO.getInstance().findGiftById(giftId);
      Logger.info("Gift Card Added. GiftId" + giftId);
      return ok(gift.toJson());
    } catch (Exception e) {
      Logger.info("Gift Card Not Inserted Properly. Reason" + e.getMessage());
      return generateInternalServer("gift not inserted properly");
    }
  }