Skip to content

Commit

Permalink
Merge pull request mosip#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…
Signed-off-by: Monobikash Das <[email protected]>
  • Loading branch information
vishwa-vyom authored and Monobikash Das committed Jan 4, 2024
1 parent d8faaed commit 57bcc8b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 15 deletions.
10 changes: 10 additions & 0 deletions registration-processor/mosip-stage-executor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
<artifactId>registration-processor-core</artifactId>
<version>${registration.processor.core.version}</version>
</dependency>
<dependency>
<groupId>io.mosip.registrationprocessor</groupId>
<artifactId>registration-processor-credential-requestor-stage</artifactId>
<version>1.2.0.1-B3</version>
</dependency>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter</artifactId>
<version>1.2.0.1-B2</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
spring.cloud.config.uri=localhost
spring.cloud.config.uri=http://localhost:51000/config
spring.cloud.config.label=master
spring.application.name=application,registration-processor
spring.profiles.active=dev
spring.profiles.active=default
spring.cloud.config.name=registration-processor
config.server.file.storage.uri=${spring.cloud.config.uri}/${packet.info.storage.service}/${spring.profiles.active}/${spring.cloud.config.label}/
management.endpoints.web.exposure.include=refresh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ public void deployVerticle() {
mosipEventBus = this.getEventBus(this, clusterManagerUrl, workerPoolSize);
this.consumeAndSend(mosipEventBus, MessageBusAddress.PRINTING_BUS_IN, MessageBusAddress.PRINTING_BUS_OUT,
messageExpiryTimeLimit);

MessageDTO messageDTO = new MessageDTO();
messageDTO.setRid("11631114541001520240104070442");
messageDTO.setReg_type("NEW");
messageDTO.setWorkflowInstanceId("f0b9911b-0c47-4454-8c8b-98d49109de38");
process(messageDTO);
}

/*
Expand Down Expand Up @@ -196,7 +202,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 @@ -245,7 +245,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 @@ -394,7 +394,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 @@ -662,7 +662,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 57bcc8b

Please sign in to comment.