Skip to content

feat: build subscription pause and resume with billing adjustment - #1022

Merged
Smartdevs17 merged 2 commits into
Smartdevs17:mainfrom
senmalong:feat/subscription-pause-resume-billing-adjustment
Aug 31, 2026
Merged

feat: build subscription pause and resume with billing adjustment#1022
Smartdevs17 merged 2 commits into
Smartdevs17:mainfrom
senmalong:feat/subscription-pause-resume-billing-adjustment

Conversation

@senmalong

Copy link
Copy Markdown
Contributor

Summary

Implements production-ready subscription pause and resume functionality with automatic billing schedule adjustment across Soroban smart contracts (contracts/subscription/src/) and the Zustand frontend store (src/store/subscriptionStore.ts).

Changes Implemented

  • Smart Contracts (contracts/subscription/src/):
    • proration.rs: Added PauseAdjustmentResult struct and calculate_pause_adjustment helper function to compute billing adjustments.
    • lib.rs: Updated check_and_resume_internal and resume_subscription to shift next_charge_at forward by the actual elapsed pause duration (min(now - paused_at, pause_duration)). Added preview_pause_adjustment for frontend/SDK previews.
  • Frontend State Store (src/store/ & src/types/):
    • src/types/subscription.ts: Added pause state properties (isPaused, pausedAt, pauseDurationDays, pausedUntil, billingAdjustmentAmount) to the Subscription interface.
    • src/store/subscriptionStore.ts: Implemented pauseSubscription, resumeSubscription, and previewPauseAdjustment store actions with calendar/reminder synchronization and stats calculation.
  • Documentation:
    • Added docs/SUBSCRIPTION_PAUSE_RESUME.md detailing contract state transitions, formulas, and usage examples.

Closes #961

@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:09 — with GitHub Actions Active
@Smartdevs17
Smartdevs17 merged commit 7e63a04 into Smartdevs17:main Aug 31, 2026
21 of 53 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 pause/resume with billing adjustment

2 participants