Tax time again in Germany. I've been dreaming of completely automating my taxes with a script for years and I finally went ahead and applied for a developer account at the German tax site, elster.de. I have interfaced with a few public German IT systems in the past and expected the worst- the most fun was an API with opening hours, because there was a civil servant on the other end manually typing in the replies.
But I was pleasantly surprised by the the developers section, which is not perfect but reasonably clear and with lots of docs. You can download an SDK called "eric" that comes as cross-platform C libraries and headers that handles the mandated way of encrypting and uploading. Aside of a bit of protocol reinvention and the quaint use of "Denglish" in the code - mixed German in English, ErzeugePufferHandle anyone?- "eric" is a decidedly straight-forward, non-terrible interface. The error logging turned out to be excellent.
So I just went ahead and pointed @PMunch's futhark at the header file and it just worked. I expected the C interfacing part to be full of edge cases but Futhark handled them all- it's like magic. It even automatically interfaced the pesky pointer-to-const-char datatype to cstring. Two hours later I had a very C-like but working prototype tax data uploader written in Nim.
https://gist.github.com/capocasa/40a78b5ffab3f657f6c06fa7c2a6ba03
I'll probably be doing some ultra-minimalistic placeholder replacing to create the XML-files for my returns, but with a little bit of programmatic XML templating it would be rather straight forward to create a proper product. Anyone care to unleash their inner bean counter?
Good to hear that Futhark works this well :) My experiences with it recently have been similar, that it just works. Unfortunately I only get issue requests and few success stories, so it's hard to tell how well it works. Very nice of you to post this so I can see that other people are in fact able to use it!
And mixed language code is always a fun confusing mess :P
I'm curious about the manually responding API though, was it just a normal rest API but with an extremely high latency? Did it do things like "503 Service Unavailable - Out to lunch"? So many questions!
Of course- you're welcome, and thanks a lot for making futhark! Can't wait to unleash it on something else.
Haha the manual API- it worked like this. You submit a SOAP request where you submit a request ID and a list of dataset-IDs and your e-mail address. Then you receive by email a reply that your data is ready. Then you connect via a version of OpenVPN that is old enough to support the requested ciphers to the government network and then connect via SFTP to an SSH server, where you will find in your dedicated directory a compressed archive file named after your request containing your data, or possibly a typo thereof. But you might also get a reply by email requesting follow-up information- that's how we figured out it was manual.
Unfortunately I only get issue requests and few success stories, so it's hard to tell how well it works. Very nice of you to post this so I can see that other people are in fact able to use it!
I've used Futhark several times, and never had to bother you because it has just worked every time!
Great PoC @cmc. Props for advocating Nim on the official forum of the ELSTER API of the German Tax Authorities. I allowed myself to fork your gist and add an important functionality of generating a PDF-Preview.
I worked with Nim the first time today and I find it a great feature of futhark, that it returns understandable feedback for type mismatches.
I just got some feedback from a developer on the tax forum who tried Nim. He thinks Nim's compiler error feedback is very good- that's great news, I used to struggle there but not so much anymore.
I'm not quite sure what they mean by Futhark error messages. Futhark itself doesn't really have a lot of error messages, it mostly generates code and lets Nim deal with that. So I think that's just a double whammy for Nim error messages (and the macro system I guess). Great to hear that these are finally starting to reach a point of being good enough though, people used to complain quite a lot about them.
@namisboss, I assume you need a german tax forum account to log in.