Приклад для плану закупівлі

Зміна власника плану закупівлі

Переглянемо приклад зміни власника для плану.

Створення плану закупівлі

Спочатку створимо план закупівлі:

Request

POST /api/2.5/plans?opt_pretty=1 HTTP/1.0
Authorization: Bearer broker
Content-Length: 3744
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-01-08T00:00:00+02:00"
      }
    },
    "items": [
      {
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "code": "KGM",
          "name": "кг"
        },
        "classification": {
          "scheme": "ДК021",
          "description": "Mustard seeds",
          "id": "03111600-8"
        },
        "quantity": 1000,
        "description": "Насіння гірчиці"
      },
      {
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "code": "KGM",
          "name": "кг"
        },
        "classification": {
          "scheme": "ДК021",
          "description": "Sunflower seeds",
          "id": "03111300-5"
        },
        "quantity": 2000,
        "description": "Насіння соняшнику"
      },
      {
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "code": "KGM",
          "name": "кг"
        },
        "classification": {
          "scheme": "ДК021",
          "description": "Cotton seeds",
          "id": "03111400-6"
        },
        "quantity": 3000,
        "description": "Насіння бавовнику"
      }
    ],
    "classification": {
      "scheme": "ДК021",
      "description": "Seeds",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "procuringEntity": {
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "name": "ДУС",
      "address": {
        "countryName": "Україна",
        "postalCode": "01220",
        "region": "м. Київ",
        "locality": "м. Київ",
        "streetAddress": "вул. Банкова, 11, корпус 1"
      },
      "kind": "general"
    },
    "buyers": [
      {
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "name": "ДУС",
        "address": {
          "countryName": "Україна",
          "postalCode": "01220",
          "region": "м. Київ",
          "locality": "м. Київ",
          "streetAddress": "вул. Банкова, 11, корпус 1"
        },
        "kind": "general"
      }
    ],
    "budget": {
      "project": {
        "name": "proj_name",
        "id": "123"
      },
      "amount": 10000,
      "amountNet": 12222,
      "currency": "UAH",
      "id": "12303111000-2",
      "description": "budget_description",
      "period": {
        "startDate": "2023-01-01T00:00:00",
        "endDate": "2023-12-31T00:00:00"
      },
      "breakdown": [
        {
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500,
            "currency": "UAH"
          }
        }
      ]
    }
  }
}

Response

HTTP/1.0 201 Created
Content-Type: application/json
Location: http://lb-api-sandbox.prozorro.gov.ua/api/2.5/plans/c4fc1923c53a47079cb230ec4595043a

{
  "data": {
    "procuringEntity": {
      "id": "22a97b03852a4e9cb0631a30e93142c2",
      "name": "ДУС",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "kind": "general"
    },
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-01-08T00:00:00+02:00"
      }
    },
    "budget": {
      "id": "12303111000-2",
      "description": "budget_description",
      "amount": 10000.0,
      "currency": "UAH",
      "amountNet": 12222.0,
      "project": {
        "id": "123",
        "name": "proj_name"
      },
      "period": {
        "startDate": "2023-01-01T00:00:00+02:00",
        "endDate": "2023-12-31T00:00:00+02:00"
      },
      "breakdown": [
        {
          "id": "0bd16b7048ac4a309c24a9573f0082b6",
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500.0,
            "currency": "UAH"
          }
        }
      ]
    },
    "classification": {
      "description": "Seeds",
      "scheme": "ДК021",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "planID": "UA-P-2023-01-01-000001",
    "items": [
      {
        "id": "bd1d53956c124170934e1c8f9f4bedfd",
        "classification": {
          "description": "Mustard seeds",
          "scheme": "ДК021",
          "id": "03111600-8"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 1000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння гірчиці"
      },
      {
        "id": "e760a777b43345c69416b48b1b4657a1",
        "classification": {
          "description": "Sunflower seeds",
          "scheme": "ДК021",
          "id": "03111300-5"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 2000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння соняшнику"
      },
      {
        "id": "7f6384838f674207bff60f5490f732d4",
        "classification": {
          "description": "Cotton seeds",
          "scheme": "ДК021",
          "id": "03111400-6"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 3000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння бавовнику"
      }
    ],
    "buyers": [
      {
        "id": "e75978dcf9ca4fd8b5afedbbbe5ec066",
        "name": "ДУС",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "address": {
          "streetAddress": "вул. Банкова, 11, корпус 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "01220",
          "countryName": "Україна"
        },
        "kind": "general"
      }
    ],
    "status": "scheduled",
    "dateCreated": "2023-01-01T00:00:00+02:00",
    "dateModified": "2023-01-01T00:00:00+02:00",
    "datePublished": "2023-01-01T00:00:00+02:00",
    "owner": "broker",
    "id": "c4fc1923c53a47079cb230ec4595043a"
  },
  "access": {
    "token": "df9e36e885a747f4a09272a9748ae862",
    "transfer": "2a76632142274eb6ba7e46638a2906df"
  }
}

Майданчик broker є поточним власником owner плану закупівлі.

Зверніть увагу, що секція відповіді access містить ключ transfer, який використовується для зміни власника плану закупівлі.

Після реєстрація плану закупівлі в ЦБД майданчик повинен довести ключ transfer до відома клієнта.

Ініціація зміни власника

Майданчик, що стане новим власником плану закупівлі, повинен створити об’єкт Transfer.

Request

POST /api/2.5/transfers HTTP/1.0
Authorization: Bearer broker1
Content-Length: 12
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {}
}

Response

HTTP/1.0 201 Created
Content-Type: application/json

{
  "data": {
    "date": "2023-01-01T00:00:00+02:00",
    "id": "27046e8f81d84006abd75a9b7f88c37e"
  },
  "access": {
    "token": "a724115528854291a6aa7a8049b548d1",
    "transfer": "4535842b592d45d1be6b775efd889d17"
  }
}

Об’єкт Transfer містить новий ключ доступу token та новий ключ transfer для об’єкта, власник якого буде змінений.

Об’єкт Transfer можна переглянути за допомогою ідентифікатора id:

Request

GET /api/2.5/transfers/27046e8f81d84006abd75a9b7f88c37e HTTP/1.0
Authorization: Bearer broker1
Host: public-api-sandbox.prozorro.gov.ua

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "date": "2023-01-01T00:00:00+02:00",
    "id": "27046e8f81d84006abd75a9b7f88c37e"
  }
}

Зміна власника плану закупівлі

Можливість зміни власника плану закупівлі залежить від статусу плану закупівлі:

Дозволено Не дозволено
scheduled

draft

cancelled

complete

Щоб змінити власника плану закупівлі новий майданчик повинен надіслати POST запит на відповідний /plans/id/ з секцією data, що міститиме ідентифікатор id для Transfer та ключ transfer отриманий від клієнта:

Request

POST /api/2.5/plans/c4fc1923c53a47079cb230ec4595043a/ownership HTTP/1.0
Authorization: Bearer broker1
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "27046e8f81d84006abd75a9b7f88c37e",
    "transfer": "2a76632142274eb6ba7e46638a2906df"
  }
}

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "procuringEntity": {
      "id": "22a97b03852a4e9cb0631a30e93142c2",
      "name": "ДУС",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "kind": "general"
    },
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-01-08T00:00:00+02:00"
      }
    },
    "budget": {
      "id": "12303111000-2",
      "description": "budget_description",
      "amount": 10000.0,
      "currency": "UAH",
      "amountNet": 12222.0,
      "project": {
        "id": "123",
        "name": "proj_name"
      },
      "period": {
        "startDate": "2023-01-01T00:00:00+02:00",
        "endDate": "2023-12-31T00:00:00+02:00"
      },
      "breakdown": [
        {
          "id": "0bd16b7048ac4a309c24a9573f0082b6",
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500.0,
            "currency": "UAH"
          }
        }
      ]
    },
    "classification": {
      "description": "Seeds",
      "scheme": "ДК021",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "planID": "UA-P-2023-01-01-000001",
    "items": [
      {
        "id": "bd1d53956c124170934e1c8f9f4bedfd",
        "classification": {
          "description": "Mustard seeds",
          "scheme": "ДК021",
          "id": "03111600-8"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 1000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння гірчиці"
      },
      {
        "id": "e760a777b43345c69416b48b1b4657a1",
        "classification": {
          "description": "Sunflower seeds",
          "scheme": "ДК021",
          "id": "03111300-5"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 2000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння соняшнику"
      },
      {
        "id": "7f6384838f674207bff60f5490f732d4",
        "classification": {
          "description": "Cotton seeds",
          "scheme": "ДК021",
          "id": "03111400-6"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 3000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння бавовнику"
      }
    ],
    "buyers": [
      {
        "id": "e75978dcf9ca4fd8b5afedbbbe5ec066",
        "name": "ДУС",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "address": {
          "streetAddress": "вул. Банкова, 11, корпус 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "01220",
          "countryName": "Україна"
        },
        "kind": "general"
      }
    ],
    "status": "scheduled",
    "dateCreated": "2023-01-01T00:00:00+02:00",
    "dateModified": "2023-01-01T00:00:00+02:00",
    "datePublished": "2023-01-01T00:00:00+02:00",
    "owner": "broker1",
    "id": "c4fc1923c53a47079cb230ec4595043a"
  }
}

Оновлене значення властивості owner вказує, що власник був успішно змінений.

Зверніть увагу, що новий майданчик повинен довести до відома клієнта новий ключ transfer (згенерований в об’єкті Transfer).

Після того, як об’єкт Transfer було застосовано, для нього генерується властивість usedFor (вказується шлях до об’єкта, власника якого було змінено):

Request

GET /api/2.5/transfers/27046e8f81d84006abd75a9b7f88c37e HTTP/1.0
Authorization: Bearer broker1
Host: public-api-sandbox.prozorro.gov.ua

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "date": "2023-01-01T00:00:00+02:00",
    "usedFor": "/plans/c4fc1923c53a47079cb230ec4595043a",
    "id": "27046e8f81d84006abd75a9b7f88c37e"
  }
}

„Використаний“ об’єкт Transfer вже не можна застосувати до іншого об’єкта.

Спробуємо змінити план закупівлі за допомогою ключа token, отриманого при створенні об’єкта Transfer.

Request

PATCH /api/2.5/plans/c4fc1923c53a47079cb230ec4595043a?acc_token=a724115528854291a6aa7a8049b548d1 HTTP/1.0
Authorization: Bearer broker1
Content-Length: 72
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "budget": {
      "description": "broker1 now can change the plan"
    }
  }
}

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "procuringEntity": {
      "id": "22a97b03852a4e9cb0631a30e93142c2",
      "name": "ДУС",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "kind": "general"
    },
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-01-08T00:00:00+02:00"
      }
    },
    "budget": {
      "id": "12303111000-2",
      "description": "broker1 now can change the plan",
      "amount": 10000.0,
      "currency": "UAH",
      "amountNet": 12222.0,
      "project": {
        "id": "123",
        "name": "proj_name"
      },
      "period": {
        "startDate": "2023-01-01T00:00:00+02:00",
        "endDate": "2023-12-31T00:00:00+02:00"
      },
      "breakdown": [
        {
          "id": "0bd16b7048ac4a309c24a9573f0082b6",
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500.0,
            "currency": "UAH"
          }
        }
      ]
    },
    "classification": {
      "description": "Seeds",
      "scheme": "ДК021",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "planID": "UA-P-2023-01-01-000001",
    "items": [
      {
        "id": "bd1d53956c124170934e1c8f9f4bedfd",
        "classification": {
          "description": "Mustard seeds",
          "scheme": "ДК021",
          "id": "03111600-8"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 1000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння гірчиці"
      },
      {
        "id": "e760a777b43345c69416b48b1b4657a1",
        "classification": {
          "description": "Sunflower seeds",
          "scheme": "ДК021",
          "id": "03111300-5"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 2000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння соняшнику"
      },
      {
        "id": "7f6384838f674207bff60f5490f732d4",
        "classification": {
          "description": "Cotton seeds",
          "scheme": "ДК021",
          "id": "03111400-6"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 3000.0,
        "deliveryDate": {
          "startDate": "2023-01-03T00:00:00+02:00",
          "endDate": "2023-01-06T00:00:00+02:00"
        },
        "description": "Насіння бавовнику"
      }
    ],
    "buyers": [
      {
        "id": "e75978dcf9ca4fd8b5afedbbbe5ec066",
        "name": "ДУС",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "address": {
          "streetAddress": "вул. Банкова, 11, корпус 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "01220",
          "countryName": "Україна"
        },
        "kind": "general"
      }
    ],
    "status": "scheduled",
    "dateCreated": "2023-01-01T00:00:00+02:00",
    "dateModified": "2023-01-01T00:00:00+02:00",
    "datePublished": "2023-01-01T00:00:00+02:00",
    "owner": "broker1",
    "id": "c4fc1923c53a47079cb230ec4595043a"
  }
}

Зверніть увагу, що тільки майданчик з відповідним рівнем акредитації може стати новим власником. В іншому випадку майданчику така дія буде заборонена.

Request

POST /api/2.5/plans/c4fc1923c53a47079cb230ec4595043a/ownership HTTP/1.0
Authorization: Bearer broker2
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "00f30637f2604aa7b29997273b823597",
    "transfer": "2a76632142274eb6ba7e46638a2906df"
  }
}

Response

HTTP/1.0 403 Forbidden
Content-Type: application/json

{
  "status": "error",
  "errors": [
    {
      "location": "url",
      "name": "accreditation",
      "description": "Broker Accreditation level does not permit ownership change"
    }
  ]
}

Зміна власника дозволена тільки якщо поточний власник тендера має спеціальний рівень акредетації, що дозволяє зміну:

Request

POST /api/2.5/plans/c4fc1923c53a47079cb230ec4595043a/ownership HTTP/1.0
Authorization: Bearer broker
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "8fcf14fa3a0243468886fdb290b8cb8d",
    "transfer": "2a76632142274eb6ba7e46638a2906df"
  }
}

Response

HTTP/1.0 403 Forbidden
Content-Type: application/json

{
  "status": "error",
  "errors": [
    {
      "location": "url",
      "name": "accreditation",
      "description": "Owner Accreditation level does not permit ownership change"
    }
  ]
}