I'm building a web-app for a licensing service. My domain models are Licenses, and they can be of two types at the moment: server and client license. They are almost same, except server license has softwareId field, and client license has hardwareIdArray (client licenses can be registered to multiple clients).
So, I have a base model License with it's children: ClientLicense and ServerLicense, which bring additional fields.
Models of each type are fetched by respective Repositories (I'm using TYPO3 Extbase framework, where it is standard and recommended way).
Now comes the interesting part: each license has some additional info, which I can't persist (well, I can, but only in temp cache), but instead should fetch it from REST service (e.g. "expirationDate", which may be changed outside of my web-app). And for each type of license this additional info may be different and may be fetched by different method in REST api. Also each license type has different activate() REST method. At same time there are common REST methods, like getLicenseFile().
So, I decided to hide all this internal stuff under LicenseService class, which is recommended to communicate by Controllers or other classes, that need some license info. LicenseService itself communicates to LicenseRestApi, which contains some low-level functionality to perform REST requests.
And here comes a question: who should know about each license type specific functionality? F.e. when a controller asks a service to getAllLicenses($user), is it a Service, who should determine a type of license and then perform calls to respective Repository and appropriate methods in RestApi; or a license should know everything about itself and call RestApi; or some new classes, like ClientLicenseProcessor and ServerLicenseProcessor, to which should LicenseService communicate and all the communication with RestApi should be within these processors, so in this case LicenseService will act as FactoryMethod for creating appropriate processor?
My goal is to hold specific type logic in one place and not spread it between several classes.