Ejemplo n.º 1
0
 public void updateCreditsConfigResource(String number, String uuid, String voiceRateCredits)
     throws ClientProtocolException, IOException {
   try {
     String startdate = ImiDataFormatUtils.getCurrentDate("yyyy-MM-dd");
     Date endDate = ImiDataFormatUtils.getDateFromString("9999-12-31", "yyyy-MM-dd");
     long noOfDays = ImiDataFormatUtils.getDifferenceInDaysBetweenDates(new Date(), endDate);
     String resourceRequest =
         creditsConfigResourceRequest
             .replace("{number}", number)
             .replace("{teamuuid}", uuid)
             .replace("{startdate}", startdate)
             .replace("{noofdays}", "" + noOfDays)
             .replace("{credits}", voiceRateCredits);
     String resourceUrl = creditsResourceConfigUrl;
     Map<String, String> requestBody = new HashMap<String, String>();
     requestBody.put("authkey", creditsResourceAuthkey);
     requestBody.put("key", uuid);
     requestBody.put("request", resourceRequest);
     LOG.info(
         "Made call to credits config"
             + "authkey : "
             + creditsResourceAuthkey
             + " key : "
             + uuid
             + "  request : "
             + resourceRequest);
     GenericRestResponse restResponse =
         ImiHttpUtil.defaultHttpPostHandler(
             resourceUrl, requestBody, ContentType.APPLICATION_FORM_URLENCODED.getMimeType());
     ;
     LOG.info(
         "Response from Credits Resource is "
             + restResponse.getResponseBody()
             + " with response code "
             + restResponse.getResponseCode());
   } catch (Exception e) {
     LOG.error(ImiDataFormatUtils.getStackTrace(e));
   }
 }