diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-02-01 21:50:55 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-02-01 21:50:55 +0100 |
commit | 3a7e57b0a475da4ceaca7c6f3bca96155c67a012 (patch) | |
tree | d2c105e644096cf457138303a101f01924fcab17 | |
parent | 6579727041faacd0d69a7f71bb551315561a1117 (diff) |
komplett: Consider description field
-rw-r--r-- | record/komplett/komplett.go | 4 | ||||
-rw-r--r-- | record/komplett/komplett_test.go | 1 | ||||
-rw-r--r-- | record/komplett/testdata/test.json | 22 |
3 files changed, 27 insertions, 0 deletions
diff --git a/record/komplett/komplett.go b/record/komplett/komplett.go index a95363c..d93c9de 100644 --- a/record/komplett/komplett.go +++ b/record/komplett/komplett.go @@ -32,6 +32,7 @@ type jsonRecord struct { Amount2 jsonAmount `json:"FormattedAmount"` Text1 string `json:"DisplayDescription"` Text2 string `json:"MerchantName"` + Text3 string `json:"Description"` } func (t *jsonTime) UnmarshalJSON(data []byte) error { @@ -91,6 +92,9 @@ func (r *Reader) Read() ([]record.Record, error) { if text == "" { text = jr.Text2 } + if text == "" { + text = jr.Text3 + } rs = append(rs, record.Record{ Time: txTime, Text: text, diff --git a/record/komplett/komplett_test.go b/record/komplett/komplett_test.go index 5193e60..29fdbcc 100644 --- a/record/komplett/komplett_test.go +++ b/record/komplett/komplett_test.go @@ -81,6 +81,7 @@ func TestRead(t *testing.T) { {date(2020, 12, 14), "Varekjøp", -9900}, {date(2020, 12, 28), "Varekjøp (5,00 EUR / Kurs 10,74000)", -5370}, {date(2022, 2, 1), "Varekjøp 2", -29601}, + {date(2022, 1, 15), "Varekjøp 3", -133701}, } if len(rs) != len(tests) { t.Fatalf("want %d records, got %d", len(tests), len(rs)) diff --git a/record/komplett/testdata/test.json b/record/komplett/testdata/test.json index 0350e64..93a7b1f 100644 --- a/record/komplett/testdata/test.json +++ b/record/komplett/testdata/test.json @@ -80,5 +80,27 @@ "TransactionRef": "ref", "TransactionDate": "01.02.2022", "TransactionDateRaw": "2/1/2022" + }, + { + "TransactionId": "42", + "TransactionType": 79, + "IsReserved": true, + "DeferPaymentUrl": null, + "IsDeferred": false, + "CanDefer": false, + "BookingDate": null, + "RecipientAccountNr": null, + "ExchangeRate": null, + "DeferTransactionInfo": null, + "OriginalTransactionInfo": null, + "Amount": "1337,01 NOK", + "AmountCurrency": "NOK", + "BillingAmount": "-kr 1337,01", + "BillingAmountCurrency": "NOK", + "MerchantName": null, + "Description": "Varekjøp 3", + "TransactionRef": "ref", + "TransactionDate": "15.01.2022", + "TransactionDateRaw": "1/15/2022" } ] |