Skip to content

feat(investment): add missing API fields issueDate, purchaseDate, issuerCNPJ#71

Open
victor-garcia-orbi wants to merge 1 commit into
pluggyai:masterfrom
Orbi-Finance:feat/investment-missing-fields
Open

feat(investment): add missing API fields issueDate, purchaseDate, issuerCNPJ#71
victor-garcia-orbi wants to merge 1 commit into
pluggyai:masterfrom
Orbi-Finance:feat/investment-missing-fields

Conversation

@victor-garcia-orbi
Copy link
Copy Markdown

Problem

The Pluggy REST API returns three Investment fields that are not mapped in the Investment DTO. The SDK uses FieldNamingPolicy.IDENTITY (Gson), which requires exact byte-for-byte field name matches — misnamed or missing Java fields are silently discarded.

Fields affected

API JSON key Current SDK field Effect
issueDate issuerDate (misnamed — extra r) Always null
purchaseDate (not present) Always null
issuerCNPJ (not present) Always null

issuerDate was misnamed when first introduced. Because FieldNamingPolicy.IDENTITY requires an exact match, the API key issueDate never maps to the Java field issuerDate.

Solution

  • Add issueDate (Date) — correct name for the instrument's emission/issue date
  • Add purchaseDate (Date) — date the investor purchased/applied for the investment
  • Add issuerCNPJ (String) — CNPJ of the issuing institution
  • Mark existing issuerDate as @Deprecated with a migration note (kept for backward compatibility — removing it would surface the pre-existing null in callers, not a real regression)

Verified against live API

Tested against two investment types from real API responses:

CDB (NU FINANCEIRA):

"issueDate": "2026-02-06T03:00:00.000Z",
"purchaseDate": "2026-02-06T03:00:00.000Z",
"issuerCNPJ": "30.680.829/0001-43"

Tesouro IPCA+ 2045:

"issueDate": "2022-05-03T03:00:00.000Z",
"purchaseDate": "2022-05-03T03:00:00.000Z",
"issuerCNPJ": null

🤖 Generated with Claude Code

…uerCNPJ

The Pluggy REST API returns three fields in the Investment response that
are not captured by the current DTO, causing Gson (FieldNamingPolicy.IDENTITY
— exact byte-for-byte key matching) to silently discard them.

issuerDate has been misnamed since it was introduced: the API emits
'issueDate' (no trailing 'r'), so Gson never populates the Java field.
It is kept @deprecated for backward compatibility.

Fields added:
- issuerCNPJ (String)  — CNPJ of the issuing institution
- issueDate  (Date)    — emission/issue date of the instrument
- purchaseDate (Date)  — date the investor purchased/applied

Verified against live Pluggy API responses for CDB and Tesouro IPCA+ products.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant