To enable the execution of events within our system, we need to integrate them into our router. Here we will update the company's router to handle the first three types of events: shares release, capitalization, and shares split.
We begin by verifying the existence of the company before processing any events.
Verify Shares Property:
If the shares property in the payload is greater than the existing number of shares, we trigger the shares release event.
Define Event Properties:
We ensure only necessary properties are included: type, ID, date, and specific company data.
Verify Capitalization Property:
If the capitalization value in the request exceeds the current company capitalization, we trigger the capitalization event.
Define Event Properties:
Include required properties such as type, ID, date, companyId, and capitalization.
Verify Split Factor:
If the shares split factor is greater than zero, we initiate the shares split event.
Define Event Properties:
Properties include type, ID, date, companyId, and split factor.
We need to ensure that all events are correctly closed, especially when auto-generated code might omit necessary closures.
By following these steps, we can effectively manage shares release, capitalization, and shares split events within our router. Each event is thoroughly verified for correctness in structure and required properties.
Note: Always test to ensure these configurations are functioning as expected before deploying them to a production environment.