Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement writing TR card transactions into CSV file #36

Open
dhojayev opened this issue Jun 16, 2024 · 9 comments · May be fixed by #48
Open

Implement writing TR card transactions into CSV file #36

dhojayev opened this issue Jun 16, 2024 · 9 comments · May be fixed by #48
Labels
enhancement New feature or request idea nice to have things new feature New features that are worth implementing

Comments

@dhojayev
Copy link
Owner

After a discussion with @martinAtGitHub we agreed that we will add writing card transactions into CSV file. Whether it is a separate of the same CSV file is to be decided. Conversation is attached below for reference:

          > If that helps I can implement including those transactions optionally. But there are a few questions that would be good to clarify from the very beginning:
* Shall we include those transactions in the same csv file?
* If yes - shall we simply write them under the "credit" and "debit" columns?

I would take the option that causes the least effort for you.

  • same CSV or different CSV would be both fine for me
  • and yes, just populating the columns with the available data would be perfect

Originally posted by @martinAtGitHub in #27 (comment)

@dhojayev dhojayev added enhancement New feature or request new feature New features that are worth implementing idea nice to have things labels Jun 16, 2024
@martinAtGitHub
Copy link

is it possible, implementation has started but current state causes an exception? I'm using go 1.22.3 on linux. No output is created. Trace is

Jul 28 20:01:31.014 [PANI] could not fetch transactions: could not unmarshal timelineTransactions response: json: cannot unmarshal object into Go struct field TransactionResponse.items.subAmount of type string
panic: (*logrus.Entry) 0xc0001a2310

goroutine 1 [running]:
github.com/sirupsen/logrus.(*Entry).log(0xc0001a2000, 0x0, {0xc00049e180, 0xb6})
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:260 +0x491
github.com/sirupsen/logrus.(*Entry).Log(0xc0001a2000, 0x0, {0xc00003de60?, 0xc0001ff200?, 0xc0002de2d0?})
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:304 +0x48
github.com/sirupsen/logrus.(*Logger).Log(0xc0001ff200, 0x0, {0xc00003de60, 0x1, 0x1})
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/logger.go:204 +0x58
github.com/sirupsen/logrus.(*Logger).Panic(...)
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/logger.go:253
main.main()
/home/ms/traderepublic-portfolio-downloader/cmd/portfoliodownloader/public/main.go:44 +0x43b

@dhojayev
Copy link
Owner Author

Hi @martinAtGitHub!
Is it possible that you are using outdated revision?
This error was present a month or two ago, but was fixed already.
If you are using the current revision of the main branch: please share the response written into the files to help me to debug.

@martinAtGitHub
Copy link

my intention is to run with the latest revision, what I did
git pull
make build-linux-amd64
./bin/portfoliodownloader-linux-amd64

@martinAtGitHub
Copy link

I tried again, git pull said "Bereits aktuell." and I got the same error

Jul 30 15:17:44.734 [PANI] could not fetch transactions: could not unmarshal timelineTransactions response: json: cannot unmarshal object into Go struct field TransactionResponse.items.subAmount of type string
panic: (*logrus.Entry) 0xc0001d80e0

goroutine 1 [running]:
github.com/sirupsen/logrus.(*Entry).log(0xc0001cc9a0, 0x0, {0xc00027e540, 0xb6})
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:260 +0x491
github.com/sirupsen/logrus.(*Entry).Log(0xc0001cc9a0, 0x0, {0xc00003de60?, 0xc00022f200?, 0xc0003620c0?})
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:304 +0x48
github.com/sirupsen/logrus.(*Logger).Log(0xc00022f200, 0x0, {0xc00003de60, 0x1, 0x1})
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/logger.go:204 +0x58
github.com/sirupsen/logrus.(*Logger).Panic(...)
/home/ms/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/logger.go:253
main.main()
/home/ms/traderepublic-portfolio-downloader/cmd/portfoliodownloader/public/main.go:44 +0x43b

@martinAtGitHub
Copy link

I'm not an git expert. But "git pull origin main" tells "Bereits aktuell.", too. So I expect I'm using the latest revision.
When executing no "transactions" file is created.

@martinAtGitHub
Copy link

martinAtGitHub commented Jul 30, 2024

On 13th July I successfully run the program (with the latest revision on that day).

@martinAtGitHub
Copy link

I've missed, build generates executable into "/tmp/portfoliodownloader/public/". So I've used a very old version all the time.
I've upgraded to go 1.23, did a build with latest git and used the generated executable. Now the panic message ist gone and output is created.

@parthux1
Copy link

parthux1 commented Nov 14, 2024

Hi, I'm interested in this feature as well. @martinAtGitHub do you still work at this? If not I'd like to take over.


my findings

response content

klick to expand

As far as I've seen the following fields could be mapped to a csv:

  • timestamp
  • related to the actual payment
    • beneficiary name
    • amount
    • last 4 digits of users IBAN
    • status
  • related to benefit payments
    • payback amount
    • selected payback instrument

integration in current code

klick to expand

as far as I've checked, integration in portfolio/transaction should work w/o problems.

New builder just needs a override of ExtractTotalAmount because the total amount is hidden in the header (extractable via already defined parsing functions).

Some new constants in api-files like timeline/details/response.go and so on...

maybe some way to suppress missing document warnings is required.

integration in current output

klick to expand

if you want the information to be written into a different csv:
the processor would need to differenciate csv-files for these event-types. But all information seem to be present already (csv name as constant and eventType per response).

If you want the information in the same table as the other stuff, a mapping would be required.
IMO a new table would be better, because it wouldn't require fitting two different schemas into one table.

card payment information existing csv table
beneficiary name Name?
amount total?
last 4 digits of users IBAN ?
status Status
timestamp Timestamp
payback amount ?
selected payback instrument ?

@martinAtGitHub
Copy link

@parthux1 feel free!

@parthux1 parthux1 linked a pull request Nov 21, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea nice to have things new feature New features that are worth implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants