Skip to main content

Module offboarding_settlement_handler

Module offboarding_settlement_handler 

Source
Expand description

Consumer for the offboarding.closed compound event — settlement side (ADR-005).

The payroll module owns the APPLY side of the offboarding final settlement: on each offboarding.closed envelope it appends a compensation_changes row carrying the settlement total, idempotently. Registered on the integration bus in backbone-hr-app’s main.rs alongside the employee OffboardingClosedHandler.

§Producer-carried pesangon (no payroll→lifecycle edge)

The settlement calc lives in backbone-lifecycle. To keep the dependency graph acyclic, payroll does NOT recompute it — the producer (OffboardingWriteService::close) runs the calc and embeds the breakdown in the event payload. This handler just reads the carried breakdown and writes compensation_changes with change_type='offboarding', new_amount=breakdown.total (the settlement’s net payable: severance items + unused-leave payout, without the last pay, which the final payroll run pays), and a note naming every item so the row is self-describing. Idempotent via inbox::once on the event id (preserved from the outbox row id through the relay).

Two payload generations are read. The itemised one (PP 35/2021) carries uang_pesangon, upmk, uang_pisah, unused_leave_payout, net_payable and legal_basis, plus pesangon, upm (always 0) and total for readers of the earlier shape. The earlier one carries only pesangon, upmk, upm, unused_leave_payout and total. Either way the row’s amount is total.

§Legacy tolerance

If a payload carries no pesangon_breakdown (an event emitted by an older producer), this handler still commits — it writes new_amount = 0 with a flagged note rather than poison the queue. The current producer always carries the breakdown, so this is purely defensive.

Timeoff balance encashment is a separate target and is intentionally NOT wired here.

This is a user-owned custom file — it is NEVER regenerated.

Structs§

OffboardingSettlementHandler
Integration-event handler that appends the real pesangon settlement row on offboarding.closed, idempotently. Holds only the pool.