[PR #5184] [CLOSED] [Feature] Feature/pluggyai investment support #5802

Closed
opened 2026-02-28 21:18:53 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/5184
Author: @AugustoPinheiro
Created: 6/17/2025
Status: Closed

Base: masterHead: feature/pluggyai-investment-support


📝 Commits (9)

  • eccaf9f fix(CreateAccountModal.tsx): remove unnecessary console.log statements
  • a7daafa feat: Add INVESTMENT account support for Pluggy.ai integration - Add getInvestmentsByItemId method to pluggyai-service.js with fallback to direct API calls - Extend /accounts endpoint to fetch and consolidate investment data - Enhance /transactions endpoint to handle investment account transactions with UUID validation - Update frontend CreateAccountModal.tsx to correctly calculate investment balances - Add comprehensive logging for debugging investment data processing - Consolidate all investments into single account per institution showing total balance - Add proper balance conversion and number validation to prevent NaN issues - Support UUID validation for itemIds with graceful fallback for non-UUID formats This enables Brazilian users to track their complete investment portfolio through Actual Budget's Pluggy.ai integration.
  • 0b236be [autofix.ci] apply automated fixes
  • d2f5781 feat(release-notes): add support for INVESTMENT accounts in Pluggy.ai integration
  • f818d39 Merge branch 'master' into feature/pluggyai-investment-support
  • 43c0b24 refactor(app-pluggyai.js): optimize UUID validation function
  • 7593645 [autofix.ci] apply automated fixes
  • a11563e Clean up console.log statements and translate comments to English - Remove all console.log/console.error statements from Pluggy.ai integration files - Fix CodeQL security issue: externally-controlled format string - Improve code quality and production readiness
  • bcfd523 refactor(app-pluggyai.js): improve code readability by removing unused

📊 Changes

4 files changed (+0 additions, -0 deletions)

View changed files

📝 packages/desktop-client/src/components/modals/CreateAccountModal.tsx (+22 -8)
📝 packages/sync-server/src/app-pluggyai/app-pluggyai.js (+177 -15)
📝 packages/sync-server/src/app-pluggyai/pluggyai-service.js (+46 -4)
upcoming-release-notes/5184.md (+6 -0)

📄 Description

Add INVESTMENT account support for Pluggy.ai integration

Description

This PR extends Pluggy.ai integration to support INVESTMENT accounts in addition to existing BANK and CREDIT accounts. Investment accounts from Brazilian institutions are now consolidated into a single "Investimentos" account per institution, showing the total balance across all individual investments (CDBs, funds, etc.).

Key Changes

Backend (packages/sync-server/src/app-pluggyai/)

  • Added getInvestmentsByItemId method in pluggyai-service.js with fallback to direct API calls
  • Extended /accounts endpoint to fetch and consolidate investment data
  • Enhanced /transactions endpoint to handle investment account transactions with proper UUID validation
  • Added comprehensive logging for debugging investment data processing

Frontend (packages/desktop-client/src/components/modals/)

  • Updated CreateAccountModal.tsx to correctly calculate investment balances using investmentData?.totalBalance
  • Added detailed logging for debugging received data

Technical Details

  • ID Format: Investment accounts use investment-{itemId}-all format for consolidated accounts
  • Validation: Proper balance conversion and number validation to prevent NaN issues
  • UUID Support: UUID validation for itemIds with graceful fallback for non-UUID formats
  • Consolidation: Consolidated account creation that sums all individual investment balances

Result

This enables Brazilian users to track their complete investment portfolio through Actual Budget's Pluggy.ai integration.

Example Output

Before: Investment accounts were not supported

After:

✅ [Institution Name] - Investimentos
   💰 Balance: R$ XX,XXX.XX (consolidated from multiple investments)
   📈 Types: CDBs, Funds, etc.

Testing

Successfully tested with:

  • Brazilian bank investment accounts (multiple CDBs consolidated)
  • Correct balance calculations and consolidation
  • Investment transactions working
  • UUID validation working
  • Detailed debugging logs

Testing Details

From the logs, we can see successful operation:

Investments fetched for item [itemId]: [X investments]
Starting consolidation for X investments
Creating single consolidated investment account with total balance: [amount]
Final consolidated account: {
  id: 'investment-[itemId]-all',
  name: '[Institution] - Investimentos',
  balance: [consolidated_balance],
  investmentCount: X
}

Implementation Notes

  • UUID Validation: Added proper validation for Pluggy.ai itemIds with informative error messages
  • Balance Precision: Implemented proper number conversion to handle Brazilian currency formatting
  • Consolidation Logic: All investments are grouped into a single account per institution for better UX
  • Transaction Support: Full transaction history support for consolidated investment accounts
  • Error Handling: Graceful degradation when investment data is unavailable

Checklist

  • Code implemented and tested
  • Debug logging added
  • UUID validation implemented
  • Fallback for non-UUID formats
  • Changelog created (upcoming-release-notes/5184.md)
  • Error handling implemented
  • Balance consolidation working


---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/5184 **Author:** [@AugustoPinheiro](https://github.com/AugustoPinheiro) **Created:** 6/17/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/pluggyai-investment-support` --- ### 📝 Commits (9) - [`eccaf9f`](https://github.com/actualbudget/actual/commit/eccaf9f7c4188ac9791ebb83778899d88dd6b931) fix(CreateAccountModal.tsx): remove unnecessary console.log statements - [`a7daafa`](https://github.com/actualbudget/actual/commit/a7daafa8119f0701d5f9ce1158973c6f7668befd) feat: Add INVESTMENT account support for Pluggy.ai integration - Add getInvestmentsByItemId method to pluggyai-service.js with fallback to direct API calls - Extend /accounts endpoint to fetch and consolidate investment data - Enhance /transactions endpoint to handle investment account transactions with UUID validation - Update frontend CreateAccountModal.tsx to correctly calculate investment balances - Add comprehensive logging for debugging investment data processing - Consolidate all investments into single account per institution showing total balance - Add proper balance conversion and number validation to prevent NaN issues - Support UUID validation for itemIds with graceful fallback for non-UUID formats This enables Brazilian users to track their complete investment portfolio through Actual Budget's Pluggy.ai integration. - [`0b236be`](https://github.com/actualbudget/actual/commit/0b236bea2aa85699b41bb714c1dc3f67dd88a1fe) [autofix.ci] apply automated fixes - [`d2f5781`](https://github.com/actualbudget/actual/commit/d2f5781aa215a12d51edcc187f6753d6f96d3338) feat(release-notes): add support for INVESTMENT accounts in Pluggy.ai integration - [`f818d39`](https://github.com/actualbudget/actual/commit/f818d39e29abdbfd66f872217fb10e8f54768376) Merge branch 'master' into feature/pluggyai-investment-support - [`43c0b24`](https://github.com/actualbudget/actual/commit/43c0b2476f7d3795afa053ad8e69cb31419ac4a8) refactor(app-pluggyai.js): optimize UUID validation function - [`7593645`](https://github.com/actualbudget/actual/commit/7593645ee9453cff918eb2fd0774eb5312b316a1) [autofix.ci] apply automated fixes - [`a11563e`](https://github.com/actualbudget/actual/commit/a11563ed84f5e9ed7e2ee1e34778556f2863aeea) Clean up console.log statements and translate comments to English - Remove all console.log/console.error statements from Pluggy.ai integration files - Fix CodeQL security issue: externally-controlled format string - Improve code quality and production readiness - [`bcfd523`](https://github.com/actualbudget/actual/commit/bcfd523b228c4bfd75d06a4c4f3994ce5a89cda3) refactor(app-pluggyai.js): improve code readability by removing unused ### 📊 Changes **4 files changed** (+0 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/modals/CreateAccountModal.tsx` (+22 -8) 📝 `packages/sync-server/src/app-pluggyai/app-pluggyai.js` (+177 -15) 📝 `packages/sync-server/src/app-pluggyai/pluggyai-service.js` (+46 -4) ➕ `upcoming-release-notes/5184.md` (+6 -0) </details> ### 📄 Description # Add INVESTMENT account support for Pluggy.ai integration ## Description This PR extends Pluggy.ai integration to support **INVESTMENT** accounts in addition to existing BANK and CREDIT accounts. Investment accounts from Brazilian institutions are now consolidated into a single "Investimentos" account per institution, showing the total balance across all individual investments (CDBs, funds, etc.). ## Key Changes ### Backend (`packages/sync-server/src/app-pluggyai/`) - Added `getInvestmentsByItemId` method in `pluggyai-service.js` with fallback to direct API calls - Extended `/accounts` endpoint to fetch and consolidate investment data - Enhanced `/transactions` endpoint to handle investment account transactions with proper UUID validation - Added comprehensive logging for debugging investment data processing ### Frontend (`packages/desktop-client/src/components/modals/`) - Updated `CreateAccountModal.tsx` to correctly calculate investment balances using `investmentData?.totalBalance` - Added detailed logging for debugging received data ## Technical Details - **ID Format**: Investment accounts use `investment-{itemId}-all` format for consolidated accounts - **Validation**: Proper balance conversion and number validation to prevent NaN issues - **UUID Support**: UUID validation for itemIds with graceful fallback for non-UUID formats - **Consolidation**: Consolidated account creation that sums all individual investment balances ## Result This enables Brazilian users to track their complete investment portfolio through Actual Budget's Pluggy.ai integration. ## Example Output **Before**: Investment accounts were not supported **After**: ``` ✅ [Institution Name] - Investimentos 💰 Balance: R$ XX,XXX.XX (consolidated from multiple investments) 📈 Types: CDBs, Funds, etc. ``` ## Testing Successfully tested with: - Brazilian bank investment accounts (multiple CDBs consolidated) - Correct balance calculations and consolidation - Investment transactions working - UUID validation working - Detailed debugging logs ### Testing Details From the logs, we can see successful operation: ``` Investments fetched for item [itemId]: [X investments] Starting consolidation for X investments Creating single consolidated investment account with total balance: [amount] Final consolidated account: { id: 'investment-[itemId]-all', name: '[Institution] - Investimentos', balance: [consolidated_balance], investmentCount: X } ``` ## Implementation Notes - **UUID Validation**: Added proper validation for Pluggy.ai itemIds with informative error messages - **Balance Precision**: Implemented proper number conversion to handle Brazilian currency formatting - **Consolidation Logic**: All investments are grouped into a single account per institution for better UX - **Transaction Support**: Full transaction history support for consolidated investment accounts - **Error Handling**: Graceful degradation when investment data is unavailable ## Checklist - [x] Code implemented and tested - [x] Debug logging added - [x] UUID validation implemented - [x] Fallback for non-UUID formats - [x] Changelog created (`upcoming-release-notes/5184.md`) - [x] Error handling implemented - [x] Balance consolidation working ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 21:18:53 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#5802