Part 6: Scheduled Functions and Anniversary Logic
Useful documentation
Overview and success criteria
✅ Every 1 January, the cover amount is increased by R10,000.00 for all policies that are older than a year, and the premium is recalculated.
✅ Unit tests are written to determine the successful execution of the scheduled function.
Watch our explainer videos:
Watch the video Policy Lifecycle: Renewals & Anniversaries to learn more about how scheduled functions can be used to update anniversary logic:
To successfully apply the anniversary logic to a policy using scheduled functions follow these steps:
- Start by adding the scheduled function to the .root-config file, where the frequency, policy statuses and the function name are specified.
- Create the function that correlates with the function name specified in the config file, with the accompanying business logic specified below.
- Create unit tests that thoroughly test the correct application of the scheduled function, and pricing and cover updates on the policy.
Updating anniversary logic with scheduled functions
Business rules
Ref | Details |
---|---|
AH1 | On the 1st of January, all policies older than a year should have their cover increased by R10,000.00 and the accompanying premium is calculated and updated on the policy. |
Testing
The scenarios below should have unit tests written for them to show that the logic has been implemented correctly:
A policy younger than a year does not increase in cover on the 1st of January.
A policy older than a year does increase in cover on the 1st of January.
A policy older than a year does not increase in cover on any other date except 1st of January.
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 uses can you think of for scheduled functions?
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 7 months ago