List of cashbook transactions api:
- /cashbook/transactions/
- /cashbook/transactions/actions/taken/
- /cashbook/transactions/actions/release/
Returns only transactions for the prisons that the user can manage.
status
Filters by the status of the transactions.
Default: no status => all transactions
Possible values:
- available: returns list of transactions that have not been taken by anyone
- pending: returns list of transactions taken
- credited: returns list of transactions credited
prison
Filters by list of prisons (in OR).
Default: all prison that the user can manage.
Note:
- If the user can't manage a specified prison, the related returning value will be an empty list.
user
Filters by single user, list of users not allowed (to keep things simple).
Default:
- all users that can manage the prisons that the logged-in user can manage if
prison
is not passed in - all users managing the related prisons if
prison
is passed in
Note:
- if
status
is not passed in, theuser
filter does not make sense at all and it won't do anything. - if
status=available
, theuser
filter does not make sense at all and it won't do anything. - if
user
is passed in but notprison
and the specified user can't manage the prisons of the overall query, the endpoint will return an empty list. - if
user
andprison
are passed in but the the specified user can't manage the specified prison, the endpoint will return an empty list. - if
user
andprison
are passed in, the specified user can manage the specified prison but the logged-in user can't manage the specified prison, the endpoint will return an empty list.
Marks/unmarks a list of transactions as credited.
Data
List of:
- id: id of the transaction to be changed
- credited:
True
if the transactions has to be marked as credited,False
otherwise
Note:
- returns 403 if at least one of the transactions have been taken by a different user. Only the user that took a transaction can mark/unmark it as credited.
- returns 400 if at least one of the transactions is not taken. Transactions have to be taken before being able to get changed.
Takes (meaning locks) some transactions. There's no way to specify which transactions have to be taken as the user doesn't care which one they take.
No data has to be specified.
count
Number of transactions to be taken.
Default: min(20, 20-count(taken transactions)). This is to make sure that the user can only take max 20 transactions at any given time.
prison (mandatory)
Id of the prison to be used when taking transactions. It has to be one of the prisons that the user can manage otherwise it will error.
Default: no defaults.
Note:
- returns 403 if the specified
prison
is not one of the prisons that the user can manage.
for_user - we don't need this for now so maybe we don't need to implement it?
User the transactions will be assigned to.
Default: logged-in user
Note:
- returns 403 if
for_user
is passed in but the logged-in user and the specified user do not belong to the same specified prison.
Releases (meaning unlocks) some transactions.
transaction_ids (mandatory)
List of transactions to be released.
Note:
- returns 403 if at least one of the transactions belongs to a prison not managed by the logged-in user
- returns 400 if at least one of the transactions is credited. Available (meaning non-taken) transactions can be released without any problems as their state does not change anyway.
Does /take accept a list of prisons? If not, I think it should. Looking at the cashbook UI, there's no prison selection there, the user is just taking from the queue of all those available to them, in which case /take should just return the next batch of the given size across everything they can get.