Skip to content

fix: [SDK-605] stop sending checkDate in dismissal payroll creation#1397

Open
jeffredodd wants to merge 2 commits intomainfrom
fix/SDK-605-past-dated-dismissal-check-date
Open

fix: [SDK-605] stop sending checkDate in dismissal payroll creation#1397
jeffredodd wants to merge 2 commits intomainfrom
fix/SDK-605-past-dated-dismissal-check-date

Conversation

@jeffredodd
Copy link
Copy Markdown
Contributor

@jeffredodd jeffredodd commented Mar 27, 2026

Summary

  • Fix past-dated dismissal payrolls failing with "Check date is invalid. You cannot back date a physical check."
  • Stop sending checkDate in the dismissal off-cycle payroll creation request entirely — the server computes it, matching how gws-flows handles dismissal payrolls

Root Cause

DismissalPayPeriodSelection.tsx was computing and sending a checkDate with the off-cycle payroll creation request. For terminations 6+ weeks old, the API-provided check_date is in the past, which ZenPayroll rejects. The previous fix attempted a client-side fallback, but the real fix is simpler: gws-flows never sends check_date when creating dismissal payrolls — the server determines it. We should do the same.

Fix

  • Remove the checkDate field from the createOffCyclePayroll request body
  • Remove the client-side past-date detection and fallback logic
  • Remove unused imports (addBusinessDays, ACH_LEAD_TIME_BUSINESS_DAYS)
  • Update tests to assert checkDate is undefined in the request

Test plan

  • All unit tests pass (10/10)
  • Verified API request body matches gws-flows: offCycle, offCycleReason, startDate, endDate, employeeUuids — no checkDate
  • Confirmed gws-flows dismissal_payroll_params does not include check_date

Refs SDK-605

@jeffredodd jeffredodd changed the title fix: [SDK-605] use fallback check date for past-dated dismissal payrolls fix: [SDK-605] stop sending checkDate in dismissal payroll creation Mar 30, 2026
@jeffredodd jeffredodd marked this pull request as ready for review March 30, 2026 03:30
Copilot AI review requested due to automatic review settings March 30, 2026 03:30
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
@jeffredodd jeffredodd force-pushed the fix/SDK-605-past-dated-dismissal-check-date branch from cf0dc86 to e5f4f86 Compare March 30, 2026 03:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 checkDate in the dismissal off-cycle payroll creation request.
  • Remove client-side fallback checkDate computation and related unused imports.
  • Update unit tests to assert checkDate is 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.

Comment on lines 95 to 99
offCycle: true,
offCycleReason: OffCycleReason.DismissedEmployee,
startDate: new RFCDate(period.startDate),
endDate: new RFCDate(period.endDate),
employeeUuids: [resolvedEmployeeId],
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants