Permalink
Switch branches/tags
a105191787427142_transfer_token a142022530357637_fix_journal_logging a145319666913685_test_mode a147484942466775_add_date_signed_4_change a147484942466775_change_date_signed a148438653129104_update_after a157395766181019_fix_deliveryDate_startDate a157444434989308_filter_comp_dialogue_stage1_tenders a161346855223642_detailed_log_on_error a163098707244167_databridge_delivery_date_values a166080492734376_immortal_jobs a168264359610926_bridge_configuration a168264359610951_missing_revisions_fix a182845521285042_administrator_value_edit a182845521285042_value_suppliers_migration a183841703369017_items_are_not_required a194273370978952_log_bridge_state a200308578426382_add_raise a200308578426382_initial_sync_point_reinit a200308578426382_reinitialize_clients_on_restart a209967385970878_fix_items_processing a217582340368153_items_cpv_3to4_validation a225525300977111_px_operator a227201023869555_pure_requests a231215749783594_reinit_contracting_clients_on_error a234097332408087_fix_items_copy a235605590507661_create_with_documents_metadata a238475631689727_esco_contracts a250378148444126_handle_multilot_limited_tenders a258001251842882_refactoring_sandbox_dev a258001251842882_refactoring_sandbox_23 a258001251842882_refactoring a282953159619251_tests_refactoring a285033184553995_asymmetric_encryption_on_refactoring a285033184553995_asymmetric_encryption a303035495659235_additional_err_info a312620117236937_block_cpv a360909018014371_contract_wo_items_modifications a421134621643366_fix_500_error_in_listing a497512512684542_additional_validation_inn a610721282535075_includeme_fixes cache-lazydb cache-percache contracting-dev databridge-2_0 deps_optimizations dev document_service documentation fix_nose_configuration frameworkagreement master_bce master migrations monitoring production_bce production px_master px_production redis_integration revert-26-a200308578426382_add_raise single-tender-sync-a136941281890889 travis_cfg_update
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
221 lines (126 sloc) 5.95 KB

Tutorial

Exploring basic rules

Let's try exploring the /contracts endpoint:

Just invoking it reveals an empty set.

Contract is transferred from the tender system by an automated process.

.. index:: Contracts

Creating contract

Let's say that we have conducted tender and it has complete status. When the tender is completed, contract (that has been created in the tender system) is transferred to the contract system automatically.

Brokers (eMalls) can't create contracts in the contract system.

Getting contract

Contract in the tender system

Contract id is the same in both tender and contract system.

Let's access the URL of the created object:

Getting access

In order to get rights for future contract editing, you need to use this view PATCH: /contracts/{id}/credentials?acc_token={tender_token} with the API key of the eMall (broker), where tender was generated.

In the PATCH: /contracts/{id}/credentials?acc_token={tender_token}:

  • id stands for contract id,
  • tender_token is tender's token (is used for contract token generation).

Response will contain access.token for the contract that can be used for further contract modification.

Let's view contracts.

We do see the internal id of a contract (that can be used to construct full URL by prepending http://api-sandbox.openprocurement.org/api/0/contracts/) and its dateModified datestamp.

Modifying contract

You can make changes to the contract in cases described in the 4th part of Article 36 of the Law "On the Public Procurement".

Essential contract terms can be modified by the submission of a new :ref:`change` object to the Contract.changes container.

All changes are processed by the endpoint /contracts/{id}/changes.

Submitting a change

Let's add new change to the contract:

Note that you can provide more than one value in rationaleTypes field.

You can view the change:

Change can be modified while it is in the pending status:

Uploading change document

Document can be added only while change is in the pending status.

Document has to be added in two stages:

  • you should upload document
  • you should set document properties "documentOf": "change" and "relatedItem": "{change.id}" in order to bind the uploaded document to the change:

Updating contract properties

Now you can update contract properties which belong to the change.

We see the added properties have merged with existing contract data. Additionally, the dateModified property was updated to reflect the last modification datestamp.

Fields that can be modified: title, description, status, value.amount, period, items, amountPaid.amount, terminationDetails.

See examples of items customization below. You can:

  • update item:
  • delete item:

Request example for cases when contract has several items:

Applying the change

Change can be applied by switching to the active status.

In order to apply active status dateSigned field must be set.

After this change can't be modified anymore.

dateSigned field validation:

  • for the first contract change date should be after contract.dateSigned;
  • for all next change objects date should be after the previous change.dateSigned.

You can view all changes:

All changes are also listed on the contract view.

Uploading documentation

Procuring entity can upload PDF files into the created contract. Uploading should follow the :ref:`upload` rules.

201 Created response code and Location header confirm document creation. We can additionally query the documents collection API endpoint to confirm the action:

And again we can confirm that there are two documents uploaded.

In case we made an error, we can reupload the document over the older version:

And we can see that it is overriding the original version:

.. index:: Enquiries, Question, Answer



Completing contract

Before contract can be completed amountPaid field value should be set (regardless whether the contract was successful or unsuccessful). Contract can be completed by switching to terminated status. Let's perform these actions in single request:

Note that you can set/change only amountPaid.amount value. amountPaid.currency and amountPaid.valueAddedTaxIncluded fields' values are generated from Contract.value field.

If contract is unsuccessful reasons for termination terminationDetails should be specified.

Any future modification to the contract are not allowed.