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

(-)a/Koha/REST/V1/Checkouts.pm (-1 / +23 lines)
Lines 102-108 sub get { Link Here
102
    };
102
    };
103
}
103
}
104
104
105
=head3 get_availablity
105
=head3 get_availability
106
106
107
Controller function that handles retrieval of Checkout availability
107
Controller function that handles retrieval of Checkout availability
108
108
Lines 123-128 sub get_availability { Link Here
123
      C4::Circulation::CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves,
123
      C4::Circulation::CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves,
124
        $params );
124
        $params );
125
125
126
    # Upgrade some confirmations to blockers if public
127
    if ( $c->stash('is_public') ) {
128
        my @should_block = qw/TOO_MANY ISSUED_TO_ANOTHER RESERVED RESERVED_WAITING TRANSFERRED PROCESSING AGE_RESTRICTION/;
129
        for my $block ( @should_block ) {
130
            if ( exists($confirmation->{$block}) ) {
131
                $impossible->{$block} = $confirmation->{$block};
132
                delete $confirmation->{$block};
133
            }
134
        }
135
    }
136
126
    my $token;
137
    my $token;
127
    if (keys %{$confirmation}) {
138
    if (keys %{$confirmation}) {
128
        my $claims = { map { $_ => 1 } keys %{$confirmation} };
139
        my $claims = { map { $_ => 1 } keys %{$confirmation} };
Lines 131-136 sub get_availability { Link Here
131
        $token = Mojo::JWT->new( claims => $claims, secret => $secret )->encode;
142
        $token = Mojo::JWT->new( claims => $claims, secret => $secret )->encode;
132
    }
143
    }
133
144
145
    # Remove any non-public info that's returned by CanBookBeIssued
146
    if ( $c->stash('is_public') ) {
147
        my @restricted_keys = qw/issued_borrowernumber issued_cardnumber issued_firstname issued_surname resborrowernumber resbranchcode rescardnumber reserve_id resfirstname resreservedate ressurname item_notforloan/;
148
        for my $key (@restricted_keys) {
149
            delete $confirmation->{$key};
150
            delete $impossible->{$key};
151
            delete $alerts->{$key};
152
            delete $messages->{$key};
153
        }
154
    }
155
134
    my $response = {
156
    my $response = {
135
        blockers           => $impossible,
157
        blockers           => $impossible,
136
        confirms           => $confirmation,
158
        confirms           => $confirmation,
(-)a/api/v1/swagger/paths/checkouts.yaml (-4 / +36 lines)
Lines 89-101 Link Here
89
        description: Created checkout
89
        description: Created checkout
90
        schema:
90
        schema:
91
          $ref: "../swagger.yaml#/definitions/checkout"
91
          $ref: "../swagger.yaml#/definitions/checkout"
92
      "400":
92
      "400": 
93
        description: Missing or wrong parameters
93
        description: Missing or wrong parameters
94
        schema:
94
        schema: 
95
          $ref: "../swagger.yaml#/definitions/error"
95
          $ref: "../swagger.yaml#/definitions/error"
96
      "401":
96
      "401": 
97
        description: Authentication required
97
        description: Authentication required
98
        schema:
98
        schema: 
99
          $ref: "../swagger.yaml#/definitions/error"
99
          $ref: "../swagger.yaml#/definitions/error"
100
      "403":
100
      "403":
101
        description: Cannot create checkout
101
        description: Cannot create checkout
Lines 370-372 Link Here
370
    x-koha-authorization:
370
    x-koha-authorization:
371
      permissions:
371
      permissions:
372
        circulate: circulate_remaining_permissions
372
        circulate: circulate_remaining_permissions
373
"/public/checkouts/availability":
374
  get:
375
    x-mojo-to: Checkouts#get_availability
376
    operationId: availabilityCheckoutsPublic
377
    tags:
378
      - checkouts
379
    summary: Get checkout availability
380
    parameters:
381
      - $ref: "../swagger.yaml#/parameters/patron_id_qp"
382
      - $ref: "../swagger.yaml#/parameters/item_id_qp"
383
    produces:
384
      - application/json
385
    responses:
386
      "200":
387
        description: Availability
388
        schema:
389
          type: "object"
390
      "403":
391
        description: Access forbidden
392
        schema:
393
          $ref: "../swagger.yaml#/definitions/error"
394
      "500":
395
        description: |
396
          Internal server error. Possible `error_code` attribute values:
397
398
          * `internal_server_error`
399
        schema:
400
          $ref: "../swagger.yaml#/definitions/error"
401
      "503":
402
        description: Under maintenance
403
        schema:
404
          $ref: "../swagger.yaml#/definitions/error"
(-)a/api/v1/swagger/paths/public_patrons.yaml (+60 lines)
Lines 62-67 Link Here
62
          $ref: "../swagger.yaml#/definitions/error"
62
          $ref: "../swagger.yaml#/definitions/error"
63
    x-koha-authorization:
63
    x-koha-authorization:
64
      allow-owner: true
64
      allow-owner: true
65
"/public/patrons/{patron_id}/checkouts":
66
  post:
67
    x-mojo-to: Checkouts#add
68
    operationId: addCheckoutPublic
69
    tags:
70
      - checkouts
71
      - patrons
72
    summary: Add a new checkout
73
    parameters:
74
      - name: body
75
        in: body
76
        description: A JSON object containing information about the new checkout
77
        required: true
78
        schema:
79
          $ref: "../swagger.yaml#/definitions/checkout"
80
      - name: confirmation
81
        in: query
82
        description: A JWT confirmation token
83
        required: false
84
        type: string
85
    produces:
86
      - application/json
87
    responses:
88
      "201":
89
        description: Created checkout
90
        schema:
91
          $ref: "../swagger.yaml#/definitions/checkout"
92
      "400":
93
        description: Missing or wrong parameters
94
        schema:
95
          $ref: "../swagger.yaml#/definitions/error"
96
      "401":
97
        description: Authentication required
98
        schema:
99
          $ref: "../swagger.yaml#/definitions/error"
100
      "403":
101
        description: Cannot create checkout
102
        schema:
103
          $ref: "../swagger.yaml#/definitions/error"
104
      "409":
105
        description: Conflict in creating checkout
106
        schema:
107
          $ref: "../swagger.yaml#/definitions/error"
108
      "412":
109
        description: Precondition failed
110
        schema:
111
          $ref: "../swagger.yaml#/definitions/error"
112
      "500":
113
        description: |
114
          Internal server error. Possible `error_code` attribute values:
115
116
          * `internal_server_error`
117
        schema:
118
          $ref: "../swagger.yaml#/definitions/error"
119
      "503":
120
        description: Under maintenance
121
        schema:
122
          $ref: "../swagger.yaml#/definitions/error"
123
    x-koha-authorization:
124
      allow-owner: true
65
"/public/patrons/{patron_id}/guarantors/can_see_charges":
125
"/public/patrons/{patron_id}/guarantors/can_see_charges":
66
  put:
126
  put:
67
    x-mojo-to: Patrons#guarantors_can_see_charges
127
    x-mojo-to: Patrons#guarantors_can_see_charges
(-)a/api/v1/swagger/swagger.yaml (-1 / +4 lines)
Lines 305-310 paths: Link Here
305
    $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
305
    $ref: "./paths/patrons_password.yaml#/~1patrons~1{patron_id}~1password~1expiration_date"
306
  "/public/biblios/{biblio_id}":
306
  "/public/biblios/{biblio_id}":
307
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
307
    $ref: "./paths/biblios.yaml#/~1public~1biblios~1{biblio_id}"
308
  "/public/checkouts/availability":
309
    $ref: ./paths/checkouts.yaml#/~1public~1checkouts~1availability
308
  "/public/items":
310
  "/public/items":
309
    $ref: "./paths/items.yaml#/~1public~1items"
311
    $ref: "./paths/items.yaml#/~1public~1items"
310
  "/public/biblios/{biblio_id}/items":
312
  "/public/biblios/{biblio_id}/items":
Lines 319-324 paths: Link Here
319
    $ref: ./paths/public_oauth.yaml#/~1public~1oauth~1login~1{provider_code}~1{interface}
321
    $ref: ./paths/public_oauth.yaml#/~1public~1oauth~1login~1{provider_code}~1{interface}
320
  "/public/patrons/{patron_id}/article_requests/{article_request_id}":
322
  "/public/patrons/{patron_id}/article_requests/{article_request_id}":
321
    $ref: "./paths/article_requests.yaml#/~1public~1patrons~1{patron_id}~1article_requests~1{article_request_id}"
323
    $ref: "./paths/article_requests.yaml#/~1public~1patrons~1{patron_id}~1article_requests~1{article_request_id}"
324
  "/public/patrons/{patron_id}/checkouts":
325
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1checkouts"
322
  "/public/patrons/{patron_id}/guarantors/can_see_charges":
326
  "/public/patrons/{patron_id}/guarantors/can_see_charges":
323
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1guarantors~1can_see_charges"
327
    $ref: "./paths/public_patrons.yaml#/~1public~1patrons~1{patron_id}~1guarantors~1can_see_charges"
324
  "/public/patrons/{patron_id}/guarantors/can_see_checkouts":
328
  "/public/patrons/{patron_id}/guarantors/can_see_checkouts":
325
- 

Return to bug 30979