feat: implement subscription event sourcing with full audit trail (#175) - #516
Merged
Smartdevs17 merged 2 commits intoJun 1, 2026
Merged
feat: implement subscription event sourcing with full audit trail (#175)#516Smartdevs17 merged 2 commits into
Smartdevs17 merged 2 commits into
Conversation
- Add StoredEvent, EventFilter, EventRetentionPolicy, EventMetadata types - Add Charged/Downgraded variants to SubscriptionEventType - Implement EventStore with append-only event log using env.storage() - Implement state reconstruction (current + point-in-time) - Add event querying with filters (by subscription, by type, by date range) - Add event export for compliance reporting - Add configurable event retention policy with auto-pruning - Add event-related error variants (EventNotFound, EventStoreFull, etc.) - Instrument all lifecycle functions (subscribe, cancel, pause, resume, charge, refund, transfer, change_plan) to record events - Event sequence validation for legal state machine transitions
|
@Cyberking99 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! 🚀 |
…170 #169) Billing Schedules (#170): - Extend Interval enum with BiWeekly, BiMonthly, SemiAnnually, Custom(u64) - Add BillingSchedule struct with trial, promo rate, custom invoice day support - Add billing.rs module with next_billing, prorated_first_billing, preview - Add schedule storage per subscription - Add set/get_billing_schedule and get_billing_preview contract entry points Multi-step Charging with Retry (#169): - Add ChargeAttempt, ChargeStatus, RetryConfig types - Add charging.rs module with state machine (Pending→Attempting→Retrying→Completed/Exhausted) - Implement exponential backoff retry with configurable max retries - Add circuit breaker pattern to pause after repeated failures - Add charge history tracking per subscription - Add start_charge, retry_charge, get_charge_history, abort_charge entry points Fixes: - Fix proration.rs to use Interval::Yearly (was Annually, non-existent variant)
abimbolaalabi
pushed a commit
to abimbolaalabi/SubTrackr
that referenced
this pull request
Jun 26, 2026
…artdevs17#175) (Smartdevs17#516) * feat: implement subscription event sourcing with full audit trail (Smartdevs17#175) - Add StoredEvent, EventFilter, EventRetentionPolicy, EventMetadata types - Add Charged/Downgraded variants to SubscriptionEventType - Implement EventStore with append-only event log using env.storage() - Implement state reconstruction (current + point-in-time) - Add event querying with filters (by subscription, by type, by date range) - Add event export for compliance reporting - Add configurable event retention policy with auto-pruning - Add event-related error variants (EventNotFound, EventStoreFull, etc.) - Instrument all lifecycle functions (subscribe, cancel, pause, resume, charge, refund, transfer, change_plan) to record events - Event sequence validation for legal state machine transitions * feat: implement billing schedules and multi-step charging with retry (Smartdevs17#170 Smartdevs17#169) Billing Schedules (Smartdevs17#170): - Extend Interval enum with BiWeekly, BiMonthly, SemiAnnually, Custom(u64) - Add BillingSchedule struct with trial, promo rate, custom invoice day support - Add billing.rs module with next_billing, prorated_first_billing, preview - Add schedule storage per subscription - Add set/get_billing_schedule and get_billing_preview contract entry points Multi-step Charging with Retry (Smartdevs17#169): - Add ChargeAttempt, ChargeStatus, RetryConfig types - Add charging.rs module with state machine (Pending→Attempting→Retrying→Completed/Exhausted) - Implement exponential backoff retry with configurable max retries - Add circuit breaker pattern to pause after repeated failures - Add charge history tracking per subscription - Add start_charge, retry_charge, get_charge_history, abort_charge entry points Fixes: - Fix proration.rs to use Interval::Yearly (was Annually, non-existent variant)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #175
Closes #170
Closes #169
Summary
Implements an event sourcing architecture that records every subscription state change as an immutable on-chain event, enabling full audit trails, regulatory compliance, and historical state reconstruction.
Changes
Acceptance Criteria