Skip to content

Add PayPal debit CSV template with tests#44

Merged
ydeng11 merged 2 commits intomainfrom
feature/paypal-debit-csv-template
Dec 24, 2025
Merged

Add PayPal debit CSV template with tests#44
ydeng11 merged 2 commits intomainfrom
feature/paypal-debit-csv-template

Conversation

@ydeng11
Copy link
Owner

@ydeng11 ydeng11 commented Dec 17, 2025

Summary

This PR adds support for importing PayPal transaction history CSV files.

Changes

  • Added PAYPAL to BankAccountPair.BankName enum - Enables PayPal as a supported bank
  • Created PayPalDebitCsvTemplate - New CSV template class that:
    • Parses PayPal transaction history CSV format
    • Filters to only completed transactions (pending/denied are excluded)
    • Inverts amount signs (deposits become negative, expenses become positive) for balance tracking
    • Maps all CSV fields including Name, Type, Status, Transaction ID, etc.

Tests

Added comprehensive test suite in BankAccountCsvFactoryImplTest.PayPalDebitTests:

  • parsesTransactionsCorrectly() - Verifies transaction parsing, amount inversion, and field mapping
  • filtersOutPendingTransactions() - Ensures only completed transactions are processed
  • invertsAmountSignsCorrectly() - Validates deposit/expense sign inversion logic

Test Data

  • Added paypal_balance_debit.csv test file with sample PayPal transactions

Notes

  • Amount signs are inverted to track balance where deposits reduce balance and expenses increase balance
  • Only transactions with status "Completed" are processed
  • Follows the same pattern as other CSV templates in the codebase

- Add PAYPAL to BankAccountPair.BankName enum
- Create PayPalDebitCsvTemplate to parse PayPal transaction history
- Add comprehensive tests verifying:
  * Only completed transactions are processed (pending/denied filtered out)
  * Amount signs are inverted correctly (deposits negative, expenses positive)
  * Transaction parsing and mapping works correctly
- Add test CSV file: paypal_balance_debit.csv
- Add normalizeAmount() to invert amount signs (deposits negative, expenses positive)
- Add validate() to filter out non-completed transactions (pending/denied)
- Fixes test failures for sign inversion and pending transaction filtering
@ydeng11 ydeng11 merged commit ab6d87c into main Dec 24, 2025
3 checks passed
@ydeng11 ydeng11 deleted the feature/paypal-debit-csv-template branch December 24, 2025 06:30
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