Skip to content

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

Open
baktun14 wants to merge 5 commits intomainfrom
fix/link-payment-method
Open

feat(billing): add support for Link payment methods#2722
baktun14 wants to merge 5 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

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 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.21%. Comparing base (292820f) to head (afa8dd5).
⚠️ Report is 14 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 ⚠️
...nts/shared/PaymentMethodCard/PaymentMethodCard.tsx 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2722      +/-   ##
==========================================
+ Coverage   51.77%   52.21%   +0.43%     
==========================================
  Files        1045     1043       -2     
  Lines       27447    27483      +36     
  Branches     6340     6356      +16     
==========================================
+ Hits        14211    14350     +139     
+ Misses      12809    12660     -149     
- Partials      427      473      +46     
Flag Coverage Δ *Carryforward flag
api 76.94% <84.61%> (+0.26%) ⬆️
deploy-web 37.58% <96.42%> (+0.39%) ⬆️
log-collector 75.35% <ø> (ø)
notifications 85.56% <ø> (ø) Carriedforward from b4247fd
provider-console 81.48% <ø> (ø)
provider-proxy 82.41% <ø> (ø)
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%> (ø)
...ing-usage/PaymentMethodsView/PaymentMethodsRow.tsx 95.12% <100.00%> (+1.00%) ⬆️
...nts/shared/PaymentMethodCard/PaymentMethodCard.tsx 97.05% <94.11%> (+97.05%) ⬆️
.../api/src/billing/services/stripe/stripe.service.ts 72.58% <81.81%> (+0.48%) ⬆️

... and 55 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.

🔥

@baktun14 baktun14 requested a review from ygrishajev February 17, 2026 18:11
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.

Comment on lines +13 to +14
describe("display mode (default)", () => {
it("renders card payment method with brand and last4", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Rename nested describe blocks to start with “when …” (or a method name).

Line 13 and Line 77 don’t follow the required nested-suite naming convention.

🔧 Suggested rename
-  describe("display mode (default)", () => {
+  describe("when display mode (default)", () => {
...
-  describe("selection mode", () => {
+  describe("when selection mode", () => {
As per coding guidelines: `Use either a method name or a condition starting with 'when' for nested suite descriptions in tests`.

Also applies to: 77-78

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/deploy-web/src/components/shared/PaymentMethodCard/PaymentMethodCard.spec.tsx`
around lines 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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added size: L and removed size: M labels Feb 18, 2026
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

Comments