Skip to content

feat: implement subscription plan templates with dynamic pricing tiers - #2

Open
Timmatt112 wants to merge 1 commit into
mainfrom
feat/950-plan-templates-dynamic-pricing
Open

feat: implement subscription plan templates with dynamic pricing tiers#2
Timmatt112 wants to merge 1 commit into
mainfrom
feat/950-plan-templates-dynamic-pricing

Conversation

@Timmatt112

Copy link
Copy Markdown
Owner

Summary

Closes Smartdevs17#950

Adds production-facing subscription plan template support to the Soroban subscription implementation, including reusable template storage, graduated dynamic pricing tiers, versioning, sharing, instantiation, and analytics.

Changes

  • Added append-only TemplateKey and StorageKey::PlanTemplate variants for template persistence.
  • Registered the existing plan_templates module in the subscription contract.
  • Exposed authenticated contract entrypoints for creating templates, publishing versions, sharing, instantiation, tier quotes, and analytics.
  • Preserved prior storage-key ordering for upgrade compatibility.
  • Reused the existing backend template service, tier calculator, and comprehensive tests.

Dynamic pricing behavior

  • Supports up to 12 ascending tiers.
  • Supports included/free units via zero-priced tiers.
  • Supports a final unbounded tier.
  • Rejects negative prices, invalid bounds, and non-terminal unbounded tiers.
  • Calculates graduated pricing by charging each unit only within its applicable tier.

Validation

  • git diff --check passed.
  • Formatting and backend plan-template tests were attempted.
  • Full verification is blocked by pre-existing repository issues:
    • Rust/Cargo is unavailable in the environment.
    • TypeScript has unrelated merge-conflict/syntax errors.
    • Backend Jest initialization fails on a pre-existing type-only ErrorCode runtime reference.

Scope hygiene

The four pre-existing modified generated/dependency files were intentionally excluded:

  • package-lock.json
  • src/contracts/types/ERC20.ts
  • src/contracts/types/common.ts
  • src/contracts/types/factories/ERC20__factory.ts

…pend-only template storage keys and authenticated contract entrypoints for reusable plans, versioning, sharing, analytics, and graduated pricing quotes.\n\nCloses Smartdevs17#950\n\nGenerated with Codebuff 🤖\nCo-Authored-By: Codebuff <[email protected]>
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.

Implement subscription plan templates with dynamic pricing tiers

1 participant