backoffice-commissions-service
Manages calculation and payment of Travel Counsellor commissions, moving them from Backoffice (Accounts) to Dynamics 365 and serving data to the Phenix commission website.
Health score
0 to 100 across seven weighted factors; nothing is hidden. Green is 75 and above, amber 50 to 74, red below 50. How scoring works.
Facts
| Languages | csharp, sql |
| Frameworks | ASP.NET Core 8, Dapper 2.1, Serilog, Swashbuckle/NSwag |
| Runtimes | .NET 8 |
| Tests / CI | good / CI in place |
| Last commit | 2026-05-14 |
| Owner | Owner unknown (mapping to be curated) |
| Domain | Payments and finance (system generated; curate in repo-owners.json to override) |
| Product area | Phenix |
| Hosted | On-prem Deployed to our own machines
|
| Releases | 3 release pipeline(s): \finance\backoffice\backoffice-commission-service; \finance\backoffice\backoffice-commission-service Database; \finance\backoffice\backoffice-commission-service Stealth |
| Integration | rest, redis-streams |
| Source | Open in Azure DevOps |
Risk flags
Each flag links to its glossary definition.
Dependencies in context
Entanglement
loose No binding mechanisms apply: this system needs no untangling work.
Depends on / used by
Migration playbooks
Generated from this repo's assessment data: what is feasible, what blocks it, and the steps in order. Ratings: green means actionable now, amber means sequence other work first, red means blocked, grey means not applicable.
ZDD adoption
No excuseNothing technical is holding this repo on the three-week release. It either already deploys without downtime (AWS) or is a modern, well-tested service the automated stealth path can carry today. Modern runtime, good tests, no hosted legacy transport: the automated stealth path can carry it today.
- 3 system(s) depend on this repo; during a rolling deploy they will talk to old and new versions at once, so responses must stay compatible
- Serialized state or messages in flight (Redis or queues): new code must deserialize objects written by the previous version
- Adopt the four-stage discipline from the ZDD engineering standard: pre-deployment compatibility, deployment, feature activation behind a flag, post-release cleanup.
- Make every change dual-version safe: backwards-compatible APIs (new major version for breaking wire changes), expand and contract for any schema change, and consumers tolerant of unknown fields.
- Audit serialized data: anything in Redis, queues or shared caches must deserialize cleanly across adjacent versions.
- Wrap behaviour changes in feature flags so code deploys dark and release becomes a business decision, not a deployment event.
- Route deployments through the Workflow Engine's automated drain, deploy, health-check, return cycle (the path proven by the first automated production run in mid-2026).
- Verify with area-scoped regression rather than the whole-platform cycle, and watch error rates after rollout with automated rollback on alert.
SQL Server exit
Blocked by a shared databasesqlserver:CommissionService is shared, so this system cannot change engine on its own: every sharer moves in convoy. Either agree the move with all sharers as one programme, or first split this system's data out behind an owned API, then follow the steps below.
- Inventory the schema and query surface of sqlserver:CommissionService: tables, stored procedures, triggers, cross-database joins and anything else engine-specific.
- Confirm the target: PostgreSQL (relational model; keep transactions and joins, swap the engine).
- Data access is not through an ORM, so port the SQL by hand: translate T-SQL constructs, replace stored procedures with application code or target-native equivalents, and add integration tests around the queries that matter first.
- Stand up the target alongside SQL Server, backfill with an ETL pass (pgloader or an export/import job), then dual-write or replicate until parity is proven.
- Move reads to the target, watch correctness and latency, then cut writes over and keep SQL Server read-only until confidence is earned.
- Decommission the SQL Server database and remove the connection strings and firewall paths that pointed at it.
Containerisation
Ready to containeriseModern runtime, no hosted legacy transport: this service can follow the estate's proven container path (Dockerfile, shared pipeline template, ECS via Terraform).
- Add a Dockerfile and make the app read all configuration from environment variables and the secrets manager, never from machine-local files.
- Log to stdout and expose a health check endpoint so ECS can supervise it.
- Adopt the shared ci.yml pipeline template with the container parameters (awsRegion, containerAfterBuild, ecsTerraformRepo), which is exactly how the estate's existing AWS services deploy.
- Define the service in the Terraform repo, deploy to a non-production environment, then shift traffic and disarm the deployment-group release pipeline.
Recommended actions
No specific actions for this repo. It either needs only normal maintenance, or its work is covered by an estate-level action. See the full programme.
Assessment notes
backoffice-commissions-service
Purpose
Service that manages the payment of commission, taking it from Backoffice (Accounts) to Dynamics 365 via to-dyn365-api, and providing data for the Phenix commission website. Commission batching/payment runs as asynchronous long-running background tasks inside the web API process.
Tech stack
C#/.NET 8 solution: ASP.NET Core Web API (TC.Commissions.Service.Webapi), core service, ledger integration, and data-access projects, plus a generated API client NuGet (TC.Commission.Service.Api). Uses Dapper + Microsoft.Data.SqlClient, MongoDB.Driver 3.5, Serilog, NewRelic agent, PhenixAuth authentication, API versioning, Swagger/NSwag client generation. A SQL Server database project (db/CommissionService.sqlproj) is versioned alongside.
Deployment
Three release pipelines under \finance\backoffice: the service, its database, and a "Stealth" variant; release_count 3. Two YAML builds: backoffice-commissions-service - CI (app + client package) and backoffice-commissions-service DB (DACPAC via shared build-db.yml template), both using InternalOSS/azure-pipelines-templates. Runs on-premises behind a load balancer (e.g. ukmanphs1.travelcounsellors.com).
Dependencies
Internal: backoffice (source Accounts data), to-dyn365-api (pushes payments to D365), backoffice-ledger-service (TC.Ledger.Api.Client), tc-connectionbroker, backoffice-useraccount-service (TC.UserAccount.*), plus internal framework packages (TC.Phenix.ApplicationFramework, TC.CommissionStatements.DataContract, TC.Streams.Provider.Redis). Downstream consumer: phenix-commission-ui. External: Dynamics 365 (indirect), New Relic monitoring.
Data stores
Owns the CommissionService SQL Server database (sqlproj with dbo schema, scripts, security). Reads/writes MongoDB database TCCommissionStatements (statements, payment history, remittances). Uses Redis via TC.Streams.Provider.Redis for event streaming.
Integration points
REST API with versioning, Swagger and a published client package; consumes internal REST clients (ledger, user account, D365 API) and Redis streams for user-account events. Extensive D365 remittance/vendor handlers. No RabbitMQ/MassTransit found.
Code health
Strong test coverage: six test projects (unit, API, ledger, data-access, test harness, test data). YAML CI on master/release. Last commit 2026-05-14 — actively developed. Good docs (ReadMe.md, docs/, acs.md).
Modernisation risks
Modern runtime, but operational risks: monthly commission runs follow a manual email-driven runbook with a hard-coded API key documented in the README; long-running tasks are in-process and break behind the load balancer; it depends on the legacy backoffice Accounts database. Medium priority driven by process/coupling rather than technology age.