Bug 28424

Summary: POST /patrons/:patron_id/account/credits return value wrong
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28370
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00
Bug Depends on:    
Bug Blocks: 28370    
Attachments: Bug 28424: Regression tests
Bug 28424: Fix patron credits route (POST)
Bug 28424: (28370 follow-up) Fix response definition
Bug 28424: (follow-up) Do not create account lines manually
Bug 28424: Regression tests
Bug 28424: Fix patron credits route (POST)
Bug 28424: (28370 follow-up) Fix response definition
Bug 28424: (follow-up) Do not create account lines manually

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.