From 7dcc471c47cc2b2ff284e6dfd14ec1dbe6703b04 Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Tue, 23 Jan 2024 14:24:48 +0000 Subject: [PATCH] Move getting the licence holder to the model https://eaflood.atlassian.net/browse/WATER-4188 https://eaflood.atlassian.net/browse/WATER-4328 Much like in [Move licence end date logic to model](https://github.com/DEFRA/water-abstraction-system/pull/681) we have another two tickets that need to identify the licence holder for a licence. We've already figured out how to do that in [Add licence ref. and holder to rtn. req. session](https://github.com/DEFRA/water-abstraction-system/pull/639). But that implementation was specific to return requirements and unlike `myContact.$name()` and `myLicence.$ends()` to determine the licence holder you need to have pulled through a series of related models. So, for the same reasons we want to move this piece of logic to the model to make it easier to reuse. However, their will be differences in implementation. This change adds the logic to the model and then refactors `InitiateReturnRequirementSessionService` to demonstrate how to use it.