Conversation
🦋 Changeset detectedLatest commit: e5b5193 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7de9bc2 to
1d0aa0f
Compare
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a new authenticated GET /wallet endpoint that loads a credential's ACTIVE|FROZEN card, calls Panda for processor details, returns processorCardId/timeBasedSecret, adds a Panda utility, tests covering success and error mappings, and adds a changeset for a patch release. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant API as GET /wallet
participant DB as Database
participant Panda as Panda API
Client->>API: GET /wallet (credentialId cookie)
API->>DB: Load credential (pandaId, first ACTIVE|FROZEN card)
alt no credential
DB-->>API: not found
API-->>Client: 500 { code: "no credential" }
else credential missing pandaId
DB-->>API: credential (no pandaId)
API-->>Client: 403 { code: "no panda" }
else no eligible card
DB-->>API: credential (no eligible card)
API-->>Client: 404 { code: "no card" }
else credential + card found
DB-->>API: credential + cardId
API->>Panda: GET /issuing/cards/{cardId}/processorDetails
alt processor details found
Panda-->>API: { processorCardId, timeBasedSecret }
API-->>Client: 200 { cardId, cardSecret }
else processor 404
Panda-->>API: 404
API-->>Client: 404 { code: "no card" }
else other error
Panda-->>API: error
API-->>Client: 500 (error)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## signature #949 +/- ##
=============================================
+ Coverage 71.32% 73.75% +2.42%
=============================================
Files 228 229 +1
Lines 8447 9284 +837
Branches 2716 3097 +381
=============================================
+ Hits 6025 6847 +822
+ Misses 2188 2174 -14
- Partials 234 263 +29
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
af7c987 to
9495bf1
Compare
9495bf1 to
0975d4d
Compare
0975d4d to
0ed88f7
Compare
0ed88f7 to
ba4376c
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
server/test/api/card.test.ts (1)
867-869:⚠️ Potential issue | 🟡 MinorUse
Pandain the mockedServiceErrorfor consistency.
"Rain"works, but using the real provider label keeps test fixtures closer to production behavior.Suggested fix
- vi.spyOn(panda, "getProcessorDetails").mockRejectedValueOnce(new ServiceError("Rain", 500, "internal error")); + vi.spyOn(panda, "getProcessorDetails").mockRejectedValueOnce(new ServiceError("Panda", 500, "internal error"));
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7e528c82-bb28-42c9-8cd9-b0f075ed5b87
📒 Files selected for processing (4)
.changeset/chilly-suns-dress.mdserver/api/card.tsserver/test/api/card.test.tsserver/utils/panda.ts
ba4376c to
2f6644b
Compare
9662eac to
b49e535
Compare
b49e535 to
1cf381c
Compare
c9cf016 to
184fdc9
Compare
184fdc9 to
61f0b3e
Compare
61f0b3e to
ced86c6
Compare
ced86c6 to
5b50548
Compare
5b50548 to
6ae30c0
Compare
6ae30c0 to
4fafee0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fafee0c5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (status === "DELETED") throw new Error("card deleted"); | ||
| const [{ expirationMonth, expirationYear, limit }, pan, user, pin, provisioning] = await Promise.all([ | ||
| getCard(id), | ||
| getSecrets(id, c.req.valid("header").sessionid), |
There was a problem hiding this comment.
Guard stale PAN lookup in provisioning path
The new stale-card mapping only wraps getProcessorDetails(), but getSecrets() in the same Promise.all is still unhandled. When Panda has already removed a card, getSecrets() can return 404 first, which rejects the whole request and bypasses the intended { code: "no card" } response for scope=provisioning, producing an unexpected server error instead. This makes stale-card behavior timing-dependent in the new provisioning flow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
this is uncertain right now. on purpose, the only provisioning-specific call that maps these failures to 404 { code: "no card" } is getProcessorDetails().
so i’m leaving this thread open as the current design boundary rather than resolving it as addressed.
1be83a0 to
d981d2d
Compare
d981d2d to
7589266
Compare
7589266 to
1ce4184
Compare
1ce4184 to
e5b5193
Compare
Closes #440
Summary by CodeRabbit
New Features
Tests
Chores