Skip to content

feat(escrow): marketplace escrow workflows with milestones - #990

Merged
github-actions[bot] merged 2 commits into
Smartdevs17:mainfrom
davidsoniaudin2-oss:feat/915-marketplace-escrow-workflows
Sep 28, 2026
Merged

github-actions[bot] merged 2 commits into
Smartdevs17:mainfrom
davidsoniaudin2-oss:feat/915-marketplace-escrow-workflows

Conversation

@davidsoniaudin2-oss

Copy link
Copy Markdown
Contributor

Summary

Closes #915.

Adds escrow payment workflows for marketplaces: the marketplace holds the buyer's funds until delivery is confirmed, then settles the order by paying the seller and taking a platform commission.

What changed

  • backend/src/services/marketplace-escrow.ts — MarketplaceEscrowService covering the created → funded → shipped → delivered → released lifecycle, a buyer inspection window with auto-release, milestone-based partial releases, commission-aware payout splitting, buyer-protection disputes (buyer/seller/split), refunds, cancellation, and an event audit trail.
  • backend/src/routes/marketplace-escrow.ts — REST API mounted at /api/v1/marketplace-escrow.
  • backend/src/index.ts — router registration.
  • docs/MARKETPLACE_ESCROW.md — feature documentation.

Behaviour notes

  • Milestone amounts must sum to the order amount; an order settles to released once every milestone is out (partially_released in between).
  • Delivered orders auto-release after inspectionPeriodMs (default 7 days).
  • On release the seller receives amount - platformFee; a split dispute refunds buyerPercent of the distributable amount and pays the rest to the seller.
  • Guards raise 409 for invalid state transitions and 403 for third-party disputes.

Tests

backend/src/services/__tests__/marketplace-escrow.test.ts — 30 tests covering creation/validation, the full lifecycle, state-machine guards, auto-release timing, milestones, disputes (all resolutions), refunds/cancellation, and settlement reporting. All passing; typecheck and lint clean for the new files.

Verification

cd backend && npx vitest run src/services/__tests__/marketplace-escrow.test.ts

davidsoniaudin2-oss and others added 2 commits September 28, 2026 03:35
…17#915)

Adds held-funds order escrow for marketplaces: funding, shipping and
delivery tracking, a buyer inspection window that auto-releases to the
seller, milestone-based partial releases, commission-aware payout
splitting, buyer-protection disputes resolved to buyer/seller/split,
refunds, and per-marketplace settlement reporting.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@davidsoniaudin2-oss is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 28, 2026

Copy link
Copy Markdown

@davidsoniaudin2-oss 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

@github-actions
github-actions Bot merged commit e457059 into Smartdevs17:main Sep 28, 2026
2 of 3 checks passed
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.

Build escrow payment workflows for marketplaces

1 participant