[#622] Bug in REST API - /admin/invoices

Migrated from Redmine #622 | Author: Avi Beetul
Status: Closed | Priority: High, I’m very impatient | Created: 2020-12-09


Hi,

While testing my code, I found a potential bug in the REST API.

Get order/invoice item

Return order/invoice item by id

Endpoint:

/admin/invoices/{id}

Return:

AdminInvoiceEntity

Result contains bookings as expected:

“booking_ids”: [

    329

  ],

  "bookings": [

    {

      "id": 329,

      "code": "00694ijm",

      "start_datetime": "2020-12-11 17:45:00",

      "end_datetime": "2020-12-11 17:50:00",

      "location_id": null,

      "category_id": null,

      "service_id": 1,

      "provider_id": 1,

      "client_id": 389,

      "duration": null

    }

  ],

“invoice_id”: 329,

However, the problem is when I GET all invoices.

Get orders/invoices list

Return orders and invoices list.

Endpoint:

/admin/invoices

Return:

array|AdminInvoiceEntity

Result contains no bookings.

“booking_ids”: [

      329

    ],

“bookings”: null,

“invoice_id”: 329

This is not limited to the invoice_id above.

The returned result of the endpoint /admin/invoices does NOT give me any bookings.

Example:

3160 invoices and they all contain “bookings”: null.

Can you please assist?

Dmytro Bondarev wrote:

It is correct behavior. It is not possible to return all data in single response.
If you need bookings details you have to use API callback and store bookings in local storage.