fix: [SDK-605] stop sending checkDate in dismissal payroll creation#1397
fix: [SDK-605] stop sending checkDate in dismissal payroll creation#1397jeffredodd wants to merge 2 commits intomainfrom
Conversation
When creating a dismissal payroll for a termination that occurred 6+ weeks in the past, the API returns a check_date that is also in the past. The SDK was blindly using this stale date, causing ZenPayroll to reject the payroll with "Check date is invalid. You cannot back date a physical check." Use the existing fallback calculation (today + ACH lead time) when the API's check_date is in the past, matching the behavior already used when check_date is null. Refs SDK-605 Made-with: Cursor
gws-flows never sends check_date when creating dismissal off-cycle payrolls — the server computes it. Align the SDK by removing the client-side checkDate logic (past-date fallback) and omitting the field from the request body entirely. Made-with: Cursor
cf0dc86 to
e5f4f86
Compare
There was a problem hiding this comment.
Pull request overview
Removes checkDate from dismissal off-cycle payroll creation to prevent back-dated physical check validation errors and to align request payloads with gws-flows (server-computed check date).
Changes:
- Stop including
checkDatein the dismissal off-cycle payroll creation request. - Remove client-side fallback
checkDatecomputation and related unused imports. - Update unit tests to assert
checkDateis not provided in the request body.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.tsx | Removes checkDate from the off-cycle payroll creation payload for dismissal payrolls. |
| src/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.test.tsx | Updates assertions to ensure checkDate is not sent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| offCycle: true, | ||
| offCycleReason: OffCycleReason.DismissedEmployee, | ||
| startDate: new RFCDate(period.startDate), | ||
| endDate: new RFCDate(period.endDate), | ||
| employeeUuids: [resolvedEmployeeId], |
There was a problem hiding this comment.
PR description says to stop sending checkDate for dismissal off-cycle payroll creation requests entirely, but there is still another call site that sends checkDate when offCycleReason is DismissedEmployee (see src/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.tsx:134-146). This likely means the original back-dated check error can still occur when creating dismissal payrolls from the termination flow; consider removing checkDate there as well for consistency with gws-flows and this component.
Summary
checkDatein the dismissal off-cycle payroll creation request entirely — the server computes it, matching how gws-flows handles dismissal payrollsRoot Cause
DismissalPayPeriodSelection.tsxwas computing and sending acheckDatewith the off-cycle payroll creation request. For terminations 6+ weeks old, the API-providedcheck_dateis in the past, which ZenPayroll rejects. The previous fix attempted a client-side fallback, but the real fix is simpler: gws-flows never sendscheck_datewhen creating dismissal payrolls — the server determines it. We should do the same.Fix
checkDatefield from thecreateOffCyclePayrollrequest bodyaddBusinessDays,ACH_LEAD_TIME_BUSINESS_DAYS)checkDateisundefinedin the requestTest plan
offCycle,offCycleReason,startDate,endDate,employeeUuids— nocheckDatedismissal_payroll_paramsdoes not includecheck_dateRefs SDK-605