feat(integrations): push Polar order, subscription, and refund events by webhook

Đang mở
#429 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
15/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nextjs, playwright, react, typescript
Lĩnh vực
api, backend

Hướng nghiên cứu

Start with step 1: read docs/providers/polar.md ("Permissions") and Polar's webhook API docs to pin down the create endpoint, signature scheme and headers, and the delivery id to deduplicate on, then record findings on the issue. Code lives in src/lib/adapters/polar/; the mapping of order.paid and friends onto existing event types is what the timeline consumes, so read that event pipeline before writing handlers. It is blocked on #28 (ingest contract) and #426 (setup panel), so confirm those have landed first. Done means both setup paths work against the simulated Polar provider, deliveries are verified, deduplicated, and logged without bodies, and unit plus Playwright tests pass under npm test.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area: integrations blocked enhancement impact: medium priority: P1 size: S

Context

Decision on #424 (2026-11-14): Polar offers automatic setup as an opt-in and setup by hand. Polar has no read-only scope that can create a webhook: automatic setup needs webhooks:write, while the adapter holds read scopes only (docs/providers/polar.md, "Permissions"). The panel in #426 warns about this before asking, and points users who want DevMacro to stay read-only to setup by hand.

Item Value
Create Webhook endpoints through the API with webhooks:write, or by hand in Polar's webhook settings
Events for the timeline order.paid, order.refunded, subscription.created, subscription.canceled, subscription.revoked, refund.created, mapped to the adapter's polar.order.paid, polar.subscription.started, polar.subscription.canceled, polar.refund.succeeded
Not pushed Revenue, fees, and recurring revenue from Polar's analytics. Polling stays

Plan

  1. Confirm from Polar's docs, before any code: the create endpoint, its request and response (whether it returns the signing secret), the signature scheme and headers, and the delivery id to deduplicate on. Record them on this issue and in the provider page.
  2. Declare Polar's webhook in the #28 contract: automatic setup needs webhooks:write, steps for setup by hand.
  3. Automatic: after the opt-in consent for webhooks:write, create the endpoint with DevMacro's URL and the events above, store its secret encrypted, delete it on disconnect.
  4. By hand: show the URL and the steps, and a field for Polar's signing secret if Polar generates it.
  5. Verify signatures, deduplicate, map deliveries to the connection by the per-connection URL. Deliveries become the existing event types, so polling and webhooks show one entry.
  6. Docs: docs/providers/polar.md ("Permissions", "Permission risks" for webhooks:write, "Webhooks").

Acceptance criteria

  • Step 1 findings recorded with links to Polar's docs.
  • The opt-in write access warning from #426 shows before Polar's consent screen.
  • Automatic setup creates the endpoint, and a paid order reaches the timeline within a minute.
  • Setup by hand works without requesting webhooks:write.
  • Disconnect deletes an automatic endpoint.
  • Unsigned, wrongly signed, stale, or repeated deliveries are rejected or ignored, and logged without their body.
  • Unit tests on recorded, sanitized payloads from Polar's documented samples. No live calls in CI.
  • Playwright e2e: both setup paths for the simulated Polar provider.

Files and areas

  • src/lib/adapters/polar/, docs/providers/polar.md, docs/operations/oauth-apps.md.
  • Non-goals: other write scopes, pushing analytics figures.

Verification

  • npm run lint, npm run typecheck, npm test
  • Playwright spec for both setup paths.

Depends on

  • #28 Ingest provider webhooks
  • #426 Webhook setup panel

Branch: <issue-number>-polar-webhooks
Closes with a Closes #<issue-number> footer on the commit or pull request.

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

Ngôn ngữ chính
TypeScript
Star
1
Fork
1
Merge trung bình
6 giờ 56 phút
Pull request đã merge (30 ngày)
136

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eddiejaoude/StackDash

Tất cả issue của eddiejaoude/StackDash

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.