| private LoyaltyProgramActivitiesRS getProgramActvitiesRS(LoyaltyProgramActivitiesRQ programActivitiesRQ, LoyaltyProgramActivitiesRS programActivitiesRS, JsonObject jsonResponse, JsonParser jsonParser, JsonObject jsonRequest) throws ParseException, ServiceException, IOException {
|
| HttpsURLConnection connection;
|
| String serviceURL = getMemberInteractionsURL();
|
| String fromDate = (null != jsonRequest.get(CommonConstants.START_DATE) && !jsonRequest.get(CommonConstants.START_DATE).isJsonNull()) ? jsonRequest.get(CommonConstants.START_DATE).getAsString() : null;
|
| String toDate = (null != jsonRequest.get(CommonConstants.END_DATE) && !jsonRequest.get(CommonConstants.END_DATE).isJsonNull()) ? jsonRequest.get(CommonConstants.END_DATE).getAsString() : null;
|
|
|
| // Validate presence of both dates (110006)
|
| if (fromDate == null || toDate == null) {
|
| log.error("Both start and end dates are required but missing.");
|
| throw new ServiceException(CommonConstants.AIMIA_ERROR_110006);
|
| }
|
|
|
| // Skip validation - commented out
|
| /*
|
| try {
|
| DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
|
| LocalDateTime.parse(fromDate, formatter);
|
| } catch (DateTimeParseException e) {
|
| log.error("Invalid start date format: " + fromDate, e);
|
| throw new ServiceException(CommonConstants.AIMIA_ERROR_110008);
|
| }
|
| */
|
|
|
| if (null != fromDate && null != toDate) {
|
| String fmtFromDate = formateDate(fromDate);
|
| String fmtTodate = formateDate(toDate);
|
| serviceURL = getMemberInteractionsURL() + "?fromDate=" + fmtFromDate + "&toDate=" + fmtTodate;
|
| }
|
|
|
| connection = invokeAIMIAservice(serviceURL, jsonRequest, CommonConstants.POST, "programActivities");
|
| if (null != connection && connection.getResponseCode() == HTTP_SUCCESS_REPONSE_CODE && connection.getResponseMessage().equals(HTTP_SUCCESS_REPONSE_MESSAGE)) {
|
| programActivitiesRS = mapProgramActivitiesRS(programActivitiesRQ, jsonResponse, jsonParser, connection);
|
| }
|
| return programActivitiesRS;
|
| }
|