Order Accept
Accepting Orders
Accepting an Order is a simple mutation that requires only the uuidfor the order that’s to be accepted. To be automatically be informed when an order has been submitted and can be accepted please see Subscribing to Order Notifications .
Mutation
mutation AcceptOrder($orderId: ID!, $acceptModification: Boolean) {
acceptOrder(orderId: $orderId, acceptModification: $acceptModification) {
order {
uuid
lifecycle {
orderIsCurrently
}
}
}
}Variables
{
"orderId": "your-ezcater-order-id",
"acceptModification": true
}Arguments
Argument Name | Description |
|---|---|
orderId: ID! | The ezCater order UUID that is provided within the payload of Order subscription notifications. |
acceptModification: Boolean = false | A boolean representing whether a modification to an order is accepted. acceptModification: true is required when accepting an order modification. |
Return Type
Returns an AcceptOrderPayload.
Successful Responses
When the AcceptOrder mutation succeeds you can expect the response payload to look like:
{
"data": {
"acceptOrder": {
"order": {
"uuid": "your-ezcater-order-id",
"lifecycle": {
"orderIsCurrently": "accepted"
}
}
}
}
}You will also receive the accepted order event notification shortly afterwards, if you choose to subscribe to it via Subscription Create.
Failure Responses
AcceptOrder calls may fail for a variety of reasons: the order not being found, or the feature not being enabled for your brand. In the event that an AcceptOrder call fails, one of the below errors may be returned.
404 Couldn’t find Order
You will get a 404 error when the specified order couldn’t be found.
{
"errors": [
{
"message": "Couldn't find Order",
"path": [
"acceptOrder"
],
"extensions": {
"type": "request",
"statusCode": 404,
"serviceName": "orders-public",
"code": "DOWNSTREAM_SERVICE_ERROR",
"exception": {
"message": "Couldn't find Order",
"locations": [
{
"line": 1,
"column": 54
}
],
"path": [
"acceptOrder"
]
}
}
}
],
"data": {
"acceptOrder": null
}
}403 Unauthorized
You will get a 403 error when the API user account doesn’t have permission to perform this action for this caterer location.
{
"errors": [
{
"message": "You are not authorized to access this data",
"path": [
"acceptOrder"
],
"extensions": {
"type": "request",
"statusCode": 403,
"serviceName": "orders-public",
"code": "DOWNSTREAM_SERVICE_ERROR",
"exception": {
"message": "You are not authorized to access this data",
"locations": [
{
"line": 1,
"column": 54
}
],
"path": [
"acceptOrder"
]
}
}
}
],
"data": {
"acceptOrder": null
}
}Feature Not Enabled (feature_not_enabled)
You will get this error if this API feature has not yet been enabled for your brand.
{
"data": {
"acceptOrder": null
},
"errors": [
{
"message": "Feature not enabled for the caterer associated with this order",
"locations": [
{
"line": 4,
"column": 3
}
],
"path": [
"acceptOrder"
],
"extensions": {
"type": "summary",
"code": "feature_not_enabled"
}
}
]
}Invalid State Transition (invalid_state_transition)
You will get this error when the order is no longer in a valid state to be accepted (the order hasn’t been submitted yet; the customer may have canceled it; it may have already been accepted or rejected by API or one of the other channels for accepting/rejecting orders).
This error can also occur when attempting to accept an order modification without providing the argument "acceptModification": true.
{
"errors": [
{
"message": "Sorry, we were unable to accept this order.",
"path": [
"acceptOrder"
],
"extensions": {
"type": "summary",
"code": "invalid_state_transition",
"serviceName": "orders-public",
"exception": {
"message": "Sorry, we were unable to accept this order.",
"locations": [
{
"line": 1,
"column": 54
}
],
"path": [
"acceptOrder"
]
}
}
}
],
"data": {
"acceptOrder": null
}
}