...
And user this function useEffect for get results of delivery:
...
The const deliveryRestaurantData
in line 529 have the data about the restaurant, and this information comes in a delivery query of GraphQl useDeliveryRestaurantLazyQuery
:
...
File: src/functions/graphql/resolvers/restaurant.ts
In this file, have this function deliveryRestaurant
...
We need to pass some information for work in studio apollo or postman, this is an example for use in this query, this example work in PLK ES DEV.
Code Block |
---|
{
"dropoff": {
"addressLine1": "Vía Hispanidad 12",
"city": "Zaragoza",
"state": "AR",
"streetNumber": "12",
"route": "Vía Hispanidad",
"zip": "50009",
"country": "ESP",
"latitude": 41.63374590000001,
"longitude": -0.9082201,
"phoneNumber": "02398565666"
},
"searchRadius": 9656.04,
"platform": "web",
} |
Response of success is a big data, for this response we need to call the query with result valid and between hours work valid:
Code Block | ||
---|---|---|
| ||
{
"data": {
"deliveryRestaurant": {
"deliverySurchargeFeeCents": 0,
"nextEarliestOpen": null,
"quote": "QUOTE_SUCCESSFUL",
"quoteId": "d9227070-a23e-46e9-9d82-6a3f535e29ec",
"restaurant": {
"drinkStationType": null,
"id": "cbf4d9b3-35cf-402e-9a7b-6ffdbeff1c3c",
"_id": "cbf4d9b3-35cf-402e-9a7b-6ffdbeff1c3c",
"storeId": "1111",
"isAvailable": true,
"posVendor": "PARTNER",
"chaseMerchantId": null,
"curbsideHours": {
"monOpen": "00:01:00",
"monClose": "23:59:00",
"tueOpen": "00:01:00",
"tueClose": "23:59:00",
"wedOpen": "00:01:00",
"wedClose": "23:59:00",
"thrOpen": "00:01:00",
"thrClose": "23:59:00",
"friOpen": "00:01:00",
"friClose": "23:59:00",
"satOpen": "00:01:00",
"satClose": "23:59:00",
"sunOpen": "00:01:00",
"sunClose": "23:59:00"
},
"deliveryHours": {
"monOpen": "00:01:00",
"monClose": "23:59:00",
"tueOpen": "00:01:00",
"tueClose": "23:59:00",
"wedOpen": "00:01:00",
"wedClose": "23:59:00",
"thrOpen": "00:01:00",
"thrClose": "23:59:00",
"friOpen": "10:01:00",
"friClose": "23:59:00",
"satOpen": "00:01:00",
"satClose": "23:59:00",
"sunOpen": "00:01:00",
"sunClose": "23:59:00"
},
"diningRoomHours": {
"monOpen": "00:01:00",
"monClose": "23:59:00",
"tueOpen": "00:01:00",
"tueClose": "23:59:00",
"wedOpen": "00:01:00",
"wedClose": "23:59:00",
"thrOpen": "00:02:00",
"thrClose": "23:59:00",
"friOpen": "00:01:00",
"friClose": "23:59:00",
"satOpen": "00:01:00",
"satClose": "23:59:00",
"sunOpen": "00:01:00",
"sunClose": "23:59:00"
},
"distanceInMiles": null,
"driveThruHours": {
"monOpen": "00:01:00",
"monClose": "23:59:00",
"tueOpen": "00:01:00",
"tueClose": "23:59:00",
"wedOpen": "00:01:00",
"wedClose": "23:59:00",
"thrOpen": "00:01:00",
"thrClose": "23:59:00",
"friOpen": "00:01:00",
"friClose": "23:59:00",
"satOpen": "00:01:00",
"satClose": "23:59:00",
"sunOpen": "00:01:00",
"sunClose": "23:59:00"
},
"driveThruLaneType": null,
"email": null,
"environment": null,
"franchiseGroupId": null,
"franchiseGroupName": "Burger King ES",
"frontCounterClosed": null,
"hasBreakfast": null,
"hasBurgersForBreakfast": null,
"hasCatering": null,
"hasCurbside": true,
"hasDelivery": true,
"hasDineIn": true,
"hasDriveThru": true,
"hasTableService": true,
"hasLateNightMenu": false,
"hasMobileOrdering": true,
"hasParking": null,
"hasPlayground": null,
"hasTakeOut": true,
"hasWifi": null,
"hasLoyalty": null,
"isDarkKitchen": null,
"isFavorite": false,
"isHalal": null,
"isRecent": false,
"latitude": 41.6333797,
"longitude": -0.9109282,
"mobileOrderingStatus": "dev",
"name": "ES Lab Restaurant Partner API",
"number": "1111",
"parkingType": null,
"phoneNumber": "918-319-5008",
"physicalAddress": {
"address1": "Vía de la Hispanidad 15",
"address2": null,
"city": "Zaragoza",
"country": "Spain",
"postalCode": "50009",
"stateProvince": "Zaragoza",
"stateProvinceShort": null
},
"playgroundType": null,
"pos": {
"vendor": "PARTNER"
},
"posRestaurantId": null,
"restaurantImage": null,
"status": "Open",
"restaurantPosData": {
"_id": "e1f87ccb-0293-428f-8080-423e943d4a4c"
},
"vatNumber": null
},
"storeStatus": "OPEN"
}
}
} |
But in case the restaurant is closed, the information is every null and the status is NO_DELIVERY, and this is WRONG, because the restaurant has closed and no unavailable, the status should be CLOSED:
Code Block |
---|
{
"data": {
"deliveryRestaurant": {
"deliverySurchargeFeeCents": 0,
"nextEarliestOpen": null,
"quote": "QUOTE_UNAVAILABLE",
"quoteId": null,
"restaurant": {
"drinkStationType": null,
"id": null,
"_id": null,
"storeId": null,
"isAvailable": false,
"posVendor": null,
"chaseMerchantId": null,
"curbsideHours": null,
"deliveryHours": null,
"diningRoomHours": null,
"distanceInMiles": null,
"driveThruHours": null,
"driveThruLaneType": null,
"email": null,
"environment": null,
"franchiseGroupId": null,
"franchiseGroupName": null,
"frontCounterClosed": null,
"hasBreakfast": null,
"hasBurgersForBreakfast": null,
"hasCatering": null,
"hasCurbside": null,
"hasDelivery": null,
"hasDineIn": null,
"hasDriveThru": null,
"hasTableService": null,
"hasLateNightMenu": null,
"hasMobileOrdering": null,
"hasParking": null,
"hasPlayground": null,
"hasTakeOut": null,
"hasWifi": null,
"hasLoyalty": null,
"isDarkKitchen": null,
"isFavorite": false,
"isHalal": null,
"isRecent": false,
"latitude": null,
"longitude": null,
"mobileOrderingStatus": "temporary_unavailable",
"name": null,
"number": null,
"parkingType": null,
"phoneNumber": null,
"physicalAddress": null,
"playgroundType": null,
"pos": null,
"posRestaurantId": null,
"restaurantImage": null,
"status": null,
"restaurantPosData": null,
"vatNumber": null
},
"storeStatus": "NO_DELIVERY"
}
}
} |