Audience: Engineers. What this answers: where the code is, how the integration works, and what the sync workers do.

Source: EwaService.cs (147), ControlEwaService.cs (297), the two sync BackgroundServices (118 each), EwaApiModel.cs, the Ewa* entities (MembershipDb), EwaController / Control/EwaController — plus a live network capture (2026-07-20).


1. The service split

Driving every EWA admin screen produced zero EWA data calls to core-backend. All of it came from ewa-dev.paidhr.com:

/v1/employer/withdrawals            /v1/employees
/v1/employer/withdrawals/analytics  /v1/employer/invoices
/v1/group-policies                  /v1/employers/companies
/v1/integration/{host}

This repo is the integration side, not the product. It holds:

Component Role
EwaService (147) Outbound client — every method calls the EWA service
ControlEwaService (297) Internal control panel: approve / decline / set up
EwaEmployeeSynchronizationService (118) 30s worker — push enrolments
EwaWithdrawalSynchronizationService (118) 30s worker — pull withdrawals
Ewa* entities Local mirror + config (§3)

The same host serves /v1/ats/* for Hiring. ewa-*.paidhr.com is an "extended platform" service, not an EWA-only one. (RFD-001)

2. EwaService — the outbound client

All ten methods are calls out:

Method Direction
CreateEmployer / UpdateEmployer Register/update the company with the provider
CreateEmployee / CreateBulkEmployees / UpdateBulkEmployees Enrol employees
CreateExternalLoanRequest Raise an advance
PayrollLedgerSync Reconcile the payroll ledger
SettleInvoice Settle the employer invoice
UpdateEwaWithdrawalApproval Push an approve/decline decision
Payroll_Status The one method surfaced via EwaController

3. Entities — MembershipDb, org-scoped

Note these live in MembershipDb, keyed by OrganisationId — not TenantDb. EWA is an organisation-level commercial arrangement, not per-company operational data.

Entity Purpose Notable fields
EwaConfigSetting The company's EWA enrolment + rules EwaId (external id), EwaConfigSettingStatusId, RegisteredName, RegistrationNumber, TaxIdentificationNumber, CanEmployeesWithdraw, WithdrawalStopDay, IsApprovalRequired, IsTermsAccepted
EwaConfigSettingStatus Application status lookup
EwaApprover Named withdrawal approvers EwaConfigSettingId, name, email
EwaInitialization An employee enrolment awaiting push EwaId, UserKey, CompanyKey, Status, IsSynchronized
EwaWithdrawal A withdrawal pulled back ReferenceNumber, UserKey, CompanyKey, Amount, Fee, FeePayer, IsSynchronized, CreatedAt

UserKey / CompanyKey (not FK ids) are the cross-system correlation keys.

4. The external contract (EwaApiModel.cs)

CreateEwaEmployerRequest {
  user    { firstName, lastName, email, gender, phoneNumber, padeUserId }
  company { name, address, withdrawalPercent, rcNumber, tinNumber,
            employeesCanWithdraw, phoneNumber, payrollDayOfMonth,
            stopWithdrawalDayOfMonth, withdrawalFeePayer, approvalRequired,
            padeCompanyId, padeParentCompanyId }
  employee{ ... }
}
→ CreateEwaEmployerResponse { success, code, message, data }

The pade* keys are PaidHR identifiers handed to the provider — the same convention as the ATS hooks. padeParentCompanyId supports group structures.

5. Control-panel flow (Control/EwaController, 8 endpoints)