View | Details | Raw Unified | Return to bug 13895
Collapse All | Expand All

(-)a/Koha/REST/V1/Checkout.pm (-1 / +2 lines)
Lines 118-125 sub renew { Link Here
118
    AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode);
118
    AddRenewal($borrowernumber, $itemnumber, $checkout->branchcode);
119
    $checkout = Koha::Checkouts->find($checkout_id);
119
    $checkout = Koha::Checkouts->find($checkout_id);
120
120
121
    $c->res->headers->location( $c->req->url->to_string );
121
    return $c->render(
122
    return $c->render(
122
        status => 200,
123
        status => 201,
123
        openapi => _to_api( $checkout->TO_JSON )
124
        openapi => _to_api( $checkout->TO_JSON )
124
    );
125
    );
125
}
126
}
(-)a/api/v1/swagger/paths/checkouts.json (-1 / +1 lines)
Lines 73-79 Link Here
73
      }],
73
      }],
74
      "produces": ["application/json"],
74
      "produces": ["application/json"],
75
      "responses": {
75
      "responses": {
76
        "200": {
76
        "201": {
77
          "description": "Updated borrower's checkout",
77
          "description": "Updated borrower's checkout",
78
          "schema": { "$ref": "../definitions.json#/checkout" }
78
          "schema": { "$ref": "../definitions.json#/checkout" }
79
        },
79
        },
(-)a/t/db_dependent/api/v1/checkouts.t (-6 / +8 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 51;
20
use Test::More tests => 53;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Mojo;
22
use Test::Mojo;
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 137-144 $dbh->do(q{ Link Here
137
137
138
my $expected_datedue = DateTime->now->add(days => 14)->set(hour => 23, minute => 59, second => 0);
138
my $expected_datedue = DateTime->now->add(days => 14)->set(hour => 23, minute => 59, second => 0);
139
$t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )
139
$t->post_ok ( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )
140
  ->status_is(200)
140
  ->status_is(201)
141
  ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) );
141
  ->json_is('/due_date' => output_pref( { dateformat => "rfc3339", dt => $expected_datedue }) )
142
  ->header_is(Location => "/api/v1/checkouts/" . $issue1->issue_id . "/renewal");
142
143
143
$t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" )
144
$t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id . "/renewal" )
144
  ->status_is(403)
145
  ->status_is(403)
Lines 147-154 $t->post_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->i Link Here
147
            });
148
            });
148
149
149
$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/renewal" )
150
$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue2->issue_id . "/renewal" )
150
  ->status_is(200)
151
  ->status_is(201)
151
  ->json_is('/due_date' => output_pref({ dateformat => "rfc3339", dt => $expected_datedue}) );
152
  ->json_is('/due_date' => output_pref({ dateformat => "rfc3339", dt => $expected_datedue}) )
153
  ->header_is(Location => "/api/v1/checkouts/" . $issue2->issue_id . "/renewal");
154
152
155
153
$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )
156
$t->post_ok( "//$userid:$password@/api/v1/checkouts/" . $issue1->issue_id . "/renewal" )
154
  ->status_is(403)
157
  ->status_is(403)
155
- 

Return to bug 13895