# Third party

# Introduction

Third party businesses with a "valid token", can perform a number of actions on the system such as:

# Create a third party token

A token should be created for authentication purposes, this token will be sent with every request made by a business to perform any action. Only a "label" parameter is sent to create a token, as seen below:

Param Required? Description
label Yes A string value to identify the generated token.

See sample request

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: url,
                            data: {
                                label: "blue"
                            }
                        });
                    }
                
            

# View Orders

The third party business can view their restaurant or store orders by sending a request like the one below:

See sample request

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/restaurant/order/me`,
                            data: {
                                token: "eyJpdiPSIsInZhbHVlIjoiV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ...",
                                restaurant_id: "123457775yhii5e3"
                            }
                        });
                    }
                
            

For store orders:

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/store/order/me`,
                            data: {
                                token: "eyJpdiIc9PSIsInZhbHVlIjoiV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ...",
                                store_id: "123457775yhii5e3"
                            }
                        });
                    }
                
            

#Mark order as delivered

The third party business can mark orders as delivered by sending a request like the one below:

See sample request

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/restaurant/order/mark/delivered`,
                            data: {
                                token: "eyJpdiI6IlSIsInZhbHVlIjoiV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ...",
                                id: "123457775yhii5e3",
                                properties: "1"
                            }
                        });
                    }
                
            

For store orders:

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/store/order/mark/delivered`,
                            data: {
                                token: "eyJpdiI6IlVCMV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ...",
                                id: "123457775yhii5e3",
                                properties: "1"
                            }
                        });
                    }
                
            

#Mark order as closed

The third party business can mark orders as closed by sending a request like the one below:

See sample request

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/restaurant/order/mark/closed`,
                            data: {
                                token: "eyJpdiI6IlSIsInZhbHVlIjoiV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ...",
                                id: "123457775yhii5e3",
                                properties: "1"
                            }
                        });
                    }
                
            

For store orders:

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/store/order/mark/closed`,
                            data: {
                                token: "eyJpdiI6IlVCMV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ...",
                                id: "123457775yhii5e3",
                                properties: "1"
                            }
                        });
                    }
                
            

# List Businesses

To list management approved businesses, send a sample request like the following:

See sample request

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/business/list`,
                            data: {
                                token: "eyJpdiI6IlSIsInZhbHVlIjoiV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ..."
                            }
                        });
                    }
                
            

# View Employee Location

For a third party business to view an employees' location, they should send an http request like:

See sample request

                
                    const createOrder = async () => {
                        const res = await axios({
                            method: post,
                            url: `${base_url}/api/third-party/employee/locate`,
                            data: {
                                token: "eyJpdiI6IlSIsInZhbHVlIjoiV1hSSDZDdml0RHVLMW9GK0JTcDhqYlBPd1BCU09pZWd0aDBlV3BueVZhZ..."
                                id: "53465e675eiei65e4675", //employee id
                                business_id: "5464754ut66e654"
                            }
                        });
                    }