Skip to content

Feat/max plans per merchant 51#507

Open
manueldezman wants to merge 4 commits into
Smartdevs17:mainfrom
manueldezman:feat/max-plans-per-merchant-51
Open

Feat/max plans per merchant 51#507
manueldezman wants to merge 4 commits into
Smartdevs17:mainfrom
manueldezman:feat/max-plans-per-merchant-51

Conversation

@manueldezman
Copy link
Copy Markdown

@manueldezman manueldezman commented Jun 1, 2026

Closes #51


Summary

Implements Issue #51 by enforcing a maximum number of subscription plans a merchant can create, with a global default cap and an admin-updatable on-chain override. Existing plans remain unaffected; once a merchant reaches the cap, further plan creation fails with a clear error.

Changes

  • Enforce per-merchant plan cap in create_plan (default MAX_PLANS_PER_MERCHANT = 100)
  • Add global config storage key StorageKey::MaxPlansPerMerchant
  • Add admin APIs:
    • set_max_plans_per_merchant(new_limit: u32)
    • get_max_plans_per_merchant() -> u32
  • Add proxy passthrough wrappers for set/get
  • Add integration tests verifying:
    • 3rd plan fails when limit is 2
    • lowering the limit does not affect existing plans but blocks new creates

Pull Request Checklist

Quality Gates (All must pass before merge)

  • Lint: Code passes ESLint and Prettier checks
  • Type Check: TypeScript compilation succeeds
  • Tests: All tests pass (cd contracts && cargo test)
  • Build: Project builds successfully
  • Rust Format: Smart contract formatting is correct
  • Rust Clippy: Smart contract linting passes
  • Rust Tests: All smart contract tests pass (cd contracts && cargo test)
  • Rust Build: Smart contracts compile successfully (covered by cargo test)

Additional Requirements

  • New code has appropriate TypeScript types
  • No hardcoded secrets or credentials
  • New features have corresponding tests
  • Documentation updated if needed

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

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

@Smartdevs17
Copy link
Copy Markdown
Owner

merge conflicts

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.

🔧 Add maximum plan limit per merchant

2 participants