summaryrefslogtreecommitdiffstats
path: root/app/Import/Ing
diff options
context:
space:
mode:
Diffstat (limited to 'app/Import/Ing')
-rw-r--r--app/Import/Ing/SavingsAccountCsv.hs32
1 files changed, 16 insertions, 16 deletions
diff --git a/app/Import/Ing/SavingsAccountCsv.hs b/app/Import/Ing/SavingsAccountCsv.hs
index f6632fc..3f2e5e6 100644
--- a/app/Import/Ing/SavingsAccountCsv.hs
+++ b/app/Import/Ing/SavingsAccountCsv.hs
@@ -121,26 +121,26 @@ mutationTypeCP "Opname" = return WithdrawalMutation
121mutationTypeCP "Rente" = return InterestMutation 121mutationTypeCP "Rente" = return InterestMutation
122mutationTypeCP t = fail ("Unknown mutation type '" ++ T.unpack t ++ "'") 122mutationTypeCP t = fail ("Unknown mutation type '" ++ T.unpack t ++ "'")
123 123
124parseNamedRecord :: C.NamedRecord -> C.Parser Tx 124instance C.FromNamedRecord Tx where
125parseNamedRecord m = 125 parseNamedRecord m =
126 eitherToCP . processPrimTx 126 eitherToCP . processPrimTx
127 =<< PrimTx 127 =<< PrimTx
128 <$> (m .: "Datum" >>= dateCP "%Y-%m-%d") 128 <$> (m .: "Datum" >>= dateCP "%Y-%m-%d")
129 <*> m .: "Omschrijving" 129 <*> m .: "Omschrijving"
130 <*> m .: "Rekening" 130 <*> m .: "Rekening"
131 <*> m .: "Rekening naam" 131 <*> m .: "Rekening naam"
132 <*> (m .: "Tegenrekening" >>= maybeCP ibanCP) 132 <*> (m .: "Tegenrekening" >>= maybeCP ibanCP)
133 <*> (m .: "Af Bij" >>= debitCreditCP) 133 <*> (m .: "Af Bij" >>= debitCreditCP)
134 <*> (m .: "Bedrag" >>= decimalCP) 134 <*> (m .: "Bedrag" >>= decimalCP)
135 <*> m .: "Valuta" 135 <*> m .: "Valuta"
136 <*> (m .: "Mutatiesoort" >>= mutationTypeCP) 136 <*> (m .: "Mutatiesoort" >>= mutationTypeCP)
137 <*> m .: "Mededelingen" 137 <*> m .: "Mededelingen"
138 <*> (m .: "Saldo na mutatie" >>= decimalCP) 138 <*> (m .: "Saldo na mutatie" >>= decimalCP)
139 139
140readFile :: Handle -> IO (V.Vector Tx) 140readFile :: Handle -> IO (V.Vector Tx)
141readFile h = do 141readFile h = do
142 contents <- BS.hGetContents h 142 contents <- BS.hGetContents h
143 case C.decodeByNameWithP parseNamedRecord scsvOptions contents of 143 case C.decodeByNameWith scsvOptions contents of
144 Left err -> fail err 144 Left err -> fail err
145 Right 145 Right
146 ( [ "Datum", 146 ( [ "Datum",