Skip to content

Migrate billing endpoints from billing-service to lc_api-go#281

Merged
lc-kirill merged 3 commits intocli-v2from
migrate-billing-to-lc-api-go-cli-v2
Apr 23, 2026
Merged

Migrate billing endpoints from billing-service to lc_api-go#281
lc-kirill merged 3 commits intocli-v2from
migrate-billing-to-lc-api-go-cli-v2

Conversation

@lc-kirill
Copy link
Copy Markdown
Contributor

Summary

Billing functionality has been migrated server-side from the legacy billing.limacharlie.io service to lc_api-go (served at api.limacharlie.io/v1/). This PR points the v2 Billing SDK at the new endpoints so consumers don't drift out of sync as the legacy service is retired.

Mirrors #280 on master.

Path changes (limacharlie/sdk/billing.py)

Method Old path (billing root) New path (default root)
get_status orgs/{oid}/status orgs/{oid}/billing/status
get_details orgs/{oid}/details orgs/{oid}/billing/details
get_invoice_url orgs/{oid}/invoice_url/{y}/{m} orgs/{oid}/billing/invoice/{y}/{m}
get_plans user/self/plans plans

All four methods drop the alt_root=BILLING_URL argument and the BILLING_URL constant is removed. limacharlie/help_topics.py is updated to stop directing users to billing.limacharlie.io.

limacharlie api --target billing alias in commands/api_cmd.py is intentionally left in place — it's a raw escape hatch and removing it is a caller-visible breaking change that doesn't belong in this PR.

Semantic parity

Compared each migrated endpoint against its legacy counterpart in billing-services/billing-service:

  • /billing/invoice/{y}/{m} — lc_api-go returns only the first paid/open invoice for a month. The legacy urls[] / invoices[] multi-invoice keys are gone. Consumers reading response['url'] (the common case) are unaffected.
  • /plans — response is narrower ({id, name, region}) vs the legacy shape ({ID, MetaProduct, Datacenter:{Name, Region}}). SDK returns the raw dict, so any consumer reading plan['ID'] / plan['MetaProduct'] / plan['Datacenter'] needs to switch to the new keys.
  • /billing/status, /billing/details — identical response shape.

Test plan

  • python3 -m ast parse check
  • tests/integration/test_billing.py::test_v2_billing_status against a real org
  • Verify limacharlie billing status|details|plans|invoice CLI commands still work end-to-end
  • Confirm no downstream consumers rely on the removed urls[] / invoices[] response keys from get_invoice_url or legacy plan object fields from get_plans

🤖 Generated with Claude Code

lc-kirill and others added 3 commits April 23, 2026 15:27
Point the v2 Billing SDK at the lc_api-go paths under
api.limacharlie.io/v1/ instead of the legacy billing.limacharlie.io
service, which is being retired. Mirrors #280 against master.

Paths updated:

  orgs/{oid}/status          -> orgs/{oid}/billing/status
  orgs/{oid}/details         -> orgs/{oid}/billing/details
  orgs/{oid}/invoice_url/... -> orgs/{oid}/billing/invoice/...
  user/self/plans            -> plans

All four methods drop the alt_root argument and now use the default
api.limacharlie.io/v1/ base. Also updates the help topic to stop
directing users to billing.limacharlie.io.

Semantic parity was verified against billing-services/billing-service:
- /billing/invoice returns only the first invoice per month; the
  legacy "urls"/"invoices" multi-invoice keys are gone.
- /plans response is narrower ({id, name, region}) than the legacy
  shape that returned MetaProduct and a nested Datacenter block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The billing.limacharlie.io host is deprecated; all its endpoints have
been folded into lc_api under api.limacharlie.io/v1/. Rather than
break existing callers of 'limacharlie api --target billing', rewrite
the legacy relative paths they pass to their new /v1/ counterparts
and route through the default api host.

Rewrites applied:
  orgs/{oid}/status              -> orgs/{oid}/billing/status
  orgs/{oid}/details             -> orgs/{oid}/billing/details
  orgs/{oid}/invoice_url/{y}/{m} -> orgs/{oid}/billing/invoice/{y}/{m}
  user/self/plans                -> plans

Paths with no path change (user/self/auth, domain/{d}/auth,
orgs/{oid}/quota) pass through unchanged but still route to api.
Unrecognized paths also pass through — if a caller hits something
the legacy host served that never migrated, they get a 404 from
api.limacharlie.io instead of a DNS/connection error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- test_sdk_billing.py: drop the BILLING_URL import/assertion and
  expect the new /v1/ relative paths with no alt_root.
- test_api_cmd.py: replace test_billing_target (which asserted the
  old alt_root) with coverage of the compat shim — four rewrites
  (status, details, invoice_url, user/self/plans) plus a passthrough
  case for paths that kept their shape (user/self/auth).

Full unit suite: 3105 passed, 5 skipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lc-kirill lc-kirill marked this pull request as ready for review April 23, 2026 13:46
@lc-kirill lc-kirill requested a review from maximelb April 23, 2026 13:46
@lc-kirill lc-kirill merged commit 99ee007 into cli-v2 Apr 23, 2026
7 checks passed
@lc-kirill lc-kirill deleted the migrate-billing-to-lc-api-go-cli-v2 branch April 23, 2026 15:29
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.

2 participants