Um objeto com status completed é enviado quando o operador der baixa no aplicativo como Serviço Completo (com sucesso ou não).
Finalização com Sucesso
Abaixo podemos observar um evento de serviço completo com sucesso. Os anexos (assinatura e foto de comprovação da entrega) podem ser obtidos no campo de metadata values.
{
"current": {
"_id": "5c6313f299c38427c2978c35",
"entity": {
"status": "completed",
"id": "5c61e41c73921910e1a2680f",
"type": "task"
},
"eventType": "action",
"date": "2019-02-12T18:44:01.391Z",
"action": "complete",
"sender": {
"firstName": "Operador",
"lastName": "ou Analista",
"username": "operador",
"updated": "2020-02-21T18:12:08.340Z",
"created": "2020-02-21T18:12:08.340Z",
"authentication_type": "email",
"email": "[email protected]",
"phone": "91111-1111",
"status": {
"position": {
"date": "2020-02-21T18:12:08.340Z",
"lat":-23.6179656,
"lng":-46.6378011,
},
"last_login": {
"date": "2021-05-17T19:45:12.289Z",
"device": {
"_id": "60a2c7c88366d12584f50dce"
}
}
},
"company_bound": "none",
"_id": "5e501d78be3cc67dfe61e8b6",
"displayName": "Operador ou Analista",
"__v": 0,
"id": "5e501d78be3cc67dfe61e8b6"
},
"values": {
"generate_proof_of_delivery": false,
"occurrence_code": {
"_id": "5c6313f299c38427c2978c40",
"key": "occurrence_code",
"value": "S01",
"label": "Código de Ocorrência",
"type": "info"
},
"completion_type": "success",
"description": {
"_id": "5c6313f299c38427c2978c3e",
"key": "description",
"value": "Entrega efetuada.",
"label": "Descrição",
"type": "info"
},
"comments": {
"_id": "5c6313f299c38427c2978c3d",
"key": "comments",
"value": "Segue anexo comprovação de entrega",
"label": "Comentário",
"type": "info"
},
"name": {
"_id": "5c6313f299c38427c2978c3c",
"key": "name",
"value": "Hermanoteu da Pentescopeia",
"label": "Nome",
"type": "info"
},
"document": {
"_id": "5c6313f299c38427c2978c3b",
"key": "document",
"value": "4563744563",
"label": "Documento",
"type": "info"
},
"file_signature": {
"_id": "5c6313f299c38427c2978c3a",
"key": "file_signature",
"value": [
"https://app-routeasy.s3.amazonaws.com/test/job_confirmation/5c6313f299c38427c2978c35_file_signature_1"
],
"label": "Assinatura",
"type": "attachment"
},
"file_photo": {
"_id": "5c6313f299c38427c2978c39",
"key": "file_photo",
"value": [
"https://app-routeasy.s3.amazonaws.com/test/job_confirmation/5c6313f299c38427c2978c35_file_photo_1"
],
"label": "Foto",
"type": "attachment"
},
"file_pdf": {
"_id": "60a67dc52515250bb4d2b01f",
"key": "file_pdf",
"value": [
"https://app-routeasy.s3.amazonaws.com/test/job_confirmation/5c6313f299c38427c2978c35_file_pdf_1"
],
"label": "PDF",
"type": "attachment"
}
"lat": -23.617981,
"lng": -46.6378466,
"device": "39895e3dd0d49dc5"
},
"created": "2019-02-12T18:44:02.547Z",
"__v": 0,
"tracking": "http://localhost:3000/tracking?hash=9976d5ab2db8744fa6c459c8b635c5381180525d88abc1e7d77c3b950b158337351b26e4f407ff4214aa23a0f0d64ee9f041f42feb85fd2e69ad2a08c065bc5b274eebdb05143ab11dfce03c63df46b4",
"status": "completed",
"services": [{
"id": "5c61e43873921910e1a26921",
"code": "19337462000127",
"name": "SUPERMERCADO NOVA ESPERANCA LTDA ME LTDA",
"invoice_number": "41140502834982004563550010000084111000132252",
"order_number": "44070",
"shipment_number": "0000566",
"email": "[email protected]",
"phone": "(19)982623331"
}],
"job": {
"id": "5eaae67cc9732214e9b4b8b2",
"due_date": "2020-04-30T14:53:48.323Z",
"routing": "5eaae657c9732214e9b4b891",
"route": {
"id": "5eaae65dc9732214e9b4b8a2",
"name": "Rota 1"
},
"operator": {
"displayName": "Josué da Silva",
"documentNumber": "12345667899",
"license_plate": "ABC-1234",
"phone": [
"119999-0909"
]
}
},
"company": {
"id": "5e416e0e0c50b02c6183c777",
"name": "Sua Empresa",
"company_info": {
"logo": "",
"domain": "routeasy"
}
},
"site":{
"id": "5e416e0e0c50b02c6183c799",
"code": "Código Filial",
"name": "Nome Filial"
}
},
"previous": null
}
Finalização com Falha
Quando ocorre uma falha ao executar um serviço, seja por destinatário ausente, objeto errado, etc, o evento de serviço vem com completion_type: failure, como pode ser visto no objeto de exemplo abaixo. Assim como na finalização com sucesso, os anexos (assinatura e foto de comprovação da entrega) podem ser obtidos no campo de metadata values.
{
"current": {
"_id": "5c6323442fd2be2e3b1e535e",
"entity": {
"status": "completed",
"id": "5c61e41c73921910e1a2680f",
"type": "task"
},
"eventType": "action",
"date": "2019-02-12T19:49:23.105Z",
"action": "complete",
"sender": "5c13a98060b63e7fa39d3238",
"user": "5b23d1d2614e781179e54c7e",
"values": {
"occurrence_code": {
"_id": "5c6323442fd2be2e3b1e5369",
"key": "occurrence_code",
"value": "F02",
"label": "Código de Ocorrência",
"type": "info"
},
"completion_type": "failure",
"description": {
"_id": "5c6323442fd2be2e3b1e5367",
"key": "description",
"value": "Produto avariado.",
"label": "Descrição",
"type": "info"
},
"comments": {
"_id": "5c6323442fd2be2e3b1e5366",
"key": "comments",
"value": "Minha latinha de Coca veio vazia",
"label": "Comentário",
"type": "info"
},
"name": {
"_id": "5c6323442fd2be2e3b1e5365",
"key": "name",
"value": "Hermanoteu da Pentescopeia ",
"label": "Nome",
"type": "info"
},
"document": {
"_id": "5c6323442fd2be2e3b1e5364",
"key": "document",
"value": "55566885666",
"label": "Documento",
"type": "info"
},
"file_signature": {
"_id": "5c6323442fd2be2e3b1e5363",
"key": "file_signature",
"value": [
"https://app-routeasy.s3.amazonaws.com/test/job_confirmation/5c6323442fd2be2e3b1e535e_file_signature_1"
],
"label": "Assinatura",
"type": "attachment"
},
"file_photo": {
"_id": "5c6323442fd2be2e3b1e5362",
"key": "file_photo",
"value": [
"https://app-routeasy.s3.amazonaws.com/test/job_confirmation/5c6323442fd2be2e3b1e535e_file_photo_1"
],
"label": "Foto",
"type": "attachment"
},
"lat": -23.6179746,
"lng": -46.6378697,
"device": "39895e3dd0d49dc5"
},
"created": "2019-02-12T19:49:24.708Z",
"__v": 0,
"tracking": "http://localhost:3000/tracking?hash=9976d5ab2db8744fa6c459c8b635c5381180525d88abc1e7d77c3b950b158337351b26e4f407ff4214aa23a0f0d64ee9f041f42feb85fd2e69ad2a08c065bc5b274eebdb05143ab11dfce03c63df46b4",
"status": "completed",
"services": [{
"id": "5c61e43873921910e1a26921",
"code": "19337462000127",
"name": "SUPERMERCADO NOVA ESPERANCA LTDA ME LTDA",
"invoice_number": "41140502834982004563550010000084111000132252",
"order_number": "44070",
"shipment_number": "0000566"
}],
"job": {
"id": "5eaae67cc9732214e9b4b8b2",
"due_date": "2020-04-30T14:53:48.323Z",
"routing": "5eaae657c9732214e9b4b891",
"route": {
"id": "5eaae65dc9732214e9b4b8a2",
"name": "Rota 1"
},
"operator": {
"displayName": "Josué da Silva",
"documentNumber": "12345667899",
"license_plate": "ABC-1234",
"phone": [
"119999-0909"
]
}
}
},
"previous": null
}