Engineering starts at the service boundary: the EWA product is outside core-backend; this repository provides its configuration, control tooling and integration.
| Layer | Responsibility / code entry point |
|---|---|
| EWA/extended service | Withdrawals, available balance/accrual, policy evaluation, employee transaction backend, analytics and invoices. Recorded admin traffic used ewa-dev.paidhr.com/v1/*; this is a dated environment observation, not a production-host setting. |
| EwaService.cs | Outbound client: CreateEmployer/UpdateEmployer; CreateEmployee/CreateBulkEmployees/UpdateBulkEmployees; CreateExternalLoanRequest; PayrollLedgerSync; SettleInvoice; UpdateEwaWithdrawalApproval; Payroll_Status. These names are not core-backend HTTP routes. |
| ControlEwaService.cs + Control/EwaController | Internal application review, Approve/Decline, SetUp/Initialize, Sync and Update. Distinguish underwriting from employee withdrawal approval. |
| Membership entities / EwaApiModel.cs | Local configuration/mirror and external DTO vocabulary. Chapter 05 owns the field/route map. |
| BackgroundServices/Ewa*SynchronizationService.cs | Employee enrolment push and withdrawal pull workers. |
| EwaController | Payroll_Status readiness hook, not a product CRUD controller. |
The external host also serves /v1/ats/* for Hiring & offers. A common host failure may affect both; it does not establish identical data permissions or a single logical workflow.
EwaConfigSetting, EwaConfigSettingStatus, EwaApprover, EwaInitialization and EwaWithdrawal live in MembershipDb, not the tenant payroll database. OrganisationId scopes the commercial arrangement; EwaConfigSetting also carries CompanyId. Cross-system correlation uses UserKey/CompanyKey and provider EwaId; provider DTOs carry padeUserId/padeCompanyId/padeParentCompanyId.
Do not join arbitrary tenant Person IDs to provider identifiers or discard company scope because organisation is the primary commercial boundary. Local withdrawals are a mirror; provider-facing admin history may differ from local payroll evidence when sync lags. Organisation/company mapping, duplicate identities and cross-database isolation need explicit checks.
Each worker uses a 30-second Task.Delay in the copied code. This is a polling interval, not a delivery SLA or proof the deployed worker is healthy. IsSynchronized flags expose backlog; they are not bank-settlement or exactly-once evidence. The reconstructed RFD describes repeated polling without visible adaptive backoff; outage behaviour was not exercised.
Core state, provider calls, employee payouts, payroll deductions and invoice settlement cross services/databases. The sources do not establish an atomic transaction covering them. Never conclude a failed client response means nothing happened remotely.
Before a replay, reconcile reference, user/company mapping, amount, fee payer, provider result, local sync and payroll evidence. Do not flip IsSynchronized manually to hide backlog, repeat employer creation blindly, bypass Payroll_Status or add a second deduction to compensate for an uncertain first one. Source runbook's manual Sync and ledger methods are privileged actions; safety, deduplication and failure scope need current contracts.
ewaid and companyewaid.