Skip to content

Conversation

@olegbonar
Copy link
Contributor

@olegbonar olegbonar commented Jan 23, 2026

Fixes errors while synchronization like [TSZ] Wrong transaction ODIwNDAyOTEzOjA6MTc2MDA0MDAwMDAwMA==. Transaction should have either income > 0 or outcome > 0
Now consider interestedAmount and withdrawnDepositAmount from DepositStatementV2, too

Add test cases for deposit statements that properly handle:
- Interest payouts (interestedAmount)
- Withdrawals (withdrawnDepositAmount)
- Combined deposits and interest
- Regular deposits

These tests currently fail because convertStatementV2 only uses
depositAmount and ignores interestedAmount and withdrawnDepositAmount,
causing transactions with sum=0 when depositAmount=0.
…drawals

Fix convertStatementV2 to properly handle all deposit statement types:
- Interest payouts (interestedAmount)
- Withdrawals (withdrawnDepositAmount)
- Regular deposits (depositAmount)

Based on observed API behavior, only one field is non-zero at a time
(mutually exclusive), so use if/else logic. Add descriptive comments
to help ZenMoney categorize transactions.

Previously only depositAmount was used, causing transactions with sum=0
when interest was paid out (depositAmount=0, interestedAmount>0), which
resulted in "Wrong transaction. Transaction should have either income > 0
or outcome > 0" errors.
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