From 51441cd842a2cb29a419176add88c01ab56ef6df Mon Sep 17 00:00:00 2001 From: jamil314 Date: Fri, 31 Jan 2025 16:17:36 +0600 Subject: [PATCH] fix: payment details not found --- .../metrics/src/features/registration/fhirUtils.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/metrics/src/features/registration/fhirUtils.ts b/packages/metrics/src/features/registration/fhirUtils.ts index 6ea07671c32..d036ab7ce42 100644 --- a/packages/metrics/src/features/registration/fhirUtils.ts +++ b/packages/metrics/src/features/registration/fhirUtils.ts @@ -18,6 +18,10 @@ import { export const CAUSE_OF_DEATH_CODE = 'ICD10' export const MANNER_OF_DEATH_CODE = 'uncertified-manner-of-death' import { NOTIFICATION_TYPES } from '@metrics/features/metrics/constants' +import { + URLReference, + urlReferenceToResourceIdentifier +} from '@opencrvs/commons/types' export function getSectionBySectionCode( bundle: fhir.Bundle, @@ -148,8 +152,12 @@ export function getPaymentReconciliation( const paymentDetailsReference = task.extension?.find((x) => x.url.includes('paymentDetails') )?.valueReference?.reference - return bundle.entry?.find((x) => x.fullUrl === paymentDetailsReference) - ?.resource as fhir.PaymentReconciliation + return bundle.entry?.find( + (x) => + x.fullUrl && + urlReferenceToResourceIdentifier(x.fullUrl as URLReference) === + paymentDetailsReference + )?.resource as fhir.PaymentReconciliation } return getResourceByType(