fix: [SDK-614] hide ACH deadline message in cancel dialog for check-only payrolls#1360
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the PayrollOverview cancel dialog to suppress ACH deadline messaging when the payroll is check-only, aligning the dialog copy with the actual payment method mix.
Changes:
- Added a
hasDirectDepositEmployeeshelper to detect whether direct deposit is present. - Wrapped the PayrollOverview cancel dialog “Run this payroll by X…” deadline copy behind the new helper.
- Added tests to assert the deadline message is hidden for check-only payrolls and shown for direct deposit payrolls.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/components/Payroll/helpers.ts |
Introduces hasDirectDepositEmployees helper used to decide whether ACH messaging should render. |
src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.tsx |
Conditionally renders the cancel-dialog deadline message based on the helper result. |
src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.test.tsx |
Adds coverage for the updated cancel dialog behavior for check-only vs direct-deposit payrolls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const hasDirectDepositEmployees = ( | ||
| employeeCompensations?: Array<{ paymentMethod?: string | null }>, | ||
| ): boolean => { | ||
| if (!employeeCompensations || employeeCompensations.length === 0) return true | ||
| return employeeCompensations.some(comp => comp.paymentMethod !== 'Check') | ||
| } |
There was a problem hiding this comment.
hasDirectDepositEmployees currently returns true for any payment method other than 'Check' (including 'Historical' and undefined/null) and also doesn't ignore excluded employees, so it can show the ACH deadline message when there are no direct-deposit employees (e.g., historical payrolls or only excluded DD employees). Consider accepting the real EmployeeCompensations/PayrollEmployeeCompensationsType shape (incl. excluded) and explicitly checking for PAYMENT_METHODS.directDeposit on non-excluded comps; also reconsider returning true for an empty list (or rename the helper to reflect an 'unknown => show' policy).
73b71d7 to
7116fb8
Compare
7116fb8 to
d7b0cab
Compare
When cancelling a check-only payroll, the dialog showed an irrelevant ACH deadline message. Now the deadline is only shown when there are direct deposit employees on the payroll. SDK-614 Made-with: Cursor
Address Copilot review feedback: hasDirectDepositEmployees now filters out excluded employees and explicitly checks for 'Direct Deposit' rather than checking for != 'Check', avoiding false positives from historical or null payment methods. SDK-614 Made-with: Cursor
d7b0cab to
1cea76f
Compare
Summary
hasDirectDepositEmployeeshelper to conditionally show ACH deadline messagingpayrollDeadlinepresence)Test plan
Fixes SDK-614
Made with Cursor