Expense to Payroll Events
Summary
Payroll subscribes to all three Expense lifecycle contracts and maintains a payroll-owned approved-expense projection. It never reads the Expense store during calculation.
Projection behavior
| Expense contract | Payroll projection result |
|---|---|
| ExpenseApprovedEvent | Creates or updates the claim projection as Approved |
| ExpenseRejectedEvent | Updates the claim projection as Rejected |
| ExpensePaidEvent | Updates the claim projection as Paid |
Only Approved projections for the calculation period contribute to reimbursement totals. Rejected and Paid projections remain as records but are excluded from approved reimbursement calculation.
Payroll ignores duplicate event identities. For the same projected claim, an event older than the projection's last occurrence is ignored. Processing errors are negatively acknowledged and requeued.
Frozen-period behavior
The consumer continues to maintain its projection independently of payroll-run state. A frozen run cannot be recalculated, so later projection changes do not rewrite that frozen run through this consumer. Their effect on a future calculation depends on the run being eligible for calculation.
Requires confirmation
Projection reconciliation, late-event operational handling, frozen-period business policy, and ownership of corrections require confirmation.
Source References
microservices/src/payroll-service/Messaging/PayrollReadModelConsumer.csmicroservices/src/payroll-service/Domain/PayrollEntities.csmicroservices/src/payroll-service/Application/PayrollCalculationService.csmicroservices/scripts/smoke-payroll.ps1
Related Articles
See Also
Keywords
- Expense events
- Payroll Events
- Integration contracts
Revision Information
- Status: Draft
- Last reviewed: 2026-07-16
- Review cycle: Quarterly