Beispiel #1
0
def _order_node_iyo_see(app_user,
                        node_order_id,
                        pdf_url,
                        pdf_size,
                        create_quotation=True):
    iyo_username = get_iyo_username(app_user)
    doc_id = u'Zero-Node order %s' % NodeOrder.create_human_readable_id(
        node_order_id)
    category = u'Terms and conditions'
    content_type = u'application/pdf'
    description = u'Terms and conditions for ordering a Zero-Node'
    create_see_document(doc_id, category, description, iyo_username, pdf_url,
                        content_type)
    attachment_name = u' - '.join([doc_id, category])

    def trans():
        order = get_node_order(node_order_id)
        order.tos_iyo_see_id = doc_id
        order.put()
        if create_quotation:
            deferred.defer(_create_quotation,
                           app_user,
                           node_order_id,
                           pdf_url,
                           attachment_name,
                           pdf_size,
                           _transactional=True)

    ndb.transaction(trans)
Beispiel #2
0
def _order_node_iyo_see(app_user, node_order_id, pdf_url):
    iyo_username = get_iyo_username(app_user)
    organization_id = get_iyo_organization_id()

    iyo_see_doc = IYOSeeDocumentView(username=iyo_username,
                                     globalid=organization_id,
                                     uniqueid=u'Zero-Node order %s' % NodeOrder.create_human_readable_id(node_order_id),
                                     version=1,
                                     category=u'Terms and conditions',
                                     link=pdf_url,
                                     content_type=u'application/pdf',
                                     markdown_short_description=u'Terms and conditions for ordering a Zero-Node',
                                     markdown_full_description=u'Terms and conditions for ordering a Zero-Node')
    logging.debug('Creating IYO SEE document: %s', iyo_see_doc)
    iyo_see_doc = create_see_document(iyo_username, iyo_see_doc)

    attachment_name = u' - '.join([iyo_see_doc.uniqueid, iyo_see_doc.category])

    def trans():
        order = get_node_order(node_order_id)
        order.tos_iyo_see_id = iyo_see_doc.uniqueid
        order.put()
        deferred.defer(_create_quotation, app_user, node_order_id, pdf_url, attachment_name,
                       _transactional=True)

    ndb.transaction(trans)