Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to dev2 1201b2 3 #698

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
c3d24e1
[MOSIP-22639] Resolved security hotspots in code (#605)
aihamh Dec 12, 2022
4789de7
MOSIP-24939 Improved code coverage. (#604)
kameshsr Dec 12, 2022
57e76b8
Mosip 24879 add event id in the response of the below stories (#606)
RitikJain4108 Dec 12, 2022
dc3d719
MOSIP-24939 Improved code coverage of validator class. (#607)
kameshsr Dec 12, 2022
47ef191
Fixed service history issue. (#609)
kameshsr Dec 13, 2022
87c466b
[MOSIP-24630] Fixed Security Vulnerability in code (#608)
aihamh Dec 13, 2022
b442f08
email and phone added in profile info (#610)
Neha2365 Dec 13, 2022
416e9e1
identity/info API method changed to get photo (#611)
Neha2365 Dec 13, 2022
82565a8
added masked VID (#612)
Neha2365 Dec 14, 2022
e4e12d3
Mosip 24879 add event id in the response of the below stories (#613)
RitikJain4108 Dec 14, 2022
19aab32
Mosip 24879 add event id in the response of the below stories (#614)
RitikJain4108 Dec 15, 2022
b3d1710
MOSIP-25310 MOSIP-24730 MOSIP-25312 MOSIP-24731 Added grievance api (…
kameshsr Dec 16, 2022
025b09b
MOSIP-25307 Created API to get DocumentType from masterdata (#617)
Neha2365 Dec 16, 2022
3c1f9b2
MOSIP-24784 Fixed download card api. (#619)
kameshsr Dec 16, 2022
5b269e3
Mosip 24879 add event id in the response of the below stories (#618)
RitikJain4108 Dec 16, 2022
8bf439b
Mosip 24879 add event id in the response of the below stories (#620)
RitikJain4108 Dec 19, 2022
0f6ea2e
Mosip 25307 api create the following proxy ap is from masterdata (#621)
Neha2365 Dec 19, 2022
a96ac62
MOSIP-22046 change input LocalDateTime to LocalDate. (#622)
kameshsr Dec 19, 2022
6243ac8
MOSIP-22046 corrected query param for service history api. (#623)
kameshsr Dec 19, 2022
e46d28d
Mosip 24879 add event id in the response of the below stories (#625)
RitikJain4108 Dec 21, 2022
ab9e982
MOSIP-21674 Added custom response for download card api. (#624)
kameshsr Dec 21, 2022
c24afc3
Mosip 24879 add event id in the response of the below stories (#627)
RitikJain4108 Dec 21, 2022
54a7272
[MOSIP-24670] Made corrections in id and version (#626)
aihamh Dec 21, 2022
a9d9dd2
MOSIP-24939 Improved code coverage. (#628)
kameshsr Dec 21, 2022
0a30054
added get status of individual id api. (#629)
kameshsr Dec 22, 2022
8b2d275
Mosip 21147 Upload document changes done (#630)
Neha2365 Dec 22, 2022
77a9182
changes done (#631)
RitikJain4108 Dec 22, 2022
100b1c4
refactored-for-auth-adapter-changes (#632)
loganathan-sekaran Dec 23, 2022
4ca07aa
MOSIP-25274 changes done (#616)
Neha2365 Dec 23, 2022
b8c39ec
MOSIP-24939 Fixed sonar bug. (#633)
kameshsr Dec 26, 2022
e2054c3
MOSIP-24939 Improved code coverage. (#634)
kameshsr Dec 26, 2022
3146480
Changes in identityserviceImpl to check UIN (#635)
Neha2365 Dec 26, 2022
fe4f119
MOSIP-24939 Improved code coverage. (#636)
kameshsr Dec 27, 2022
fb0c355
MOSIP-24939 Fixed aid otp issue. (#637)
kameshsr Dec 27, 2022
bd4942c
updated id version for document APIs (#638)
RitikJain4108 Dec 29, 2022
55772e6
Handle client exception from auth codeflow proxy apis (#640)
loganathan-sekaran Dec 29, 2022
ae65da1
MOSIP-25438 Fixed placeholder issue. (#641)
kameshsr Dec 29, 2022
dc8dab0
Refactored for auth adapter changes (#642)
loganathan-sekaran Dec 29, 2022
ea2dd4e
MOSIP-25438 Performed null check for purpose. (#643)
kameshsr Dec 29, 2022
9ba7167
MOSIP-25438 increased purpose column value. (#644)
kameshsr Dec 29, 2022
375273a
removed idtype (#646)
RitikJain4108 Jan 2, 2023
008099c
[MOSIP-24670] Made corrections in API body, response code (#639)
aihamh Jan 2, 2023
26824df
MOSIP-25438 increased ref_id column value in otp_transaction.sql. (#647)
kameshsr Jan 3, 2023
bc936e0
Merge 1201b2 to develop (#650)
loganathan-sekaran Jan 4, 2023
be4d9b3
MOSIP-24372 Fixed update my data api jpa issue. (#653)
kameshsr Jan 4, 2023
982dfa8
Mosip 25364 resident api we are able to request card of a vid of a di…
RitikJain4108 Jan 4, 2023
922c444
return masked attributes (#645)
RitikJain4108 Jan 4, 2023
7b4752b
Latest develop fixes from 1201b2 merge (#656)
loganathan-sekaran Jan 5, 2023
42c406c
[MOSIP-25539] Made corrections in API body, response code (#657)
aihamh Jan 5, 2023
22977dc
for resolve merge conflicts (#659)
ramadeviidupulapati Jan 10, 2023
557fb12
Fix missing masked attributes in identity info response (#661)
loganathan-sekaran Jan 10, 2023
532ac4f
Fix id info masking attribs issue (#662)
loganathan-sekaran Jan 10, 2023
c6bd6cd
Fix id info masking attribs issue (#663)
loganathan-sekaran Jan 10, 2023
ec7edc8
MOSIP-24372 Fixed ack placeholder issue for ack api. (#664)
kameshsr Jan 11, 2023
ed842b2
fixed error status code (#658)
RitikJain4108 Jan 11, 2023
07ad152
Minor correction to the id prop (#665)
loganathan-sekaran Jan 11, 2023
1ac83b6
Fix id version issues 1 (#666)
loganathan-sekaran Jan 11, 2023
d9df97a
MOSIP-24372 Removed SEND OTP from service history. (#667)
kameshsr Jan 11, 2023
fb9ba57
[MOSIP-25539] Made corrections in API body, Task 1,5 (#660)
aihamh Jan 12, 2023
857ebfd
Revert "[MOSIP-25539] Made corrections in API body, Task 1,5 (#660)" …
loganathan-sekaran Jan 12, 2023
fc46c92
MOSIP-24372 added attribute list to download personalized card api. (…
kameshsr Jan 12, 2023
21f0921
Mosip 25539 corrections required in api end points or response reques…
RitikJain4108 Jan 12, 2023
a40639a
[MOSIP-25539] made corrections in API body 5 (#671)
aihamh Jan 12, 2023
c74a1b2
Timeszone test (#672)
loganathan-sekaran Jan 12, 2023
f3fe329
[MOSIP-25539] made corrections in api body. Task 5 (#673)
aihamh Jan 13, 2023
7ad276d
MOSIP-24372 Fixed service history from date to date issue. (#674)
kameshsr Jan 13, 2023
9e4d0b8
MOSIP-24372 Fixed ack api template issue. (#675)
kameshsr Jan 13, 2023
5f199f1
[MOSIP-25539] changed API endpoint /individualId/otp (#677)
aihamh Jan 13, 2023
4700aad
[MOSIP-25539] Corrected API response body Task 5 (#678)
aihamh Jan 13, 2023
b3ce03b
Resolved Build failures (#679)
aihamh Jan 13, 2023
3baea65
Mosip 25778 update existing authenticated API & Mosip 25780 create a …
RitikJain4108 Jan 16, 2023
3190d7a
Fix expiry time for big expiry time (#681)
loganathan-sekaran Jan 16, 2023
934b52c
return bad request error response for pdf apis and fixed metadata exc…
RitikJain4108 Jan 17, 2023
6e993a0
MOSIP-25804 Fixed automation failure. (#683)
kameshsr Jan 18, 2023
1cfdbb5
Mosip 25778 technical story update the existing authentication audit …
RitikJain4108 Jan 18, 2023
31d13f5
Add timezone based timestamp response (#685)
loganathan-sekaran Jan 18, 2023
5e4389f
Add timezone based timestamp response (#686)
loganathan-sekaran Jan 18, 2023
d03e4fd
Add timezone based timestamp response 1 (#687)
loganathan-sekaran Jan 18, 2023
2fc4c0f
Add timezone based timestamp response 2 (#688)
loganathan-sekaran Jan 18, 2023
3bf0e5d
Refactor fix utility classname (#689)
loganathan-sekaran Jan 18, 2023
556cd71
Time format fix for last login times (#692)
loganathan-sekaran Jan 19, 2023
0f6e28f
Time format fix for last login times (#693)
loganathan-sekaran Jan 19, 2023
acc160e
Time format fix for last login times 2 (#694)
loganathan-sekaran Jan 19, 2023
4a3706b
Time format fix for last login times 3 (#695)
loganathan-sekaran Jan 19, 2023
499c6e5
Merge branch 'develop' of https://github.com/mosip/resident-services …
Jan 19, 2023
3680cf9
Fixed merge conflicts
Jan 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.mosip.resident.entity.ResidentUserEntity;
import io.mosip.resident.repository.ResidentUserRepository;
import io.mosip.resident.service.impl.IdentityServiceImpl;
import io.mosip.resident.util.Utility;

/**
* Aspect class for login redirect API
Expand All @@ -33,7 +34,6 @@
@EnableAspectJAutoProxy
public class LoginCheck {

private static final String ID_TOKEN = "id_token";
private static final String SET_COOKIE = "Set-Cookie";
private static final String USER_AGENT = "User-Agent";
private static final String WINDOWS = "Windows";
Expand All @@ -42,18 +42,6 @@ public class LoginCheck {
private static final String X11 = "x11";
private static final String ANDROID = "Android";
private static final String IPHONE = "IPhone";
private static final String X_FORWARDED_FOR = "X-Forwarded-For";
private static final String X_REAL_IP = "x-real-ip";
private static final String PROXY_CLIENT_IP = "Proxy-Client-IP";
private static final String WL_PROXY_CLIENT_IP = "WL-Proxy-Client-IP";
private static final String HTTP_X_FORWARDED_FOR = "HTTP_X_FORWARDED_FOR";
private static final String HTTP_X_FORWARDED = "HTTP_X_FORWARDED";
private static final String HTTP_X_CLUSTER_CLIENT_IP = "HTTP_X_CLUSTER_CLIENT_IP";
private static final String HTTP_CLIENT_IP = "HTTP_CLIENT_IP";
private static final String HTTP_FORWARDED_FOR = "HTTP_FORWARDED_FOR";
private static final String HTTP_FORWARDED = "HTTP_FORWARDED";
private static final String HTTP_VIA = "HTTP_VIA";
private static final String REMOTE_ADDR = "REMOTE_ADDR";
private static final CharSequence AUTHORIZATION_TOKEN = "Authorization";

@Autowired
Expand All @@ -62,6 +50,9 @@ public class LoginCheck {
@Autowired
private IdentityServiceImpl identityServiceImpl;

@Autowired
private Utility utility;

private static final Logger logger = LoggerConfiguration.logConfig(LoginCheck.class);

@After("execution(* io.mosip.kernel.authcodeflowproxy.api.controller.LoginController.loginRedirect(..)) && args(redirectURI,state,sessionState,code,stateCookie,req,res)")
Expand All @@ -82,11 +73,11 @@ public void getUserDetails(String redirectURI, String state, String sessionState
if(idaToken!=null && !idaToken.isEmpty()) {
Optional<ResidentUserEntity> userData = residentUserRepository.findById(idaToken);
if (userData.isPresent()) {
residentUserRepository.updateUserData(idaToken, DateUtils.getUTCCurrentDateTime(), getClientIp(req),
residentUserRepository.updateUserData(idaToken, DateUtils.getUTCCurrentDateTime(), utility.getClientIp(req),
req.getRemoteHost(), getMachineType(req));
} else {
residentUserRepository.save(new ResidentUserEntity(idaToken, DateUtils.getUTCCurrentDateTime(),
getClientIp(req), req.getRemoteHost(), getMachineType(req)));
utility.getClientIp(req), req.getRemoteHost(), getMachineType(req)));
}
}
logger.debug("LoginCheck::getUserDetails()::exit");
Expand Down Expand Up @@ -126,34 +117,4 @@ private String getMachineType(HttpServletRequest req) {
logger.debug("LoginCheck::getMachineType()::exit");
return os;
}

private String getClientIp(HttpServletRequest req) {
logger.debug("LoginCheck::getClientIp()::entry");
String[] IP_HEADERS = {
X_FORWARDED_FOR,
X_REAL_IP,
PROXY_CLIENT_IP,
WL_PROXY_CLIENT_IP,
HTTP_X_FORWARDED_FOR,
HTTP_X_FORWARDED,
HTTP_X_CLUSTER_CLIENT_IP,
HTTP_CLIENT_IP,
HTTP_FORWARDED_FOR,
HTTP_FORWARDED,
HTTP_VIA,
REMOTE_ADDR
};
for (String header : IP_HEADERS) {
String value = req.getHeader(header);
if (value == null || value.isEmpty()) {
continue;
}
String[] parts = value.split(",");
logger.debug("LoginCheck::getClientIp()::exit");
return parts[0].trim();
}
logger.debug("LoginCheck::getClientIp()::exit - excecuted till end");
return req.getRemoteAddr();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.mosip.kernel.keygenerator.bouncycastle.KeyGenerator;
import io.mosip.kernel.templatemanager.velocity.impl.TemplateManagerImpl;
import io.mosip.resident.util.ResidentServiceRestClient;
import io.mosip.resident.util.Utilitiy;
import io.mosip.resident.util.Utility;


@Configuration
Expand All @@ -52,7 +52,7 @@ public class Config {

@Bean("varres")
public VariableResolverFactory getVariableResolverFactory() {
String mvelExpression = Utilitiy.readResourceContent(mvelFile);
String mvelExpression = Utility.readResourceContent(mvelFile);
VariableResolverFactory functionFactory = new MapVariableResolverFactory();
MVEL.eval(mvelExpression, functionFactory);
return functionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
import java.util.Map;
import java.util.function.BiFunction;

import org.apache.commons.lang3.function.TriFunction;

import io.mosip.resident.dto.NotificationTemplateVariableDTO;
import io.mosip.resident.function.QuadFunction;
import io.mosip.resident.util.TemplateUtil;
import reactor.util.function.Tuple2;

/**
* The Enum RequestType.
*
Expand Down Expand Up @@ -73,7 +80,7 @@ public enum RequestType {
DEFAULT("Default", TemplateUtil::getDefaultTemplateVariables, List.of(), List.of(), List.of(), "",
TemplateUtil::getNotificationCommonTemplateVariables, null);

private TriFunction<TemplateUtil, String, String, Tuple2<Map<String, String>, String>> ackTemplateVariablesFunction;
private QuadFunction<TemplateUtil, String, String, Integer, Tuple2<Map<String, String>, String>> ackTemplateVariablesFunction;
private List<EventStatusSuccess> successStatusList;
private List<EventStatusFailure> failureStatusList;
private List<EventStatusInProgress> inProgressStatusList;
Expand All @@ -83,7 +90,7 @@ public enum RequestType {

private String name;

private RequestType(String name, TriFunction<TemplateUtil, String, String, Tuple2<Map<String, String>, String>> ackTemplateVariablesFunction,
private RequestType(String name, QuadFunction<TemplateUtil, String, String, Integer, Tuple2<Map<String, String>, String>> ackTemplateVariablesFunction,
List<EventStatusSuccess> successStatusList, List<EventStatusFailure> failureStatusList,
List<EventStatusInProgress> inProgressStatusList, String featureName,
BiFunction<TemplateUtil, NotificationTemplateVariableDTO, Map<String, Object>> notificationTemplateVariablesFunction,
Expand Down Expand Up @@ -149,8 +156,8 @@ public String getSummaryTemplateCodeProperty(TemplateType templateType) {
return "resident.template.summary." + templateType.getType() + "." + getFeatureName();
}

public Tuple2<Map<String, String>, String> getAckTemplateVariables(TemplateUtil templateUtil, String eventId, String languageCode) {
return ackTemplateVariablesFunction.apply(templateUtil, eventId, languageCode);
public Tuple2<Map<String, String>, String> getAckTemplateVariables(TemplateUtil templateUtil, String eventId, String languageCode, Integer timeZoneOffset) {
return ackTemplateVariablesFunction.apply(templateUtil, eventId, languageCode, timeZoneOffset);
}

public Map<String, Object> getNotificationTemplateVariables(TemplateUtil templateUtil, NotificationTemplateVariableDTO dto) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/
public class ResidentConstants {

private ResidentConstants() {
public static final int UTC_TIMEZONE_OFFSET = 0;
private ResidentConstants() {
}

public static final String OBJECT_STORE_ACCOUNT_NAME = "mosip.resident.object.store.account-name";
Expand Down Expand Up @@ -178,9 +179,25 @@ private ResidentConstants() {
public static final String ACTION_PERFORMED = "actionPerformed";
public static final String VID_TYPE = "vidType";
public static final String MASKED_VID = "*masked VID*";
public static final String ACK_DATE_TIME_PATTERN = "resident.ack.datetime.pattern";
public static final String UI_DATE_TIME_PATTERN = "resident.ui.datetime.pattern";
public static final String FILENAME_DATETIME_PATTERN = "resident.filename.datetime.pattern";

public static final String NO_ID = "NO_ID";
public static final String NO_ID_TYPE = "NO_ID_TYPE";

// IP headers constants start---
public static final String X_FORWARDED_FOR = "X-Forwarded-For";
public static final String X_REAL_IP = "x-real-ip";
public static final String PROXY_CLIENT_IP = "Proxy-Client-IP";
public static final String WL_PROXY_CLIENT_IP = "WL-Proxy-Client-IP";
public static final String HTTP_X_FORWARDED_FOR = "HTTP_X_FORWARDED_FOR";
public static final String HTTP_X_FORWARDED = "HTTP_X_FORWARDED";
public static final String HTTP_X_CLUSTER_CLIENT_IP = "HTTP_X_CLUSTER_CLIENT_IP";
public static final String HTTP_CLIENT_IP = "HTTP_CLIENT_IP";
public static final String HTTP_FORWARDED_FOR = "HTTP_FORWARDED_FOR";
public static final String HTTP_FORWARDED = "HTTP_FORWARDED";
public static final String HTTP_VIA = "HTTP_VIA";
public static final String REMOTE_ADDR = "REMOTE_ADDR";
// IP headers constants end---

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,33 @@
import io.mosip.kernel.core.logger.spi.Logger;
import io.mosip.resident.config.LoggerConfiguration;
import io.mosip.resident.constant.LoggerFileConstant;
import io.mosip.resident.constant.ResidentConstants;
import io.mosip.resident.exception.InvalidInputException;
import io.mosip.resident.exception.ResidentServiceCheckedException;
import io.mosip.resident.exception.ResidentServiceException;
import io.mosip.resident.service.AcknowledgementService;
import io.mosip.resident.util.AuditUtil;
import io.mosip.resident.util.EventEnum;
import io.mosip.resident.util.TemplateUtil;
import io.mosip.resident.util.Utilitiy;
import io.mosip.resident.util.Utility;
import io.mosip.resident.validator.RequestValidator;
import io.swagger.v3.oas.annotations.tags.Tag;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
* This class is used to create api for getting acknowledgement.
Expand Down Expand Up @@ -57,36 +62,40 @@ public class AcknowledgementController {
private TemplateUtil templateUtil;

@Autowired
private Utilitiy utilitiy;
private Utility utility;

@GetMapping("/ack/download/pdf/event/{eventId}/language/{languageCode}")
public ResponseEntity<Object> getAcknowledgement(@PathVariable("eventId") String eventId,
@PathVariable("languageCode") String languageCode) throws ResidentServiceCheckedException, IOException {
@PathVariable("languageCode") String languageCode,
@RequestHeader(name = "time-zone-offset", required = false, defaultValue = "0") int timeZoneOffset) throws ResidentServiceCheckedException, IOException {
logger.debug("AcknowledgementController::acknowledgement()::entry");
InputStreamResource resource = null;
String featureName = null;
try {
auditUtil.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.GET_ACKNOWLEDGEMENT_DOWNLOAD_URL, "acknowledgement"));
requestValidator.validateEventIdLanguageCode(eventId, languageCode);
byte[] pdfBytes = acknowledgementService.getAcknowledgementPDF(eventId, languageCode);
resource = new InputStreamResource(new ByteArrayInputStream(pdfBytes));
auditUtil.setAuditRequestDto(EventEnum.GET_ACKNOWLEDGEMENT_DOWNLOAD_URL_SUCCESS);
logger.debug("AcknowledgementController::acknowledgement()::exit");
featureName = templateUtil.getFeatureName(eventId);
requestValidator.validateEventIdLanguageCode(eventId, languageCode);
} catch (ResidentServiceException | InvalidInputException e) {
throw new ResidentServiceException(e.getErrorCode(), e.getErrorText(), e,
Map.of(ResidentConstants.HTTP_STATUS_CODE, HttpStatus.BAD_REQUEST, ResidentConstants.REQ_RES_ID,
ackDownloadId));
}
try {
auditUtil.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.GET_ACKNOWLEDGEMENT_DOWNLOAD_URL, "acknowledgement"));
byte[] pdfBytes = acknowledgementService.getAcknowledgementPDF(eventId, languageCode, timeZoneOffset);
resource = new InputStreamResource(new ByteArrayInputStream(pdfBytes));
auditUtil.setAuditRequestDto(EventEnum.GET_ACKNOWLEDGEMENT_DOWNLOAD_URL_SUCCESS);
logger.debug("AcknowledgementController::acknowledgement()::exit");
featureName = templateUtil.getFeatureName(eventId);
} catch(ResidentServiceCheckedException e) {
ResponseWrapper<?> responseWrapper = new ResponseWrapper<>();
responseWrapper.setId(ackDownloadId);
responseWrapper.setVersion(ackDownloadVersion);
auditUtil.setAuditRequestDto(EventEnum.GET_ACKNOWLEDGEMENT_DOWNLOAD_URL_FAILURE);
logger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.APPLICATIONID.toString(),
LoggerFileConstant.APPLICATIONID.toString(), ExceptionUtils.getStackTrace(e));
responseWrapper.setErrors(List.of(new ServiceError(e.getErrorCode(), e.getErrorText())));
return ResponseEntity.badRequest().contentType(MediaType.APPLICATION_JSON)
.body(responseWrapper);
throw new ResidentServiceCheckedException(e.getErrorCode(), e.getErrorText(), e,
Map.of(ResidentConstants.HTTP_STATUS_CODE, HttpStatus.BAD_REQUEST, ResidentConstants.REQ_RES_ID,
ackDownloadId));
}
return ResponseEntity.ok().contentType(MediaType.APPLICATION_PDF)
.header("Content-Disposition", "attachment; filename=\"" +
utilitiy.getFileNameAsPerFeatureName(eventId, featureName) + ".pdf\"")
utility.getFileNameAsPerFeatureName(eventId, featureName, timeZoneOffset) + ".pdf\"")
.body(resource);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.mosip.resident.service.DownLoadMasterDataService;
import io.mosip.resident.util.AuditUtil;
import io.mosip.resident.util.EventEnum;
import io.mosip.resident.util.Utilitiy;
import io.mosip.resident.util.Utility;
import io.mosip.resident.validator.RequestValidator;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,6 +16,7 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

Expand Down Expand Up @@ -51,7 +52,7 @@ public class DownLoadMasterDataController {
private AuditUtil audit;

@Autowired
private Utilitiy utilitiy;
private Utility utility;

@Autowired
private Environment environment;
Expand All @@ -70,7 +71,8 @@ public class DownLoadMasterDataController {
*/
@GetMapping("/download/registration-centers-list")
public ResponseEntity<Object> downloadRegistrationCentersByHierarchyLevel(@RequestParam(name="langcode") String langCode,
@RequestParam(name="hierarchylevel") Short hierarchyLevel, @RequestParam("name") List<String> name)
@RequestParam(name="hierarchylevel") Short hierarchyLevel, @RequestParam("name") List<String> name,
@RequestHeader(name = "time-zone-offset", required = false, defaultValue = "0") int timeZoneOffset)
throws ResidentServiceCheckedException, IOException, Exception {
logger.debug("DownLoadMasterDataController::getRegistrationCentersByHierarchyLevel()::entry");
DOWNLOADABLE_REGCEN_FILENAME = "regcenter-";
Expand All @@ -83,16 +85,17 @@ public ResponseEntity<Object> downloadRegistrationCentersByHierarchyLevel(@Reque
logger.debug("downLoad file name::" + DOWNLOADABLE_REGCEN_FILENAME);
logger.debug("AcknowledgementController::acknowledgement()::exit");
return ResponseEntity.ok().contentType(MediaType.parseMediaType("application/pdf"))
.header("Content-Disposition", "attachment; filename=\"" + utilitiy.getFileName(null,
.header("Content-Disposition", "attachment; filename=\"" + utility.getFileName(null,
Objects.requireNonNull(this.environment.getProperty(
ResidentConstants.DOWNLOAD_REGISTRATION_CENTRE_FILE_NAME_CONVENTION_PROPERTY))) + ".pdf\"")
ResidentConstants.DOWNLOAD_REGISTRATION_CENTRE_FILE_NAME_CONVENTION_PROPERTY)), timeZoneOffset) + ".pdf\"")
.body(resource);
}

@GetMapping("/download/nearestRegistrationcenters")
public ResponseEntity<Object> downloadNearestRegistrationcenters(@RequestParam(name="langcode") String langCode,
@RequestParam(name="longitude") double longitude, @RequestParam(name="latitude") double latitude,
@RequestParam(name="proximitydistance") int proximityDistance)
@RequestParam(name="proximitydistance") int proximityDistance,
@RequestHeader(name = "time-zone-offset", required = false, defaultValue = "0") int timeZoneOffset)
throws ResidentServiceCheckedException, IOException, Exception {
logger.debug("DownLoadMasterDataController::getRegistrationCentersByHierarchyLevel()::entry");
DOWNLOADABLE_REGCEN_FILENAME = "regcenter-";
Expand All @@ -105,14 +108,15 @@ public ResponseEntity<Object> downloadNearestRegistrationcenters(@RequestParam(n
logger.debug("downLoad file name::" + DOWNLOADABLE_REGCEN_FILENAME);
logger.debug("AcknowledgementController::acknowledgement()::exit");
return ResponseEntity.ok().contentType(MediaType.parseMediaType("application/pdf"))
.header("Content-Disposition", "attachment; filename=\"" + utilitiy.getFileName(null,
.header("Content-Disposition", "attachment; filename=\"" + utility.getFileName(null,
Objects.requireNonNull(this.environment.getProperty(
ResidentConstants.DOWNLOAD_NEAREST_REGISTRATION_CENTRE_FILE_NAME_CONVENTION_PROPERTY))) + ".pdf\"")
ResidentConstants.DOWNLOAD_NEAREST_REGISTRATION_CENTRE_FILE_NAME_CONVENTION_PROPERTY)), timeZoneOffset) + ".pdf\"")
.body(resource);
}

@GetMapping(path = "/download/supporting-documents", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<Object> downloadSupportingDocsByLanguage(@RequestParam(name = "langcode") String langCode)
public ResponseEntity<Object> downloadSupportingDocsByLanguage(@RequestParam(name = "langcode") String langCode,
@RequestHeader(name = "time-zone-offset", required = false, defaultValue = "0") int timeZoneOffset)
throws ResidentServiceCheckedException, IOException, Exception {
logger.debug("DownLoadMasterDataController::getSupportingDocsByLanguageCode()::entry");
DOWNLOADABLE_SUPPORTING_FILENAME = "supportingDocs-";
Expand All @@ -125,9 +129,9 @@ public ResponseEntity<Object> downloadSupportingDocsByLanguage(@RequestParam(nam
logger.debug("downLoad file name::" + DOWNLOADABLE_SUPPORTING_FILENAME);
logger.debug("AcknowledgementController::acknowledgement()::exit");
return ResponseEntity.ok().contentType(MediaType.parseMediaType("application/pdf"))
.header("Content-Disposition", "attachment; filename=\"" + utilitiy.getFileName(null,
.header("Content-Disposition", "attachment; filename=\"" + utility.getFileName(null,
Objects.requireNonNull(this.environment.getProperty(
ResidentConstants.DOWNLOAD_SUPPORTING_DOCUMENT_FILE_NAME_CONVENTION_PROPERTY))) + ".pdf\"")
ResidentConstants.DOWNLOAD_SUPPORTING_DOCUMENT_FILE_NAME_CONVENTION_PROPERTY)), timeZoneOffset) + ".pdf\"")
.body(resource);
}
/**
Expand Down
Loading