Skip to content

Instantly share code, notes, and snippets.

@pllearns
Created November 8, 2022 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pllearns/e7f5af91ac3d8b8f6216def9d74ea74f to your computer and use it in GitHub Desktop.
Save pllearns/e7f5af91ac3d8b8f6216def9d74ea74f to your computer and use it in GitHub Desktop.
Order Controller Instructions For Review

Order Controller API Description

The order controller needs to take coffee orders from multiple delivery apps and send those orders to the coffee robot. Note that all of these APIs need to know the menu.

Preferably, an API will be written as the controller that will have simple REST for:

  • Getting an Order
  • Getting steps to make the order
  • Finalizing the order

Simple code example:

  coffeeBot.receiveOrder()
  coffeeBot.startOrder()
  coffeeBot.finishOrder()

Additionally, the receiveOrder method should include options for multiple delivery services

  const receiveOrder = (order) => {
    if order.source = `uber` {
      return { order: uberOrderObj }
    }
      
    if order.source = `doorDash` {
      return { order: ddOrderObj }
    }
    
    return order
  }

For each API, you will need an access key and/or a JWT.

Note that all GET requests for Orders need to happen only after order has been accepted

Uber API - GET Developers

  https://api.uber.com/v2/eats/order/{order_id}

Response needed

  {
    "cart": {
      "items": [
        {
          "id",
          "instance_id",
          "title",
          "external_data",
          "special_instructions",
          "quantity"
        },
        "taxInfo": {
          "labels": [
            "TEMP",
            "CAT_COFFEE"
          ]
        },
        {
          "selected_modifier_groups": [
            "id",
            "title",
            "external_data",
            "selected_items"
          ]
        }
      ]
    }
  }

Door Dash API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment