CONTEÚDO


01. VISÃO GERAL

Este endpoint é utilizado para obter informações detalhadas sobre consumo, fornecendo um retorno em formato JSON com diversos atributos relevantes. Ao enviar uma solicitação conforme especificado nos exemplos abaixo, o endpoint processa a requisição e retorna um conjunto de dados que inclui o status mais recente do consumo.

Obtenha o consumo atribuído a um ou mais pedidos utilizando o parâmetro orderKeyType, que pode ser ORDER_ID, TABLE ou CARD.



02. ENDPOINT


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



03. EXEMPLO DE UTILIZAÇÃO

01. Retornar todos os status dos consumos:

{
  "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
  "orderKeyType": "CARD",
  "orderKey": []
}
{
	"success": true,
	"error": null,
	"integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
	"orderKeyType": "CARD",
	"orderKey": [],
	"consumption": [
		{
			"orderId": "ad976378-8823-48d3-9cd1-62d68cf3be77",
			"type": "CARD",
			"createdAt": "2024-09-09 12:33:52",
			"customerName": "TOTVS",
			"items": [
				{
					"id": "181",
					"index": "181",
					"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"
						}
					]
				},
				{
					"id": "1",
					"index": "1",
					"name": "MARACUJA",
					"externalCode": "58",
					"unit": "UNIT",
					"ean": "",
					"quantity": 1,
					"specialInstructions": "TESTE",
					"unitPrice": {
						"value": 61,
						"currency": "R$"
					},
					"optionsPrice": {
						"value": 0,
						"currency": "R$"
					},
					"totalPrice": {
						"value": 61,
						"currency": "R$"
					},
					"options": null,
					"productionPoint": [
						{
							"name": "NENHUM"
						}
					]
				}
			],
			"otherFees": [
				{
					"name": "Taxa de Serviço",
					"type": "SERVICE_FEE",
					"receivedBy": "MERCHANT",
					"receiverDocument": "",
					"price": {
						"value": 13.09,
						"currency": "R$"
					},
					"observation": ""
				}
			],
			"discounts": null,
			"total": {
				"items": 130.9,
				"otherFees": 13.09,
				"discount": 0,
				"orderAmount": 143.99
			},
			"delivery": null,
			"takeout": null,
			"indoor": null,
			"table": null,
			"card": {
				"waiterCode": 9999,
				"cardNumber": 1,
				"deliveryTableNumber": 326
			}
		},
		{
			"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": "5b8d7e5c-f87e-40ac-91b7-726da529fc88",
			"type": "CARD",
			"createdAt": "2024-09-09 14:39:39",
			"customerName": "TOTVS",
			"items": [
				{
					"id": "1",
					"index": "332003",
					"name": "A FRANCESA",
					"externalCode": "1",
					"unit": "UNIT",
					"ean": "",
					"quantity": 1,
					"specialInstructions": "",
					"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": 4040,
				"deliveryTableNumber": 0
			}
		}
	]
}



02. Obter detalhes de um consumo específico:

{
  "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
  "orderKeyType": "TABLE",
  "orderKey": ["40"]
}

A solicitação foi aceita, mas ainda não foi processada. É necessário aguardar alguns momentos e, em seguida, entrar em contato no mesmo endereço para obter o status do consumo solicitado.




{
	"errors": [
		{
			"key": "orderKeyType_orderKey",
			"message": "Order consumption request already exists: TABLE_40"
		}
	]
}  
 

A solicitação já foi enviada. É necessário aguardar alguns momentos e, em seguida, entrar em contato no mesmo endereço para obter o status do consumo solicitado.




{
	"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.



04. Retornar o status de múltiplos pedidos:

{
  "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
  "orderKeyType": "TABLE",
  "orderKey": ["340", "350"]
}




{
	"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
			}
		}
	]
}



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.

{
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
	  "orderKeyType": "string",
	   "orderKey": ["string"]
}
{
	"errors": [
		{
			"key": "orderKeyType",
			"message": "body.orderKeyType must be one of [ORDER_ID, TABLE, CARD]"
		}
	]
}



02. JSON enviando faltando um ou mais campos.

{
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58"
}
{
	"errors": [
		{
			"key": "orderKeyType",
			"message": "body.orderKeyType is required"
		},
		{
			"key": "orderKey",
			"message": "body.orderKey is required"
		}
	]
}



03. GUID incorreto 

{
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686eAA",
	  "orderKeyType": "TABLE",
	  "orderKey": []
}
{
	"errors": [
		{
			"key": "integrationHubServiceId",
			"message": "body.integrationHubServiceId must be a valid GUID"
		}
	]
}




04. Enviando uma requisição sem informar o código da orderKey corretamente

{
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
	  "orderKeyType": "TABLE",
	  "orderKey": [""]
}
{
	"errors": [
		{
			"key": 0,
			"message": "body.orderKey[0] is not allowed to be empty"
		}
	]
}

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 servidor entendeu a requisição do cliente, mas está se recusando a cumpri-la. Isso geralmente ocorre quando o cliente enviou a URL incorreta para a requisição.


https://api-barramento.meuelevestage.com/order/getConsumptionS
{
	"message": "Missing Authentication Token"
}

O cliente enviou a URL incorreta para solicitação da requisição.




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 pode ocorrer quando o integrationHubId  está incorreto ou inválido.


{
    "integrationHubServiceId": "f1b874af-96ab-4535-aac3-25118fe586cc",
	  "orderKeyType": "TABLE",
		"orderKey": ["350"]
}
{
	"errors": [
		{
			"key": "integrationHubServiceId",
			"message": "Provider Merchant for integrationHubServiceId \"f1b874af-96ab-4535-aac3-25118fe586cc\" not found or disabled"
		}
	]
}

Uma ou mais informações enviadas não puderam ser encontradas.




Alguma regra para atendimento de sua solicitação não foi atendida, analise o corpo da declaração para saber os motivos.




O código de status HTTP 429, conhecido como "Too Many Requests" (Muitas Requisições), indica que o cliente excedeu o limite de requisições permitido para um determinado período de tempo. Esse limite é definido pelo servidor e pode variar de acordo com a política de limitação de taxa implementada.


{
    "integrationHubServiceId": "66ca34be-a568-4444-a78d-098a68686e58",
	  "orderKeyType": "TABLE",
		"orderKey": ["340", "350"]
}
{
	"success": true,
	"error": null,
	"integrationHubServiceId": "7d7d205b-83ba-47c5-91ba-e4f32a2bbd9e",
	"orderKeyType": "TABLE",
	"orderKey": [
		"20",
		"40"
	],
	"consumption": [
		{
			"orderId": "f5fee4b4-c13f-482d-8e98-0dd840629e02",
			"type": "TABLE",
			"createdAt": "2024-06-28 17:27:20",
			"customerName": "TOTVS",
			"items": [
				{
					"id": "39735945",
					"index": "4",
					"name": "MARACUJA",
					"externalCode": "58",
					"unit": "UNIT",
					"ean": "",
					"quantity": 1,
					"specialInstructions": "TESTE",
					"unitPrice": {
						"value": 61,
						"currency": "R$"
					},
					"optionsPrice": {
						"value": 0,
						"currency": "R$"
					},
					"totalPrice": {
						"value": 61,
						"currency": "R$"
					},
					"options": null,
					"productionPoint": [
						{
							"name": "NENHUM"
						}
					]
				}
			],
			"otherFees": [
				{
					"name": "Taxa de Serviço",
					"type": "SERVICE_FEE",
					"receivedBy": "MERCHANT",
					"receiverDocument": "",
					"price": {
						"value": 6.1,
						"currency": "R$"
					},
					"observation": ""
				}
			],
			"discounts": [],
			"total": {
				"items": 61,
				"otherFees": 6.1,
				"discount": 0,
				"orderAmount": 67.1
			},
			"delivery": null,
			"takeout": null,
			"indoor": null,
			"table": {
				"waiterCode": 9999,
				"tableNumber": 20,
				"chairNumber": 0
			},
			"card": null
		}
	]
}

Alguma regra para atender ao seu pedido não foi cumprida; analise o corpo da resposta para descobrir as razões.


05. LINKS


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