Custom URI Scheme
This wiki page discusses the possibility to register some custom URL Scheme so that the online banking functions in GnuCash can be called from a browser.
Here's my target use case: Let's say a user looks at the http://www.gnucash.org/de/ website. The website should then contain a link "Click here to donate from your German bank account". That link contains our custom URI Scheme (the part usually called the "protocol"), e.g. as follows:
tag:gnucash.org,2012://de/11111111/22222222?desc=Some%20Description
- "tag:gnucash.org,2012" is our URL Tag Scheme (following RFC 4151) which is unused so far
- "de" refers to the fact we're using the German bank account addressing scheme,
- 1111111 is the bank code of the German bank,
- 2222222 is the account number,
- and "Some Description" is the description text that is inserted in the "description" text field of the online banking transfer.
Once clicked, this URL string needs to be passed to GnuCash, most probably as a command line argument similar to the file://path/filename argument. I'll have to tweak the command line parsing so that my custom schemes are redirected into the online banking module, but that shouldn't be a problem.
Once that URL made it into GnuCash's online banking module, it should look up the preferred online banking account which the user regularly uses, then open the dialog for transferring money. The user just has to insert the amount, then press "Send now", then entering his security numbers, and voila, here the money goes to our gnucash donation bank account.
Which URI Scheme to use?
See
- http://en.wikipedia.org/wiki/URI_scheme
- http://www.w3.org/wiki/UriSchemes
- http://infomesh.net/2001/09/urischemes "New URI Schemes: 99% Harmful"
- http://techbase.kde.org/Policies/URI_%26_XML_Namespaces_Policy
The scheme should be Tag scheme RFC 4151 using gnucash.org and 2012 as a year:
tag:gnucash.org,2012://de/11111111/22222222?desc=Some%20Description
How can we register gnucash as a handler for our custom scheme?
- Gnome: Registering in gconf, http://people.w3.org/~dom/archives/2005/09/integrating-a-new-uris-scheme-handler-to-gnome-and-firefox/
- KDE: Registering in kfmclient, only works for KDE applications?!?
- Windows: In the registry http://msdn.microsoft.com/en-us/library/aa767914%28VS.85%29.aspx
- A general but probably unimplemented proposal http://wiki.lxde.org/en/Desktop_Preferred_Applications_Specification