Hello all.
After a hiatus I have successfully interacted with the HMRC API for a test
account to post earning & expenses using python. None of it is joined up yet
to: create|query a business, post and query data about that business but my
"tests" appear to work as individual pieces.
I haven't yet queried GnuCash for the data either but I can confirm that the
HMRC API works for submitting self employed account data. I've not looked at
the VAT part, because I'm not VAT registered, so...
A minimal json data set for a self-employed quarterly submission looks like:
json_data = {
"from": "2017-04-06",
"to": "2017-07-04",
"incomes": {
"turnover": {
"amount": 100.25
},
"other": {
"amount": 100.25
}
},
"consolidatedExpenses": 100.25
}
and that's it. That's the example data from:
https://developer.service.hmrc.gov.uk/api-documentation/docs/api/service/self-assessment-api/2.0#selfemployment-business_create-a-selfemployment-periodic-update_post_accordion
Doing a query on the same period returns:
{u'to': u'2017-07-04', u'consolidatedExpenses': 100.25, u'from': u'2017-04-06',
u'incomes': {u'other': {u'amount': 100.25}, u'turnover': {u'amount': 100.25}}}
You can of course provide detailed account data but I never have in past
submissions. These data should be easy to pull out of GnuCash with the
(probably augmented) Python bindings to satisfy HMRC each quarter. I guess this
could be incorporated into GnuCash as a C++ module at some point but I'll leave
that that others more committed. Lest I be committed.
I'll stick the code on GitHub in a while. It's very much just code to test the
connection with a some test POSTs and GETs. I have lots of cleaning up and
comments to add before it's publicly viewable. Tomorrow maybe.
I'm still thinking how to keep the secret, even though HMRC have apparently
relaxed that requirement. Ideas welcome on that, maybe a json request from
gnucash.org, I know the request code will still be public however, that's the
part that needs more_thought&more_input.
Python because it's easy to do quick tests, Sorry Derek. :)
Mike E
--
GPG Key fingerprint = 0D8A 33A8 F7F8 733C 7519 2A56 DB8F 7CF1 C67B BC0F
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel