- Add YooKassa webhook handler (POST /api/yookassa/webhook) that updates booking to confirmed+paid on payment.succeeded, cancelled on payment.canceled - Add public status endpoint GET /api/online-bookings/:id for return URL polling - Add 'reserved' booking status (violet) shown in calendar while awaiting payment - Add 'website' to BookingSource type - Payment timeout job (every 2 min) auto-cancels expired unpaid bookings - Widget setting: "Время ожидания оплаты" (5–60 min, default 15) - BookingConfirmPage at /booking-confirm/:id — polls status, countdown timer, shows success/pending/cancelled state - Widget bookings now use status='reserved' instead of 'inquiry' when YooKassa is configured; set to 'confirmed' by webhook on payment.succeeded - Migration 070: add 'reserved' to bookings status constraint + payment_expires_at Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 lines
508 B
SQL
10 lines
508 B
SQL
-- Migration 070 — Add 'reserved' booking status + payment_expires_at for widget bookings
|
|
|
|
-- Add 'reserved' to bookings status constraint
|
|
ALTER TABLE bookings DROP CONSTRAINT IF EXISTS bookings_status_check;
|
|
ALTER TABLE bookings ADD CONSTRAINT bookings_status_check
|
|
CHECK (status IN ('inquiry','confirmed','checked_in','checked_out','cancelled','no_show','reserved'));
|
|
|
|
-- Add payment expiry column to online_bookings
|
|
ALTER TABLE online_bookings ADD COLUMN IF NOT EXISTS payment_expires_at TIMESTAMPTZ;
|