Bug 20944: Add route to add credits to a patron's account
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 10 Jul 2018 17:54:17 +0000 (14:54 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 31 Aug 2018 12:47:00 +0000 (12:47 +0000)
commitd19d8ec049271afb5840af15bc9fee9da7ab4e19
tree195b836aa10182c67ffaf9144ac7b34e576c507a
parent566badf12ae22cf3748db867dd93b67a91088eff
Bug 20944: Add route to add credits to a patron's account

This patch adds the /patrons/{patron_id}/account/credits endpoint, that
can be used to add credits to a patron's account. It is implemented so
the new credits are used to pay existing debts.

To test:
- Run:
  $ kshell
k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: Tests pass!
- Make your favourite REST testing tool (RESTer on Firefox?) do:
  POST /api/v1/patrons/{patron_id}/account/credits
{
  "amount": 100
}
- Play with other possible attributes on the credit object.
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Koha/REST/V1/Patrons/Account.pm
t/db_dependent/api/v1/patrons_accounts.t