Skip to content

feat(js-sdk): TurboQuote payments (pay link, status, connection, webhook) - #35

Draft
nicolasiscoding wants to merge 3 commits into
mainfrom
feature/turboquote-payments
Draft

feat(js-sdk): TurboQuote payments (pay link, status, connection, webhook)#35
nicolasiscoding wants to merge 3 commits into
mainfrom
feature/turboquote-payments

Conversation

@nicolasiscoding

Copy link
Copy Markdown
Member

Description

Adds the TurboQuote online payments surface to the JS SDK (Stripe Connect today, provider-agnostic shape). Sellers connect a provider once, then generate a hosted pay link, track payment status, check collection readiness, and consume the TurboDocx-native quote.payment.succeeded webhook.

Methods

  • TurboQuote.getPaymentConnectionStatus() — is the org set up to collect? + provider capabilities
  • TurboQuote.createPaymentLink(quoteId, { buyerEmail? }) — hosted checkout URL + stable paymentId
  • TurboQuote.getPaymentStatus(quoteId) — latest payment status (none|pending|partial|paid|failed|overdue)
  • Types: QuotePaymentLink, QuotePaymentStatus, QuotePaymentConnectionStatus, PaymentProviderCapabilities, QuotePaymentEvents, QuotePaymentSucceededPayload

Tests / verification

  • Unit: tests/quote-payment.test.ts (mock HttpClient) — full suite 263/263 green.
  • Live E2E test bed: e2e/turboquote-payments.e2e.test.ts (guarded by E2E_* env).
  • Runnable example: examples/turboquote-payments.ts — verified green end-to-end against a live backend + Stripe sandbox: connection → pay link (real cs_test_… Checkout URL) → pending status → quote.payment.succeeded signature-verify. Webhook envelope shape verified against backend WebhookService.WebhookPayload ({ event, event_id, created_at, version, data }).

Related

Notes

  • Backend payments surface ships separately (provider abstraction, env-gated onboarding, outbound webhook).
  • Port to the other 5 SDKs is a follow-up (parity tracked separately).

Pre-Review Checklist

  • Tests pass (263/263)
  • Live E2E verified over HTTP
  • No any in public interfaces

[js-sdk] Add TurboQuote payment methods + types

- TurboQuote.createPaymentLink(quoteId, { buyerEmail? }) -> { checkoutUrl, paymentId }
- TurboQuote.getPaymentStatus(quoteId) -> status/amount/currency/...
- TurboQuote.getPaymentConnectionStatus() -> connected/charges/payouts + capabilities
- types/quote-payment.ts (incl. QuotePaymentEvents + QuotePaymentSucceededPayload
  for the quote.payment.succeeded webhook)
- Reads the backend's { data: { results } } envelope.
- Tests: 5 (mocked HttpClient); full suite 263/263. Port to the other 5 SDKs after.
[js-sdk] E2E test bed (Approach A) for the payments chain

- e2e/turboquote-payments.e2e.test.ts: SDK getPaymentConnectionStatus →
  createPaymentLink → getPaymentStatus(pending) → sign+POST a
  checkout.session.completed to the backend (Stripe's card capture is bot-blocked,
  so we feed the provider event ourselves) → getPaymentStatus(paid).
- Guarded by E2E_* env (api key OR access token); describe.skip without it, so
  npm test stays hermetic. jest.e2e.config.js + 'npm run test:e2e'.
nicolasiscoding pushed a commit that referenced this pull request Jul 29, 2026
…ns (#50)

Resolves all 6 open high-severity Dependabot alerts in this repo:

| Package         | Alerts   | Was     | Now     | Advisory            |
|-----------------|----------|---------|---------|---------------------|
| brace-expansion | #17, #35 | 1.1.12  | 1.1.16  | GHSA-3jxr-9vmj-r5cp |
| js-yaml         | #18, #36 | 3.14.2  | 3.15.0  | GHSA-52cp-r559-cp3m |
| minimatch       | #3,  #21 | 3.1.2   | 3.1.5   | GHSA-7r86-cg39-jmmj |

Each alert is filed twice, once per lockfile (root and
packages/js-sdk), so both lockfiles are updated.

All three are dev-only transitive dependencies of the Jest/ts-jest test
toolchain — none is a direct dependency, none appears in any
package.json, and the JS SDK has zero runtime dependencies, so nothing
here ships to consumers.

No manifest change was needed: every patched version already satisfies
the existing semver range its consumers declare (minimatch ^3.1.1,
brace-expansion ^1.1.x, js-yaml ^3.13.x), so a plain `npm update`
resolves them. No `overrides` pin is used, which keeps future patch
releases flowing normally.

Verified: `npm ci`, `npm run build:js` (tsc), and `npm run test:js`
(271/271 tests) all pass.

Co-authored-by: yacineKahlerras <kahlerasse@gmail.com>
Co-authored-by: Claude Opus 4.8 (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.

1 participant