> * a Policy entity service with have a capability (Erl-speak for a > method) 'cancel' which will check that the policy is currently in a > valid state to be cancelled (e.g. correct status, premium payments > up to date etc) and then set its status to 'cancelled'. [I would > contrast this with my interpretation of a 'data service' which > would probably just have a 'setStatus' method and assume the caller > knows when it's ok to set the status to the requested value] > > * a Rate entity service with capability calculateRefund() which > calculates the refund based on policy information eg # of days left > on policy > * a customer entity service with capability getBankingDetails() - > this is a pure read .. > * a Payment task service which facilitates the process of effecting > a payment, including any human approvals that may be needed. > and > * a Cancellation task service which orchestrates all of the above > to effect policy cancellation.
Hi, Interesting, I'd like to contrast it with my own preferred solution (I think they are quite similiar). Policy/Rate/Customer would all be entities (and probably aggregate roots in DDD terms) in a domain model specifically created for handling auto insurance policies. We'd design each of these classes for the purpose at hand, without worrying about coming up with totally generic representations to publish to the rest of the enterprise. On top of them would be a couple of thin service classes, one for payment and one for cancellation. These would coordinate the domain model entities and any other work (e.g. sending messages to other systems) that is required. These would be the public interface into the auto-insurance policy system. As I say I'm not sure they are that different because it sounds to me like you are designing your entity services specifically for the job at hand. With that in mind those entity services will only be used by the task services that are specifically related to auto-insurance policies, and if so the two approaches are not that different. If however you publish these entity services into a public service inventory then I think you have to deal with things differently... Ta for replying by the way, interesting to hear how others are tackling these sorts of issues. -Colin Jack
