Skip to content

Map the API's invalid pixKey rejection to InvalidPixKeyError in the SDK - #1386

Merged
ebma merged 1 commit into
stagingfrom
fix/sdk-invalid-pixkey-mapping
Sep 29, 2026
Merged

ebma merged 1 commit into
stagingfrom
fix/sdk-invalid-pixkey-mapping

Conversation

@ebma

@ebma ebma commented Sep 29, 2026

Copy link
Copy Markdown
Member

Problem

The API rejects bad BRL payout details with Invalid pixKey or receiverTaxId. (trailing period, avenia-registration.ts). parseAPIError compared against the string without the period, so a server-side rejection never became InvalidPixKeyError. Only the client-side pre-check in BrlHandler raised it.

Fix

Match the exact API message. The API sends no type or code for this error, so the message is the only thing to match on.

Tests

  • New parseAPIError case in packages/sdk/test/errors.test.ts feeds the exact API message. It fails without the fix and passes with it.
  • bun lint (ESLint) in packages/sdk passes.
  • bun run wire-contract:check reports the snapshot is up to date.

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.
@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vrtx-dashboard canceled.

Name Link
🔨 Latest commit bec6979
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6abb82be8c9f080008e638b8

@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit bec6979
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6abb82be5b46140008a6f462
😎 Deploy Preview https://deploy-preview-1386--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit bec6979
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6abb82be88cd390008f716b9
😎 Deploy Preview https://deploy-preview-1386--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@ebma
ebma merged commit ad8870c into staging Sep 29, 2026
7 checks passed
@ebma
ebma deleted the fix/sdk-invalid-pixkey-mapping branch September 29, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants