feat: deferred payments & installment plans — pledge = promise to pay on a date
CORE PRODUCT SHIFT: A pledge is now a promise to pay on a future date, not just 'pay now'. NEW FLOW: Amount → Schedule → Payment/Identity → Confirmation SCHEDULE STEP (/p/[token] step 1): - 'Pay right now' — existing card/DD/bank flow - 'Pay on a specific date' — calendar picker with smart suggestions (This Friday, End of month, Payday 1st, In 2 weeks, In 1 month) - 'Split into monthly payments' — 2/3/4/6/12 month installment plans with per-installment breakdown and date schedule SCHEMA CHANGES: - Pledge.dueDate — when the donor promises to pay (null = now) - Pledge.planId — groups installment pledges together - Pledge.installmentNumber / installmentTotal — e.g. 2 of 4 - Pledge.reminderSentForDueDate — tracking flag - New indexes on dueDate+status and planId INSTALLMENT PLANS: - Creates N linked Pledge records with shared planId - Each installment gets its own reference, due date, reminders - Reminders: 2 days before, on due date, 3 days after, 10 days after - WhatsApp receipt shows full plan summary DEFERRED SINGLE PLEDGES: - Reminders anchored to due date, not creation date - 'Pay on date' → reminders: 2 days before, on day, +3d nudge, +10d final - WhatsApp preferred when phone number provided DASHBOARD: - API returns dueDate, planId, installment info for each pledge - Confirmation step shows schedule details for deferred pledges
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
-- Payment scheduling: pledges can have a future due date and installment plans
|
||||
ALTER TABLE "Pledge" ADD COLUMN "dueDate" TIMESTAMP(3);
|
||||
ALTER TABLE "Pledge" ADD COLUMN "planId" TEXT;
|
||||
ALTER TABLE "Pledge" ADD COLUMN "installmentNumber" INTEGER;
|
||||
ALTER TABLE "Pledge" ADD COLUMN "installmentTotal" INTEGER;
|
||||
ALTER TABLE "Pledge" ADD COLUMN "reminderSentForDueDate" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- Index for finding pledges due today/upcoming
|
||||
CREATE INDEX "Pledge_dueDate_status_idx" ON "Pledge"("dueDate", "status");
|
||||
CREATE INDEX "Pledge_planId_idx" ON "Pledge"("planId");
|
||||
Reference in New Issue
Block a user