Skip to content

Commit

Permalink
Merge pull request #1818 from MonobikashDas/develop
Browse files Browse the repository at this point in the history
MOSIP-28121 : calling idrepo instead of packetmanager in credential r…
  • Loading branch information
vishwa-vyom authored Jan 3, 2024
2 parents 8fdeb49 + 059a7d9 commit 320a715
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import io.mosip.registration.processor.credentialrequestor.dto.CredentialPartner;
import io.mosip.registration.processor.credentialrequestor.stage.exception.VidNotAvailableException;
import io.mosip.registration.processor.credentialrequestor.util.CredentialPartnerUtil;
import io.mosip.registration.processor.packet.storage.exception.ParsingException;
import io.mosip.registration.processor.packet.storage.utils.Utilities;
import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder;
import io.mosip.registration.processor.status.code.RegistrationStatusCode;
Expand All @@ -41,7 +40,6 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -198,7 +196,7 @@ public MessageDTO process(MessageDTO object) {
registrationStatusDto
.setLatestTransactionTypeCode(RegistrationTransactionTypeCode.PRINT_SERVICE.toString());
registrationStatusDto.setRegistrationStageName(getStageName());
JSONObject jsonObject = utilities.retrieveUIN(regId);
JSONObject jsonObject = utilities.idrepoRetrieveIdentityByRid(regId);
uin = JsonUtil.getJSONValue(jsonObject, IdType.UIN.toString());
if (uin == null) {
regProcLogger.error(LoggerFileConstant.SESSIONID.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import io.mosip.kernel.core.exception.ExceptionUtils;
import io.mosip.kernel.core.logger.spi.Logger;
import io.mosip.kernel.core.util.exception.JsonProcessingException;
import io.mosip.registration.processor.core.constant.JsonConstant;
import io.mosip.registration.processor.core.constant.LoggerFileConstant;
import io.mosip.registration.processor.core.constant.MappingJsonConstants;
import io.mosip.registration.processor.core.constant.ProviderStageName;
import io.mosip.registration.processor.core.constant.*;
import io.mosip.registration.processor.core.exception.ApisResourceAccessException;
import io.mosip.registration.processor.core.exception.PacketManagerException;
import io.mosip.registration.processor.core.exception.RegistrationProcessorCheckedException;
Expand Down Expand Up @@ -128,11 +125,11 @@ public List<CredentialPartner> getCredentialPartners(String regId, String regist
return Lists.emptyList();
}

Map<String, String> identityFieldValueMap = utilities.getPacketManagerService().getFields(regId,
requiredIdObjectFieldNames, registrationType, ProviderStageName.CREDENTIAL_REQUESTOR);
Map<String, Object> identityFieldValueMap = new HashMap<>();
requiredIdObjectFieldNames.forEach(field -> identityFieldValueMap.put(field, JsonUtil.getJSONValue(identity, field)));

Map<String, Object> context = new HashMap<>();
for (Map.Entry<String, String> identityAttribute: identityFieldValueMap.entrySet()) {
for (Map.Entry<String, Object> identityAttribute: identityFieldValueMap.entrySet()) {
JSONObject attributeObject = new JSONObject(identityFieldValueMap);
try {
if (identityAttribute.getKey() != null && identityAttribute.getValue() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void setup() throws Exception {
Map<String, String> map1 = new HashMap<>();
map1.put("UIN", "4238135072");
JSONObject jsonObject = new JSONObject(map1);
Mockito.when(utitilites.retrieveUIN(any())).thenReturn(jsonObject);
Mockito.when(utitilites.idrepoRetrieveIdentityByRid(any())).thenReturn(jsonObject);

CredentialPartner partner1 = new CredentialPartner();
partner1.setId("digitalcardPartner");
Expand Down Expand Up @@ -396,7 +396,7 @@ public void testUINNotavailable()
Map<String, String> map1 = new HashMap<>();

JSONObject jsonObject = new JSONObject(map1);
Mockito.when(utitilites.retrieveUIN(any())).thenReturn(jsonObject);
Mockito.when(utitilites.idrepoRetrieveIdentityByRid(any())).thenReturn(jsonObject);
MessageDTO result = stage.process(dto);

assertFalse(result.getIsValid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ public String getLatestTransactionId(String registrationId, String process, int
* @throws IOException Signals that an I/O exception has
* occurred.
*/
public JSONObject retrieveUIN(String regId) throws ApisResourceAccessException, IdRepoAppException, IOException {
public JSONObject idrepoRetrieveIdentityByRid(String regId) throws ApisResourceAccessException, IdRepoAppException, IOException {
regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(),
regId, "Utilities::retrieveUIN()::entry");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ private Map<String, Object> setAttributes(String id, String process, String lang

String uin = "";
if (idType.toString().equalsIgnoreCase(UIN)) {
JSONObject jsonObject = utility.retrieveUIN(id);
JSONObject jsonObject = utility.idrepoRetrieveIdentityByRid(id);
uin = JsonUtil.getJSONValue(jsonObject, UIN);
attributes.put("RID", id);
attributes.put("UIN", uin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void setup() throws Exception {

map1.put("UIN", "423072");
JSONObject jsonObject1 = new JSONObject(map1);
Mockito.when(utility.retrieveUIN(any())).thenReturn(jsonObject1);
Mockito.when(utility.idrepoRetrieveIdentityByRid(any())).thenReturn(jsonObject1);
Mockito.when(utility.getGetRegProcessorDemographicIdentity()).thenReturn("identity");

InputStream in = IOUtils.toInputStream("Hi Alok, Your UIN is generated", "UTF-8");
Expand Down

0 comments on commit 320a715

Please sign in to comment.