From 39198db642f369e7bf86a9d263c9d7c64392fbe7 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Fri, 16 May 2025 09:16:28 +1000 Subject: [PATCH] Switch bank account from First Republic to Citizens --- README.md | 3 +-- TODO.md | 1 + manifest.scm | 1 + src/import.clj | 10 +++++----- test/import_test.clj | 14 +++++++------- test/parse_test.clj | 4 ++-- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 842d6a9..57b6e84 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,7 @@ later. If you prefer, you can provide any/all of these explicitly: You can test the output in Beancount by adding the following header entries to define the accounts: - 2023-01-01 open Assets:FR:Check2721 - 2023-01-01 open Assets:FR:Check1345 + 2023-01-01 open Assets:Citizens:Check1273 2023-01-01 open Expenses:Payroll:Salary 2023-01-01 open Expenses:Payroll:Fees 2023-01-01 open Expenses:Payroll:Tax diff --git a/TODO.md b/TODO.md index cd2148d..ac76ed7 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # To-do +* Avoid hard-coding the bank account * Add validation/error handling of required CLI arguments such as csv, date and period * Potentially move employee-name->entity-tag into config * Potentially move cat->payroll-type into config diff --git a/manifest.scm b/manifest.scm index e258fa9..e440576 100644 --- a/manifest.scm +++ b/manifest.scm @@ -8,5 +8,6 @@ "openjdk@21" ;; Works fine with clojure-tools from Guix. "clojure-tools" + "clj-kondo" "beancount" )) diff --git a/src/import.clj b/src/import.clj index ac70da9..23ebf94 100644 --- a/src/import.clj +++ b/src/import.clj @@ -278,7 +278,7 @@ {:account "Expenses:Payroll:Fees" :amount fee :currency "USD" :meta (assoc-project projects name {:entity name})}) - asset-postings [{:account "Assets:FR:Check2721" + asset-postings [{:account "Assets:Citizens:Check1273" :amount (- total-fees) :currency "USD"}] all-postings (concat expense-postings asset-postings)] [(assoc template :postings all-postings)])) @@ -300,7 +300,7 @@ :amount total-retirement :currency "USD" :meta {:entity name}})) total-liabilities (total liability-postings) - asset-postings [{:account "Assets:FR:Check1345" + asset-postings [{:account "Assets:Citizens:Check1273" :amount (- total-liabilities) :currency "USD"}] all-postings (concat liability-postings asset-postings)] [(assoc template :postings all-postings)])) @@ -329,10 +329,10 @@ :meta (assoc-project projects name {:entity name})}]))) total-net-pay (total-by-type "Net Pay" records) total-reimbursements (total-by-type "Reimbursement" records) - total-net-pay-posting {:account "Assets:FR:Check2721" + total-net-pay-posting {:account "Assets:Citizens:Check1273" :amount (- (- total-net-pay total-reimbursements)) :currency "USD" :meta {:entity "Paychex" :tax-implication "W2"}} - total-reimbursements-posting {:account "Assets:FR:Check2721" + total-reimbursements-posting {:account "Assets:Citizens:Check1273" :amount (- total-reimbursements) :currency "USD" :meta {:entity "Paychex" :tax-implication "Reimbursement"}} all-postings (concat employee-postings [total-net-pay-posting total-reimbursements-posting])] @@ -372,7 +372,7 @@ {:account "Liabilities:Payable:Accounts" :amount (- (total insurance-records)) :currency "USD" :meta (assoc-project projects name {:entity name})}]))) - asset-postings [{:account "Assets:FR:Check2721" + asset-postings [{:account "Assets:Citizens:Check1273" :amount (- (+ total-liabilities total-unemploy (total withholding-liability-postings))) :currency "USD" :meta {:entity "Paychex" :tax-implication "Tax-Payment"}}] all-postings (concat withholding-liability-postings liability-postings asset-postings)] diff --git a/test/import_test.clj b/test/import_test.clj index a6c8d79..bc04462 100644 --- a/test/import_test.clj +++ b/test/import_test.clj @@ -246,7 +246,7 @@ :amount 103.25M :currency "USD" :meta {:entity "Citizen-Jill"}} - {:account "Assets:FR:Check2721" :amount -206.51 :currency "USD"})}]] + {:account "Assets:Citizens:Check1273" :amount -206.51 :currency "USD"})}]] (is (= actual expected)))) (deftest retirement @@ -272,7 +272,7 @@ :amount 820M :currency "USD" :meta {:entity "Citizen-Jill"}} - {:account "Assets:FR:Check1345" :amount -1820M :currency "USD"})}]] + {:account "Assets:Citizens:Check1273" :amount -1820M :currency "USD"})}]] (is (= actual expected)))) (deftest net-pay-ach-debit @@ -303,11 +303,11 @@ :amount 50M :currency "USD" :meta {:entity "Citizen-Jill"}} - {:account "Assets:FR:Check2721" + {:account "Assets:Citizens:Check1273" :amount -8481.88M :currency "USD" :meta {:entity "Paychex" :tax-implication "W2"}} - {:account "Assets:FR:Check2721" + {:account "Assets:Citizens:Check1273" :amount -100M :currency "USD" :meta {:entity "Paychex" :tax-implication "Reimbursement"}}]}]] @@ -343,7 +343,7 @@ :amount 988.08M :currency "USD" :meta {:entity "Paychex"}} - {:account "Assets:FR:Check2721" + {:account "Assets:Citizens:Check1273" :amount -3602.31M :currency "USD" :meta {:entity "Paychex" :tax-implication "Tax-Payment"}}]}]] @@ -370,7 +370,7 @@ :amount 103.25M :currency "USD" :meta {:entity "Citizen-Jill"}} - {:account "Assets:FR:Check2721" :amount -206.51M :currency "USD"})} + {:account "Assets:Citizens:Check1273" :amount -206.51M :currency "USD"})} actual (import/render-transaction transaction) expected (str/triml " DATE txn \"Paychex\" \"Monthly Payroll - PERIOD - Fee\" @@ -384,7 +384,7 @@ DATE txn \"Paychex\" \"Monthly Payroll - PERIOD - Fee\" entity: \"Citizen-Jack\" Expenses:Payroll:Fees 103.25 USD entity: \"Citizen-Jill\" - Assets:FR:Check2721 -206.51 USD + Assets:Citizens:Check1273 -206.51 USD ")] (is (= actual expected)))) diff --git a/test/parse_test.clj b/test/parse_test.clj index c41d20b..f36c0c2 100644 --- a/test/parse_test.clj +++ b/test/parse_test.clj @@ -16,7 +16,7 @@ DATE txn \"Paychex\" \"Monthly Payroll - PERIOD - Fee\" entity: \"Citizen-Jack\" Expenses:Payroll:Fees 103.25 USD entity: \"Citizen-Jill\" - Assets:FR:Check2721 -206.51 USD + Assets:Citizens:Check1273 -206.51 USD ") expected '[{:date "DATE" :payee "Paychex" @@ -38,5 +38,5 @@ DATE txn \"Paychex\" \"Monthly Payroll - PERIOD - Fee\" :amount 103.25M :currency "USD" :meta {:entity "Citizen-Jill"}} - {:account "Assets:FR:Check2721" :amount -206.51M :currency "USD"})}]] + {:account "Assets:Citizens:Check1273" :amount -206.51M :currency "USD"})}]] (is (= (parse/parse transaction) expected))))