[#206] getClientBookings API returning same booking multiple times

Migrated from Redmine #206 | Author: Luiz Soares
Status: New | Priority: Normal | Created: 2018-07-30


Hi, I’m using the trying to get the client bookings and somehow the API is returning the same booking multiple times.

Request:

{
	"jsonrpc":"2.0",
	"method":"getClientBookings",
	"params":[11, "", {"upcoming_only" : true, "confirmed_only" : false}],
	"id":1
}

Response:

{
    "result": [
        {
            "service_id": "1",
            "provider_id": "2",
            "start_date": "2018-07-31",
            "start_time": "17:00:00",
            "end_date": "2018-07-31",
            "end_time": "18:00:00",
            "id": "714",
            "code": "5akjt6i0",
            "hash": "410617a862676e57d36927fe3e86e9e0",
            "time_offset": "0",
            "status": "pending",
            "is_cancellable": "1",
            "price_without_tax": 20,
            "price_with_tax": 20,
            "show_tax": true,
            "currency": "BRL",
            "products": [],
            "additional_fields_values": [...]
        },
        {
            "service_id": "1",
            "provider_id": "2",
            "start_date": "2018-07-31",
            "start_time": "17:00:00",
            "end_date": "2018-07-31",
            "end_time": "18:00:00",
            "id": "714",
            "code": "5akjt6i0",
            "hash": "410617a862676e57d36927fe3e86e9e0",
            "time_offset": "0",
            "status": "pending",
            "is_cancellable": "1",
            "price_without_tax": 20,
            "price_with_tax": 20,
            "show_tax": true,
            "currency": "BRL",
            "products": [],
            "additional_fields_values": [...]
        },
        {
            "service_id": "1",
            "provider_id": "2",
            "start_date": "2018-07-31",
            "start_time": "17:00:00",
            "end_date": "2018-07-31",
            "end_time": "18:00:00",
            "id": "714",
            "code": "5akjt6i0",
            "hash": "410617a862676e57d36927fe3e86e9e0",
            "time_offset": "0",
            "status": "pending",
            "is_cancellable": "1",
            "price_without_tax": 20,
            "price_with_tax": 20,
            "show_tax": true,
            "currency": "BRL",
            "products": [],
            "additional_fields_values": [...]
        },
        {
            "service_id": "1",
            "provider_id": "2",
            "start_date": "2018-07-31",
            "start_time": "17:00:00",
            "end_date": "2018-07-31",
            "end_time": "18:00:00",
            "id": "714",
            "code": "5akjt6i0",
            "hash": "410617a862676e57d36927fe3e86e9e0",
            "time_offset": "0",
            "status": "pending",
            "is_cancellable": "1",
            "price_without_tax": 20,
            "price_with_tax": 20,
            "show_tax": true,
            "currency": "BRL",
            "products": [],
            "additional_fields_values": [...]
        }
...

Please note that the bookings have the same ID.

Regards

Vitaliy Kordiak wrote:

We were not able to repeat the error:
Request

POST / HTTP/1.1
Host: user-api.simplybook.me
Origin: https://simplybook.me
X-Token: 7e5312d2a429d1ea006c2cb1cb393ff3c897062812c7c2639afe16ccafe06913
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36
Content-Type: application/json
Accept: application/json, text/javascript, */*; q=0.01
X-Company-Login: ******(removed)
DNT: 1
Accept-Encoding: gzip, deflate, br
Accept-Language: uk-UA,uk;q=0.9,ru;q=0.8,en-US;q=0.7,en;q=0.6
Cache-Control: no-cache
Postman-Token: f735c81a-b52f-fe48-4134-a6d0e7312e7a

{"jsonrpc":"2.0","method":"getClientBookings","params":[18, "70adb5327900e15a062e5a9b834992e1", {"upcoming_only" : true, "confirmed_only" : false}],"id":2}

Response:

{
    "result": [
        {
            "service_id": "10",
            "provider_id": "3",
            "start_date": "2018-08-06",
            "start_time": "06:00:00",
            "end_date": "2018-08-06",
            "end_time": "07:00:00",
            "id": "2232",
            "code": "82j1pz463",
            "hash": "db80579a5d096678047182b4a2d5d91e",
            "time_offset": "0",
            "status": "confirmed",
            "is_cancellable": "1",
            "products": [],
            "additional_fields_values": []
        },
        {
            "service_id": "10",
            "provider_id": "25",
            "start_date": "2018-08-11",
            "start_time": "07:00:00",
            "end_date": "2018-08-11",
            "end_time": "08:00:00",
            "id": "2233",
            "code": "82j1q06c3",
            "hash": "2d524cedc3364712930675676568ce83",
            "time_offset": "0",
            "status": "confirmed",
            "is_cancellable": "1",
            "products": [],
            "additional_fields_values": []
        }
    ],
    "id": "2",
    "jsonrpc": "2.0"
}

Vitaliy Kordiak wrote:

Please clarify, is the problem still relevant? (also enter company login)

Luiz Soares wrote:

Hi Vitaliy, thanks for the response.

The problem is still relevant, it’s happening now.

The company login is godog.

We noticed that the repeated bookings happens when we book with recurring. But the response from the book endpoint returns the correct amount of recurring events.

When we call getClientBookings, we get from the API 4 bookings with the same ID and same start date. The start date of these 4 bookings are always the same date of the first book date.

Example: Let’s say our user tries to book an event that starts today (2018-07-31). The booking is recurring, and he wants to repeat it for four weeks and in the same weekday. So he wants to book an event that begins today and will occur in the next 3 tuesdays (2018-08-07, 2018-08-14, 2018-08-21). The API response from the book endpoint returns 4 bookings with the correct dates.

But the response from the getClientBookings endpoint returns 4 bookings with the same ID and the first date (2018-07-31). Also, we get the other bookings for the other tuesdays.

If more information is needed, we can provide.

Regards

Redmine Admin wrote:

Problem fixed.

(Short original content)

Luiz Soares wrote:

Thanks!

(Short original content)