Skip to content

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

Merged
maximelb merged 1 commit intomasterfrom
migrate-billing-to-lc-api-go
Apr 23, 2026
Merged

Migrate billing endpoints from billing-service to lc_api-go#280
maximelb merged 1 commit intomasterfrom
migrate-billing-to-lc-api-go

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 SDK at the new endpoints so consumers don't drift out of sync as the legacy service is retired.

Mirrors go-limacharlie#237.

Path changes

Method Old path (billing root) New path (default root)
getOrgStatus orgs/{oid}/status orgs/{oid}/billing/status
getOrgDetails orgs/{oid}/details orgs/{oid}/billing/details
getOrgInvoiceURL orgs/{oid}/invoice_url/{y}/{m} orgs/{oid}/billing/invoice/{y}/{m}
getAvailablePlans user/self/plans plans
getSkuDefinitions orgs/{oid}/sku-definitions orgs/{oid}/billing/sku
getUserAuthRequirements user/self/auth (billing root) user/self/auth (default root)

All altRoot = 'https://billing.limacharlie.io/' arguments are dropped; calls now use the default api.limacharlie.io/v1/ base from Manager._restCall.

Side note: billing-services/billing-service never actually served /orgs/{oid}/sku-definitionsgetSkuDefinitions had been pointed at a non-existent endpoint. It's now backed by lc_api-go's real /orgs/{oid}/billing/sku handler.

Semantic parity

Compared each migrated endpoint against its legacy counterpart in billing-services/billing-service. Caller-visible differences:

  • /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. Single-URL consumers (the common case) are unaffected.
  • /plans — response is narrower ({id, name, region}) than the legacy shape ({ID, MetaProduct, Datacenter:{Name, Region}}). The SDK passes responses through as dicts, so any consumer reading plan['ID'] / plan['MetaProduct'] / plan['Datacenter'] needs to switch to the new keys.
  • /user/self/auth — error message for non-user identities unchanged; lc_api-go additionally returns a top-level is_unified_billing.
  • /billing/status, /billing/details — identical response shape.

Test plan

  • python3 -c 'import ast; ast.parse(open(\"limacharlie/Billing.py\").read())' passes
  • Manual smoke test of each Billing method against a real org
  • Verify no downstream consumers rely on the removed urls[] / invoices[] response keys from getOrgInvoiceURL or on the legacy plan object fields from getAvailablePlans

🤖 Generated with Claude Code

Point all Billing SDK methods at the lc_api-go paths under
api.limacharlie.io/v1/ instead of the legacy billing.limacharlie.io
service, which is being retired. 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
  orgs/{oid}/sku-definitions -> orgs/{oid}/billing/sku

user/self/auth is unchanged in path but now routes to lc_api-go via
the default root. The legacy billing-service never actually served
/orgs/{oid}/sku-definitions, so getSkuDefinitions is now backed by
a real endpoint for the first time.

Semantic parity was verified against billing-services/billing-service
for each migrated endpoint; the only caller-visible differences are:
- /billing/invoice returns only the first invoice for a month; the
  legacy "urls"/"invoices" multi-invoice keys are gone.
- /plans response is narrower ({id, name, region}) than the legacy
  response that returned full plan objects with MetaProduct and a
  nested Datacenter block.

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 12:05
@lc-kirill lc-kirill requested a review from maximelb April 23, 2026 12:05
@maximelb maximelb merged commit 97393f8 into master Apr 23, 2026
1 check failed
@maximelb maximelb deleted the migrate-billing-to-lc-api-go branch April 23, 2026 13:22
lc-kirill added a commit that referenced this pull request Apr 23, 2026
* Migrate billing endpoints from billing-service to lc_api-go

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>

* Reroute --target billing to lc_api as a compat shim

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>

* Update billing unit tests for lc_api paths and api_cmd shim

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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