{
  "openapi": "3.0.1",
  "info": {
    "title": "Scoffable Partners API",
    "description": "Public API for Scoffable Partners",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partners-api.scoffable.com"
    }
  ],
  "tags": [
    {
      "name": "Orders",
      "description": "Fetch and amend orders"
    }
  ],
  "paths": {
    "/v1/orders/{id}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Retrieve an order",
        "description": "Get the current state of the order. Note that this is merely the state of the order at the time of the request. The order might be amended or cancelled after this time. ",
        "operationId": "getOrder",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Order not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "examples": {
                  "Successfully completed order, paid online for delivery": {
                    "description": "Successfully completed order, paid online for delivery",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "accepted",
                      "type": "delivery",
                      "placedAt": 1641038400000,
                      "acceptedAt": 1641038520000,
                      "deliveryFee": {
                        "amount": 350,
                        "currency": "GBP"
                      },
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 2399,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Set meal for 2",
                          "type": "product",
                          "optionCategories": [
                            {
                              "name": "Starters",
                              "selectedOptions": [
                                {
                                  "name": "Spring Rolls"
                                },
                                {
                                  "name": "Prawn Toast"
                                }
                              ]
                            },
                            {
                              "name": "Mains",
                              "selectedOptions": [
                                {
                                  "name": "Sweet and Sour Chicken Cantonese Style"
                                },
                                {
                                  "name": "Crispy Shredded Duck",
                                  "optionPrice": {
                                    "amount": 150,
                                    "currency": "GBP"
                                  }
                                }
                              ]
                            }
                          ],
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 1999,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "online",
                          "collectedBy": "scoffable",
                          "payment": {
                            "amount": 2399,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "deliveryProvider": "vendor"
                    }
                  },
                  "Successfully completed order, paid via cash on collection": {
                    "description": "Successfully completed order, paid via cash on collection",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "accepted",
                      "type": "collection",
                      "placedAt": 1641038400000,
                      "acceptedAt": 1641038520000,
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 2049,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Set meal for 2",
                          "type": "product",
                          "optionCategories": [
                            {
                              "name": "Starters",
                              "selectedOptions": [
                                {
                                  "name": "Spring Rolls"
                                },
                                {
                                  "name": "Prawn Toast"
                                }
                              ]
                            },
                            {
                              "name": "Mains",
                              "selectedOptions": [
                                {
                                  "name": "Sweet and Sour Chicken Cantonese Style"
                                },
                                {
                                  "name": "Crispy Shredded Duck",
                                  "optionPrice": {
                                    "amount": 150,
                                    "currency": "GBP"
                                  }
                                }
                              ]
                            }
                          ],
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 1999,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "cash",
                          "collectedBy": "vendor",
                          "payment": {
                            "amount": 2399,
                            "currency": "GBP"
                          }
                        }
                      ]
                    }
                  },
                  "Successfully completed order, part paid with a voucher": {
                    "description": "Successfully completed order, part paid with a voucher",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "accepted",
                      "type": "delivery",
                      "placedAt": 1641038400000,
                      "acceptedAt": 1641038520000,
                      "deliveryFee": {
                        "amount": 350,
                        "currency": "GBP"
                      },
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 2399,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Set meal for 2",
                          "type": "product",
                          "optionCategories": [
                            {
                              "name": "Starters",
                              "selectedOptions": [
                                {
                                  "name": "Spring Rolls"
                                },
                                {
                                  "name": "Prawn Toast"
                                }
                              ]
                            },
                            {
                              "name": "Mains",
                              "selectedOptions": [
                                {
                                  "name": "Sweet and Sour Chicken Cantonese Style"
                                },
                                {
                                  "name": "Crispy Shredded Duck",
                                  "optionPrice": {
                                    "amount": 150,
                                    "currency": "GBP"
                                  }
                                }
                              ]
                            }
                          ],
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 1999,
                            "currency": "GBP"
                          }
                        },
                        {
                          "id": "3f3324b7-0799-42be-acdf-e29366855e10",
                          "name": "Scoffable Promotion",
                          "type": "voucher",
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": -500,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": -500,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "cash",
                          "collectedBy": "vendor",
                          "payment": {
                            "amount": 1899,
                            "currency": "GBP"
                          }
                        },
                        {
                          "type": "voucher",
                          "collectedBy": "scoffable",
                          "payment": {
                            "amount": 500,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "deliveryProvider": "vendor"
                    }
                  },
                  "Order rejected": {
                    "description": "Order rejected",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "rejected",
                      "type": "delivery",
                      "placedAt": 1641038400000,
                      "deliveryFee": {
                        "amount": 350,
                        "currency": "GBP"
                      },
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 2399,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Set meal for 2",
                          "type": "product",
                          "optionCategories": [
                            {
                              "name": "Starters",
                              "selectedOptions": [
                                {
                                  "name": "Spring Rolls"
                                },
                                {
                                  "name": "Prawn Toast"
                                }
                              ]
                            },
                            {
                              "name": "Mains",
                              "selectedOptions": [
                                {
                                  "name": "Sweet and Sour Chicken Cantonese Style"
                                },
                                {
                                  "name": "Crispy Shredded Duck",
                                  "optionPrice": {
                                    "amount": 150,
                                    "currency": "GBP"
                                  }
                                }
                              ]
                            }
                          ],
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 1999,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "online",
                          "collectedBy": "scoffable",
                          "payment": {
                            "amount": 2399,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "deliveryProvider": "vendor"
                    }
                  },
                  "Order cancelled": {
                    "description": "Order cancelled",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "cancelled",
                      "type": "delivery",
                      "placedAt": 1641038400000,
                      "acceptedAt": 1641038520000,
                      "deliveryFee": {
                        "amount": 350,
                        "currency": "GBP"
                      },
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 2399,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Set meal for 2",
                          "type": "product",
                          "optionCategories": [
                            {
                              "name": "Starters",
                              "selectedOptions": [
                                {
                                  "name": "Spring Rolls"
                                },
                                {
                                  "name": "Prawn Toast"
                                }
                              ]
                            },
                            {
                              "name": "Mains",
                              "selectedOptions": [
                                {
                                  "name": "Sweet and Sour Chicken Cantonese Style"
                                },
                                {
                                  "name": "Crispy Shredded Duck",
                                  "optionPrice": {
                                    "amount": 150,
                                    "currency": "GBP"
                                  }
                                }
                              ]
                            }
                          ],
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 1999,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "online",
                          "collectedBy": "scoffable",
                          "payment": {
                            "amount": 2399,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "deliveryProvider": "vendor"
                    }
                  },
                  "Order containing a substitution": {
                    "description": "Order containing a substitution",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "accepted",
                      "type": "delivery",
                      "placedAt": 1641038400000,
                      "acceptedAt": 1641038520000,
                      "deliveryFee": {
                        "amount": 350,
                        "currency": "GBP"
                      },
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 799,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Galaxy 200g",
                          "type": "product",
                          "quantityOrdered": 1,
                          "quantityFulfilled": 0,
                          "price": {
                            "amount": 399,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 399,
                            "currency": "GBP"
                          },
                          "substitutionDetails": {
                            "substitutedBy": [
                              "5114d08f-bb16-4fad-b992-f43682665b40"
                            ]
                          }
                        },
                        {
                          "id": "5114d08f-bb16-4fad-b992-f43682665b40",
                          "name": "Dairy Milk 200g",
                          "type": "product",
                          "quantityOrdered": 0,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 399,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 399,
                            "currency": "GBP"
                          },
                          "substitutionDetails": {
                            "substitutedFor": [
                              "2d4f50ed-de8e-4296-b7c5-9b5704cc6240"
                            ]
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "online",
                          "collectedBy": "scoffable",
                          "payment": {
                            "amount": 799,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "deliveryProvider": "vendor"
                    }
                  },
                  "Order containing a price adjustment": {
                    "description": "Order containing a price adjustment",
                    "value": {
                      "id": 749274,
                      "version": 4,
                      "latestVersion": true,
                      "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                      "status": "accepted",
                      "type": "delivery",
                      "placedAt": 1641038400000,
                      "acceptedAt": 1641038520000,
                      "deliveryFee": {
                        "amount": 350,
                        "currency": "GBP"
                      },
                      "serviceFee": {
                        "amount": 50,
                        "currency": "GBP"
                      },
                      "total": {
                        "amount": 1999,
                        "currency": "GBP"
                      },
                      "items": [
                        {
                          "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                          "name": "Set meal for 2",
                          "type": "product",
                          "optionCategories": [
                            {
                              "name": "Starters",
                              "selectedOptions": [
                                {
                                  "name": "Spring Rolls"
                                },
                                {
                                  "name": "Prawn Toast"
                                }
                              ]
                            },
                            {
                              "name": "Mains",
                              "selectedOptions": [
                                {
                                  "name": "Sweet and Sour Chicken Cantonese Style"
                                },
                                {
                                  "name": "Crispy Shredded Duck",
                                  "optionPrice": {
                                    "amount": 150,
                                    "currency": "GBP"
                                  }
                                }
                              ]
                            }
                          ],
                          "quantityOrdered": 1,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 1999,
                            "currency": "GBP"
                          },
                          "priceAdjustmentDetails": {
                            "relatedPriceAdjustment": "18bcee32-48d7-444b-a374-866f1caa6d02"
                          }
                        },
                        {
                          "id": "18bcee32-48d7-444b-a374-866f1caa6d02",
                          "name": "Price match",
                          "type": "adjustment",
                          "quantityOrdered": 0,
                          "quantityFulfilled": 1,
                          "price": {
                            "amount": -400,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": -400,
                            "currency": "GBP"
                          },
                          "priceAdjustmentDetails": {
                            "itemsAdjusted": [
                              "2d4f50ed-de8e-4296-b7c5-9b5704cc6240"
                            ]
                          }
                        }
                      ],
                      "customerPayments": [
                        {
                          "type": "online",
                          "collectedBy": "scoffable",
                          "payment": {
                            "amount": 1999,
                            "currency": "GBP"
                          }
                        }
                      ],
                      "deliveryProvider": "vendor"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/orderUpdates": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Retrieve order updates",
        "description": "Returns a paginated list of updates to orders. Use the `nextPageId` from the response to fetch subsequent pages. Note that each response may include only a subset of the versions for a given order. For example, if an order has 16 versions, one page might only contain versions 3 and 4. By continuing to request pages using `pageId=<nextPageId>`, you can retrieve all versions incrementally. When `hasMore=false`, all available updates have been fetched.",
        "operationId": "getOrderUpdates",
        "parameters": [
          {
            "name": "pageId",
            "in": "query",
            "description": "Optional. Opaque token used to retrieve the next page of results. This value is returned by a previous request and should not be modified. If omitted, the earliest available page will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab"
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "Optional. Number of results to return per page. Defaults to 10 if not specified. Maximum allowed is 100.",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 10
            },
            "example": 10
          },
          {
            "name": "vendorIds",
            "in": "query",
            "description": "Optional. Filters results by vendor location id. If omitted, results will include orders for all vendors associated with the account.",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "orderIds",
            "in": "query",
            "description": "Optional. Filters results by the specified order IDs. If omitted, all orders associated with the account will be returned.",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          {
            "name": "fromTimestamp",
            "in": "query",
            "description": "Optional. Only returns results with a timestamp after this value. If omitted, results start from the earliest available entry.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "example": "2020-06-31T01:30:00.000+01:00"
          },
          {
            "name": "minAgeMinutes",
            "in": "query",
            "description": "Optional. Filters out updates from the most recent X minutes. Since most updates occur early in an order's lifecycle, setting this can reduce processing overhead. If minimizing processing is important, Scoffable recommends using a value between 60 and 120 minutes. Use the `latestUpdate` flag to determine whether this is the latest update for an order and should be processed. Note that setting this value will delay the visibility of new orders.",
            "required": false,
            "schema": {
              "maximum": 1440,
              "minimum": 1,
              "type": "integer",
              "format": "int32"
            },
            "example": 120
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                },
                "examples": {
                  "Page with orders (more pages available)": {
                    "description": "Page with orders (more pages available)",
                    "value": {
                      "hasMore": true,
                      "data": [
                        {
                          "id": 749274,
                          "version": 4,
                          "latestVersion": true,
                          "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                          "status": "accepted",
                          "type": "delivery",
                          "placedAt": 1641038400000,
                          "acceptedAt": 1641038520000,
                          "deliveryFee": {
                            "amount": 350,
                            "currency": "GBP"
                          },
                          "serviceFee": {
                            "amount": 50,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 2399,
                            "currency": "GBP"
                          },
                          "items": [
                            {
                              "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                              "name": "Set meal for 2",
                              "type": "product",
                              "optionCategories": [
                                {
                                  "name": "Starters",
                                  "selectedOptions": [
                                    {
                                      "name": "Spring Rolls"
                                    },
                                    {
                                      "name": "Prawn Toast"
                                    }
                                  ]
                                },
                                {
                                  "name": "Mains",
                                  "selectedOptions": [
                                    {
                                      "name": "Sweet and Sour Chicken Cantonese Style"
                                    },
                                    {
                                      "name": "Crispy Shredded Duck",
                                      "optionPrice": {
                                        "amount": 150,
                                        "currency": "GBP"
                                      }
                                    }
                                  ]
                                }
                              ],
                              "quantityOrdered": 1,
                              "quantityFulfilled": 1,
                              "price": {
                                "amount": 1999,
                                "currency": "GBP"
                              },
                              "total": {
                                "amount": 1999,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "customerPayments": [
                            {
                              "type": "online",
                              "collectedBy": "scoffable",
                              "payment": {
                                "amount": 2399,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "deliveryProvider": "vendor"
                        },
                        {
                          "id": 47387,
                          "version": 4,
                          "latestVersion": true,
                          "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                          "status": "rejected",
                          "type": "delivery",
                          "placedAt": 1641038400000,
                          "deliveryFee": {
                            "amount": 350,
                            "currency": "GBP"
                          },
                          "serviceFee": {
                            "amount": 50,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 2399,
                            "currency": "GBP"
                          },
                          "items": [
                            {
                              "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                              "name": "Set meal for 2",
                              "type": "product",
                              "optionCategories": [
                                {
                                  "name": "Starters",
                                  "selectedOptions": [
                                    {
                                      "name": "Spring Rolls"
                                    },
                                    {
                                      "name": "Prawn Toast"
                                    }
                                  ]
                                },
                                {
                                  "name": "Mains",
                                  "selectedOptions": [
                                    {
                                      "name": "Sweet and Sour Chicken Cantonese Style"
                                    },
                                    {
                                      "name": "Crispy Shredded Duck",
                                      "optionPrice": {
                                        "amount": 150,
                                        "currency": "GBP"
                                      }
                                    }
                                  ]
                                }
                              ],
                              "quantityOrdered": 1,
                              "quantityFulfilled": 1,
                              "price": {
                                "amount": 1999,
                                "currency": "GBP"
                              },
                              "total": {
                                "amount": 1999,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "customerPayments": [
                            {
                              "type": "online",
                              "collectedBy": "scoffable",
                              "payment": {
                                "amount": 2399,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "deliveryProvider": "vendor"
                        },
                        {
                          "id": 974359,
                          "version": 4,
                          "latestVersion": true,
                          "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                          "status": "accepted",
                          "type": "collection",
                          "placedAt": 1641038400000,
                          "acceptedAt": 1641038520000,
                          "serviceFee": {
                            "amount": 50,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 2049,
                            "currency": "GBP"
                          },
                          "items": [
                            {
                              "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                              "name": "Set meal for 2",
                              "type": "product",
                              "optionCategories": [
                                {
                                  "name": "Starters",
                                  "selectedOptions": [
                                    {
                                      "name": "Spring Rolls"
                                    },
                                    {
                                      "name": "Prawn Toast"
                                    }
                                  ]
                                },
                                {
                                  "name": "Mains",
                                  "selectedOptions": [
                                    {
                                      "name": "Sweet and Sour Chicken Cantonese Style"
                                    },
                                    {
                                      "name": "Crispy Shredded Duck",
                                      "optionPrice": {
                                        "amount": 150,
                                        "currency": "GBP"
                                      }
                                    }
                                  ]
                                }
                              ],
                              "quantityOrdered": 1,
                              "quantityFulfilled": 1,
                              "price": {
                                "amount": 1999,
                                "currency": "GBP"
                              },
                              "total": {
                                "amount": 1999,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "customerPayments": [
                            {
                              "type": "cash",
                              "collectedBy": "vendor",
                              "payment": {
                                "amount": 2399,
                                "currency": "GBP"
                              }
                            }
                          ]
                        }
                      ],
                      "nextPageId": "bd920def-0caf-41b3-957d-1259b82a376f"
                    }
                  },
                  "Page with orders (no more pages available)": {
                    "description": "Page with orders (no more pages available)",
                    "value": {
                      "hasMore": false,
                      "data": [
                        {
                          "id": 749274,
                          "version": 4,
                          "latestVersion": true,
                          "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                          "status": "accepted",
                          "type": "delivery",
                          "placedAt": 1641038400000,
                          "acceptedAt": 1641038520000,
                          "deliveryFee": {
                            "amount": 350,
                            "currency": "GBP"
                          },
                          "serviceFee": {
                            "amount": 50,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 2399,
                            "currency": "GBP"
                          },
                          "items": [
                            {
                              "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                              "name": "Set meal for 2",
                              "type": "product",
                              "optionCategories": [
                                {
                                  "name": "Starters",
                                  "selectedOptions": [
                                    {
                                      "name": "Spring Rolls"
                                    },
                                    {
                                      "name": "Prawn Toast"
                                    }
                                  ]
                                },
                                {
                                  "name": "Mains",
                                  "selectedOptions": [
                                    {
                                      "name": "Sweet and Sour Chicken Cantonese Style"
                                    },
                                    {
                                      "name": "Crispy Shredded Duck",
                                      "optionPrice": {
                                        "amount": 150,
                                        "currency": "GBP"
                                      }
                                    }
                                  ]
                                }
                              ],
                              "quantityOrdered": 1,
                              "quantityFulfilled": 1,
                              "price": {
                                "amount": 1999,
                                "currency": "GBP"
                              },
                              "total": {
                                "amount": 1999,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "customerPayments": [
                            {
                              "type": "online",
                              "collectedBy": "scoffable",
                              "payment": {
                                "amount": 2399,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "deliveryProvider": "vendor"
                        },
                        {
                          "id": 47387,
                          "version": 4,
                          "latestVersion": true,
                          "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                          "status": "rejected",
                          "type": "delivery",
                          "placedAt": 1641038400000,
                          "deliveryFee": {
                            "amount": 350,
                            "currency": "GBP"
                          },
                          "serviceFee": {
                            "amount": 50,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 2399,
                            "currency": "GBP"
                          },
                          "items": [
                            {
                              "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                              "name": "Set meal for 2",
                              "type": "product",
                              "optionCategories": [
                                {
                                  "name": "Starters",
                                  "selectedOptions": [
                                    {
                                      "name": "Spring Rolls"
                                    },
                                    {
                                      "name": "Prawn Toast"
                                    }
                                  ]
                                },
                                {
                                  "name": "Mains",
                                  "selectedOptions": [
                                    {
                                      "name": "Sweet and Sour Chicken Cantonese Style"
                                    },
                                    {
                                      "name": "Crispy Shredded Duck",
                                      "optionPrice": {
                                        "amount": 150,
                                        "currency": "GBP"
                                      }
                                    }
                                  ]
                                }
                              ],
                              "quantityOrdered": 1,
                              "quantityFulfilled": 1,
                              "price": {
                                "amount": 1999,
                                "currency": "GBP"
                              },
                              "total": {
                                "amount": 1999,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "customerPayments": [
                            {
                              "type": "online",
                              "collectedBy": "scoffable",
                              "payment": {
                                "amount": 2399,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "deliveryProvider": "vendor"
                        },
                        {
                          "id": 974359,
                          "version": 4,
                          "latestVersion": true,
                          "vendorId": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab",
                          "status": "accepted",
                          "type": "collection",
                          "placedAt": 1641038400000,
                          "acceptedAt": 1641038520000,
                          "serviceFee": {
                            "amount": 50,
                            "currency": "GBP"
                          },
                          "total": {
                            "amount": 2049,
                            "currency": "GBP"
                          },
                          "items": [
                            {
                              "id": "2d4f50ed-de8e-4296-b7c5-9b5704cc6240",
                              "name": "Set meal for 2",
                              "type": "product",
                              "optionCategories": [
                                {
                                  "name": "Starters",
                                  "selectedOptions": [
                                    {
                                      "name": "Spring Rolls"
                                    },
                                    {
                                      "name": "Prawn Toast"
                                    }
                                  ]
                                },
                                {
                                  "name": "Mains",
                                  "selectedOptions": [
                                    {
                                      "name": "Sweet and Sour Chicken Cantonese Style"
                                    },
                                    {
                                      "name": "Crispy Shredded Duck",
                                      "optionPrice": {
                                        "amount": 150,
                                        "currency": "GBP"
                                      }
                                    }
                                  ]
                                }
                              ],
                              "quantityOrdered": 1,
                              "quantityFulfilled": 1,
                              "price": {
                                "amount": 1999,
                                "currency": "GBP"
                              },
                              "total": {
                                "amount": 1999,
                                "currency": "GBP"
                              }
                            }
                          ],
                          "customerPayments": [
                            {
                              "type": "cash",
                              "collectedBy": "vendor",
                              "payment": {
                                "amount": 2399,
                                "currency": "GBP"
                              }
                            }
                          ]
                        }
                      ],
                      "nextPageId": "2af76715-dc46-4526-bc12-21fa568fd1b6"
                    }
                  },
                  "No results at all": {
                    "description": "No results at all",
                    "value": {
                      "hasMore": false,
                      "data": []
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "CustomerPayment": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "The type of payment collected",
            "example": "online",
            "enum": [
              "online",
              "voucher",
              "cash"
            ]
          },
          "collectedBy": {
            "type": "string",
            "description": "Who is receiving the funds from the consumer",
            "example": "scoffable",
            "enum": [
              "scoffable",
              "vendor"
            ]
          },
          "payment": {
            "$ref": "#/components/schemas/MonetaryAmount"
          }
        },
        "description": "The payments made for the order, including who collected them (Scoffable or the vendor)."
      },
      "MonetaryAmount": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "description": "The amount in the currency specified. Note that the amount will be represented as a whole number from the least significant digit (e.g 523 USD = $5.23)",
            "format": "int64",
            "example": 1099
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 Currency code e.g 'GBP'",
            "example": "GBP"
          }
        },
        "description": "The amount of the payment"
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique ID of the order.",
            "format": "int64",
            "example": 8948843
          },
          "version": {
            "type": "integer",
            "description": "The version of this order. The version may increment even when no visible changes occur, due to internal processing.",
            "format": "int64",
            "example": 4
          },
          "latestVersion": {
            "type": "boolean",
            "description": "Indicates whether this is the latest version of the order known to Scoffable.",
            "example": true
          },
          "vendorId": {
            "type": "string",
            "description": "The unique ID of the vendor location processing the order.",
            "example": "ebd97b79-02b1-41e8-94b4-7821ca2c77ab"
          },
          "status": {
            "type": "string",
            "description": "The high-level status of the order. Possible values:<ul><li><b>placed</b>: The initial status of the order.</li><li><b>rejected</b>: The order (which was never accepted) has been cancelled.</li><li><b>accepted</b>: The order was accepted by the vendor location.</li><li><b>cancelled</b>: The order (previously accepted) has been cancelled.</li></ul>",
            "example": "accepted",
            "enum": [
              "placed",
              "rejected",
              "accepted",
              "cancelled"
            ]
          },
          "type": {
            "type": "string",
            "description": "The fulfillment method of the order. Possible values:<ul><li><b>collection</b>: The consumer will pick up the order from the vendor.</li><li><b>delivery</b>: The order will be delivered to the consumer's address.</li></ul>",
            "example": "delivery",
            "enum": [
              "collection",
              "delivery"
            ]
          },
          "placedAt": {
            "type": "string",
            "description": "The timestamp when the order was placed by the consumer.",
            "format": "date-time"
          },
          "acceptedAt": {
            "type": "string",
            "description": "The timestamp when the order was accepted by the vendor. Only present for accepted orders.",
            "format": "date-time"
          },
          "cancelledAt": {
            "type": "string",
            "description": "The timestamp when the order was cancelled. Only present for rejected or cancelled orders.",
            "format": "date-time"
          },
          "dispatchedAt": {
            "type": "string",
            "description": "The timestamp when the order was dispatched. Only present for delivery orders with tracking.",
            "format": "date-time"
          },
          "deliveredAt": {
            "type": "string",
            "description": "The timestamp when the order was delivered to the consumer. Only present for delivery orders with tracking.",
            "format": "date-time"
          },
          "returnedAt": {
            "type": "string",
            "description": "The timestamp when the order was returned to the vendor. Only present for delivery orders with tracking.",
            "format": "date-time"
          },
          "deliveryFee": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "serviceFee": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "total": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "items": {
            "type": "array",
            "description": "The line items in the order. May include products, discounts, or vouchers.",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "customerPayments": {
            "type": "array",
            "description": "The payments made for the order, including who collected them (Scoffable or the vendor).",
            "items": {
              "$ref": "#/components/schemas/CustomerPayment"
            }
          },
          "deliveryProvider": {
            "type": "string",
            "description": "Indicates who provided the delivery service.",
            "example": "vendor",
            "enum": [
              "vendor",
              "uber"
            ]
          }
        }
      },
      "OrderItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique identifier for this item."
          },
          "name": {
            "type": "string",
            "description": "The name of the item"
          },
          "ageRestricted": {
            "type": "boolean",
            "description": "Is this item subject to an age restriction check?"
          },
          "barcode": {
            "type": "string",
            "description": "An optional item barcode"
          },
          "vendorReference": {
            "type": "string",
            "description": "An optional item reference that can be used to identify the item at the vendor"
          },
          "type": {
            "type": "string",
            "description": "What this line item is <ul><li>product: A physical product that has been ordered</li><li>offer: e.g You've added 2 items and you get the third free ... the offer entry would be a price negation of the third item.</li><li>voucher: The consumer has used a promotional voucher code</li><li>adjustment: An adjustment made after the order was placed (defective products, price matching etc).</li></ul>",
            "enum": [
              "product",
              "offer",
              "voucher",
              "adjustment"
            ]
          },
          "optionCategories": {
            "type": "array",
            "description": "If this item can be customised, this contains the categories of options that can be chosen (e.g 'Toppings', 'Sides' etc)",
            "items": {
              "$ref": "#/components/schemas/OrderItemOptionCategory"
            }
          },
          "quantityOrdered": {
            "type": "integer",
            "description": "The quantity of this item that was ordered.",
            "format": "int32"
          },
          "quantityFulfilled": {
            "type": "integer",
            "description": "The quantity of this item that was supplied to the customer.",
            "format": "int32"
          },
          "price": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "total": {
            "$ref": "#/components/schemas/MonetaryAmount"
          },
          "priceAdjustmentDetails": {
            "$ref": "#/components/schemas/OrderItemPriceAdjustmentDetails"
          },
          "substitutionDetails": {
            "$ref": "#/components/schemas/OrderItemSubstitutionDetails"
          }
        },
        "description": "The line items in the order. May include products, discounts, or vouchers."
      },
      "OrderItemOption": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the selected option (e.g 'Chips')"
          },
          "optionPrice": {
            "$ref": "#/components/schemas/MonetaryAmount"
          }
        },
        "description": "The options that were selected (e.g 'Plain Chips', 'Peri-Peri Chips', 'Noodles' etc)"
      },
      "OrderItemOptionCategory": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the group of options (e.g 'Sides', 'Toppings', 'Drinks' etc)."
          },
          "selectedOptions": {
            "type": "array",
            "description": "The options that were selected (e.g 'Plain Chips', 'Peri-Peri Chips', 'Noodles' etc)",
            "items": {
              "$ref": "#/components/schemas/OrderItemOption"
            }
          }
        },
        "description": "If this item can be customised, this contains the categories of options that can be chosen (e.g 'Toppings', 'Sides' etc)"
      },
      "OrderItemPriceAdjustmentDetails": {
        "type": "object",
        "properties": {
          "itemsAdjusted": {
            "type": "array",
            "description": "If this item is an adjustment, this contains a list of items that this adjustment relates to",
            "items": {
              "type": "string",
              "description": "If this item is an adjustment, this contains a list of items that this adjustment relates to"
            }
          },
          "relatedPriceAdjustment": {
            "type": "string",
            "description": "If this item is a product which has been price adjusted, this is the associated adjustment id"
          }
        },
        "description": "If the price of this item was adjusted after the order was placed, this contains further information"
      },
      "OrderItemSubstitutionDetails": {
        "type": "object",
        "properties": {
          "substitutedBy": {
            "type": "array",
            "description": "List of item ids that this item has been replaced by",
            "items": {
              "type": "string",
              "description": "List of item ids that this item has been replaced by"
            }
          },
          "substitutedFor": {
            "type": "array",
            "description": "List of item ids that this item replaces",
            "items": {
              "type": "string",
              "description": "List of item ids that this item replaces"
            }
          }
        },
        "description": "If this item was substituted by another item / substitutes an item, this contains further information"
      },
      "Page": {
        "type": "object",
        "properties": {
          "hasMore": {
            "type": "boolean",
            "description": "Whether there are more results to fetch after this page",
            "example": true
          },
          "data": {
            "type": "array",
            "description": "The list of results in the page",
            "items": {
              "type": "object",
              "description": "The list of results in the page"
            }
          },
          "nextPageId": {
            "type": "string",
            "description": "The id to use for fetching the next page of results",
            "example": "2512c910-57b0-4883-b3e3-5ff95ffab822"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "in": "header",
        "scheme": "bearer",
        "bearerFormat": "Token"
      }
    }
  }
}
