@agentaos/pay 2.0: new API surface, management + subscriptions, pagination, void() fix - #32
Open
PancheI wants to merge 11 commits into
Open
@agentaos/pay 2.0: new API surface, management + subscriptions, pagination, void() fix#32PancheI wants to merge 11 commits into
PancheI wants to merge 11 commits into
Conversation
…surface Seller mode is derived by the server from the account — never a client input. Remove sellerMode from the create params (CreatePaymentLinkParams, CreateCheckoutParams); the resolved value is still returned on responses (PaymentLink, Checkout) for display. Add the additive new API surface: subscription payment links (type, billingInterval), invoice dueDate on checkouts, and the response fields sellerMode/type/billingInterval (PaymentLink) + sellerMode/invoiceId/ invoiceNumber (Checkout). Changeset: minor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The SDK shipped untested. Add 91 behavioral tests across the untested core: - fetch.ts: header/auth selection, idempotency key, body-sent-as-is + response camelization, retries (429/5xx/network → success and exhaustion), and the full status->error-class mapping (400 ValidationError w/ errors[], 401/403/404/409, 429 RateLimitError, 5xx ApiError, AbortError->TimeoutError). - client.ts: sk_ vs JWT auth detection, invalid-key + browser guards, baseUrl, resource wiring. - transform.ts: snake<->camel (nested/arrays/Date/round-trip). - resources: every checkouts/paymentLinks/transactions/invoices method asserted against captured METHOD+PATH + camelized returns. - webhooks.verify: REAL node:crypto HMAC + timingSafeEqual (valid/tampered/expired). Only the fetch boundary is mocked. Also drop a dead camelToSnake import in fetch.ts. typecheck 0 · 96 tests green · lint clean · build ok. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
….js to npm) Every published package compiled its src/**/*.test.ts into dist/, so the npm tarball shipped the test files to consumers. Add a per-package tsconfig.build.json (extends tsconfig.json + excludes *.test.ts/*.spec.ts) and point `build` at it, so dist ships only production code. `typecheck` still uses tsconfig.json and keeps type-checking the tests. Applied to the 5 packages that had tests: pay, chains, schemes (@agentaos/engine), signer (@agentaos/sdk), wallet (agentaos CLI). Verified: each rebuilds with 0 test.js in dist; typecheck still covers tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror the dashboard's merchant management/read API in the SDK, matching the
professional MoR-SDK bar (resource.operation, like Creem/Polar/Paddle). Read +
manage only — subscriptions are created by buyers on the hosted checkout, never
by the SDK.
- subscriptions.list() / subscriptions.cancel(id, { atPeriodEnd }) — defaults to
cancel-at-period-end (subscriber keeps the paid period, no refund).
- customers.list().
- invoices.getReceipt(id) (receipt PDF) / invoices.sendReceipt(id).
- Types typed against the live BE contracts (list endpoints return plain arrays,
not paginated envelopes; camelCase keys verified).
- CLI parity: agenta subscriptions list|cancel, agenta customers list.
- Tests (102 pay green) + README + folded into the 2.0.0 changeset.
- Independently reviewed (spec + quality), lint-green, live local smoke 7/7.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…docs Bring the CLI and MCP server to parity with @agentaos/pay's management surface. MCP (4 new agenta_pay_* tools): list_subscriptions, cancel_subscription, list_customers, send_receipt. (No get_receipt tool — a binary PDF isn't useful over MCP text; it stays CLI/SDK.) CLI: new 'agenta invoices' group — list, receipt <id> (downloads the PDF), send-receipt <id>. Rounds out subscriptions/customers (already shipped). Docs: wallet + top-level README CLI tables + MCP tool list; corrected the tool count to the real total (25) — the wallet README had also silently omitted the pre-existing pay tools, now backfilled. Changeset for agentaos (minor). typecheck + lint + build + mcp-server test green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…g resources)
The BE now paginates these two endpoints, so bring the SDK in line with every
other list resource: list(params?: ListParams) -> PaginatedList<T> ({items,
total, hasMore}) instead of a bare array. CLI gains --limit + a '(N total)'
header and 'X of Y shown' note; MCP tools accept limit/offset. README updated.
Tests: 102 pay tests green; CLI/MCP typecheck + build clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
void() called DELETE /gateway/invoices/{id}, which is not a route (404). The
real endpoint is POST /gateway/invoices/{id}/void. Corrects the method and the
test that was asserting the wrong DELETE behavior.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ntaos/pay, core libs) Applied the queued changesets: agentaos (CLI) major -> 2.0.0, cascading the fixed group (@agentaos/core, /crypto, /engine, /chains, /sdk) to 2.0.0; @agentaos/pay major -> 2.0.0. CLI now ships the MoR management surface (subscriptions, customers, invoices) at 2.0.0, matching the SDK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
x402-client.test.ts hit httpbin.org live (flaky: 15s timeouts, a different assert failing each run). Renamed it to *.integration.test.ts and excluded integration tests from 'test' (matching @agentaos/engine); added 'test:integration' to run them on demand. Gate now runs only deterministic unit tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reverses the earlier exclusion. x402-client is a UNIT test that lazily hit httpbin.org live (flaky: 15s timeouts, a different assert failing each run). Renamed it back from *.integration and mocked the global fetch so checkX402/discoverX402 are deterministic (added JSON-402 + .well-known manifest coverage). Restored the wallet 'test' script to run everything (no --exclude). x402-live.integration.test.ts (a genuine live test vs a real x402 server) stays in the gate as before. Suite green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@agentaos/pay2.0 — the new-API-era release.dueDate; new API surface.subscriptions/customerslist + cancel, receipt methods.subscriptions.list+customers.listpaginated to match the sibling resources ({ items, total, hasMore }).invoices.void()nowPOST /gateway/invoices/{id}/void(wasDELETE /{id}, which 404s), with its test corrected.Pre-push test suite green.
🤖 Generated with Claude Code