CONTEÚDO


01. VISÃO GERAL

O endpoint Status da API Order Mesa é utilizado para envio do resultado da solicitação de consumo do pedido através do Ponto de Venda (PDV). Este endpoint recebe o mesmo corpo de requisição utilizado pelo endpoint GetConsumption -   API Order Cartão - Get Consumption



02. ENDPOINT


MétodoURL
POSThttps://api-barramento.meuelevestage.com/order/consumption



03. EXEMPLO DE UTILIZAÇÃO

01. O corpo da requisição enviada para retornar um consumos especifico é o seguinte:

{
    "success": true,
    "error": null,
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
    "orderKeyType": "CARD",
    "orderKey": [
        "340"
    ],
    "consumption": [
        {
            "orderId": "2160c838-97d0-432f-a43a-dce087150d49",
            "type": "CARD",
            "createdAt": "2024-09-09 14:57:36",
            "customerName": "TOTVS",
            "items": [
                {
                    "id": "200",
                    "index": "20",
                    "name": "A FRANCESA",
                    "externalCode": "1",
                    "unit": "UNIT",
                    "ean": "",
                    "quantity": 1,
                    "specialInstructions": "TESTE",
                    "unitPrice": {
                        "value": 69.9,
                        "currency": "R$"
                    },
                    "optionsPrice": {
                        "value": 0,
                        "currency": "R$"
                    },
                    "totalPrice": {
                        "value": 69.9,
                        "currency": "R$"
                    },
                    "options": null,
                    "productionPoint": [
                        {
                            "name": "COZINHA"
                        }
                    ]
                }
            ],
            "otherFees": [
                {
                    "name": "Taxa de Serviço",
                    "type": "SERVICE_FEE",
                    "receivedBy": "MERCHANT",
                    "receiverDocument": "",
                    "price": {
                        "value": 6.99,
                        "currency": "R$"
                    },
                    "observation": ""
                }
            ],
            "discounts": null,
            "total": {
                "items": 69.9,
                "otherFees": 6.99,
                "discount": 0,
                "orderAmount": 76.89
            },
            "delivery": null,
            "takeout": null,
            "indoor": null,
            "table": null,
            "card": {
                "waiterCode": 9999,
                "cardNumber": 340,
                "deliveryTableNumber": 340
            }
        }
    ]
}

A solicitação foi processada com sucesso e o resultado foi retornado conforme esperado.



02. Corpo da requisição para obter o status de múltiplos consumos:

{
    "success": true,
    "error": null,
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
    "orderKeyType": "CARD",
    "orderKey": [
        "340",
        "350"
    ],
    "consumption": [
        {
            "orderId": "2160c838-97d0-432f-a43a-dce087150d49",
            "type": "CARD",
            "createdAt": "2024-09-09 14:57:36",
            "customerName": "TOTVS",
            "items": [
                {
                    "id": "200",
                    "index": "20",
                    "name": "A FRANCESA",
                    "externalCode": "1",
                    "unit": "UNIT",
                    "ean": "",
                    "quantity": 1,
                    "specialInstructions": "TESTE",
                    "unitPrice": {
                        "value": 69.9,
                        "currency": "R$"
                    },
                    "optionsPrice": {
                        "value": 0,
                        "currency": "R$"
                    },
                    "totalPrice": {
                        "value": 69.9,
                        "currency": "R$"
                    },
                    "options": null,
                    "productionPoint": [
                        {
                            "name": "COZINHA"
                        }
                    ]
                }
            ],
            "otherFees": [
                {
                    "name": "Taxa de Serviço",
                    "type": "SERVICE_FEE",
                    "receivedBy": "MERCHANT",
                    "receiverDocument": "",
                    "price": {
                        "value": 6.99,
                        "currency": "R$"
                    },
                    "observation": ""
                }
            ],
            "discounts": null,
            "total": {
                "items": 69.9,
                "otherFees": 6.99,
                "discount": 0,
                "orderAmount": 76.89
            },
            "delivery": null,
            "takeout": null,
            "indoor": null,
            "table": null,
            "card": {
                "waiterCode": 9999,
                "cardNumber": 340,
                "deliveryTableNumber": 340
            }
        },
        {
            "orderId": "1fbcd589-1bbd-472c-a28d-6b1164282964",
            "type": "CARD",
            "createdAt": "2024-09-09 15:27:18",
            "customerName": "TOTVS",
            "items": [
                {
                    "id": "201",
                    "index": "201",
                    "name": "A FRANCESA",
                    "externalCode": "1",
                    "unit": "UNIT",
                    "ean": "",
                    "quantity": 1,
                    "specialInstructions": "TESTE",
                    "unitPrice": {
                        "value": 69.9,
                        "currency": "R$"
                    },
                    "optionsPrice": {
                        "value": 0,
                        "currency": "R$"
                    },
                    "totalPrice": {
                        "value": 69.9,
                        "currency": "R$"
                    },
                    "options": null,
                    "productionPoint": [
                        {
                            "name": "COZINHA"
                        }
                    ]
                }
            ],
            "otherFees": [
                {
                    "name": "Taxa de Serviço",
                    "type": "SERVICE_FEE",
                    "receivedBy": "MERCHANT",
                    "receiverDocument": "",
                    "price": {
                        "value": 6.99,
                        "currency": "R$"
                    },
                    "observation": ""
                }
            ],
            "discounts": null,
            "total": {
                "items": 69.9,
                "otherFees": 6.99,
                "discount": 0,
                "orderAmount": 76.89
            },
            "delivery": null,
            "takeout": null,
            "indoor": null,
            "table": null,
            "card": {
                "waiterCode": 9999,
                "cardNumber": 350,
                "deliveryTableNumber": 340
            }
        }
    ]
}

O corpo da requisição enviada é o mesmo que o corpo da resposta obtida através do endpoint GetOrderStatus.



04. ERROS

A seguir, alguns dos erros comuns que podem ser apresentados ao lidar com requisições HTTP e suas respectivas respostas:


O código de status HTTP 400, conhecido como "Bad Request" (Requisição Inválida), indica que o servidor não pôde processar a requisição do cliente devido a uma sintaxe inválida, estrutura malformada ou dados inválidos presentes na requisição.


01. Formando inválido do JSON esperado.

{
	"success": true,
	"error": null,
	"integrationHubServiceId": "644a4d3c-6d2c-4154-a089-c1ab3fd89151",
	"orderKeyType": "String",
	"orderKey": [
		"06"
	],
	"consumption": [
		{
			"orderId": "542e6b3e-8e63-4498-bdc8-1e334a22012e",
			"type": "TABLE",
			"createdAt": "2024-02-08 10:12:05",
			"customerName": "TOTVS",
			"items": [
				{
					"id": "251",
					"index": "331811",
					"name": "TESTE MYTAPP",
					"externalCode": "251",
					"unit": "UNIT",
					"ean": "",
					"quantity": 1,
					"specialInstructions": "",
					"unitPrice": {
						"value": 99.9,
						"currency": "R$"
					},
					"optionsPrice": {
						"value": 0,
						"currency": "R$"
					},
					"totalPrice": {
						"value": 99.9,
						"currency": "R$"
					},
					"options": null,
					"productionPoint": [
						{
							"name": "NENHUM"
						}
					]
				}
			],
			"otherFees": [
				{
					"name": "Taxa de Serviço",
					"type": "SERVICE_FEE",
					"receivedBy": "MERCHANT",
					"receiverDocument": "",
					"price": {
						"value": 9.99,
						"currency": "R$"
					},
					"observation": ""
				}
			],
			"discounts": null,
			"total": {
				"items": 99.9,
				"otherFees": 9.99,
				"discount": 0,
				"orderAmount": 109.89
			},
			"delivery": null,
			"takeout": null,
			"indoor": null,
			"table": {
				"waiterCode": 9999,
				"tableNumber": 6,
				"chairNumber": 0
			},
			"card": null
		}
	]
}
{
	"errors": [
		{
			"key": "orderKeyType",
			"message": "body.orderKeyType must be one of [ORDER_ID, TABLE, CARD]"
		}
	]
}


02. JSON enviando faltando um ou mais campos.


{
	"success": true,
	"error": null,
	"integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
	"orderKey": [
		"340"
	],
	"consumption": [
		{
			"orderId": "2160c838-97d0-432f-a43a-dce087150d49",
			"type": "CARD",
			"createdAt": "2024-09-09 14:57:36",
			"customerName": "TOTVS",
			"items": [
				{
					"id": "200",
					"index": "20",
					"name": "A FRANCESA",
					"externalCode": "1",
					"unit": "UNIT",
					"ean": "",
					"quantity": 1,
					"specialInstructions": "TESTE",
					"unitPrice": {
						"value": 69.9,
						"currency": "R$"
					},
					"optionsPrice": {
						"value": 0,
						"currency": "R$"
					},
					"totalPrice": {
						"value": 69.9,
						"currency": "R$"
					},
					"options": null,
					"productionPoint": [
						{
							"name": "COZINHA"
						}
					]
				}
			],
			"otherFees": [
				{
					"name": "Taxa de Serviço",
					"type": "SERVICE_FEE",
					"receivedBy": "MERCHANT",
					"receiverDocument": "",
					"price": {
						"value": 6.99,
						"currency": "R$"
					},
					"observation": ""
				}
			],
			"discounts": null,
			"total": {
				"items": 69.9,
				"otherFees": 6.99,
				"discount": 0,
				"orderAmount": 76.89
			},
			"delivery": null,
			"takeout": null,
			"indoor": null,
			"table": null,
			"card": {
				"waiterCode": 9999,
				"cardNumber": 340,
				"deliveryTableNumber": 340
			}
		}
	]
}
{
	"errors": [
		{
			"key": "orderKeyType",
			"message": "body.orderKeyType is required"
		}
	]
}

A solicitação é inválida e não pôde ser processada devido a erros na entrada fornecida. Verifique os dados enviados e tente novamente.




O código de status HTTP 401, conhecido como "Unauthorized" (Não Autorizado), indica que a requisição não foi aplicada porque carece de credenciais de autenticação válidas para o recurso alvo. Diferente do código 403 (Forbidden), que significa que o servidor entendeu a requisição, mas se recusa a autorizá-la, o 401 é usado especificamente quando a autenticação é necessária e falhou ou ainda não foi fornecida.


A solicitação não pôde ser processada porque o usuário não possui as permissões necessárias. Verifique suas credenciais e tente novamente.




O código de status HTTP 403, conhecido como "Forbidden" (Proibido), indica que o Token de autenticação ausente.





O código de status HTTP 404, conhecido como "Not Found" (Não Encontrado), indica que o servidor não encontrou o recurso solicitado. Isso ocorrer quando o token  da requisição da autenticação, é diferente do token gerado utilizando o integrationHubId  diferente do corpo da requisição.


https://api-barramento.meuelevestage.com/order/consumption

{
    "errors": [
        {
            "key": "orderKeyType_orderKey",
            "message": "Order consumption for : CARD_340 not found"
        }
    ]
}



05. LINKS


API Order Mesa - Get Status
API Order Cartão - Get Consumption
API Order Cartão - Payment
API Order Mesa - Get Cancelled Items
API Order Mesa - Cancelled Items