Skip to content

Conversation

@serikjensen
Copy link
Member

@serikjensen serikjensen commented Jan 29, 2026

Summary

Implements the recovery case redebit functionality, allowing users to resubmit failed payments from the recovery cases flow.

Changes

RecoveryCasesList

  • Wire up useRecoveryCasesGet hook to fetch recovery cases from API
  • Add companyId prop for API calls
  • Refactor action button to use itemMenu pattern with actual uuid

RecoveryCasesResubmit

  • Implement useRecoveryCasesRedebitMutation for payment resubmission
  • Fetch recovery case data to display error-specific content
  • Add loading/disabled states during mutation
  • Fire RECOVERY_CASE_RESUBMIT_DONE event with response data

useRecoveryCaseErrorCode hook

  • New hook to map ACH error codes (R01, R02, R16, R29) to user-friendly content
  • Falls back to generic "Bank error" for unknown codes

Related

Demo

Screen.Recording.2026-01-28.at.6.24.58.PM.mov

🤖 Generated with Claude Code

- Wire up RecoveryCasesList to fetch data from API
- Implement redebit mutation in RecoveryCasesResubmit
- Add useRecoveryCaseErrorCode hook for error code content mapping
- Add i18n strings for R01, R02, R16, R29 error codes with fallback
- Add tests for resubmit flow and error code rendering
- Add MSW handlers for recovery cases API mocking

SDK-228

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Contributor

@jeffredodd jeffredodd left a comment

Choose a reason for hiding this comment

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

Ron Nod

- Use Trans component for rich text formatting
- Add <medium> tags to error codes and "Resubmit payment" in i18n strings
- Return ReactNode from useRecoveryCaseErrorCode hook

Co-Authored-By: Claude Opus 4.5 <[email protected]>
recoveryCase?.latestErrorCode,
)

const redebitMutation = useRecoveryCasesRedebitMutation()
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need isPending here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not on this one since we are managing the loading state by using the query key in the footer

})
onEvent(recoveryCasesEvents.RECOVERY_CASE_RESUBMIT_DONE, {
recoveryCaseId,
httpMeta: response.httpMeta,
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume httpMeta is used somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

That actually ends up being the response type for the received data. good callout tho, going to flatten this for consistency

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually i assumed this included something about the recovery case entity, but endpoint just returns a 202 so this wouldn't be super helpful https://docs.gusto.com/embedded-payroll/reference/redebit-recovery-case

updated to only pass the recovery case id that was redebited

const { t } = useTranslation('Payroll.RecoveryCasesResubmit')
const { Button } = useComponentContext()

const isMutating = useIsMutating({
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this answers my previous question, is this needed to handle multiple mutations? reason I ask is this is a new pattern for us

Copy link
Member Author

Choose a reason for hiding this comment

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

It's def suboptimal resulting from keeping the modal footer content separate. i think aspirationally we would update to think about how we might deal with these modal flows in a way that we can have footers access the query state

serikjensen and others added 2 commits January 29, 2026 10:12
- Extract ACH codes into i18n array for proper list rendering
- Add compactList styles for bulleted list
- Simplify hook API to return description array

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@serikjensen serikjensen enabled auto-merge (squash) January 29, 2026 17:45
@serikjensen serikjensen merged commit f3c5239 into main Jan 30, 2026
6 checks passed
@serikjensen serikjensen deleted the SDK-228 branch January 30, 2026 22:41
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.

4 participants