Bug 28424 - POST /patrons/:patron_id/account/credits return value wrong
Summary: POST /patrons/:patron_id/account/credits return value wrong
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 28370
  Show dependency treegraph
 
Reported: 2021-05-21 20:32 UTC by Tomás Cohen Arazi
Modified: 2022-12-12 21:24 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00


Attachments
Bug 28424: Regression tests (2.65 KB, patch)
2021-05-21 21:33 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 28424: Fix patron credits route (POST) (1.86 KB, patch)
2021-05-21 21:33 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 28424: (28370 follow-up) Fix response definition (857 bytes, patch)
2021-05-21 21:33 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 28424: (follow-up) Do not create account lines manually (6.84 KB, patch)
2021-05-22 21:06 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 28424: Regression tests (2.69 KB, patch)
2021-05-23 21:05 UTC, David Nind
Details | Diff | Splinter Review
Bug 28424: Fix patron credits route (POST) (1.91 KB, patch)
2021-05-23 21:05 UTC, David Nind
Details | Diff | Splinter Review
Bug 28424: (28370 follow-up) Fix response definition (904 bytes, patch)
2021-05-23 21:05 UTC, David Nind
Details | Diff | Splinter Review
Bug 28424: (follow-up) Do not create account lines manually (6.89 KB, patch)
2021-05-23 21:05 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2021-05-21 20:32:35 UTC
It should be returning the generated credit object, and is just returning the ID.
Comment 1 Tomás Cohen Arazi 2021-05-21 21:33:26 UTC
Created attachment 121292 [details] [review]
Bug 28424: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi 2021-05-21 21:33:30 UTC
Created attachment 121293 [details] [review]
Bug 28424: Fix patron credits route (POST)

This patch makes the route follow the coding guidelines and thus:
- Return the generated object
- Use the status code 201 for the response

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> FAIL: Tests fail. The reponse body and status is incorrect
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi 2021-05-21 21:33:35 UTC
Created attachment 121294 [details] [review]
Bug 28424: (28370 follow-up) Fix response definition

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2021-05-22 21:06:28 UTC
Created attachment 121295 [details] [review]
Bug 28424: (follow-up) Do not create account lines manually

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 David Nind 2021-05-23 21:05:17 UTC
Created attachment 121304 [details] [review]
Bug 28424: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2021-05-23 21:05:22 UTC
Created attachment 121305 [details] [review]
Bug 28424: Fix patron credits route (POST)

This patch makes the route follow the coding guidelines and thus:
- Return the generated object
- Use the status code 201 for the response

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> FAIL: Tests fail. The reponse body and status is incorrect
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2021-05-23 21:05:26 UTC
Created attachment 121306 [details] [review]
Bug 28424: (28370 follow-up) Fix response definition

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2021-05-23 21:05:30 UTC
Created attachment 121307 [details] [review]
Bug 28424: (follow-up) Do not create account lines manually

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 Jonathan Druart 2021-05-25 07:47:37 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 10 Fridolin Somers 2021-05-31 14:07:22 UTC
Does not apply on 20.11.x for t/db_dependent/api/v1/patrons_accounts.t
Because of Bug 27587 it seems.