mardi 21 juin 2016

Design pattern for a complex scenario based processing

I am developing a complex subscription management system in which users can make changes to ongoing subscription by submitting a change-request. Once approved by admins, the changes are applied to their ongoing subscription. The change-request form is comprised of different sections and they can occur altogether or in any combination possible:

  1. Shipping changes: address and shipping contact changes
  2. Product period changes: changes to subscription product cycle i.e. duration extension and shortening with impact to next item in queue.
  3. Product swap: changing upcoming product with a new one.
  4. Discount changes: if user is entitled to any discount due to company product in-availability, etc.
  5. Insurance changes: if user decides to handle product insurance himself.

Inside, all these sections there are sub sections which result in more complex scenarios. And each of these changes can individually result in changing following records: 1. Subscription 2. Subscription item 3. Payments 4. Creation of snapshot records of subscription.

I am already using UnitOfWork for handling transactions throughout individual change scenarios and template method pattern for processing this but requirements are changing so rapidly, I end up changing the whole process. Can someone please suggest a design pattern for helping scenario based processing?

Aucun commentaire:

Enregistrer un commentaire