Status: Source port complete for this chapter; implementation and security verification remain open. This is an engineering map of the documented snapshot, not confirmation of deployed behaviour. Use chapter 02 for product rules and chapter 03 for their user-facing journeys.

1. Responsibility map

Boundary Documented responsibility
Core request engine RequestService, admin/employee request controllers and SQL procedures create, review, edit and remove supported requests. Loan and advance are variants of the shared engine, not separate approval platforms.
Policy / settings Loan-policy membership and amounts; employee-request access; company/department approval configuration; marketplace switches.
External integration EwaService.CreateExternalLoanRequest acts as the provider-loan façade. Its name does not make the operation an EWA withdrawal.
Provider callback AdminRequestService.Update_External_LoanRequest updates disbursement fields. Callback authenticity and financial settlement are separate verification concerns.
Payroll Select eligible requests, calculate amortization items and update cumulative recovery using actual deductions on payroll submission.
Payment / reporting Typed payment purposes, provider records and historical repayment reporting support reconciliation; no one status proves the whole money lifecycle.

Core records need employee, company and organisation correlation. The separate extended/EWA service uses its own membership/organisation-company references; do not substitute those for the core request’s borrower identity or assume all provider operations share one permission model.

2. Request and review processing

EmployeeRequest holds the request and financial/review state. Loan type is 2, Salary Advance 3; status Approved 1, Declined 2, New 3. Approval category Loans/Advances is a different identifier. PolicyId is polymorphic; the reviewed model does not establish a single enforced policy foreign key for every request type.

EmployeeRequestReview.PersonId identifies the reviewer, not the borrower. Employee-self-service variants resolve the employee from caller context; admin paths accept a selected employee, which still needs company and action-grant validation. Do not infer that a caller can act for any submitted employee ID.

Review uses ordered workflow roles and step counts. Intermediate approval leaves the request awaiting further review; final approval closes company review. spReviewEmployeeRequest uses a SQL transaction and returns success/error values; that transaction does not atomically include an external lender call, email delivery or settlement. Bulk review loops over individual requests and can partially complete.

Counter-maintenance gap: Older prose attributes routing updates to the review procedure, but the inspected procedure does not update ReviewStepsCount or NextReviewEntityId. The source attributes that work to a reviews-table trigger; its DDL was not supplied. Treat the trigger explanation as unverified until the deployed trigger and tests are inspected. Do not prescribe resetting counters to unstick a request.

Editing can reset review history. The selected reset procedure hard-deletes review rows and does not itself establish every counter reset. Request deletion also hard-deletes request/review evidence and refuses loan/advance deletion once a linked payroll item exists. Separate application audit writes are not proof of complete immutable history. These operations are not financial reversals.

3. Marketplace integration and failure boundary

The documented provider path requires provider details and metadata. The façade sends an outbound POST /v1/loans; verify the configured host and implementation before treating that as a current public API contract.

After successful push, the snapshot marks IsWebhookNotified = true and IsForPayroll = true. It sets DeductFromPayroll = true on/before the configured cut-off, otherwise null. The helper’s documented default cut-off is day 15; use of server DateTime.Now.Day leaves the business-timezone interpretation to verify. Null is not a confirmed permanent exemption or a guaranteed next-cycle transition.

On push failure the request can remain Approved with a log entry. No complete retry queue, remote idempotency contract or recovery state machine is established. Before any replay, correlate the original request with provider evidence; a timeout/logged error does not prove the provider did nothing.

The callback updates IsDisbursed and DisbursementDate. Required verification includes callback authentication, replay protection, request/company correlation, amount matching and provider settlement evidence. Do not equate an updated flag with independently verified receipt.

Sensitive reference warning: A technical example builds integration references using a secret-key component. Do not copy that pattern or values into user-facing IDs, logs, support notes or examples. Review whether secrets are exposed through identifiers and replace the design only through an approved engineering/security change; this port does not remediate it.

4. Payroll and reporting boundary

The amortization source selects approved, open requests with relevant deduction/outstanding criteria. Monthly principal uses amount and repayment period; weekly/biweekly/monthly cycles divide the monthly figure. Items carry the request link, scheduled amount, actual deduction and cumulative fields; payroll submission increments recorded recovery by actual deducted amounts.

Keep three conflicts open: annual-interest prose versus the payroll rate expression; last-instalment summary cap versus the weekly fragment; one-instalment salary-advance prose versus admin multi-month tenor. Do not turn an illustrative formula into a verified financial contract.

A partial instalment can create a recoverable payroll-item shortfall. A fully exempt cycle creates no item for that sweep to recover. Pausing payroll eligibility does not cancel debt, and lifecycle changes do not prove repayments automatically resume.