Skip to content

fix(nextjs): mock removed Narev balance/credit-topup endpoints - #261

Closed
audrzejq wants to merge 1 commit into
mainfrom
factory/bug-mock-nextjs-narev-endpoints
Closed

fix(nextjs): mock removed Narev balance/credit-topup endpoints#261
audrzejq wants to merge 1 commit into
mainfrom
factory/bug-mock-nextjs-narev-endpoints

Conversation

@audrzejq

Copy link
Copy Markdown
Contributor

fetchPolarUsage, fetchStripeUsage, fetchTopUpConfig, and createCheckout called Narev endpoints (GET /v1/balance, GET/POST /v1/credit) that no longer exist, returning 404s and breaking the billing UI package and chatbot examples.

Replace these four nextjs server actions with deterministic, typed mock data instead of calling getNarevClient. createCheckout now safely returns the passed-in successUrl. Public exports and TypeScript contracts are unchanged. Unrelated Narev pricing/reference integrations (createOpenAIWithBilling & friends, fetchModelPricing, createChatRouter) are untouched and still call the live Narev API.

  • Add packages/nextjs/src/mock-billing-data.ts with shared fixtures.
  • Rewrite the four colocated Vitest suites to assert on mock result shapes and that getNarevClient is not called.
  • Update packages/nextjs/README.md and examples/utils/chatbot-minimal/.env.example to drop the now inaccurate NAREV_API_KEY requirement for the mocked billing UI/config calls, while keeping the still-needed model pricing NAREV_API_KEY documented.
  • Add a patch changeset for @ai-billing/nextjs.

fetchPolarUsage, fetchStripeUsage, fetchTopUpConfig, and createCheckout
called Narev endpoints (GET /v1/balance, GET/POST /v1/credit) that no
longer exist, returning 404s and breaking the billing UI package and
chatbot examples.

Replace these four nextjs server actions with deterministic, typed
mock data instead of calling getNarevClient. createCheckout now safely
returns the passed-in successUrl. Public exports and TypeScript
contracts are unchanged. Unrelated Narev pricing/reference
integrations (createOpenAIWithBilling & friends, fetchModelPricing,
createChatRouter) are untouched and still call the live Narev API.

- Add packages/nextjs/src/mock-billing-data.ts with shared fixtures.
- Rewrite the four colocated Vitest suites to assert on mock result
  shapes and that getNarevClient is not called.
- Update packages/nextjs/README.md and
  examples/utils/chatbot-minimal/.env.example to drop the now
  inaccurate NAREV_API_KEY requirement for the mocked billing UI/config
  calls, while keeping the still-needed model pricing NAREV_API_KEY
  documented.
- Add a patch changeset for @ai-billing/nextjs.
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-billing-storybook Ready Ready Preview Aug 31, 2026 4:45pm

Request Review

@foreman-ai-billing

Copy link
Copy Markdown
Contributor

Approve tool call: github__addPullRequestComment

  1. Approve
  2. Cancel

Answer by mentioning me in a reply, e.g. @foreman-ai-billing Approve.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@foreman-ai-billing

Copy link
Copy Markdown
Contributor

I can’t inspect the current check results or post the CI-fix status comment in this run.

@audrzejq audrzejq closed this Sep 1, 2026
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.

1 participant