Salt la conținut
Documentație

Caută în documentație

    English

    Deschide un coș și adaugă linii

    Deschide un coș pe o casă liberă, adaugă ce citește scanerul, declară o sacoșă proprie și anulează o linie.

    Pe această pagină

    Un coș se deschide pe o casă idle. Casa acceptă apoi câte o singură linie: fiecare scanare adaugă o linie, iar scanarea următoare așteaptă până când este raportată greutatea acelei linii.

    Deschide coșul

    curl

    curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
      "laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
        "laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '883b7e9e-7568-4828-b17c-faba4746e348',
            'laneId': '93745be9-35d3-4b71-a2a6-dfcafee63996',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
      "laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets');
    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/baskets");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
      "laneId": "93745be9-35d3-4b71-a2a6-dfcafee63996"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "883b7e9e-7568-4828-b17c-faba4746e348",
      "status": "accepted",
      "aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
      "aggregateRevision": 1
    }

    Refuzată cuCodDe ce
    409lane_not_idleCasa are deja un coș.
    409lane_out_of_serviceCasa este închisă sau un dispozitiv este defect.
    404lane_not_foundCasa nu aparține contului tău.

    Declară o sacoșă proprie

    Un client care își aduce sacoșa o pune întâi pe cântar. Trimite greutatea ei înainte de prima linie. Cântarul așteaptă apoi sacoșa împreună cu articolele, așa că sacoșa nu este luată drept articol.

    curl

    curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
      "expectedRevision": 1,
      "grams": 85
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
        "expectedRevision": 1,
        "grams": 85
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'e6779957-8d26-49ab-bdb4-3916a13a3c57',
            'expectedRevision': 1,
            'grams': 85,
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
      "expectedRevision": 1,
      "grams": 85
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag');
    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/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/own-bag");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
      "expectedRevision": 1,
      "grams": 85
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "e6779957-8d26-49ab-bdb4-3916a13a3c57",
      "status": "accepted",
      "aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
      "aggregateRevision": 2
    }

    O sacoșă mai ușoară de 20 g sau mai grea de 1500 g este refuzată cu invalid_weight. A doua sacoșă este refuzată cu own_bag_declared, iar o sacoșă declarată după prima linie, cu own_bag_too_late.

    Adaugă o linie

    Trimite cele opt cifre citite de scaner. Pentru un articol vândut la greutate, trimite codul de legume‑fructe tastat sau căutat de client. Fiecare scanare înseamnă o bucată și o linie: dacă scanezi o a doua sticlă, obții o a doua linie.

    curl

    curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
      "expectedRevision": 1,
      "code": "20101015"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
        "expectedRevision": 1,
        "code": "20101015"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'd1941539-061a-404d-bd69-d2c545eb92f0',
            'expectedRevision': 1,
            'code': '20101015',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
      "expectedRevision": 1,
      "code": "20101015"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines');
    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/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/lines");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
      "expectedRevision": 1,
      "code": "20101015"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "d1941539-061a-404d-bd69-d2c545eb92f0",
      "status": "accepted",
      "aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
      "aggregateRevision": 2
    }

    StareSemnificație
    Linia așteaptă greutatea cântarului de ambalare.
    Articolul are restricție de vârstă. O verificare de vârstă așteaptă un operator.
    Linia este numărată în total.
    Linia a fost anulată. Rămâne în coș și nu este numărată.

    Anulează o linie

    Un operator anulează o linie dintr‑un coș deschis. Greutatea unei linii numărate nu se mai așteaptă pe cântar, iar o intervenție care depindea de linie se încheie ca voided.

    curl

    curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
      "expectedRevision": 6,
      "attendantId": "cristina-lungu"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
        "expectedRevision": 6,
        "attendantId": "cristina-lungu"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': 'c190d5af-edff-47bd-85e5-099fd3de3306',
            'expectedRevision': 6,
            'attendantId': 'cristina-lungu',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
      "expectedRevision": 6,
      "attendantId": "cristina-lungu"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void');
    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/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines/7befa6fb-9f93-4bda-a605-9779f9d33f2a/void");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
      "expectedRevision": 6,
      "attendantId": "cristina-lungu"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "c190d5af-edff-47bd-85e5-099fd3de3306",
      "status": "accepted",
      "aggregateId": "c37612e6-3f10-4a7d-b962-2afad36a4ab8",
      "aggregateRevision": 7
    }

    Citește liniile cu listLines: sunt returnate în ordinea scanării, inclusiv cele anulate.

    curl

    curl "$RDC_BASE_URL/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
      },
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'GET',
        f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'GET',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        ],
    ]);
    $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.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/selfcheckout/v1/baskets/c37612e6-3f10-4a7d-b962-2afad36a4ab8/lines?limit=20");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 200

    {
      "items": [
        {
          "id": "7befa6fb-9f93-4bda-a605-9779f9d33f2a",
          "code": "20101015",
          "sku": "PN-0101",
          "name": "White bread, 500 g",
          "kind": "packaged",
          "status": "active",
          "grams": 520,
          "unitPrice": "4.90",
          "vatRate": "11",
          "total": "4.90",
          "ageApprovedBy": null
        },
        {
          "id": "57120a70-28dc-4ed0-bc26-64b21accb7b2",
          "code": "101",
          "sku": "MR-0001",
          "name": "Apples, per kg",
          "kind": "produce",
          "status": "active",
          "grams": 720,
          "unitPrice": "6.99",
          "vatRate": "11",
          "total": "5.03",
          "ageApprovedBy": null
        },
        {
          "id": "9cd3606d-0f2c-403e-af96-d862f58c03e0",
          "code": "102",
          "sku": "BN-0002",
          "name": "Bananas, per kg",
          "kind": "produce",
          "status": "active",
          "grams": 540,
          "unitPrice": "7.99",
          "vatRate": "11",
          "total": "4.31",
          "ageApprovedBy": null
        }
      ],
      "nextCursor": null
    }