From e7d65af67a867630737f115a60b38f9b8a3cbb7a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 18 Nov 2021 18:35:46 +0100 Subject: [PATCH] Import transactions as cleared --- ofx_processor/utils/ynab.py | 1 + pyproject.toml | 2 +- tests/samples/bpvf_transactions.json | 51 ++++++++++++++++--------- tests/samples/ce_transactions.json | 18 ++++++--- tests/samples/lcl_transactions.json | 9 +++-- tests/samples/revolut_transactions.json | 30 ++++++++++----- 6 files changed, 74 insertions(+), 37 deletions(-) diff --git a/ofx_processor/utils/ynab.py b/ofx_processor/utils/ynab.py index 1c18f71..a17d570 100644 --- a/ofx_processor/utils/ynab.py +++ b/ofx_processor/utils/ynab.py @@ -70,6 +70,7 @@ def push_transactions(transactions, account): url = f"{BASE_URL}/budgets/{budget_id}/transactions" for transaction in transactions: transaction["account_id"] = account + transaction["cleared"] = "cleared" data = {"transactions": transactions} headers = {"Authorization": f"Bearer {token}"} diff --git a/pyproject.toml b/pyproject.toml index f70d235..2474e30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ofx-processor" -version = "2.1.4" +version = "2.2.0" description = "Personal ofx processor" readme = "README.md" license = "GPL-3.0-or-later" diff --git a/tests/samples/bpvf_transactions.json b/tests/samples/bpvf_transactions.json index 7f98e5b..0c53caf 100644 --- a/tests/samples/bpvf_transactions.json +++ b/tests/samples/bpvf_transactions.json @@ -6,7 +6,8 @@ "payee_name": "PRLV SEPA Company 3", "memo": "123456789 PAYPAL 542UHBON", "import_id": "YNAB:-9660:2020-02-26:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-25", @@ -14,7 +15,8 @@ "payee_name": "H.I.K 69VILLEURBANNE", "memo": "240220 CB****5555", "import_id": "YNAB:-2400:2020-02-25:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-25", @@ -22,7 +24,8 @@ "payee_name": "DELIVEROO FR WWW", "memo": "230220 CB****5555 39,20EUR 1 EURO = 1,000000", "import_id": "YNAB:-39200:2020-02-25:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-25", @@ -30,7 +33,8 @@ "payee_name": "PRLV SEPA Company 1", "memo": "Votre abonnement mobile: 06XXXXX 6498165189060897", "import_id": "YNAB:-9990:2020-02-25:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -38,7 +42,8 @@ "payee_name": "COMPANY FR LYON 6EME", "memo": "210220 CB****5555 7,50EUR 1 EURO = 1,000000", "import_id": "YNAB:-7500:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -46,7 +51,8 @@ "payee_name": "PRLV SEPA Company 2", "memo": "24-02-2020 / 22-03-2020 56418710", "import_id": "YNAB:-34990:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -54,7 +60,8 @@ "payee_name": "VIR Person 1", "memo": "481840871 Splitwise", "import_id": "YNAB:-2390:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-20", @@ -62,7 +69,8 @@ "payee_name": "VIREMENT Person 2", "memo": "Cadeau", "import_id": "YNAB:235000:2020-02-20:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-20", @@ -70,7 +78,8 @@ "payee_name": "VIREMENT Company 3", "memo": "48716508719", "import_id": "YNAB:55000:2020-02-20:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-19", @@ -78,7 +87,8 @@ "payee_name": "BDE INSA LYON 69VILLEURBANNE", "memo": "170220 CB****5555", "import_id": "YNAB:-55000:2020-02-19:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-19", @@ -86,7 +96,8 @@ "payee_name": "GUY AND SONS FR LYON", "memo": "180220 CB****5555 0,90EUR 1 EURO = 1,000000", "import_id": "YNAB:-900:2020-02-19:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-19", @@ -94,7 +105,8 @@ "payee_name": "GUY AND SONS FR LYON", "memo": "170220 CB****5555 1,40EUR 1 EURO = 1,000000", "import_id": "YNAB:-1400:2020-02-19:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-19", @@ -102,7 +114,8 @@ "payee_name": "VIR Person 1", "memo": "65187460 Acompte cuisine 2", "import_id": "YNAB:-473500:2020-02-19:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-18", @@ -110,7 +123,8 @@ "payee_name": "PRLV SEPA Company 4", "memo": "487105874 Amazon.fr 3X QC.(OJBIYN:ZOFEUBZF51871", "import_id": "YNAB:-96960:2020-02-18:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-17", @@ -118,7 +132,8 @@ "payee_name": "GRAND PARC PUY 85LES EPESSES", "memo": "150220 CB****5555", "import_id": "YNAB:-232000:2020-02-17:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-17", @@ -126,7 +141,8 @@ "payee_name": "UBER BV NL HELP.UBER.CO", "memo": "140220 CB****5555 1,00EUR 1 EURO = 1,000000", "import_id": "YNAB:-1000:2020-02-17:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-17", @@ -134,7 +150,8 @@ "payee_name": "VIREMENT Person 5", "memo": "VIREMENT DE PERSON 6", "import_id": "YNAB:8600:2020-02-17:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" } ] } \ No newline at end of file diff --git a/tests/samples/ce_transactions.json b/tests/samples/ce_transactions.json index dccf86b..ea1d2de 100644 --- a/tests/samples/ce_transactions.json +++ b/tests/samples/ce_transactions.json @@ -6,7 +6,8 @@ "payee_name": "CB DECATHLON", "memo": "FACT 240220", "import_id": "YNAB:-21000:2020-02-25:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-25", @@ -14,7 +15,8 @@ "payee_name": "PRLV COMPANY", "memo": "Company Ref Prlvt SEPA 99-1KIBHEF-01 45871984", "import_id": "YNAB:-7000:2020-02-25:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -22,7 +24,8 @@ "payee_name": "CB 3403 MONOP", "memo": "FACT 210220", "import_id": "YNAB:-48130:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -30,7 +33,8 @@ "payee_name": "CB MALATIER", "memo": "FACT 210220", "import_id": "YNAB:-1200:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -38,7 +42,8 @@ "payee_name": "VIR SEPA PERSON 1", "memo": "_", "import_id": "YNAB:2390:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-02-24", @@ -46,7 +51,8 @@ "payee_name": "VIR SEPA PERSON 2", "memo": "_", "import_id": "YNAB:14490:2020-02-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" } ] } \ No newline at end of file diff --git a/tests/samples/lcl_transactions.json b/tests/samples/lcl_transactions.json index 8a151d7..526a2fe 100644 --- a/tests/samples/lcl_transactions.json +++ b/tests/samples/lcl_transactions.json @@ -6,7 +6,8 @@ "payee_name": "VIR INST M PAYEE 1", "memo": null, "import_id": "YNAB:1000000:2020-03-12:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-07-17", @@ -14,7 +15,8 @@ "payee_name": "CB IKEA", "memo": null, "import_id": "YNAB:-400450:2020-07-17:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-07-21", @@ -22,7 +24,8 @@ "payee_name": "CHQ", "memo": "CHQ 1234567", "import_id": "YNAB:-42000:2020-07-21:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" } ] } \ No newline at end of file diff --git a/tests/samples/revolut_transactions.json b/tests/samples/revolut_transactions.json index 761d800..6c80dbb 100644 --- a/tests/samples/revolut_transactions.json +++ b/tests/samples/revolut_transactions.json @@ -6,7 +6,8 @@ "payee_name": "Virement de NAME", "memo": "Transferts", "import_id": "YNAB:1500000:2021-08-30:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-29", @@ -14,7 +15,8 @@ "payee_name": "To Person 1", "memo": "Transfers", "import_id": "YNAB:-53630:2020-01-29:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-29", @@ -22,7 +24,8 @@ "payee_name": "To Person 2", "memo": "Transfers", "import_id": "YNAB:-900:2020-01-29:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-29", @@ -30,7 +33,8 @@ "payee_name": "Refund from Company 2", "memo": "Shopping", "import_id": "YNAB:53630:2020-01-29:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-24", @@ -38,7 +42,8 @@ "payee_name": "To Person 3", "memo": "Transfers", "import_id": "YNAB:-8500:2020-01-24:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-16", @@ -46,7 +51,8 @@ "payee_name": "To Person 4", "memo": "Transfers", "import_id": "YNAB:-1400:2020-01-16:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-10", @@ -54,7 +60,8 @@ "payee_name": "To Person 5", "memo": "Transfers", "import_id": "YNAB:-2009:2020-01-10:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-10", @@ -62,7 +69,8 @@ "payee_name": "To Person 6", "memo": "Transfers", "import_id": "YNAB:-1210:2020-01-10:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-05", @@ -70,7 +78,8 @@ "payee_name": "Company 1", "memo": "Shopping - FX-rate €1 = US$1,1158", "import_id": "YNAB:-123680:2020-01-05:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" }, { "date": "2020-01-04", @@ -78,7 +87,8 @@ "payee_name": "Top-up via Apple Pay", "memo": "General", "import_id": "YNAB:100000:2020-01-04:1", - "account_id": "" + "account_id": "", + "cleared": "cleared" } ] } \ No newline at end of file