Beispiel #1
0
    def patch(self):
        """Tender Edit (partial)

        For example here is how procuring entity can change number of items to be procured and total Value of a tender:

        .. sourcecode:: http

            PATCH /tenders/4879d3f8ee2443169b5fbbc9f89fa607 HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "value": {
                        "amount": 600
                    },
                    "itemsToBeProcured": [
                        {
                            "quantity": 6
                        }
                    ]
                }
            }

        And here is the response to be expected:

        .. sourcecode:: http

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

            {
                "data": {
                    "id": "4879d3f8ee2443169b5fbbc9f89fa607",
                    "tenderID": "UA-64e93250be76435397e8c992ed4214d1",
                    "dateModified": "2014-10-27T08:12:34.956Z",
                    "value": {
                        "amount": 600
                    },
                    "itemsToBeProcured": [
                        {
                            "quantity": 6
                        }
                    ]
                }
            }

        """
        tender = self.request.validated['tender']
        if tender.status in ['complete', 'unsuccessful']:
            self.request.errors.add('body', 'data',
                                    'Can\'t change tender in current status')
            self.request.errors.status = 403
            return
        src = tender.serialize("plain")
        tender_data = filter_data(self.request.validated['data'])
        if tender_data:
            tender.import_data(apply_data_patch(src, tender_data))
            save_tender(tender, src, self.request)
        return {'data': tender.serialize(tender.status)}
    def patch(self):
        """Tender Edit (partial)

        For example here is how procuring entity can change number of items to be procured and total Value of a tender:

        .. sourcecode:: http

            PATCH /tenders/4879d3f8ee2443169b5fbbc9f89fa607 HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "value": {
                        "amount": 600
                    },
                    "itemsToBeProcured": [
                        {
                            "quantity": 6
                        }
                    ]
                }
            }

        And here is the response to be expected:

        .. sourcecode:: http

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

            {
                "data": {
                    "id": "4879d3f8ee2443169b5fbbc9f89fa607",
                    "tenderID": "UA-64e93250be76435397e8c992ed4214d1",
                    "dateModified": "2014-10-27T08:12:34.956Z",
                    "value": {
                        "amount": 600
                    },
                    "itemsToBeProcured": [
                        {
                            "quantity": 6
                        }
                    ]
                }
            }

        """
        tender = self.request.validated['tender']
        if tender.status in ['complete', 'unsuccessful']:
            self.request.errors.add('body', 'data', 'Can\'t change tender in current status')
            self.request.errors.status = 403
            return
        src = tender.serialize("plain")
        tender_data = filter_data(self.request.validated['data'])
        if tender_data:
            tender.import_data(apply_data_patch(src, tender_data))
            save_tender(tender, src, self.request)
        return {'data': tender.serialize(tender.status)}
 def patch(self):
     """Post an Answer
     """
     tender = self.request.validated['tender']
     question = self.request.validated['question']
     question_data = filter_data(self.request.validated['data'])
     if question_data:
         src = tender.serialize("plain")
         question.import_data(apply_data_patch(question.serialize(), question_data))
         save_tender(tender, src, self.request)
     return {'data': question.serialize(self.request.validated['tender'].status)}
 def collection_post(self):
     """Post a question
     """
     tender = self.request.validated['tender']
     question_data = filter_data(self.request.validated['data'])
     question = Question(question_data)
     src = tender.serialize("plain")
     tender.questions.append(question)
     save_tender(tender, src, self.request)
     self.request.response.status = 201
     self.request.response.headers['Location'] = self.request.route_url('Tender Questions', tender_id=tender.id, id=question['id'])
     return {'data': question.serialize("view")}
 def put(self):
     """Tender Edit (full)"""
     tender = self.request.validated['tender']
     if tender.status in ['complete', 'unsuccessful']:
         self.request.errors.add('body', 'data', 'Can\'t change tender in current status')
         self.request.errors.status = 403
         return
     src = tender.serialize("plain")
     tender_data = filter_data(self.request.validated['data'])
     tender.import_data(tender_data)
     save_tender(tender, src, self.request)
     return {'data': tender.serialize(tender.status)}
Beispiel #6
0
 def collection_post(self):
     """Post a question
     """
     tender = self.request.validated['tender']
     question_data = filter_data(self.request.validated['data'])
     question = Question(question_data)
     src = tender.serialize("plain")
     tender.questions.append(question)
     save_tender(tender, src, self.request)
     self.request.response.status = 201
     self.request.response.headers['Location'] = self.request.route_url(
         'Tender Questions', tender_id=tender.id, id=question['id'])
     return {'data': question.serialize("view")}
Beispiel #7
0
 def put(self):
     """Tender Edit (full)"""
     tender = self.request.validated['tender']
     if tender.status in ['complete', 'unsuccessful']:
         self.request.errors.add('body', 'data',
                                 'Can\'t change tender in current status')
         self.request.errors.status = 403
         return
     src = tender.serialize("plain")
     tender_data = filter_data(self.request.validated['data'])
     tender.import_data(tender_data)
     save_tender(tender, src, self.request)
     return {'data': tender.serialize(tender.status)}
 def patch(self):
     """Tender Document Update"""
     tender = self.request.validated['tender']
     document = self.request.validated['document']
     if tender.status != 'active.enquiries':
         self.request.errors.add('body', 'data', 'Can\'t update document in current tender status')
         self.request.errors.status = 403
         return
     document_data = filter_data(self.request.validated['data'])
     if document_data:
         src = tender.serialize("plain")
         document.import_data(document_data)
         save_tender(tender, src, self.request)
     return {'data': document.serialize("view")}
 def patch(self):
     """Tender Complaint Document Update"""
     tender = self.request.validated['tender']
     if tender.status not in ['active.enquiries', 'active.tendering', 'active.auction', 'active.qualification', 'active.awarded']:
         self.request.errors.add('body', 'data', 'Can\'t update document in current tender status')
         self.request.errors.status = 403
         return
     document = self.request.validated['document']
     document_data = filter_data(self.request.validated['data'])
     if document_data:
         src = tender.serialize("plain")
         document.import_data(document_data)
         save_tender(tender, src, self.request)
     return {'data': document.serialize("view")}
    def patch(self):
        """Update of proposal

        Example request to change bid proposal:

        .. sourcecode:: http

            PATCH /tenders/4879d3f8ee2443169b5fbbc9f89fa607/bids/71b6c23ed8944d688e92a31ec8c3f61a HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "value": {
                        "amount": 600
                    }
                }
            }

        And here is the response to be expected:

        .. sourcecode:: http

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

            {
                "data": {
                    "value": {
                        "amount": 600,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        tender = self.request.validated['tender']
        if tender.status != 'active.tendering':
            self.request.errors.add(
                'body', 'data', 'Can\'t change bid in current tender status')
            self.request.errors.status = 403
            return
        bid = self.request.validated['bid']
        bid_data = filter_data(self.request.validated['data'])
        if bid_data:
            src = tender.serialize("plain")
            bid.import_data(apply_data_patch(bid.serialize(), bid_data))
            save_tender(tender, src, self.request)
        return {'data': bid.serialize("view")}
Beispiel #11
0
 def patch(self):
     """Post an Answer
     """
     tender = self.request.validated['tender']
     question = self.request.validated['question']
     question_data = filter_data(self.request.validated['data'])
     if question_data:
         src = tender.serialize("plain")
         question.import_data(
             apply_data_patch(question.serialize(), question_data))
         save_tender(tender, src, self.request)
     return {
         'data': question.serialize(self.request.validated['tender'].status)
     }
    def patch(self):
        """Update of proposal

        Example request to change bid proposal:

        .. sourcecode:: http

            PATCH /tenders/4879d3f8ee2443169b5fbbc9f89fa607/bids/71b6c23ed8944d688e92a31ec8c3f61a HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "value": {
                        "amount": 600
                    }
                }
            }

        And here is the response to be expected:

        .. sourcecode:: http

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

            {
                "data": {
                    "value": {
                        "amount": 600,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        tender = self.request.validated['tender']
        if tender.status != 'active.tendering':
            self.request.errors.add('body', 'data', 'Can\'t change bid in current tender status')
            self.request.errors.status = 403
            return
        bid = self.request.validated['bid']
        bid_data = filter_data(self.request.validated['data'])
        if bid_data:
            src = tender.serialize("plain")
            bid.import_data(apply_data_patch(bid.serialize(), bid_data))
            save_tender(tender, src, self.request)
        return {'data': bid.serialize("view")}
 def patch(self):
     """Post a complaint resolution
     """
     tender = self.request.validated['tender']
     if tender.status not in ['active.enquiries', 'active.tendering', 'active.auction', 'active.qualification', 'active.awarded']:
         self.request.errors.add('body', 'data', 'Can\'t update complaint in current tender status')
         self.request.errors.status = 403
         return
     complaint = self.request.validated['complaint']
     complaint_data = filter_data(self.request.validated['data'])
     if complaint_data:
         src = tender.serialize("plain")
         complaint.import_data(apply_data_patch(complaint.serialize(), complaint_data))
         save_tender(tender, src, self.request)
     return {'data': complaint.serialize("view")}
 def collection_post(self):
     """Post a complaint
     """
     tender = self.request.validated['tender']
     if tender.status not in ['active.enquiries', 'active.tendering', 'active.auction', 'active.qualification', 'active.awarded']:
         self.request.errors.add('body', 'data', 'Can\'t add complaint in current tender status')
         self.request.errors.status = 403
         return
     complaint_data = filter_data(self.request.validated['data'])
     complaint = Complaint(complaint_data)
     src = tender.serialize("plain")
     tender.complaints.append(complaint)
     save_tender(tender, src, self.request)
     self.request.response.status = 201
     self.request.response.headers['Location'] = self.request.route_url('Tender Complaints', tender_id=tender.id, id=complaint['id'])
     return {'data': complaint.serialize("view")}
Beispiel #15
0
 def patch(self):
     """Tender Award Complaint Document Update"""
     tender = self.request.validated['tender']
     if tender.status not in ['active.qualification', 'active.awarded']:
         self.request.errors.add(
             'body', 'data',
             'Can\'t update document in current tender status')
         self.request.errors.status = 403
         return
     document = self.request.validated['document']
     document_data = filter_data(self.request.validated['data'])
     if document_data:
         src = tender.serialize("plain")
         document.import_data(document_data)
         save_tender(tender, src, self.request)
     return {'data': document.serialize("view")}
Beispiel #16
0
 def patch(self):
     """Post a complaint resolution for award
     """
     tender = self.request.validated['tender']
     if tender.status not in ['active.qualification', 'active.awarded']:
         self.request.errors.add(
             'body', 'data',
             'Can\'t update complaint in current tender status')
         self.request.errors.status = 403
         return
     complaint = self.request.validated['complaint']
     complaint_data = filter_data(self.request.validated['data'])
     if complaint_data:
         src = tender.serialize("plain")
         complaint.import_data(
             apply_data_patch(complaint.serialize(), complaint_data))
         save_tender(tender, src, self.request)
     return {'data': complaint.serialize("view")}
Beispiel #17
0
 def collection_post(self):
     """Post a complaint
     """
     tender = self.request.validated['tender']
     if tender.status not in [
             'active.enquiries', 'active.tendering', 'active.auction',
             'active.qualification', 'active.awarded'
     ]:
         self.request.errors.add(
             'body', 'data',
             'Can\'t add complaint in current tender status')
         self.request.errors.status = 403
         return
     complaint_data = filter_data(self.request.validated['data'])
     complaint = Complaint(complaint_data)
     src = tender.serialize("plain")
     tender.complaints.append(complaint)
     save_tender(tender, src, self.request)
     self.request.response.status = 201
     self.request.response.headers['Location'] = self.request.route_url(
         'Tender Complaints', tender_id=tender.id, id=complaint['id'])
     return {'data': complaint.serialize("view")}
    def collection_post(self):
        """Registration of new bid proposal

        Creating new Bid proposal
        -------------------------

        Example request to create bid proposal:

        .. sourcecode:: http

            POST /tenders/4879d3f8ee2443169b5fbbc9f89fa607/bids HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "tenderers": [
                        {
                            "id": {
                                "name": "Державне управління справами",
                                "scheme": "https://ns.openprocurement.org/ua/edrpou",
                                "uid": "00037256",
                                "uri": "http://www.dus.gov.ua/"
                            },
                            "address": {
                                "countryName": "Україна",
                                "postalCode": "01220",
                                "region": "м. Київ",
                                "locality": "м. Київ",
                                "streetAddress": "вул. Банкова, 11, корпус 1"
                            }
                        }
                    ],
                    "value": {
                        "amount": 489,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        This is what one should expect in response:

        .. sourcecode:: http

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

            {
                "data": {
                    "id": "4879d3f8ee2443169b5fbbc9f89fa607",
                    "status": "registration",
                    "date": "2014-10-28T11:44:17.947Z",
                    "tenderers": [
                        {
                            "id": {
                                "name": "Державне управління справами",
                                "scheme": "https://ns.openprocurement.org/ua/edrpou",
                                "uid": "00037256",
                                "uri": "http://www.dus.gov.ua/"
                            },
                            "address": {
                                "countryName": "Україна",
                                "postalCode": "01220",
                                "region": "м. Київ",
                                "locality": "м. Київ",
                                "streetAddress": "вул. Банкова, 11, корпус 1"
                            }
                        }
                    ],
                    "value": {
                        "amount": 489,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        # See https://github.com/open-contracting/standard/issues/78#issuecomment-59830415
        # for more info upon schema
        tender = self.request.validated['tender']
        if tender.status != 'active.tendering':
            self.request.errors.add('body', 'data',
                                    'Can\'t add bid in current tender status')
            self.request.errors.status = 403
            return
        bid_data = filter_data(self.request.validated['data'])
        bid = Bid(bid_data)
        src = tender.serialize("plain")
        tender.bids.append(bid)
        save_tender(tender, src, self.request)
        self.request.response.status = 201
        self.request.response.headers['Location'] = self.request.route_url(
            'Tender Bids', tender_id=tender.id, id=bid['id'])
        return {'data': bid.serialize("view")}
    def collection_post(self):
        """Registration of new bid proposal

        Creating new Bid proposal
        -------------------------

        Example request to create bid proposal:

        .. sourcecode:: http

            POST /tenders/4879d3f8ee2443169b5fbbc9f89fa607/bids HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "tenderers": [
                        {
                            "id": {
                                "name": "Державне управління справами",
                                "scheme": "https://ns.openprocurement.org/ua/edrpou",
                                "uid": "00037256",
                                "uri": "http://www.dus.gov.ua/"
                            },
                            "address": {
                                "countryName": "Україна",
                                "postalCode": "01220",
                                "region": "м. Київ",
                                "locality": "м. Київ",
                                "streetAddress": "вул. Банкова, 11, корпус 1"
                            }
                        }
                    ],
                    "value": {
                        "amount": 489,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        This is what one should expect in response:

        .. sourcecode:: http

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

            {
                "data": {
                    "id": "4879d3f8ee2443169b5fbbc9f89fa607",
                    "status": "registration",
                    "date": "2014-10-28T11:44:17.947Z",
                    "tenderers": [
                        {
                            "id": {
                                "name": "Державне управління справами",
                                "scheme": "https://ns.openprocurement.org/ua/edrpou",
                                "uid": "00037256",
                                "uri": "http://www.dus.gov.ua/"
                            },
                            "address": {
                                "countryName": "Україна",
                                "postalCode": "01220",
                                "region": "м. Київ",
                                "locality": "м. Київ",
                                "streetAddress": "вул. Банкова, 11, корпус 1"
                            }
                        }
                    ],
                    "value": {
                        "amount": 489,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        # See https://github.com/open-contracting/standard/issues/78#issuecomment-59830415
        # for more info upon schema
        tender = self.request.validated['tender']
        if tender.status != 'active.tendering':
            self.request.errors.add('body', 'data', 'Can\'t add bid in current tender status')
            self.request.errors.status = 403
            return
        bid_data = filter_data(self.request.validated['data'])
        bid = Bid(bid_data)
        src = tender.serialize("plain")
        tender.bids.append(bid)
        save_tender(tender, src, self.request)
        self.request.response.status = 201
        self.request.response.headers['Location'] = self.request.route_url('Tender Bids', tender_id=tender.id, id=bid['id'])
        return {'data': bid.serialize("view")}
Beispiel #20
0
    def collection_post(self):
        """This API request is targeted to creating new Tenders by procuring organizations.

        Creating new Tender
        -------------------

        Example request to create tender:

        .. sourcecode:: http

            POST /tenders HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "procuringEntity": {
                        "id": {
                            "name": "Державне управління справами",
                            "scheme": "https://ns.openprocurement.org/ua/edrpou",
                            "uid": "00037256",
                            "uri": "http://www.dus.gov.ua/"
                        },
                        "address": {
                            "countryName": "Україна",
                            "postalCode": "01220",
                            "region": "м. Київ",
                            "locality": "м. Київ",
                            "streetAddress": "вул. Банкова, 11, корпус 1"
                        }
                    },
                    "value": {
                        "amount": 500,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    },
                    "itemsToBeProcured": [
                        {
                            "description": "футляри до державних нагород",
                            "primaryClassification": {
                                "scheme": "CPV",
                                "id": "44617100-9",
                                "description": "Cartons"
                            },
                            "additionalClassification": [
                                {
                                    "scheme": "ДКПП",
                                    "id": "17.21.1",
                                    "description": "папір і картон гофровані, паперова й картонна тара"
                                }
                            ],
                            "unitOfMeasure": "item",
                            "quantity": 5
                        }
                    ],
                    "enquiryPeriod": {
                        "endDate": "2014-10-31T00:00:00"
                    },
                    "tenderPeriod": {
                        "startDate": "2014-11-03T00:00:00",
                        "endDate": "2014-11-06T10:00:00"
                    },
                    "awardPeriod": {
                        "endDate": "2014-11-13T00:00:00"
                    },
                    "deliveryDate": {
                        "endDate": "2014-11-20T00:00:00"
                    },
                    "minimalStep": {
                        "amount": 35,
                        "currency": "UAH"
                    }
                }
            }

        This is what one should expect in response:

        .. sourcecode:: http

            HTTP/1.1 201 Created
            Location: http://localhost/api/0.1/tenders/64e93250be76435397e8c992ed4214d1
            Content-Type: application/json

            {
                "data": {
                    "id": "64e93250be76435397e8c992ed4214d1",
                    "tenderID": "UA-64e93250be76435397e8c992ed4214d1",
                    "dateModified": "2014-10-27T08:06:58.158Z",
                    "procuringEntity": {
                        "id": {
                            "name": "Державне управління справами",
                            "scheme": "https://ns.openprocurement.org/ua/edrpou",
                            "uid": "00037256",
                            "uri": "http://www.dus.gov.ua/"
                        },
                        "address": {
                            "countryName": "Україна",
                            "postalCode": "01220",
                            "region": "м. Київ",
                            "locality": "м. Київ",
                            "streetAddress": "вул. Банкова, 11, корпус 1"
                        }
                    },
                    "value": {
                        "amount": 500,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    },
                    "itemsToBeProcured": [
                        {
                            "description": "футляри до державних нагород",
                            "primaryClassification": {
                                "scheme": "CPV",
                                "id": "44617100-9",
                                "description": "Cartons"
                            },
                            "additionalClassification": [
                                {
                                    "scheme": "ДКПП",
                                    "id": "17.21.1",
                                    "description": "папір і картон гофровані, паперова й картонна тара"
                                }
                            ],
                            "unitOfMeasure": "item",
                            "quantity": 5
                        }
                    ],
                    "enquiryPeriod": {
                        "endDate": "2014-10-31T00:00:00"
                    },
                    "tenderPeriod": {
                        "startDate": "2014-11-03T00:00:00",
                        "endDate": "2014-11-06T10:00:00"
                    },
                    "awardPeriod": {
                        "endDate": "2014-11-13T00:00:00"
                    },
                    "deliveryDate": {
                        "endDate": "2014-11-20T00:00:00"
                    },
                    "minimalStep": {
                        "amount": 35,
                        "currency": "UAH"
                    }
                }
            }

        """
        tender_data = filter_data(self.request.validated['data'])
        tender_id = generate_id()
        tender_data['doc_id'] = tender_id
        tender_data['tenderID'] = generate_tender_id(tender_id)
        tender = Tender(tender_data)
        if tender.enquiryPeriod:
            tender.enquiryPeriod.startDate = tender.dateModified
        else:
            tender.enquiryPeriod = {'startDate': tender.dateModified}
        save_tender(tender, None, self.request)
        self.request.response.status = 201
        self.request.response.headers['Location'] = self.request.route_url(
            'Tender', id=tender_id)
        return {
            'data': tender.serialize(tender.status),
            'access': {
                'token': tender.owner_token
            }
        }
    def collection_post(self):
        """This API request is targeted to creating new Tenders by procuring organizations.

        Creating new Tender
        -------------------

        Example request to create tender:

        .. sourcecode:: http

            POST /tenders HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "procuringEntity": {
                        "id": {
                            "name": "Державне управління справами",
                            "scheme": "https://ns.openprocurement.org/ua/edrpou",
                            "uid": "00037256",
                            "uri": "http://www.dus.gov.ua/"
                        },
                        "address": {
                            "countryName": "Україна",
                            "postalCode": "01220",
                            "region": "м. Київ",
                            "locality": "м. Київ",
                            "streetAddress": "вул. Банкова, 11, корпус 1"
                        }
                    },
                    "value": {
                        "amount": 500,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    },
                    "itemsToBeProcured": [
                        {
                            "description": "футляри до державних нагород",
                            "primaryClassification": {
                                "scheme": "CPV",
                                "id": "44617100-9",
                                "description": "Cartons"
                            },
                            "additionalClassification": [
                                {
                                    "scheme": "ДКПП",
                                    "id": "17.21.1",
                                    "description": "папір і картон гофровані, паперова й картонна тара"
                                }
                            ],
                            "unitOfMeasure": "item",
                            "quantity": 5
                        }
                    ],
                    "enquiryPeriod": {
                        "endDate": "2014-10-31T00:00:00"
                    },
                    "tenderPeriod": {
                        "startDate": "2014-11-03T00:00:00",
                        "endDate": "2014-11-06T10:00:00"
                    },
                    "awardPeriod": {
                        "endDate": "2014-11-13T00:00:00"
                    },
                    "deliveryDate": {
                        "endDate": "2014-11-20T00:00:00"
                    },
                    "minimalStep": {
                        "amount": 35,
                        "currency": "UAH"
                    }
                }
            }

        This is what one should expect in response:

        .. sourcecode:: http

            HTTP/1.1 201 Created
            Location: http://localhost/api/0.1/tenders/64e93250be76435397e8c992ed4214d1
            Content-Type: application/json

            {
                "data": {
                    "id": "64e93250be76435397e8c992ed4214d1",
                    "tenderID": "UA-64e93250be76435397e8c992ed4214d1",
                    "dateModified": "2014-10-27T08:06:58.158Z",
                    "procuringEntity": {
                        "id": {
                            "name": "Державне управління справами",
                            "scheme": "https://ns.openprocurement.org/ua/edrpou",
                            "uid": "00037256",
                            "uri": "http://www.dus.gov.ua/"
                        },
                        "address": {
                            "countryName": "Україна",
                            "postalCode": "01220",
                            "region": "м. Київ",
                            "locality": "м. Київ",
                            "streetAddress": "вул. Банкова, 11, корпус 1"
                        }
                    },
                    "value": {
                        "amount": 500,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    },
                    "itemsToBeProcured": [
                        {
                            "description": "футляри до державних нагород",
                            "primaryClassification": {
                                "scheme": "CPV",
                                "id": "44617100-9",
                                "description": "Cartons"
                            },
                            "additionalClassification": [
                                {
                                    "scheme": "ДКПП",
                                    "id": "17.21.1",
                                    "description": "папір і картон гофровані, паперова й картонна тара"
                                }
                            ],
                            "unitOfMeasure": "item",
                            "quantity": 5
                        }
                    ],
                    "enquiryPeriod": {
                        "endDate": "2014-10-31T00:00:00"
                    },
                    "tenderPeriod": {
                        "startDate": "2014-11-03T00:00:00",
                        "endDate": "2014-11-06T10:00:00"
                    },
                    "awardPeriod": {
                        "endDate": "2014-11-13T00:00:00"
                    },
                    "deliveryDate": {
                        "endDate": "2014-11-20T00:00:00"
                    },
                    "minimalStep": {
                        "amount": 35,
                        "currency": "UAH"
                    }
                }
            }

        """
        tender_data = filter_data(self.request.validated['data'])
        tender_id = generate_id()
        tender_data['doc_id'] = tender_id
        tender_data['tenderID'] = generate_tender_id(tender_id)
        tender = Tender(tender_data)
        if tender.enquiryPeriod:
            tender.enquiryPeriod.startDate = tender.dateModified
        else:
            tender.enquiryPeriod = {'startDate': tender.dateModified}
        save_tender(tender, None, self.request)
        self.request.response.status = 201
        self.request.response.headers[
            'Location'] = self.request.route_url('Tender', id=tender_id)
        return {
            'data': tender.serialize(tender.status),
            'access': {
                'token': tender.owner_token
            }
        }
    def patch(self):
        """Update of award

        Example request to change the award:

        .. sourcecode:: http

            PATCH /tenders/4879d3f8ee2443169b5fbbc9f89fa607/awards/71b6c23ed8944d688e92a31ec8c3f61a HTTP/1.1
            Host: example.com
            Accept: application/json

            {
                "data": {
                    "value": {
                        "amount": 600
                    }
                }
            }

        And here is the response to be expected:

        .. sourcecode:: http

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

            {
                "data": {
                    "id": "4879d3f8ee2443169b5fbbc9f89fa607",
                    "date": "2014-10-28T11:44:17.947Z",
                    "status": "active",
                    "suppliers": [
                        {
                            "id": {
                                "name": "Державне управління справами",
                                "scheme": "https://ns.openprocurement.org/ua/edrpou",
                                "uid": "00037256",
                                "uri": "http://www.dus.gov.ua/"
                            },
                            "address": {
                                "countryName": "Україна",
                                "postalCode": "01220",
                                "region": "м. Київ",
                                "locality": "м. Київ",
                                "streetAddress": "вул. Банкова, 11, корпус 1"
                            }
                        }
                    ],
                    "value": {
                        "amount": 600,
                        "currency": "UAH",
                        "valueAddedTaxIncluded": true
                    }
                }
            }

        """
        tender = self.request.validated['tender']
        if tender.status != 'active.qualification':
            self.request.errors.add('body', 'data', 'Can\'t change award in current tender status')
            self.request.errors.status = 403
            return
        award = self.request.validated['award']
        award_data = filter_data(self.request.validated['data'])
        if award_data:
            src = tender.serialize("plain")
            award.import_data(apply_data_patch(award.serialize(), award_data))
            save_tender(tender, src, self.request)
        return {'data': award.serialize("view")}