@@ -70,16 +70,24 @@ def moneyMovement(self, row: Transaction):
70
70
>>> str(t.year(2018).fee)
71
71
"{'eur': -35.02348938927588, 'usd': -43.24}"
72
72
73
- # deposit
74
- >>> t.moneyMovement(t.history.iloc[262])
75
- >>> str(t.year(2019).deposit)
76
- "{'eur': 0.009070294784580499, 'usd': 0.01}"
77
-
78
73
# credit interest
79
- >>> t.moneyMovement(t.history.iloc[8])
74
+ >>> credit_interest_transaction = Transaction.fromString("12/16/2020 11:00 PM,Money Movement,Credit Interest,,,,0,,,,,0.000,0.030,INTEREST ON CREDIT BALANCE,Individual...39")
75
+ >>> t.moneyMovement(credit_interest_transaction)
80
76
>>> str(t.year(2020).creditInterest)
81
77
"{'eur': 0.02461235540241201, 'usd': 0.03}"
82
78
79
+ # credit interest but through deposit
80
+ >>> deposit_transaction = Transaction.fromString("10/16/2019 11:00 PM,Money Movement,Deposit,,,,0,,,,,0.000,0.010,INTEREST ON CREDIT BALANCE,Individual...39")
81
+ >>> t.moneyMovement(deposit_transaction)
82
+ >>> str(t.year(2019).creditInterest)
83
+ "{'eur': 0.009070294784580499, 'usd': 0.01}"
84
+
85
+ # Test for general deposit
86
+ >>> deposit_transaction = Transaction.fromString("03/07/2024 8:03 PM,Money Movement,Deposit,,,,0,,,,,0.00,1000.00,DEPOSIT,Individual...39")
87
+ >>> t.moneyMovement(deposit_transaction)
88
+ >>> str(t.year(2024).deposit)
89
+ "{'eur': 917.8522257916476, 'usd': 1000.0}"
90
+
83
91
# debit interest
84
92
>>> t = Tasty("test/merged2.csv")
85
93
>>> t.moneyMovement(t.history.iloc[48])
@@ -115,17 +123,20 @@ def moneyMovement(self, row: Transaction):
115
123
self .year (t .getYear ()).balanceAdjustment += m
116
124
elif t .loc ["Transaction Subcode" ] == "Fee" :
117
125
self .year (t .getYear ()).fee += m
118
- elif t .loc ["Transaction Subcode" ] == "Deposit" and t .loc ["Description" ] == "INTEREST ON CREDIT BALANCE" :
119
- self .year (t .getYear ()).deposit += m
126
+ elif t .loc ["Transaction Subcode" ] == "Deposit" :
127
+ if t .loc ["Description" ] == "INTEREST ON CREDIT BALANCE" :
128
+ self .year (t .getYear ()).creditInterest += m
129
+ else :
130
+ self .year (t .getYear ()).deposit += m
120
131
elif t .loc ["Transaction Subcode" ] == "Credit Interest" :
121
132
self .year (t .getYear ()).creditInterest += m
122
133
elif t .loc ["Transaction Subcode" ] == "Debit Interest" :
123
134
self .year (t .getYear ()).debitInterest += m
124
135
elif t .loc ["Transaction Subcode" ] == "Dividend" :
125
136
self .year (t .getYear ()).dividend += m
126
137
else :
127
- raise KeyError ("Found unknown money movement subcode: '{}'" . format (
128
- t .loc [" Transaction Subcode" ]) )
138
+ raise KeyError (
139
+ f"Found unknown money movement subcode: ' { t .loc [' Transaction Subcode' ] } '" )
129
140
130
141
def receiveDelivery (self , row ):
131
142
""" sub function to process the column namend "Receive Deliver" in the csv file
0 commit comments