Skip to content

feat: build subscription proration engine with mid-cycle changes - #1023

Merged
Smartdevs17 merged 2 commits into
Smartdevs17:mainfrom
senmalong:feat/subscription-proration-engine-mid-cycle
Aug 31, 2026
Merged

feat: build subscription proration engine with mid-cycle changes#1023
Smartdevs17 merged 2 commits into
Smartdevs17:mainfrom
senmalong:feat/subscription-proration-engine-mid-cycle

Conversation

@senmalong

Copy link
Copy Markdown
Contributor

Summary

Implements a production-ready subscription proration engine for mid-cycle plan upgrades, downgrades, and billing cycle conversions across both backend billing services (backend/services/billing/proration.ts) and Soroban smart contracts (contracts/subscription/src/).

Key Changes

  • Backend Billing Service (backend/services/billing/proration.ts):
    • Implemented ProrationEngine class supporting calculateMidCycleProration, generateCreditMemo, applyCreditBalance, and calculateNetProration.
    • Added support for exact second/day ratio proration calculations, immediate vs end-of-period effective dates, and cross-interval conversions.
  • Smart Contracts (contracts/subscription/src/):
    • Verified and integrated on-chain calculate_proration, preview_proration, and change_plan contract methods.
  • Documentation:
    • Added docs/PRORATION_ENGINE.md documenting proration formulas, credit memo lifecycle, and billing API examples.

Closes #959

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@senmalong 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

@senmalong
senmalong deployed to security-review August 27, 2026 02:14 — with GitHub Actions Active
@Smartdevs17
Smartdevs17 merged commit 4562bd3 into Smartdevs17:main Aug 31, 2026
7 of 33 checks passed
@Smartdevs17

Copy link
Copy Markdown
Owner

Thanks for contributing! The changes have been merged. Feel free to leave a review or feedback.

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 subscription proration engine with mid-cycle changes

2 participants