Skip to content

Commit 5e9144e

Browse files
author
Ralf Waldukat
committed
fixed credit
1 parent 90d1a30 commit 5e9144e

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

tastyworksTaxes/tasty.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,24 @@ def moneyMovement(self, row: Transaction):
7070
>>> str(t.year(2018).fee)
7171
"{'eur': -35.02348938927588, 'usd': -43.24}"
7272
73-
# deposit
74-
>>> t.moneyMovement(t.history.iloc[262])
75-
>>> str(t.year(2019).deposit)
76-
"{'eur': 0.009070294784580499, 'usd': 0.01}"
77-
7873
# 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)
8076
>>> str(t.year(2020).creditInterest)
8177
"{'eur': 0.02461235540241201, 'usd': 0.03}"
8278
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+
8391
# debit interest
8492
>>> t = Tasty("test/merged2.csv")
8593
>>> t.moneyMovement(t.history.iloc[48])
@@ -115,17 +123,20 @@ def moneyMovement(self, row: Transaction):
115123
self.year(t.getYear()).balanceAdjustment += m
116124
elif t.loc["Transaction Subcode"] == "Fee":
117125
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
120131
elif t.loc["Transaction Subcode"] == "Credit Interest":
121132
self.year(t.getYear()).creditInterest += m
122133
elif t.loc["Transaction Subcode"] == "Debit Interest":
123134
self.year(t.getYear()).debitInterest += m
124135
elif t.loc["Transaction Subcode"] == "Dividend":
125136
self.year(t.getYear()).dividend += m
126137
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']}'")
129140

130141
def receiveDelivery(self, row):
131142
""" sub function to process the column namend "Receive Deliver" in the csv file

0 commit comments

Comments
 (0)