diff options
author | Rutger Broekhoff | 2025-03-21 09:45:22 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2025-03-21 09:45:22 +0100 |
commit | e40e290ef216656d304f4f3095dbef223e94191d (patch) | |
tree | 925951d353ac81e122a8d34683ae7b7093930f44 /app/Import/Ing/SavingsAccountCsv.hs | |
parent | 86c8896ee69b068368b4ef9a4c3923285907c328 (diff) | |
download | rdcapsis-e40e290ef216656d304f4f3095dbef223e94191d.tar.gz rdcapsis-e40e290ef216656d304f4f3095dbef223e94191d.zip |
Changes
Diffstat (limited to 'app/Import/Ing/SavingsAccountCsv.hs')
-rw-r--r-- | app/Import/Ing/SavingsAccountCsv.hs | 32 |
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 | |||
121 | mutationTypeCP "Rente" = return InterestMutation | 121 | mutationTypeCP "Rente" = return InterestMutation |
122 | mutationTypeCP t = fail ("Unknown mutation type '" ++ T.unpack t ++ "'") | 122 | mutationTypeCP t = fail ("Unknown mutation type '" ++ T.unpack t ++ "'") |
123 | 123 | ||
124 | parseNamedRecord :: C.NamedRecord -> C.Parser Tx | 124 | instance C.FromNamedRecord Tx where |
125 | parseNamedRecord 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 | ||
140 | readFile :: Handle -> IO (V.Vector Tx) | 140 | readFile :: Handle -> IO (V.Vector Tx) |
141 | readFile h = do | 141 | readFile 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", |