Repository navigation
Map the API's invalid pixKey rejection to InvalidPixKeyError in the SDK - #1386
Merged
Merged
Conversation
The API rejects with "Invalid pixKey or receiverTaxId." (trailing period), so the exact-match comparison never fired and server-side rejections surfaced as a generic VortexSdkError.
✅ Deploy Preview for vrtx-dashboard canceled.
|
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vortexfi ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the verified API response and includes focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Aligns SDK error parsing with the API’s exact invalid PIX response.
Changes:
- Matches the trailing-period API message.
- Adds regression coverage for
InvalidPixKeyError.
| File | Description |
|---|---|
packages/sdk/src/errors.ts |
Corrects the API error-message match. |
packages/sdk/test/errors.test.ts |
Verifies mapping and HTTP status. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The API rejects bad BRL payout details with
Invalid pixKey or receiverTaxId.(trailing period,avenia-registration.ts).parseAPIErrorcompared against the string without the period, so a server-side rejection never becameInvalidPixKeyError. Only the client-side pre-check inBrlHandlerraised it.Fix
Match the exact API message. The API sends no
typeor code for this error, so the message is the only thing to match on.Tests
parseAPIErrorcase inpackages/sdk/test/errors.test.tsfeeds the exact API message. It fails without the fix and passes with it.bun lint(ESLint) in packages/sdk passes.bun run wire-contract:checkreports the snapshot is up to date.