Skip to content

Comments

Update dependencies and enhance subscription management with plan types#47

Merged
Pvsaint merged 4 commits intoChain-Library:mainfrom
Akshola00:issue21
Jun 9, 2025
Merged

Update dependencies and enhance subscription management with plan types#47
Pvsaint merged 4 commits intoChain-Library:mainfrom
Akshola00:issue21

Conversation

@Akshola00
Copy link
Contributor

PR Description: Subscription Types, Record Structure, and Expiration Tracking
Overview
This PR implements robust data structures and logic for managing multiple subscription types and durations, as well as accurate expiration tracking for subscriptions.

Key Changes
Subscription Types & Durations:
Added support for various subscription types (e.g., monthly, yearly, trial) and their corresponding durations via the PlanType enum and related fields in the Subscription struct.

Detailed Subscription Record Structure:
The Subscription struct in storage now captures all relevant information, including type, duration, subscriber, status, and timestamps.
The subscription_record mapping efficiently stores all subscriptions per user.

Expiration Tracking Mechanism:
Subscriptions now include end_date and is_active fields.
The contract automatically tracks expiration and updates subscription status on renewal or termination.

Testing:
Added and updated tests to verify correct handling of subscription creation, renewal, expiration, and refund logic.

Compatibility:
The new structures and logic are fully compatible with the content access system, ensuring permissions are managed based on active subscriptions.

Notes
The design is modular and can be extended for future subscription policies or features.

@Pvsaint Pvsaint merged commit 14825fa into Chain-Library:main Jun 9, 2025
2 checks passed
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.

2 participants