Conversation
WalkthroughThe changes expand payment method support in both backend and frontend. The backend now includes non-card payment methods in Stripe setup intents and when listing payment methods. The frontend updates its display logic to handle payment methods without card details. The shared type definition for payment methods marks the card property as optional. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant API
participant Stripe
User->>Frontend: View payment methods
Frontend->>API: GET /payment-methods
API->>Stripe: List all payment methods (no card filter)
Stripe-->>API: Payment methods (card and non-card)
API-->>Frontend: Payment methods data
Frontend->>User: Display card info if present, else show type
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)`**/*.spec.{ts,tsx}`: Use `setup` function instead of `beforeEach` in test files...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/setup-instead-of-before-each.mdc) List of files the instruction was applied to:
🧠 Learnings (1)apps/api/src/billing/services/stripe/stripe.service.spec.ts (5)⏰ Context from checks skipped due to timeout of 90000ms (7)
🔇 Additional comments (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1610 +/- ##
==========================================
- Coverage 42.71% 42.58% -0.14%
==========================================
Files 877 878 +1
Lines 21531 21605 +74
Branches 3943 3973 +30
==========================================
+ Hits 9198 9200 +2
+ Misses 12035 11697 -338
- Partials 298 708 +410
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
packages/http-sdk/src/stripe/stripe.types.ts (1)
37-42: Guard optionalcardproperty in UI componentsThe
cardfield is now optional onPaymentMethod. We’ve identified direct accesses that will throw at runtime ifcardis undefined—those need to be updated to handle the optional case.Affected locations:
- apps/deploy-web/src/components/user/payment/PaymentMethodsList.tsx
- method.card.brand
- method.card.last4
- method.card.exp_month / method.card.exp_year
Suggested fixes (choose one per usage):
- Use optional chaining:
- {method.card.brand} + {method.card?.brand}- Guard with a conditional render:
{method.card && ( <> <span className="font-medium capitalize">{method.card.brand}</span> {/* … */} </> )}Please update these references to safely handle the now-optional
cardproperty.
🧹 Nitpick comments (1)
apps/api/src/billing/services/stripe/stripe.service.ts (1)
38-40: Consider making payment method types configurable.The addition of
payment_method_types: ["card", "link"]correctly expands support beyond cards. However, the hardcoded array might benefit from being configurable through the billing config service for easier maintenance.Consider extracting the payment method types to the billing configuration:
+ const paymentMethodTypes = this.billingConfig.get("STRIPE_PAYMENT_METHOD_TYPES")?.split(",") || ["card", "link"]; return await this.setupIntents.create({ customer: customerId, usage: "off_session", - payment_method_types: ["card", "link"] + payment_method_types: paymentMethodTypes });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/api/src/billing/services/stripe/stripe.service.ts(2 hunks)apps/deploy-web/src/components/user/payment/PaymentMethodsList.tsx(1 hunks)packages/http-sdk/src/stripe/stripe.types.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
apps/deploy-web/src/components/user/payment/PaymentMethodsList.tsx (1)
Learnt from: CR
PR: akash-network/console#0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-06-30T12:11:50.570Z
Learning: Applies to apps/{deploy-web,provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations in `.spec.tsx` files
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (1)
apps/api/src/billing/services/stripe/stripe.service.ts (1)
90-95: LGTM - Correctly removes card-only restriction.Removing the
type: "card"filter allows the method to return all payment methods for a customer, which aligns perfectly with the goal of supporting multiple payment method types.
* feat(billing): filter payment methods * fix(billing): replace all _ * fix(billing): stripe tests
Summary by CodeRabbit
New Features
Bug Fixes