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

MOSIP-27035-in-update-my-data-page-getting-error-message-like-invalid-input-parameter-transaction-id-when-we-update-the-language-preference #882

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
639cbeb
fixed id version for document APIs
Mar 24, 2023
f78abba
Merge branch 'develop' of https://github.com/mosip/resident-services …
Mar 24, 2023
1565410
update constant names
Mar 27, 2023
3ccfc54
used constant file_text
Mar 27, 2023
6917022
added validation on req credential API
Mar 28, 2023
ad66d56
Merge branch 'develop' of https://github.com/mosip/resident-services …
Mar 28, 2023
ad40dff
added validation for req credential API
Mar 29, 2023
1c27d17
Merge branch 'develop' of https://github.com/mosip/resident-services …
Mar 29, 2023
5ae27d1
Merge branch 'develop' of https://github.com/mosip/resident-services …
Mar 29, 2023
3983879
removed duplicate code
Mar 29, 2023
900e57c
fixed rid status issue
Mar 30, 2023
50fa48d
Merge branch 'develop' of https://github.com/mosip/resident-services …
Mar 30, 2023
bb6bff3
removed name from enum
Mar 30, 2023
e98a73c
code fix for rid status issue
Mar 31, 2023
4405796
update validate request body method
Mar 31, 2023
b90ff32
resolved merge conflict
Mar 31, 2023
861d167
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 3, 2023
113c72e
Merge branch 'develop' of https://github.com/mosip/resident-services.…
Apr 4, 2023
605ac9f
Merge branch 'develop' of https://github.com/mosip/resident-services.…
Apr 4, 2023
c68783b
fixed registration center issue
Apr 5, 2023
265ec29
resolved merge conflict
Apr 5, 2023
b3f6e58
Merge branch 'develop' of https://github.com/mosip/resident-services.…
Apr 11, 2023
fb50ef1
added notification in validate otp API
Apr 12, 2023
2680167
fixed authentication request description
Apr 12, 2023
361eb27
removed space
Apr 12, 2023
ee70d26
removed validate otp from auth request service type
Apr 12, 2023
63c3b20
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 12, 2023
af2aba1
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 13, 2023
76ac174
added notification to get my uin API
Apr 13, 2023
2739dc8
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 13, 2023
758d76f
added notification in personalised card API
Apr 13, 2023
a7d6f51
fixed null check
Apr 13, 2023
b42f6d4
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 13, 2023
1a5d6f9
refactor code
Apr 13, 2023
c66ceda
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 13, 2023
f0462d9
Merge branch 'develop' of https://github.com/mosip/resident-services.…
Apr 13, 2023
ceccca0
fixed code for notify
Apr 14, 2023
296cc0f
code refactoring
Apr 15, 2023
8f12ec9
fixed test case failure
Apr 15, 2023
127b1da
take templatetype code from properties
Apr 17, 2023
6bde245
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 17, 2023
6926925
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 17, 2023
03abd35
fixed preferred language doc error
Apr 17, 2023
cc2e41c
Merge branch 'develop' of https://github.com/mosip/resident-services …
Apr 19, 2023
1c6bdbe
fixed code
Apr 19, 2023
82b3920
renamed variable
Apr 19, 2023
3af2972
take list from property
Apr 19, 2023
b7a5178
removed unused import
Apr 19, 2023
239ff52
added comment and changed list to stream
Apr 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 @@ -250,5 +250,6 @@ private ResidentConstants() {

public static final String PREFERRED_LANG_PROPERTY = "resident.update.preferred.language.by.name";
public static final String PREFERRED_LANGUAGE = "preferredLanguage";
public static final String RESIDENT_ATTRIBUTE_NAMES_WITHOUT_DOCUMENTS_REQUIRED = "resident.attribute.names.without.documents.required";

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import io.mosip.resident.constant.MappingJsonConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static io.mosip.resident.service.impl.ResidentOtpServiceImpl.EMAIL_CHANNEL;
import static io.mosip.resident.service.impl.ResidentOtpServiceImpl.PHONE_CHANNEL;

import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -14,6 +15,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.annotation.PostConstruct;
import javax.validation.Valid;
Expand Down Expand Up @@ -76,6 +78,7 @@
import io.mosip.resident.exception.ResidentServiceException;
import io.mosip.resident.repository.ResidentTransactionRepository;
import io.mosip.resident.service.impl.IdentityServiceImpl;
import io.mosip.resident.service.impl.ResidentConfigServiceImpl;
import io.mosip.resident.service.impl.ResidentServiceImpl;
import io.mosip.resident.service.impl.UISchemaTypes;
import io.mosip.resident.util.AuditUtil;
Expand Down Expand Up @@ -108,6 +111,9 @@ public class RequestValidator {
@Autowired
private IdentityServiceImpl identityService;

@Autowired
private ResidentConfigServiceImpl residentConfigService;

@Autowired
private ResidentTransactionRepository residentTransactionRepository;

Expand Down Expand Up @@ -812,10 +818,37 @@ public void validateUpdateRequest(RequestWrapper<ResidentUpdateRequestDto> reque
throw new InvalidInputException("otp");
}

if (StringUtils.isEmpty(requestDTO.getRequest().getTransactionID())) {
audit.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.INPUT_INVALID, "transactionID",
"Request for update uin"));
throw new InvalidInputException("transactionID");
if(requestDTO.getRequest().getIdentity()!=null) {
List<String> attributesWithoutDocumentsRequired = new ArrayList<>();
try {
Map<String, Object> identityMappingMap = residentConfigService.getIdentityMappingMap();
attributesWithoutDocumentsRequired = Stream.of(
(environment.getProperty(ResidentConstants.RESIDENT_ATTRIBUTE_NAMES_WITHOUT_DOCUMENTS_REQUIRED))
.split(ResidentConstants.ATTRIBUTE_LIST_DELIMITER))
.filter(attribute -> identityMappingMap.containsKey(attribute))
.map(attribute -> String
.valueOf(((Map) identityMappingMap.get(attribute)).get(ResidentConstants.VALUE)))
.collect(Collectors.toList());

} catch (ResidentServiceCheckedException | IOException e) {
throw new RuntimeException(e);
}
Map<String, ?> identityDataFromRequest = requestDTO.getRequest().getIdentity();
List<String> attributeKeysFromRequest = identityDataFromRequest.keySet().stream().collect(Collectors.toList());
// checking if the attributes coming from request body present in attributes list coming from properties
if(!attributesWithoutDocumentsRequired.containsAll(attributeKeysFromRequest)) {
if (StringUtils.isEmpty(requestDTO.getRequest().getTransactionID())) {
audit.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.INPUT_INVALID, "transactionID",
"Request for update uin"));
throw new InvalidInputException("transactionID");
}
}
} else {
if (StringUtils.isEmpty(requestDTO.getRequest().getTransactionID())) {
audit.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.INPUT_INVALID, "transactionID",
"Request for update uin"));
throw new InvalidInputException("transactionID");
}
}

if(!isPatch) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import io.mosip.resident.repository.ResidentTransactionRepository;
import io.mosip.resident.service.ResidentService;
import io.mosip.resident.service.impl.IdentityServiceImpl;
import io.mosip.resident.service.impl.ResidentConfigServiceImpl;
import io.mosip.resident.service.impl.ResidentServiceImpl;
import io.mosip.resident.util.AuditUtil;
import io.mosip.resident.validator.RequestValidator;
Expand Down Expand Up @@ -98,6 +99,9 @@ public class RequestValidatorTest {
@Mock
private Environment environment;

@Mock
private ResidentConfigServiceImpl residentConfigService;

@Mock
private ResidentTransactionRepository residentTransactionRepository;

Expand Down