Load latest checked transaction.
This commit is contained in:
parent
0dd621c30f
commit
dc49fcc9a0
1 changed files with 15 additions and 1 deletions
|
@ -117,12 +117,26 @@
|
|||
(bank-fio-parse (make-pathname dir (string-append acc ".csv"))))
|
||||
accounts-list))
|
||||
|
||||
;; Reads single number from given file and returns it. If no number
|
||||
;; is and/or the file does not exist, returns #f.
|
||||
(define (get-latest-checked-id file-name)
|
||||
(call/cc
|
||||
(lambda (ret)
|
||||
(with-exception-handler
|
||||
(lambda (ex)
|
||||
(ret #f))
|
||||
(lambda ()
|
||||
(with-input-from-file file-name
|
||||
(lambda ()
|
||||
(number->string (read-line)))))))))
|
||||
|
||||
;; If apikeys is not #f, loads the account numbers, loads bank
|
||||
;; accounts and processes transactions.
|
||||
(define (members-payments-process mb apikeys-file dir checked-fn)
|
||||
(if apikeys-file
|
||||
(let* ((acc-list (load-accounts-list apikeys-file))
|
||||
(accounts (if acc-list (load-accounts acc-list dir) #f)))
|
||||
(accounts (if acc-list (load-accounts acc-list dir) #f))
|
||||
(last-checked (get-latest-checked-id checked-fn)))
|
||||
(if accounts
|
||||
(let ((mbp (foldl members-payments-process-bank
|
||||
mb
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue