[#686] Available slot not getting displayed

Migrated from Redmine #686 | Author: Fayaz Ahamed PA
Status: Rejected | Priority: High, I’m very impatient | Created: 2021-04-22


I have tried to get the available slots for multiple providers using the REST API method,
I have booked the first slots with the provider using the JSON_RPC method.
Again I tried to get slots for the multiple providers but the response was different, The doubt is we have multiple providers and we can serve clients with the same slots but when I book with the single provider a slot gets locked again that slots are not visible in the available slots were us rather than that provider others were available.

AVAILABLE SLOTS:

URL: https://user-api-v2.simplybook.me/admin/schedule/available-slots

METHOD: GET

QUERY: date=2021-04-23&service_id=5&provider_id=1&provider_id=2

HEADER: server: nginx
date: Thu, 22 Apr 2021 04:27:12 GMT
content-type: application/json; charset=UTF-8
content-length: 202
access-control-allow-origin: *
access-control-allow-methods: POST, PUT, DELETE, GET, OPTIONS
access-control-allow-headers: content-type, x-company-login, x-token, x-requested- with
x-xss-protection: 1; mode=block

RESPONSE: [
{
“id”: “2021-04-23 07:00:00”,
“date”: “2021-04-23”,
“time”: “07:00:00”
},
{
“id”: “2021-04-23 10:00:00”,
“date”: “2021-04-23”,
“time”: “10:00:00”
},
{
“id”: “2021-04-23 13:00:00”,
“date”: “2021-04-23”,
“time”: “13:00:00”
}
]

BOOK:

URL: https://user-api.simplybook.me/

METHOD: POST

BODY: {“jsonrpc”:“2.0”,“method”:“book”,“params”:[“5”,1,“2021-04-23”,“07:00:00”,{“name”:“indhumathi”,“email”:“indhumathi@studioq.co.in”,“phone”:“7092860626”},{“174f93dea26a3e68edd5863971f1a776”:“Pragi”,“1e03f7a8574a6acea8d9871c3fb65b25”:“8220536636”,“2d42cf2bb70e82898ba9ffc46dba74f2”:“Melbourone. VIC, Australia”,“9f785f73333f13a44dbd5cc9df0060f4”:“Jaguar SVU”,“ac59cc4cfbdefb7805668ea679018e02”:“11000”,“a25f4d5f4cba4c7428d27430d7dca0d6”:“VIN”,“661e7ff7914016277b3e4de4c62fb285”:“123DHW293E78596”,“a6bf0d4d47602038ef0bbb2fd3ff6f22”:“25000”,“36820785829f0404de8fb18d886350a7”:“By developers”,“handle_invoice”: true,“products”:[{“id”:4,“qty”:1}]
},1],“id”:8}

HEADER: server: nginx
date: Thu, 22 Apr 2021 04:27:12 GMT
content-type: application/json; charset=UTF-8
content-length: 202
access-control-allow-origin: *
access-control-allow-methods: POST, PUT, DELETE, GET, OPTIONS
access-control-allow-headers: content-type, x-company-login, x-token, x-requested- with
x-xss-protection: 1; mode=block

RESPONSE: {
“result”: {
“require_confirm”: true,
“bookings”: [
{
“id”: “531”,
“event_id”: “5”,
“unit_id”: 1,
“client_id”: “599”,
“client_hash”: “d9501ade0b5e79bc983c4e41a4f90a0c”,
“start_date_time”: “2021-04-23 07:00:00”,
“end_date_time”: “2021-04-23 10:00:00”,
“time_offset”: “0”,
“is_confirmed”: “1”,
“require_payment”: true,
“code”: “1gabeqi12”,
“hash”: “2defdba264c20a3429f661ea4fc64dea”
}
],
“invoice”: {
“id”: 436,
“number”: “O-00000436”,
“datetime”: “2021-04-22 14:33:17”,
“due_datetime”: “2021-04-22 14:38:17”,
“payment_datetime”: null,
“amount”: 370,
“deposit”: 370,
“is_with_deposit_amount”: false,
“rest_amount”: 0,
“discount_amount”: 0,
“taxes”: [
{
“amount”: 33.6364,
“id”: 1,
“name”: “GST”,
“ratio”: 0.1,
“is_default”: true
}
],
“tax_amount”: 33.6364,
“currency”: “AUD”,
“client_id”: 599,
“description”: “”,
“payment_received”: false,
“payment_processor”: null,
“lines”: [
{
“booking_ids”: [
531
],
“bookings”: [
{
“id”: 531,
“code”: “1gabeqi12”,
“start_datetime”: “2021-04-23 07:00:00”,
“end_datetime”: “2021-04-23 10:00:00”,
“location_id”: null,
“category_id”: null,
“service_id”: 5,
“provider_id”: 1,
“client_id”: 599,
“duration”: null
}
],
“tickets”: ,
“deposit”: 340,
“is_with_deposit_amount”: false,
“description_string”: “Service: Premium Mobile Inspection (23-04-2021 07:00 AM, 1gabeqi12) x1 340.00 AUD”,
“id”: “735”,
“invoice_id”: 436,
“name”: “Premium Mobile Inspection (23-04-2021 07:00 AM, 1gabeqi12)”,
“type”: “booking”,
“discount_ratio”: 0,
“discount_amount”: 0,
“discount”: 0,
“price”: 340,
“final_price”: 340,
“qty”: 1,
“package_qty”: 0,
“tax”: {
“id”: 1,
“name”: “GST”,
“ratio”: 0.1,
“is_default”: true
},
“tax_ratio”: 0.1,
“tax_amount”: 30.9091,
“amount”: 340,
“rest_amount”: 0,
“currency”: “AUD”
},
{
“product_id”: 4,
“product”: {
“id”: 4,
“name”: “Car Valuation Report”,
“barcode”: null,
“description”: “”,
“price”: 30,
“currency”: “AUD”,
“tax_id”: “1”,
“tax”: {
“id”: 1,
“name”: “GST”,
“ratio”: 0.1,
“is_default”: true
},
“duration”: 0,
“type”: “attribute”
},
“booking_id”: 531,
“description_string”: “attribute: Car Valuation Report (Booking #1gabeqi12) x1 30.00 AUD”,
“id”: “736”,
“invoice_id”: 436,
“name”: “Car Valuation Report (Booking #1gabeqi12)”,
“type”: “product”,
“discount_ratio”: 0,
“discount_amount”: 0,
“discount”: 0,
“price”: 30,
“final_price”: 30,
“qty”: 1,
“package_qty”: 0,
“tax”: {
“id”: 1,
“name”: “GST”,
“ratio”: 0.1,
“is_default”: true
},
“tax_ratio”: 0.1,
“tax_amount”: 2.7273,
“amount”: 30,
“deposit”: 30,
“is_with_deposit_amount”: false,
“rest_amount”: 0,
“currency”: “AUD”
}
],
“status”: “new”,
“support_recurring_payment_method”: false,
“recurring_profile_id”: null,
“promotion_instances”: ,
“package_instances”: ,
“deposit_child_invoice”: null,
“deposit_parent_invoice”: null
}
},
“id”: “8”,
“jsonrpc”: “2.0”
}

AVALIABLESLOTS:

URL: https://user-api-v2.simplybook.me/admin/schedule/available-slots

METHOD: GET

QUERY: date=2021-04-23&service_id=5&provider_id=1&provider_id=2

HEADER: server: nginx
date: Thu, 22 Apr 2021 04:27:12 GMT
content-type: application/json; charset=UTF-8
content-length: 202
access-control-allow-origin: *
access-control-allow-methods: POST, PUT, DELETE, GET, OPTIONS
access-control-allow-headers: content-type, x-company-login, x-token, x-requested- with
x-xss-protection: 1; mode=block

RESPONSE:[
{
“id”: “2021-04-23 09:00:00”,
“date”: “2021-04-23”,
“time”: “09:00:00”
},
{
“id”: “2021-04-23 12:00:00”,
“date”: “2021-04-23”,
“time”: “12:00:00”
}
]

Redmine Admin wrote:

i see no problem above, you just booked a slot and it disappeared, seems correct behaviour

Fayaz Ahamed PA wrote:

There are two providers, when we book a slot for one provider, its only for that provider. When we try again with same slot for another provider, the API says the slot not available.

For eg: We pick 23 Apr as the date and book a time 7 AM (returned in API response), we again try 23 Apr as the date, but the 7 AM slot is not returned by API, it should return, right? because the other provider is available at that time and we send the provider ID in the request.

Redmine Admin wrote:

is this slot still bookable via web interface but not returned in API? If so, please give link

Fayaz Ahamed PA wrote:

Its not returning from API even from the Postman itself, also in our custom app http://159.65.145.204:3000.

Redmine Admin wrote:

i really have no idea what this means

Fayaz Ahamed PA wrote:

Let me share a video of the request and response from Postman. Which will explain better.

Fayaz Ahamed PA wrote:

I have attached a video of the issue, in the video, we get slots of two providers (7 & 12 o clock) and book an available slot for the first provider (for 7 o clock). And we get slots again for both providers, but the 7 o clock slot is not getting listed, as there is another provider available it should list 7 o clock again, right?

Redmine Admin wrote:

please get slots per each provider separately, hope it will solve the issue

Fayaz Ahamed PA wrote:

Unable to upload file, here is the video: http://dev.studioq.co.in/files/Available_Slots.webm

Dmytro Bondarev wrote:

Did you try to get slots separately? Is there free slot?

Fayaz Ahamed PA wrote:

Here is the video where both providers are free at a specific time, but the API returns different slots.
http://dev.studioq.co.in/files/Single_ProviderSlots.webm

Redmine Admin wrote:

that is clear on video provider 2 has some event/non working time till 9:00 and API returns correct data

Fayaz Ahamed PA wrote:

Thanks for the efforts, yes its the non-working time gave such results. Thanks again.