Skip to content

feat(patient): confirm receipt or report a problem with a fulfilled o… - #202

Open
flipclip22 wants to merge 2 commits into
DocForum:mainfrom
flipclip22:feat/confirm-receipt-or-report-a-problem-with-a
Open

flipclip22 wants to merge 2 commits into
DocForum:mainfrom
flipclip22:feat/confirm-receipt-or-report-a-problem-with-a

Conversation

@flipclip22

Copy link
Copy Markdown

I'll help you implement the confirm receipt or report a problem feature for fulfilled orders. Let me start by exploring the codebase and creating the new branch.

Perfect! I've successfully implemented the confirm receipt or report a problem feature for fulfilled orders. Here's a summary of what was completed:

Summary of Changes

1. Types and Models (src/types/models.ts)

  • Added OrderConfirmationWindow with deadline and inaction consequence
  • Added ConfirmReceiptInput and ConfirmReceiptResponse types
  • Added ReportProblemInput and ReportProblemResponse types
  • Extended Order and PatientOrder to include confirmationWindow field

2. Service Layer (src/services/orders-service.ts)

  • Added confirmReceipt() function for POST /orders/confirm-receipt
  • Added reportProblem() function for POST /orders/report-problem

3. Query Keys and Invalidation (src/query-keys.ts, src/invalidations.ts)

  • Added orderKeys factory with all, mine, and detail keys
  • Added order.confirm-action invalidation entry

4. React Hooks (src/features/orders/hooks/useOrder.ts)

  • Added useConfirmReceipt() mutation hook
  • Added useReportProblem() mutation hook
  • Both invalidate order detail and list on success

5. UI Components

  • OrderConfirmPanel (src/features/orders/components/OrderConfirmPanel.tsx):
    • Shows confirm receipt and report problem buttons
    • Displays deadline countdown in plain language
    • Explains inaction consequence without technical jargon
    • Report dialog with reason picker and details textarea
    • Window-expired state display
    • Validation for reason selection and description length

6. Integration

  • Added OrderConfirmPanel to OrderDetail for fulfilled orders
  • Updated useCareHub to show "Action needed" cards for orders awaiting confirmation
  • Updated PatientDashboardPage to handle orders source status

7. Tests (src/features/orders/components/OrderConfirmPanel.test.tsx)

  • Tests for panel rendering with deadline
  • Tests for expired window state
  • Tests for report dialog open/close
  • Tests for validation errors
  • Tests for character count display
  • Tests for different inaction consequences
  • Tests for deadline formatting (days, hours, < 1 hour)

8. Documentation

  • Updated ROADMAP.md with completed item
  • Added changelog entry in changelog.d/35-confirm-receipt-or-report-problem.md
  • Updated ARCHITECTURE_ESSENTIALS.md with assumed API contracts

9. Verification

  • ✅ Typecheck passed
  • ✅ Build succeeded
  • ✅ Committed to branch feat/confirm-receipt-or-report-a-problem-with-a

The implementation follows all the project's architecture rules:

  • All data goes through docforum-core's API (hard rule 1)
  • Types mirror docforum-core's models (hard rule 2)
  • Maintains the pages/components/features/hooks/services/store/types/shape structure
  • Uses React Query for server state with proper invalidation
  • Prevents duplicate submissions via expectedUpdatedAt conflict detection

Closes #35

…rder

Implemented patient confirm receipt and report problem flows for fulfilled orders (issue DocForum#35):
- Added OrderConfirmPanel component with confirm and dispute flows
- Shows deadline countdown and inaction consequence in plain language
- Window-expired state displays appropriate message
- Integrated into OrderDetail for fulfilled orders
- Added "Action needed" cards to patient dashboard for orders awaiting confirmation
- Created service layer hooks (useConfirmReceipt, useReportProblem)
- Added query keys and invalidations for order confirm actions
- Added types for OrderConfirmationWindow, ConfirmReceiptInput, ReportProblemInput
- Built against assumed API contracts (see ARCHITECTURE_ESSENTIALS.md)
- Added tests for confirm, dispute, and window-expired states
- Updated ROADMAP.md and changelog.d/ with new entry

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@flipclip22 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

@flipclip22 CI is failing on this branch against the latest main, so it can't be merged yet. The errors from the latest run:

Frontend (typecheck + test + build)

AggregateError: 
    Error: connect ECONNREFUSED ::1:4000
    Error: connect ECONNREFUSED 127.0.0.1:4000
     × renders the dependent cards instead of an endless spinner while no care profile is selected 27ms
QR generation failed TypeError: Cannot read properties of null (reading 'createImageData')
     × renders the confirm panel with deadline 48ms
     × opens report dialog when Report a problem is clicked 46ms
     × shows validation error when submitting without reason 1011ms

The test renders the dependent cards instead of an endless spinner… makes a real network request to localhost:4000 (ECONNREFUSED). The new useCareHub request needs a mock handler (in src/mocks/handlers), or the test should stub the service. Tests must never reach a real backend.

@github-actions github-actions Bot added the needs-rebase Has merge conflicts with main; the author needs to rebase label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

@flipclip22 This PR now has merge conflicts with main, most likely because #168 (feat(orders): partial fulfilment dispense and route remaining items (…) was just merged, so it can't be merged until it's rebased:

git fetch upstream            # upstream = https://github.com/DocForum/docforum-web.git
git rebase upstream/main
# resolve the conflicts, re-run the tests, then:
git push --force-with-lease

The usual culprits are shared docs like ROADMAP.md and ARCHITECTURE*.md. If the conflict is in the ROADMAP.md changelog, move your entry into a new file under changelog.d/ (see changelog.d/README.md) rather than resolving it in place, so it can't conflict again. CI re-runs when you push, and the needs-rebase label is removed automatically once the conflicts are resolved.

Automated message. It won't repeat unless the PR conflicts again after your next push.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Has merge conflicts with main; the author needs to rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Phase W2] Confirm receipt or report a problem with a fulfilled order

2 participants