Skip to content

Comments

feat(billing): add support for Link payment methods#2722

Merged
baktun14 merged 8 commits intomainfrom
fix/link-payment-method
Feb 23, 2026
Merged

feat(billing): add support for Link payment methods#2722
baktun14 merged 8 commits intomainfrom
fix/link-payment-method

Conversation

@baktun14
Copy link
Contributor

@baktun14 baktun14 commented Feb 12, 2026

Summary by CodeRabbit

  • New Features

    • Added Stripe Link as an alternative payment method; UI displays "Link" or "Link (email)" and hides "Valid until" for Link methods.
  • Improvements

    • More consistent payment-method identification across flows (improved fingerprint handling).
    • Improved privacy: Link emails are redacted in transaction/charge exports and records.
  • Tests

    • Updated and added tests covering Link payment method rendering and behaviors.

@baktun14 baktun14 requested a review from a team as a code owner February 12, 2026 21:49
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds Link payment method support: schema/type additions for link.email, centralized fingerprint extraction and sanitization in the Stripe service, UI updates to render Link methods (optional email) and hide expiry for non-card methods, plus test helpers and spec updates.

Changes

Cohort / File(s) Summary
Schema & Types
apps/api/src/billing/http-schemas/stripe.schema.ts, packages/http-sdk/src/stripe/stripe.types.ts
Add optional nullable link object with optional nullable email to PaymentMethod schema/type; add refinement requiring card or link.
Service Layer
apps/api/src/billing/services/stripe/stripe.service.ts
Introduce extractFingerprint(paymentMethod) to derive fingerprint from card.fingerprint or hashed link.email; switch callers to use it; redact link.email when constructing/sanitized payment method payloads; adjust related messages.
UI Components
apps/deploy-web/src/components/billing-usage/PaymentMethodsView/PaymentMethodsRow.tsx, apps/deploy-web/src/components/shared/PaymentMethodCard/PaymentMethodCard.tsx
Compute unified display label and optional expiry via helper; render card details when present and Link (optionally Link (email)) otherwise; hide expiry for non-card methods; introduce dependency injection prop in PaymentMethodCard.
Tests & Mocks
apps/deploy-web/src/components/billing-usage/PaymentMethodsView/PaymentMethodsRow.spec.tsx, apps/deploy-web/tests/seeders/payment.ts, apps/deploy-web/src/components/shared/PaymentMethodCard/PaymentMethodCard.spec.tsx
Add createMockLinkPaymentMethod() and update/add tests to cover Link payment methods (with/without email); update expectations for rendering and expiry visibility; add comprehensive specs for PaymentMethodCard.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client (UI)
  participant API as API Server
  participant Stripe as Stripe SDK
  participant DB as Database

  Client->>API: Attach payment method (card or link{email})
  API->>Stripe: Create/attach PaymentMethod
  Stripe-->>API: Return PaymentMethod (card.fingerprint or link.email)
  API->>API: extractFingerprint(paymentMethod)
  API->>DB: Store payment method record with fingerprint
  API-->>Client: Return sanitized PaymentMethod (link.email redacted)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐇 I found a Link and gave a squeak,
Emails hashed so fingerprints speak,
I hopped through schema, service, and view,
Tests snugged in, labels tidy and new,
A tiny hop for billing, cheerful and sleek.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty, missing required sections (Why and What) specified in the repository's PR template. Add a description explaining why Link payment method support was added (including any issue references) and what changes were made to implement this feature.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for Link payment methods, which is the primary feature implemented across multiple files in this PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/link-payment-method

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 93.61702% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.84%. Comparing base (08ec057) to head (a1efc3a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../api/src/billing/services/stripe/stripe.service.ts 81.81% 2 Missing ⚠️
.../services/stripe-webhook/stripe-webhook.service.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2722      +/-   ##
==========================================
+ Coverage   53.68%   53.84%   +0.15%     
==========================================
  Files        1020     1020              
  Lines       23573    23604      +31     
  Branches     5751     5774      +23     
==========================================
+ Hits        12655    12709      +54     
+ Misses       9522     9501      -21     
+ Partials     1396     1394       -2     
Flag Coverage Δ *Carryforward flag
api 76.79% <82.35%> (+0.05%) ⬆️
deploy-web 36.39% <100.00%> (+0.25%) ⬆️
log-collector 75.35% <ø> (ø)
notifications 85.56% <ø> (ø)
provider-console 81.48% <ø> (ø) Carriedforward from 08ec057
provider-proxy 82.41% <ø> (ø) Carriedforward from 08ec057
tx-signer 79.29% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
apps/api/src/billing/http-schemas/stripe.schema.ts 100.00% <100.00%> (ø)
...ervices/wallet-settings/wallet-settings.service.ts 96.22% <100.00%> (ø)
...ing-usage/PaymentMethodsView/PaymentMethodsRow.tsx 97.61% <100.00%> (+0.56%) ⬆️
...nts/shared/PaymentMethodCard/PaymentMethodCard.tsx 100.00% <100.00%> (+100.00%) ⬆️
.../services/stripe-webhook/stripe-webhook.service.ts 77.19% <66.66%> (ø)
.../api/src/billing/services/stripe/stripe.service.ts 73.84% <81.81%> (+0.66%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

stalniy
stalniy previously approved these changes Feb 17, 2026
Copy link
Contributor

@stalniy stalniy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/http-sdk/src/stripe/stripe.types.ts`:
- Around line 43-45: The Link typing currently assumes link and link.email are
non-nullable; update the SDK types in stripe.types.ts so the link property
itself can be null and its email can be string or null (i.e., make link accept
null and make email nullable). Locate the declaration that defines "link?: {
email?: string; }" and change it so the link union allows null and email's type
includes null (preserving optionality where appropriate) to match the backend
schema.

@github-actions github-actions bot added size: M and removed size: S labels Feb 18, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/deploy-web/src/components/shared/PaymentMethodCard/PaymentMethodCard.spec.tsx`:
- Around line 13-14: The nested test-suite descriptions in
PaymentMethodCard.spec.tsx (e.g., describe("display mode (default)") and the
other nested describe around lines 77–78) should be renamed to start with "when"
or a method name; update those describe strings to something like describe("when
in display mode (default)") or describe("when rendering the display mode") (and
similarly rename the other nested describe to start with "when ...") so they
follow the project's nested-suite naming convention while leaving the test
bodies (it blocks) and test helpers unchanged.

@github-actions github-actions bot added size: L and removed size: M labels Feb 18, 2026
@baktun14 baktun14 force-pushed the fix/link-payment-method branch from 4fb8c94 to 1389803 Compare February 19, 2026 20:41
baktun14 and others added 8 commits February 23, 2026 11:05
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After rebasing to main, the test file still used jest globals.
Replaced jest.fn/jest.Mock with vitest equivalents.
…eload scheduling

Webhook handlers only extracted fingerprints from card payment methods,
causing Link types to never get local DB records. This made setting Link
as default fail with 403. Also fix auto-reload enable failing with 500
when a stale singleton job already existed in the queue.
@baktun14 baktun14 force-pushed the fix/link-payment-method branch from 0094b92 to a1efc3a Compare February 23, 2026 16:05
@baktun14 baktun14 added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 1f2fa7a Feb 23, 2026
55 of 56 checks passed
@baktun14 baktun14 deleted the fix/link-payment-method branch February 23, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants