Stu Mason
Stu Mason

Activity

StuMason/cleanconnect
TidyLinker.com
TypeScript
Pull Request Merged

PR #50 merged: Add job completion flow with payment capture and payout

Summary

  • Implements job completion flow where cleaners mark jobs as done, triggering payment capture and payout creation
  • Adds retry mechanism for transient Stripe errors with exponential backoff
  • Adds admin dashboard visibility for payment health (failed captures, pending/processing payouts)
  • Adds webhook event deduplication to prevent duplicate processing

Changes

  • CompleteJob action - Core flow: validate job/payment state, update status, capture payment, create payout
  • RetryPaymentCapture job - Retries failed captures with backoff (1min, 5min, 15min)
  • Custom exceptions - PaymentCaptureException, PaymentTransientException, PaymentPermanentException, PayoutException
  • Admin alerts - PaymentFailureAlert mailable sent on capture/payout failures
  • Frontend - Mark Complete button with confirmation dialog on cleaner job page
  • Admin dashboard - Payment health cards showing failed captures and payout status
  • Webhook deduplication - Cache-based tracking prevents duplicate event processing

Test plan

  • All 756 tests passing
  • Frontend builds successfully
  • Manual test: Create job → accept quote → authorize payment → login as cleaner → mark complete
  • Verify job status changes to Completed
  • Verify payment is captured and payout created
  • Admin dashboard shows updated stats
+3250
additions
-2325
deletions
26
files changed