-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): Self Service Portal APIs #8286
base: develop
Are you sure you want to change the base?
Conversation
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
if (eventType === 'BIRTH' && statusType === 'approved') { | ||
currentTrigger = TRIGGERS.BIRTH_APPROVED | ||
} else if (eventType === 'BIRTH' && statusType === 'rejected') { | ||
currentTrigger = TRIGGERS.BIRTH_REJECTED | ||
} else if (eventType === 'DEATH' && statusType === 'approved') { | ||
currentTrigger = TRIGGERS.DEATH_APPROVED | ||
} else if (eventType === 'DEATH' && statusType === 'rejected') { | ||
currentTrigger = TRIGGERS.DEATH_REJECTED | ||
} else { | ||
throw new Error('Invalid eventType or statusType') | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this filtering needed? We're making it possible for event type to be whatever value in the future so if these variables could be whatever, we'd support the new approach right away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep this filtering, then do it on the route definition level, so instead of one catch-all
'/events/{eventType}/status/{statusType}'
you would do
/events/birth/status/approved'
/events/birth/status/rejected'
and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can remove this. However, what will serve as the trigger point for the webhook?
Currently, it's set up like BIRTH_REGISTERED
, DEATH_REGISTERED
and so on.
How can we filter the webhook to ensure it only triggers for the desired events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific constraint that prevents us from calling /events/{eventType}/status/{statusType}
with arbitrary event type and status type e.g. '/events/divorce/status/my-custom-status'
? The hub.topic that gets sent could directly be divorce/my-custom-status
in this case without us needing the hard coded triggers at all
export enum TRIGGERS {
BIRTH_REGISTERED,
DEATH_REGISTERED,
BIRTH_CERTIFIED,
DEATH_CERTIFIED,
BIRTH_CORRECTED,
DEATH_CORRECTED
}
This approach would support Events v2 right away.
cc @euanmillar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rikukissa @euanmillar
When doing this, the webhook subscribe POST API
also needs to be changed.
Currently, the hub.topic
should be in TRIGGERS
I have removed that validation in this API also.
Changes are pushed.
@@ -148,6 +149,14 @@ export const approveCorrectionRoute = createRoute({ | |||
} | |||
) | |||
|
|||
await invokeWebhooks({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tharakadadigama20 this webhook for correction isnt dispatching for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated it. Please check now.
@rikukissa no sure how best to brief on how the triggers should work for Events V2. If you have any time to technically design that then I can brief the team. @tharakadadigama20 I am not getting any webhook dispatch where a Registration Agent has validated a declaration from a field agent. This is where we would expect that BIRTH_VALIDATED webhook to be invoked. The reject one is working well. Additionally I am not getting any BIRTH_CORRECTED webhook. Maybe you should take a look through the workflow microservice some more to debug where those webhooks should be invoked. |
…nto ocrvs-2268-webhook
…nto ocrvs-2268-webhook
Added webhooks when registration is approved/ rejected and record search API to return records of all statuses
Ticket no: 2268 (sub task)
When an registration is approved or rejected (on correction as well), an webhook is being sent which consists of the trackingId and Status.
Sample webhook payload:
Additionally in the record search API, the declare, validated and rejected statuses registrations are also returned.