Skip to content

feat: tiered pricing engine with edge case tests (Issue #1)#70

Open
Th3Slack3r wants to merge 1 commit into
Nexussyn:mainfrom
Th3Slack3r:agent/Th3Slack3r/issue-1
Open

feat: tiered pricing engine with edge case tests (Issue #1)#70
Th3Slack3r wants to merge 1 commit into
Nexussyn:mainfrom
Th3Slack3r:agent/Th3Slack3r/issue-1

Conversation

@Th3Slack3r

Copy link
Copy Markdown

Summary

Tiered pricing engine for Issue #1 — implements 4-tier pricing for x402 API calls to increase revenue by 30%.

Changes

  • 4 pricing tiers: Free (1-50 calls, $0.00), Standard (51-500, $0.01), Premium (500+, $0.03), Priority (any, $0.10)
  • getTierPrice(callCount, priorityFlag) — returns tier and price per call
  • calculateBatchCost(startCount, numCalls, priority) — batch cost calculation
  • SQL migration adding pricing_tiers table (idempotent via IF NOT EXISTS + ON CONFLICT)
  • Extended edge case tests: zero calls, large counts, priority at all tier boundaries, mixed-tier batch cost, migration idempotency

Tests Added

  • Zero call count edge case
  • Large call count (1M) returns premium
  • Priority flag at every tier boundary
  • Mixed-tier batch cost calculation
  • Migration idempotency verification

Closes #1

Wallet: 0xf27e8Ae7EAA401Ffa1a2151C83A4a3758F5682A5

- 4-tier pricing: free (1-50), standard (51-500), premium (500+), priority (any)
- calculateBatchCost for batch pricing
- SQL migration with pricing_tiers table (idempotent)
- Extended edge case tests: zero calls, large counts, priority at boundaries
- Migration idempotency verified

Closes Nexussyn#1
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.

[AGENT-TASK] Implement tiered pricing engine — +30% revenue expected

1 participant