{"action":"closed","issue":{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/11","labels_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/11/comments","events_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/11/events","html_url":"https://github.com/IMA-WorldHealth/bhima-2.X/issues/11","id":125596566,"number":11,"title":"Unify posting journal interface","user":{"login":"jniles","id":896472,"avatar_url":"https://avatars.githubusercontent.com/u/896472?v=3","gravatar_id":"","url":"https://api.github.com/users/jniles","html_url":"https://github.com/jniles","followers_url":"https://api.github.com/users/jniles/followers","following_url":"https://api.github.com/users/jniles/following{/other_user}","gists_url":"https://api.github.com/users/jniles/gists{/gist_id}","starred_url":"https://api.github.com/users/jniles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jniles/subscriptions","organizations_url":"https://api.github.com/users/jniles/orgs","repos_url":"https://api.github.com/users/jniles/repos","events_url":"https://api.github.com/users/jniles/events{/privacy}","received_events_url":"https://api.github.com/users/jniles/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/labels/Design","name":"Design","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-08T11:49:46Z","updated_at":"2016-01-29T12:32:54Z","closed_at":"2016-01-29T12:32:54Z","body":"The [current journal code](https://github.com/IMA-WorldHealth/bhima-2.X/blob/master/server/controllers/finance/journal.js#L70) uses string matching and a function that takes in six parameters - some of them objects, numbers, or functions.  We should re-write this interface to provide direct posting without the need for anything but a UUID.  For example:\r\n```js\r\n// inside controllers/finance/sales.js\r\n// create a sale with some uuid\r\njournal.postPatientInvoice(uuid);\r\n\r\n// inside controllers/finance/cash.js\r\n// create a cash payment with some uuid\r\njournal.postCashPayment(uuid);\r\n```\r\n\r\nAll information needed to post any record should already exist in the database."}}