Skip to content

feat: implement flexible recurring payment plans with schedule engine… - #1036

Merged
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
kingsrichie79-cmyk:feat/flexible-recurring-payment-plans
Oct 21, 2026
Merged

Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
kingsrichie79-cmyk:feat/flexible-recurring-payment-plans

Conversation

@kingsrichie79-cmyk

Copy link
Copy Markdown
Contributor

Closes #972

Overview

Implements flexible recurring payment plans with customizable intervals and amounts, comprehensive schedule management, amount variation rules, safe modification guards, pause/resume policies, and plan analytics.

Key Features & Requirements

  1. Payment Plan Data Model & Types (src/types/recurringPaymentPlan.ts):
    • Customizable intervals: daily, weekly, biweekly, monthly (with month-end clamping and leap year support), quarterly, yearly, and custom day intervals.
    • Plan status tracking (active, paused, completed, cancelled), execution history, modifications audit trail, and pause sessions.
  2. Amount Variation Engine (src/lib/recurringPaymentPlan/amountEngine.ts):
    • Supports fixed amounts, cycle-specific scheduled amounts, tiered amounts by cycle, percentage steps (compound or linear with cycle frequency and min/max caps), and milestone-based bonuses.
    • Comprehensive amount validation and multi-cycle cashflow projection.
  3. Schedule Engine (src/lib/recurringPaymentPlan/scheduleEngine.ts):
    • Calculates next execution dates and generates upcoming execution schedules.
    • Guarantees no missed payments: detects and sequentially catches up all overdue cycles if payments were delayed.
    • Automatically handles plan completion when maxCycles or endDate criteria are met.
  4. Plan Modification Logic (src/lib/recurringPaymentPlan/modificationEngine.ts):
    • Ensures safe modifications: completed executions remain strictly immutable; prevents reducing maxCycles below already completed cycles or setting endDate prior to the last payment.
    • Dynamically recalculates future execution schedules and records full audit records for every change.
  5. Pause/Resume Functionality (src/lib/recurringPaymentPlan/pauseResumeEngine.ts):
    • Prevents executions while paused and records pause session history.
    • Resumes with customizable schedule policies (catch_up to process missed payments, shift_schedule to shift upcoming milestones forward by pause duration, or next_scheduled_date for a fresh interval).
  6. Payment Plan Analytics (src/lib/recurringPaymentPlan/analyticsEngine.ts):
    • Computes single-plan and portfolio-wide metrics: total volume collected, projected volume, on-time execution rate, missed payments count, pause rate, completion rate, churn rate, amount volatility, and chronological cashflow forecasts.
  7. UI Component & Hook (src/components/RecurringPaymentPlanManager.tsx, src/hooks/useRecurringPaymentPlans.ts):
    • Interactive dashboard for managing plans, creating plans with amount variation rules, adjusting upcoming settings, simulating executions, and visualizing analytics cards.

Acceptance Criteria Verification

  • Plans execute on schedule
  • Amounts vary correctly
  • Modifications apply safely
  • Pause/resume works
  • Analytics accurate
  • No missed payments
  • All 65 unit and integration tests pass

@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

@kingsrichie79-cmyk 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

@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@kingsrichie79-cmyk is attempting to deploy a commit to the kingsman-99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Kingsman-99
Kingsman-99 merged commit ba6d213 into Stellar-split:main Oct 21, 2026
1 check failed
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.

Implement recurring payment plans with flexible scheduling

2 participants