Refactor: Move WebOrdering Handlers and Services to New Project

Refactor: Move WebOrdering Handlers and Services to New Project

Refactor: Move WebOrdering Handlers and Services to New Project

Author: Duane Gerken
Date: 2026-04-20
Status: Planning — Option B approved


Overview

This document describes the detailed steps and effort estimates for extracting the WebOrdering handler classes and their supporting services from Gops.OrderManagement into two new assemblies:

  • Northstar.WebOrdering.Shared — shared DTOs, data models, and service interfaces (consumed by both Gops.OrderManagement and the new handlers/services project)

  • Gops.WebOrdering — all WebOrdering handlers, services, and AutoMapper profiles

The goal is to improve separation of concerns, break the circular dependency cleanly, reduce the size of Gops.OrderManagement, and make the WebOrdering layer independently testable and deployable.


Assembly Structure After Refactor

Northstar.WebOrdering.Shared (new) Data\ ← 53+ WebOrdering DTOs moved here Services\Checks\Contracts\ ← ICheckService, IWebOrderingValidationService, IWebOrderingCompatibilityManager Services\OrderEntryEvents\Contracts\ ← IOrderEntryEventNotifier Gops.WebOrdering (new) Handlers\ ← 63 handler classes + MapperProfiles + Models Services\Checks\ ← CheckService, CheckService.Coupons, WebOrderingValidationService, WebOrderingCompatibilityManager Services\OrderEntryEvents\ ← OrderEntryEventNotifier + Entities Gops.OrderManagement (existing — shrinks) WebOrderManager.cs ← stays (references Northstar.WebOrdering.Shared for DTOs) Helpers\OrderItemComponentsAssignerHelper.cs ← stays Extensions\ISessionManagerExtensions.cs ← stays Extensions\ICacheManagerExtensions.cs ← stays IWebOrderHandler.cs ← stays [all other non-WebOrdering code] ← stays

Dependency graph (no cycles):

Northstar.WebOrdering.Shared ← Gops.OrderManagement ← Gops.WebOrdering ← Gops.AlertManagement ← Gops.TableManagement ← Gops.WebServices Gops.OrderManagement ← Gops.WebOrdering ← Gops.WebServices

What Moves Where

Into Northstar.WebOrdering.Shared

Source (in Gops.OrderManagement)

New namespace

Source (in Gops.OrderManagement)

New namespace

Data\WebOrdering\ (53+ DTO classes)

Northstar.WebOrdering.Shared.Data

Services\Checks\Contracts\ICheckService.cs

Northstar.WebOrdering.Shared.Services.Checks

Services\Checks\Contracts\IWebOrderingValidationService.cs

Northstar.WebOrdering.Shared.Services.Checks

Services\Checks\Contracts\IWebOrderingCompatibilityManager.cs

Northstar.WebOrdering.Shared.Services.Checks

Services\OrderEntryEvents\Contracts\IOrderEntryEventNotifier.cs

Northstar.WebOrdering.Shared.Services.OrderEntryEvents

Into Gops.WebOrdering

Source (in Gops.OrderManagement)

New namespace

Source (in Gops.OrderManagement)

New namespace

Handlers\WebOrdering\Checks\ (23 handlers)

Gops.WebOrdering.Handlers.Checks

Handlers\WebOrdering\Membership\ (8 handlers)

Gops.WebOrdering.Handlers.Membership

Handlers\WebOrdering\Sites\ (6 handlers)

Gops.WebOrdering.Handlers.Sites

Handlers\WebOrdering\Loyalty\ (4 handlers)

Gops.WebOrdering.Handlers.Loyalty

Handlers\WebOrdering\Devices\ (3 handlers)

Gops.WebOrdering.Handlers.Devices

Handlers\WebOrdering\Chowly\, GiftCards\, CreditCards\, Concur\, Wisely\

Gops.WebOrdering.Handlers.*

Handlers\WebOrdering\MapperProfiles\

Gops.WebOrdering.Handlers.MapperProfiles

Handlers\WebOrdering\Models\ (~100 classes)

Gops.WebOrdering.Handlers.Models

Services\Checks\CheckService.cs + CheckService.Coupons.cs

Gops.WebOrdering.Services.Checks

Services\Checks\WebOrderingValidationService.cs

Gops.WebOrdering.Services.Checks

Services\Checks\WebOrderingCompatibilityManager.cs

Gops.WebOrdering.Services.Checks

Services\OrderEntryEvents\OrderEntryEventNotifier.cs

Gops.WebOrdering.Services.OrderEntryEvents

Services\OrderEntryEvents\Entities\PublishedMessage\ (6 classes)

Gops.WebOrdering.Services.OrderEntryEvents.Entities

Stays in Gops.OrderManagement

  • IWebOrderHandler.cs and WebOrderManager.cs

  • Helpers\OrderItemComponentsAssignerHelper.cs

  • Extensions\ISessionManagerExtensions.cs

  • Extensions\ICacheManagerExtensions.cs

  • All internal managers (IOrderManager, IComboManager, IAdjustmentManager, etc.)


Detailed Steps & Estimates

Step 1 — Create Northstar.WebOrdering.Shared

Estimate: 1.5 hours

  1. Add new Class Library project Northstar.WebOrdering.Shared to the solution.

  2. Target the same .NET framework version as Gops.OrderManagement.

  3. Add minimal dependencies only — this project should be lean:

    • Newtonsoft.Json (NuGet) — if any DTOs use JSON attributes

    • No project references to other Gops assemblies (interfaces should use only primitive/framework types in their signatures where possible; if they require types from other assemblies, add those references carefully)

  4. Move Data\WebOrdering\ (53+ DTO files) into Northstar.WebOrdering.Shared\Data\.

  5. Move the four interface files (ICheckService, IWebOrderingValidationService, IWebOrderingCompatibilityManager, IOrderEntryEventNotifier) into appropriate subfolders.

  6. Update all namespace declarations to Northstar.WebOrdering.Shared.*.

  7. Remove moved files from Gops.OrderManagement.csproj.


Step 2 — Update Gops.OrderManagement to reference Northstar.WebOrdering.Shared

Estimate: 1.5 hours

  1. Add project reference to Northstar.WebOrdering.Shared in Gops.OrderManagement.csproj.

  2. Update using statements in the four files that stay and use the moved types:

    • WebOrderManager.cs (lines 43, 55, 158, 164, 168)

    • Helpers\OrderItemComponentsAssignerHelper.cs (lines 29, 50, 74–75, 101–103, 217+)

    • Extensions\ISessionManagerExtensions.cs (lines 28, 107, 119, 122, 154)

    • Extensions\ICacheManagerExtensions.cs (lines 15, 30, 46, 173, 190)

  3. Build Gops.OrderManagement alone and confirm it compiles cleanly before proceeding.


Step 3 — Create Gops.WebOrdering

Estimate: 1 hour

  1. Add new Class Library project Gops.WebOrdering to the solution.

  2. Target the same .NET framework version.

  3. Add project/package references:

Dependency

Source

Dependency

Source

Northstar.WebOrdering.Shared

Project reference

Gops.OrderManagement

Project reference (for IWebOrderHandler, IOrderManager, IComboManager, etc.)

Gops.SessionManagement

Project reference

Gops.CacheManagement

Project reference

Gops.MemberManagement

Project reference

Gops.PaymentManagement / Gops.PaymentProcessor

Project reference

Gops.DAL

Project reference

Gops.AdminManagement

Project reference

Gops.PrintEngine.PrintManagement

Project reference

Gops.TableManagement

Project reference

Gops.TransactionManagement

Project reference

Gops.TaxEngine.Management

Project reference

Gops.OfferManagement

Project reference

AutoMapper

NuGet

Newtonsoft.Json

NuGet

System.Reactive

NuGet (match version in Gops.OrderManagement)

NorthStar.Framework.Core

Project/NuGet


Step 4 — Move Services into Gops.WebOrdering

Estimate: 2 hours

Move from Gops.OrderManagement\Services\ into Gops.WebOrdering\Services\:

  • Checks\CheckService.cs + Checks\CheckService.Coupons.cs

  • Checks\WebOrderingValidationService.cs

  • Checks\WebOrderingCompatibilityManager.cs

  • OrderEntryEvents\OrderEntryEventNotifier.cs

  • OrderEntryEvents\Entities\PublishedMessage\ (6 entity classes)

Update namespace declarations. Remove from Gops.OrderManagement.csproj.


Step 5 — Move Handler Files into Gops.WebOrdering

Estimate: 2 hours

Move all of Handlers\WebOrdering\ (63 handlers, MapperProfiles, Models) into Gops.WebOrdering\Handlers\. Update namespace declarations. Remove from Gops.OrderManagement.csproj.


Step 6 — Add InternalsVisibleTo to new assembly

Estimate: 15 minutes

Add to Gops.WebOrdering\Properties\AssemblyInfo.cs:

[assembly: InternalsVisibleTo("NorthStar.OrderManagement.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

Step 7 — Update all consuming projects

Estimate: 2.5 hours

For each project below: add project reference(s) to .csproj and update using statements in each file.

Gops.WebServices — add references to both Northstar.WebOrdering.Shared and Gops.WebOrdering:

File

Change

File

Change

Unity.cs (lines 144–254)

Update using for service and handler namespaces

OrderService.cs (lines 35–36)

Update using for handler namespaces

ConfigurationState\AppState.cs line 20

Update using for WebOrderApiMapperProfile; Mapper.Configuration.AddProfile(new WebOrderApiMapperProfile()) on line 171 stays unchanged

SignalR\OrderEntryEventHubNotifier.cs

Update using for DTO and event notifier namespaces

SignalR\WOAPIHubListener.cs

Update using for DTO namespaces

WOAPINotifier.cs

Update using for DTO and event notifier namespaces

Interfaces\IOrderService.cs

Update using for DTO namespaces

Gops.AlertManagement — add references to Northstar.WebOrdering.Shared and Gops.WebOrdering:

  • AlertManager.cs: update using for CheckGetHandler (handlers namespace) and WebOrderingCheck (shared namespace)

Gops.TableManagement — add reference to Northstar.WebOrdering.Shared:

  • Contracts\IWebTableHandler.cs, IWebTableManager.cs, WebTable\ResetTableHandler.cs, WebTable\WebTableDataHandler.cs, WebTableManager.cs: update using for DTO and ICheckService namespaces


Step 8 — Clean up Gops.OrderManagement

Estimate: 30 minutes

Remove stale using statements for any moved namespaces. Confirm IWebOrderHandler, WebOrderManager, and all internal managers compile cleanly with only the Northstar.WebOrdering.Shared reference for DTO types.


Step 9 — Build and fix compile errors

Estimate: 3–5 hours

Build the full solution. Work through errors in order: Northstar.WebOrdering.Shared first, then Gops.OrderManagement, then Gops.WebOrdering, then consuming projects. Expect the most errors in CheckService (1,359 lines) and Gops.AlertManagement (direct concrete instantiation).


Step 10 — Update and run tests

Estimate: 2–3 hours

  1. Add project references to Northstar.WebOrdering.Shared and Gops.WebOrdering in Gops.UnitTests.csproj.

  2. Update using statements in CheckServiceTests.cs (concrete CheckService instantiation on lines 76–77, 89, 99, 110).

  3. Run full test suite; fix any failures.


Step 11 — Smoke test end-to-end

Estimate: 2 hours

Deploy to local/dev. Exercise all handler categories. Verify DI resolution, AutoMapper mappings, and OrderEntryEventNotifier observable streams.


Step 12 — Code review and merge

Estimate: 2–3 hours

PR to develop. Confirm no dead code left in Gops.OrderManagement, all tests pass, and the dependency graph matches the diagram above.


Total Effort Estimate

Step

Description

Estimate

Step

Description

Estimate

1

Create Northstar.WebOrdering.Shared + move DTOs and interfaces

1.5 hrs

2

Update Gops.OrderManagement to reference shared project

1.5 hrs

3

Create Gops.WebOrdering + add references

1 hr

4

Move Services

2 hrs

5

Move Handler files

2 hrs

6

InternalsVisibleTo

15 min

7

Update all consuming projects (WebServices, AlertManagement, TableManagement)

2.5 hrs

8

Clean up Gops.OrderManagement

30 min

9

Build & fix compile errors

3–5 hrs

10

Update & run tests

2–3 hrs

11

Smoke test

2 hrs

12

Code review & merge

2–3 hrs

Total

 

24–31 hours


Risk Summary

Risk

Severity

Resolution

Risk

Severity

Resolution

AutoMapper hardcoded in AppState.cs:20

MEDIUM

Update one using statement; line 171 code unchanged

Test direct instantiation of CheckService

MEDIUM

Update CheckServiceTests.cs lines 76–77, 99, 110

Gops.AlertManagement direct instantiation of CheckGetHandler

MEDIUM

Add project references + update AlertManager.cs

Gops.TableManagement — 6 files reference moved types

MEDIUM

Add project reference + update 5–6 files

InternalsVisibleTo missing from new assembly

LOW

Add 2 lines to AssemblyInfo.cs (Step 6)