Skip to content

[Backend] Complete Party Invitation and Acceptance Flow #274

@KuchiMercy

Description

@KuchiMercy

Problem

This issue was previously opened as #58 but was never implemented. When an escrow is created, parties (buyer, seller, arbitrator) are added but there is no formal invitation flow. Parties cannot accept or reject invitations, and the escrow can proceed even if a party hasn't agreed to participate.

Current State

  • Party entity has status field (PENDING, ACCEPTED, REJECTED) but it's never updated
  • No endpoint for a party to accept or reject an invitation
  • No notification sent to invited parties
  • Escrow can be funded even if parties haven't accepted

Acceptance Criteria

  • Add endpoint: POST /escrows/:id/parties/:partyId/accept
    • Set party status to ACCEPTED
    • Record acceptance timestamp
    • Notify escrow creator
  • Add endpoint: POST /escrows/:id/parties/:partyId/reject
    • Set party status to REJECTED
    • Notify escrow creator
    • If a required party rejects, optionally cancel the escrow
  • Add endpoint: GET /escrows/pending-invitations
    • List all escrows where the user has a PENDING party invitation
    • Include escrow details (title, amount, creator, other parties)
  • Validate party acceptance before escrow funding:
    • All required parties (buyer + seller minimum) must have ACCEPTED status before funding is allowed
    • Return clear error if attempting to fund with unaccepted parties
  • Add PARTY_INVITED notification event (ties into notification wiring issue)
  • Add unit tests for accept/reject/validate flows
  • Add E2E test for the complete invitation flow

Technical Notes

  • Party status transitions: PENDING → ACCEPTED | REJECTED
  • Only the user matching party.userId can accept/reject their own invitation
  • Consider adding an expiry for invitations (auto-reject after X days)

Points: 100 (Trivial)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions