diff --git a/mediator/src/main/java/io/mosip/opencrvs/dto/DecryptedEventDto.java b/mediator/src/main/java/io/mosip/opencrvs/dto/DecryptedEventDto.java index e85d89b..41e99c4 100644 --- a/mediator/src/main/java/io/mosip/opencrvs/dto/DecryptedEventDto.java +++ b/mediator/src/main/java/io/mosip/opencrvs/dto/DecryptedEventDto.java @@ -12,7 +12,14 @@ public static class Focus { public String reference; } public static class Identifier{ - public String type; + public static class Type { + public static class Coding { + public String system; + public String code; + } + public List coding; + } + public Type type; public String system; public String value; } diff --git a/mediator/src/main/java/io/mosip/opencrvs/service/DeathEventHandlerService.java b/mediator/src/main/java/io/mosip/opencrvs/service/DeathEventHandlerService.java index 29f2d9e..e68598b 100644 --- a/mediator/src/main/java/io/mosip/opencrvs/service/DeathEventHandlerService.java +++ b/mediator/src/main/java/io/mosip/opencrvs/service/DeathEventHandlerService.java @@ -9,6 +9,7 @@ import io.mosip.opencrvs.constant.LoggingConstants; import io.mosip.opencrvs.dto.BaseEventRequest; import io.mosip.opencrvs.dto.DecryptedEventDto; +import io.mosip.opencrvs.dto.DecryptedEventDto.Event.Context.Entry.Resource.Identifier.Type.Coding; import io.mosip.opencrvs.error.ErrorCode; import io.mosip.opencrvs.util.LogUtil; import io.mosip.opencrvs.util.OpencrvsCryptoUtil; @@ -124,8 +125,10 @@ public String getUINFromDecryptedEvent(DecryptedEventDto decryptedEventDto) thro throw ErrorCode.MISSING_UIN_IN_DEATH_EVENT.throwChecked(); } for(DecryptedEventDto.Event.Context.Entry.Resource.Identifier identifier: patient.identifier){ - if("NATIONAL_ID".equals(identifier.type)){ - return identifier.value; + for(Coding coding : identifier.type.coding) { + if("NATIONAL_ID".equals(coding.code)){ + return identifier.value; + } } } throw ErrorCode.MISSING_UIN_IN_DEATH_EVENT.throwChecked(); diff --git a/mediator/src/main/java/io/mosip/opencrvs/util/OpencrvsDataUtil.java b/mediator/src/main/java/io/mosip/opencrvs/util/OpencrvsDataUtil.java index bd49b8f..b75b8c5 100644 --- a/mediator/src/main/java/io/mosip/opencrvs/util/OpencrvsDataUtil.java +++ b/mediator/src/main/java/io/mosip/opencrvs/util/OpencrvsDataUtil.java @@ -6,6 +6,7 @@ import io.mosip.kernel.core.util.StringUtils; import io.mosip.opencrvs.constant.LoggingConstants; import io.mosip.opencrvs.dto.DecryptedEventDto; +import io.mosip.opencrvs.dto.DecryptedEventDto.Event.Context.Entry.Resource.Identifier.Type.Coding; import io.mosip.opencrvs.dto.ReceiveDto; import io.mosip.opencrvs.error.ErrorCode; import org.json.JSONObject; @@ -127,8 +128,10 @@ public ReceiveDto buildIdJson(DecryptedEventDto opencrvsRequestBody){ public String getOpencrvsBRNFromPatientBody(DecryptedEventDto.Event.Context.Entry.Resource patient){ for(DecryptedEventDto.Event.Context.Entry.Resource.Identifier identifier : patient.identifier){ - if("BIRTH_REGISTRATION_NUMBER".equals(identifier.type)){ - return identifier.value; + for(Coding coding : identifier.type.coding) { + if("BIRTH_REGISTRATION_NUMBER".equals(coding.code)){ + return identifier.value; + } } } return null; @@ -220,8 +223,10 @@ public String getRidFromBody(DecryptedEventDto decryptedEvent){ for(DecryptedEventDto.Event.Context.Entry entry: contextEntries) { if ("Patient".equals(entry.resource.resourceType)) { for(DecryptedEventDto.Event.Context.Entry.Resource.Identifier identifier : entry.resource.identifier){ - if("MOSIP_AID".equals(identifier.type)){ - return identifier.value; + for(Coding coding : identifier.type.coding) { + if("MOSIP_AID".equals(coding.code)){ + return identifier.value; + } } } break;