Printer
What the receipt printer reports and what a printer fault does to its lane.
The printer prints the receipt of a paid basket. It takes the receipt from the basket: the receipt number, the lines, the total and the vatBreakdown. It reports its health like every other device, with a heartbeat.
A printer that cannot print reports a fault: paper_out when the paper has run out, jammed when it is stuck. From that moment its lane is out of service.
A printer that reports a fault
curl
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
"fault": "paper_out"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
"fault": "paper_out"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'a2930ef4-ba94-4886-9309-32e47ae150c8',
'fault': 'paper_out',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
"fault": "paper_out"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/selfcheckout/v1/devices/73bdccc0-4479-426a-b241-aeaf02cac7dc/heartbeat");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
"fault": "paper_out"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "a2930ef4-ba94-4886-9309-32e47ae150c8",
"status": "accepted",
"aggregateId": "73bdccc0-4479-426a-b241-aeaf02cac7dc",
"aggregateRevision": 2
} | If the lane was | Then |
|---|---|
idle | It becomes out_of_service. |
scanning, weight_pending, assistance_needed, payment | It becomes out_of_service, the open basket is voided with the reason device_fault, and the interventions that waited on it are voided. |
complete | It becomes out_of_service. The basket is already paid and stays paid, with its receipt number. |
The event device.faulted is sent once for a fault, however many times the device repeats it. When the paper is loaded, the printer reports again with fault set to null; the lane stays out of service until an attendant opens it, and the opening is refused with device_fault while any device of the lane still reports a fault.