Skip to content

Commit a079a08

Browse files
committed
fix: how the mock expects the data to look like
1 parent 878c43a commit a079a08

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

packages/mosip-mock/src/routes/birth.ts

+6-11
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@ const CREDENTIAL_PARTNER_CERTIFICATE = readFileSync(
1919

2020
const sendNid = async ({
2121
token,
22-
bundle,
22+
payload,
2323
}: {
2424
token: string;
25-
bundle: fhir3.Bundle;
25+
payload: { event: { context: [fhir3.Bundle] } };
2626
}) => {
27-
const composition = getComposition(bundle);
28-
const child = findEntry(
29-
"child-details",
30-
composition,
31-
bundle,
32-
) as fhir3.Patient;
33-
const brn = child.identifier?.[0].value;
27+
const child = payload.event.context[0].entry![0].resource as fhir3.Patient;
28+
const brn = child.identifier![0].value;
3429

3530
console.log(`${JSON.stringify({ brn }, null, 4)}, creating NID...`);
3631

@@ -89,9 +84,9 @@ type OpenCRVSBirthEvent = {
8984
export const birthHandler: RouteHandlerMethod = async (request, reply) => {
9085
const { token, data } = request.body as OpenCRVSBirthEvent;
9186

92-
const bundle = decryptData(data, CREDENTIAL_PARTNER_PRIVATE_KEY);
87+
const payload = decryptData(data, CREDENTIAL_PARTNER_PRIVATE_KEY);
9388

94-
sendNid({ token, bundle }).catch((e) => {
89+
sendNid({ token, payload }).catch((e) => {
9590
console.error(e);
9691
});
9792

0 commit comments

Comments
 (0)