Part 5: Lifecycle Hooks and Reactivation
Learn how to manage policy life cycles and policy reactivation. These hooks are pivotal for maintaining policies effectively.
Useful documentation
Overview and success criteria
✅ If a policy is in a lapsed or cancelled state, it can be reactivated via the Root API or Dashboard.
✅ The policy has a reactivation date added to the module data on reactivation.
✅ Unit tests are written to see that a policy can be reactivated and the correct data is added to it.
Watch our explainer videos:
Watch the video on Policy Lifecycle: Lifecycle hooks to learn more configuring lifecycle hooks on the Root platform:
In this part of the course, you want to build the ability for a policy to reactivate from a cancelled or lapsed state. Policies being reactivated is a common insurance practice and is usually accompanied by a few business rules.
To successfully reactivate a policy follow these steps:
- Add the reactivation option to the policy, and ensure that the policy can be reactivated, which should have been set in the configuration of the product in Part 1.
- Use the beforePolicyReactivated( ) hook to determine whether the policy can be reactivated (state of lapse or cancelled) and adding the reactivation date to the module data with an action.
Testing
The scenarios below should have unit tests written for them to show that the logic has been implemented correctly:
- A policy being reactivated with a status of cancelled and lapsed can be reactivated.
- A policy with a status of expired cannot be reactivated.
If you're doing the Root certification:
Once you’ve worked through the changes above, submit it as a pull request into the
main
branch on your Github repository. In the PR description, copy and answer the questions below in the last section Part Specific Questions. Message your facilitator to review the PR when ready.Question:
What other limits do you think would be useful to add to policy reactivation restrictions?
You can proceed to the next part without being blocked by the facilitator, but be sure to branch off of this part’s branch to ensure that these workings are in place for the next part. You will be required to ship a new PR for the next Part.
Updated 5 months ago