Salt la conținut
Documentație

Caută în documentație

    English

    Mod prestator de servicii

    Lasă o companie să acționeze pentru un angajator cu un drept de acces de tip prestator și citește operațiunile fiecărui angajator pentru care acționează.

    Pe această pagină

    O companie poate acționa pentru un angajator. În exemple, Brumar Distribuție SRL acționează pentru Brumar Retail SRL. Angajatorul dă companiei un drept de acces de tip provider, iar compania pregătește și transmite cu el așa cum ar face o persoană desemnată.

    Dă dreptul de acces

    1. Adaugă ambele companii

      Angajatorul și prestatorul sunt angajatori ai contului tău. Vezi Adaugă un angajator.

    2. Adaugă dreptul pentru angajator

      Trimite kind provider, numele companiei ca holder, domeniile și ultima zi. Exemplul dă prepare, transmit și lasă approve în seama persoanei desemnate a angajatorului.

    Adaugă un drept de acces pentru un prestator

    curl

    curl -X POST "$RDC_BASE_URL/reges/v1/employers/6f90be8d-78b7-4a97-9b06-7cc6db931f53/permissions" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "0ffc2a96-b45a-4b42-918e-01026d1adcf1",
      "kind": "provider",
      "holder": "Brumar Distribuție SRL",
      "scope": [
        "prepare",
        "transmit"
      ],
      "expires": "2027-06-30"
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/reges/v1/employers/6f90be8d-78b7-4a97-9b06-7cc6db931f53/permissions`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "0ffc2a96-b45a-4b42-918e-01026d1adcf1",
        "kind": "provider",
        "holder": "Brumar Distribuție SRL",
        "scope": [
          "prepare",
          "transmit"
        ],
        "expires": "2027-06-30"
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/reges/v1/employers/6f90be8d-78b7-4a97-9b06-7cc6db931f53/permissions',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '0ffc2a96-b45a-4b42-918e-01026d1adcf1',
            'kind': 'provider',
            'holder': 'Brumar Distribuție SRL',
            'scope': [
                'prepare',
                'transmit',
            ],
            'expires': '2027-06-30',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "0ffc2a96-b45a-4b42-918e-01026d1adcf1",
      "kind": "provider",
      "holder": "Brumar Distribuție SRL",
      "scope": [
        "prepare",
        "transmit"
      ],
      "expires": "2027-06-30"
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/reges/v1/employers/6f90be8d-78b7-4a97-9b06-7cc6db931f53/permissions');
    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")}/reges/v1/employers/6f90be8d-78b7-4a97-9b06-7cc6db931f53/permissions");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "0ffc2a96-b45a-4b42-918e-01026d1adcf1",
      "kind": "provider",
      "holder": "Brumar Distribuție SRL",
      "scope": [
        "prepare",
        "transmit"
      ],
      "expires": "2027-06-30"
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Răspuns 202

    {
      "operationId": "0ffc2a96-b45a-4b42-918e-01026d1adcf1",
      "status": "accepted",
      "aggregateId": "fda4ecc4-9e6f-4e7f-ab51-001cf3f61806",
      "aggregateRevision": 1
    }

    Ce poate face prestatorul

    Domeniile dreptului hotărăsc: prepare, approve și transmit funcționează ca la o persoană desemnată, iar regula celor două persoane se aplică și aici, deci cine aprobă nu este cine a pregătit. Dreptul unui prestator expiră, poate fi prelungit și poate fi revocat ca oricare altul. Vezi Persoane desemnate și delegări.

    Citește operațiunile fiecărui angajator

    Un prestator care acționează pentru mai mulți angajatori folosește un singur cont și același apel de listare: schimbă employerId ca să citești următorul angajator. status, kind, dueBefore și late restrâng lista. listLate și listSubmissions primesc employerId în același fel.

    curl

    curl "$RDC_BASE_URL/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3" \
      -H "Authorization: Bearer $RDC_TOKEN"

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3`, {
      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"]}/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
    )
    result = response.json()

    PHP

    <?php
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3');
    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")}/reges/v1/register-operations?employerId=6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0&limit=3");
    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": "27357abf-301f-4956-88af-73c842b85100",
          "number": "RG-2026-001471",
          "employerId": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
          "contractId": "4fc60d72-3c1e-415c-a931-f0b21bfda436",
          "employee": "Mihai Stan",
          "kind": "change-salary",
          "status": "authorized",
          "date": "2026-10-26",
          "until": null,
          "deadline": {
            "date": "2026-11-20",
            "rule": "salary",
            "from": "2026-10-26",
            "workingDaysLeft": -1
          },
          "late": true,
          "details": {
            "date": "2026-10-26",
            "salary": "5600.00"
          },
          "preparedBy": {
            "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
            "name": "Elena Dumitru"
          },
          "authorizedBy": {
            "id": "c403d6ca-4254-4be4-8781-6be8b95a3de0",
            "name": "Ana Rusu"
          },
          "transmittedBy": null,
          "reference": null,
          "rejection": null,
          "lateReason": null,
          "correctionOf": null,
          "attempts": 0,
          "history": [
            {
              "status": "draft",
              "at": "2026-10-27T10:02:00Z",
              "by": {
                "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
                "name": "Elena Dumitru"
              },
              "reference": null,
              "message": null,
              "reason": null,
              "late": false
            },
            {
              "status": "validated",
              "at": "2026-10-27T10:10:00Z",
              "by": null,
              "reference": null,
              "message": null,
              "reason": null,
              "late": false
            },
            {
              "status": "authorized",
              "at": "2026-10-28T11:30:00Z",
              "by": {
                "id": "c403d6ca-4254-4be4-8781-6be8b95a3de0",
                "name": "Ana Rusu"
              },
              "reference": null,
              "message": null,
              "reason": null,
              "late": false
            }
          ],
          "revision": 3
        },
        {
          "id": "b5f54bb0-fa5e-43d6-b9fc-b5b0afe9d3d7",
          "number": "RG-2026-001481",
          "employerId": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
          "contractId": "02b6b76c-19a6-4b97-af20-50b265e9d36d",
          "employee": "Radu Ionescu",
          "kind": "suspend",
          "status": "validated",
          "date": "2026-11-18",
          "until": null,
          "deadline": {
            "date": "2026-11-23",
            "rule": "suspension-days",
            "from": "2026-11-19",
            "workingDaysLeft": 0
          },
          "late": false,
          "details": {
            "date": "2026-11-18",
            "reason": "medical-leave",
            "learnedOn": "2026-11-19"
          },
          "preparedBy": {
            "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
            "name": "Elena Dumitru"
          },
          "authorizedBy": null,
          "transmittedBy": null,
          "reference": null,
          "rejection": null,
          "lateReason": null,
          "correctionOf": null,
          "attempts": 0,
          "history": [
            {
              "status": "draft",
              "at": "2026-11-19T15:12:00Z",
              "by": {
                "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
                "name": "Elena Dumitru"
              },
              "reference": null,
              "message": null,
              "reason": null,
              "late": false
            },
            {
              "status": "validated",
              "at": "2026-11-19T15:20:00Z",
              "by": null,
              "reference": null,
              "message": null,
              "reason": null,
              "late": false
            }
          ],
          "revision": 2
        },
        {
          "id": "4bbaadac-0dc6-40b0-9470-f26f8177bd8d",
          "number": "RG-2026-001483",
          "employerId": "6e2aa977-c041-49c3-8c57-b9f2cd6cf3f0",
          "contractId": "13156f30-1274-45d1-af53-672ccb3c7e04",
          "employee": "Dan Ilie",
          "kind": "hire",
          "status": "draft",
          "date": "2026-12-02",
          "until": null,
          "deadline": {
            "date": "2026-12-01",
            "rule": "hire",
            "from": "2026-12-02",
            "workingDaysLeft": 4
          },
          "late": false,
          "details": {
            "date": "2026-12-02"
          },
          "preparedBy": {
            "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
            "name": "Elena Dumitru"
          },
          "authorizedBy": null,
          "transmittedBy": null,
          "reference": null,
          "rejection": null,
          "lateReason": null,
          "correctionOf": null,
          "attempts": 0,
          "history": [
            {
              "status": "draft",
              "at": "2026-11-20T13:41:00Z",
              "by": {
                "id": "f3a70882-0da0-4686-bc0c-f29ce600bb0c",
                "name": "Elena Dumitru"
              },
              "reference": null,
              "message": null,
              "reason": null,
              "late": false
            }
          ],
          "revision": 1
        }
      ],
      "nextCursor": "eyJvZmZzZXQiOjN9"
    }

    Evenimentele poartă id-ul angajatorului ca legalCompanyId, deci o singură adresă poate deservi toți angajatorii și poate direcționa fiecare eveniment după acest câmp. Vezi Plicul evenimentului.