Bug 20944

Summary: Add routes to add credits to a patron's account
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: new feature    
Priority: P5 - low CC: fridolin.somers, josef.moravec, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
URL: https://wiki.koha-community.org/wiki/Patrons_account_lines_endpoint_RFC
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21043
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29453
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Introduces the API endpoint for dealing with patron account credits, a highly requested feature for third-party integrations.
Version(s) released in:
Bug Depends on: 20942, 20978, 20997    
Bug Blocks: 15165, 21786, 28544    
Attachments: Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits
Bug 20944: Add route to add credits to a patron's account
Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits
Bug 20944: Add route to add credits to a patron's account
Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits
Bug 20944: Add route to add credits to a patron's account
Bug 20944: Fix perlcritic issues

Description Tomás Cohen Arazi 2018-06-14 14:14:19 UTC

    
Comment 1 Tomás Cohen Arazi 2018-07-10 17:58:44 UTC
Created attachment 76815 [details] [review]
Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits
Comment 2 Tomás Cohen Arazi 2018-07-10 17:58:49 UTC
Created attachment 76816 [details] [review]
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
Comment 3 Martin Renvoize 2018-08-10 10:13:59 UTC
Created attachment 77645 [details] [review]
Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2018-08-10 10:14:02 UTC
Created attachment 77646 [details] [review]
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>
Comment 5 Martin Renvoize 2018-08-10 10:14:58 UTC
Ooops, I thought I'd already signed this one off..

Looks good, works well.. no breakages and completes the functionality off nicely for working with patron accounts.

Signing Off.
Comment 6 Josef Moravec 2018-08-16 13:59:23 UTC
Created attachment 77928 [details] [review]
Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Josef Moravec 2018-08-16 13:59:28 UTC
Created attachment 77929 [details] [review]
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>
Comment 8 Nick Clemens 2018-08-31 12:57:27 UTC
Awesome work all!

Pushed to master for 18.11
Comment 9 Tomás Cohen Arazi 2018-08-31 14:27:23 UTC
Created attachment 78329 [details] [review]
Bug 20944: Fix perlcritic issues

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Nick Clemens 2018-08-31 15:30:53 UTC
(In reply to Tomás Cohen Arazi from comment #9)
> Created attachment 78329 [details] [review] [review]
> Bug 20944: Fix perlcritic issues
> 
> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Followup pushed to master