Order statuses

1 - Waiting for acceptance
2 - Accepted, waiting for pay
3 - Payment proceed
4 - Accepted, paid
5 - Closed
6 - Cancelled
7 - Rejected

GET ORDER - GET /order/{id}

Request:

/order/5

Response:

{
    "status": "ok",
    "data": {
        "id": 1,
        "created": "2020-12-16T00:00:00.000+01:00",
        "start": "2020-12-16T00:00:00.000+01:00",
        "end": "2020-12-23T00:00:00.000+01:00",
        "price": "350",
        "status": 2,
        "number": "2020/12/18/1",
        "landlord": {...},
        "client": {...},
        "property": {...},
    }
}

GET LANDLORD ORDERS - GET /order/list/landlord

Request:

/order/list/landlord

Response:

{
    "status": "ok",
    "data": [
        {
            "id": 14,
            "created": "2021-07-13T13:51:55.000+02:00",
            "start": "2021-12-01T00:00:00.000+01:00",
            "end": "2021-12-05T00:00:00.000+01:00",
            "price": "21",
            "status": 1,
            "number": "2021/07/13/1",
            "landlord": {...},
            "client": {...},
            "property": {...},
        },
        {
            "id": 15,
            "created": "2021-07-13T14:20:49.000+02:00",
            "start": "2021-12-08T00:00:00.000+01:00",
            "end": "2021-12-10T00:00:00.000+01:00",
            "price": "12",
            "status": 1,
            "number": "2021/07/13/1",
            "landlord": {...},
            "client": {...},
            "property": {...},
        }
    ]
}

GET CLIENT ORDERS - GET /order/list/client

Request:

/order/list/client

Response:

{
    "status": "ok",
    "data": [
        {
            "id": 14,
            "created": "2021-07-13T13:51:55.000+02:00",
            "start": "2021-12-01T00:00:00.000+01:00",
            "end": "2021-12-05T00:00:00.000+01:00",
            "price": "21",
            "status": 1,
            "number": "2021/07/13/1",
            "landlord": {...},
            "client": {...},
            "property": {...},
        },
        {
            "id": 15,
            "created": "2021-07-13T14:20:49.000+02:00",
            "start": "2021-12-08T00:00:00.000+01:00",
            "end": "2021-12-10T00:00:00.000+01:00",
            "price": "12",
            "status": 1,
            "number": "2021/07/13/1",
            "landlord": {...},
            "client": {...},
            "property": {...},
        }
    ]
}

ADD ORDER - POST /order/create

body:

{
   "start_date": "2021-12-22",
   "end_date": "2021-12-25",
   "property": 5,
   "client": 14,
}

variables:

start_date - Order start date (format YYYY-mm-dd) (string)
end_date - Order end date (format YYYY-mm-dd) (string)
property - Property ID (int)
client - Client ID (int)

response:

{
    "status": "ok",
    "data": {
        "id": 16,
        "created": "2021-07-13T14:31:11.879+02:00",
        "start": "2021-12-22T00:00:00.000+01:00",
        "end": "2021-12-25T00:00:00.000+01:00",
        "price": "16.4",
        "status": 1,
        "number": "2021/07/13/1",
        "landlord": {...},
        "client": {...},
        "property": {...},
    }
}

ACCEPT ORDER - GET /order/{id}/accept

You can accept offer only when ORDER have status 1 (waiting for acceptance) and logged user is an owner of property from order.

Request:

/order/1/accept

Response:

{
    "status": "ok",
    "data": {
        "id": 1,
        "created": "2020-12-16T00:00:00.000+01:00",
        "start": "2020-12-16T00:00:00.000+01:00",
        "end": "2020-12-23T00:00:00.000+01:00",
        "price": "350",
        "status": 2,
        "number": "2020/12/18/1",
        "landlord": {...},
        "client": {...},
        "property": {...},
    }
}

REJECT ORDER - GET /order/{id}/reject

You can reject offer only when ORDER have status 1 (waiting for acceptance) and logged user is an owner of property from order.

Request:

/order/1/reject

Response:

{
    "status": "ok",
    "data": {
        "id": 1,
        "created": "2020-12-16T00:00:00.000+01:00",
        "start": "2020-12-16T00:00:00.000+01:00",
        "end": "2020-12-23T00:00:00.000+01:00",
        "price": "350",
        "status": 7,
        "number": "2020/12/18/1",
        "landlord": {...},
        "client": {...},
        "property": {...},
    }
}