diff --git a/Koha/REST/V1/Patrons/Account.pm b/Koha/REST/V1/Patrons/Account.pm index c75f91a1f7..1bf64aa58c 100644 --- a/Koha/REST/V1/Patrons/Account.pm +++ b/Koha/REST/V1/Patrons/Account.pm @@ -142,7 +142,12 @@ sub add_credit { $credit->apply({ debits => [ $outstanding_debits->as_list ], offset_type => 'payment' }); } - return $c->render( status => 200, openapi => { account_line_id => $credit->id } ); + $credit->discard_changes; + + return $c->render( + status => 201, + openapi => $credit->to_api + ); } catch { $c->unhandled_exception($_); diff --git a/api/v1/swagger/paths/patrons_account.json b/api/v1/swagger/paths/patrons_account.json index 428999fe00..9e118d9ade 100644 --- a/api/v1/swagger/paths/patrons_account.json +++ b/api/v1/swagger/paths/patrons_account.json @@ -85,7 +85,7 @@ "application/json" ], "responses": { - "200": { + "201": { "description": "Credit added", "schema": { "type": "object"