def serialize(self):
        """Serializes the modified orders request.

        The request model for the GetModifiedOrders call in the Symantec
        SOAP XML API. Serializes all related sections to this request model.

        This will serialize the following:
            Query Request Header
            Query Options

        :return: root element for the get modified order request
        """
        root = etree.Element('GetModifiedOrders', nsmap=utils.NS)

        query_request_header = self.request_header.serialize(
            order_type=False
        )
        query_options = self.query_options.serialize()

        request = etree.SubElement(root, 'Request')

        request.append(query_request_header)
        request.append(query_options)

        for node, node_text in [
            ('FromDate', self.from_date),
            ('ToDate', self.to_date)
        ]:
            utils.create_subelement_with_text(request, node, node_text)

        return root
Exemple #2
0
    def serialize(self, element_name):
        """Serializes the contact information section in the request.

        :param element_name: contact element type. Limited to Admin, Tech, and
         Billing.
        :return: the contact element that is to be used for request.
        """

        ele = etree.Element(element_name)
        for node, node_text in [
            ('FirstName', self.first_name),
            ('LastName', self.last_name),
            ('Phone', self.phone),
            ('Email', self.email),
            ('Title', self.title),
            ('OrganizationName', self.org_name),
            ('AddressLine1', self.address_line_one),
            ('AddressLine2', self.address_line_two),
            ('City', self.city),
            ('Region', self.region),
            ('PostalCode', self.postal_code),
            ('Country', self.country),
            ('Fax', self.fax)
        ]:
            utils.create_subelement_with_text(ele, node, node_text)

        return ele
    def serialize(self):
        """Serializes the get order by partner order ID.

        The request model for the GetOrderByPartnerOrderID call in the Symantec
        SOAP XML API. Serializes all related sections to this request model.

        This will serialize the following:
            Query Request Header
            Query Options

        :return: root element for the get order by partner order id
        """
        root = etree.Element('GetOrderByPartnerOrderID', nsmap=utils.NS)

        query_request_header = self.request_header.serialize(
            order_type=False
        )
        query_options = self.query_options.serialize()

        request = etree.SubElement(root, 'Request')
        request.append(query_request_header)
        utils.create_subelement_with_text(
            request, 'PartnerOrderID', self.partner_order_id
        )
        request.append(query_options)

        return root
    def serialize(self):
        """Serializes the Order Parameters section for the request.

        note:: Symantec limits customers to 1, 12, 24, 36, and 48 month options
        for validity period.

        :return: root element of OrderParameters
        """

        root = etree.Element('OrderParameters')

        renewal_indicator = utils._boolean_to_str(self.renewal_indicator, True)
        wildcard = utils._boolean_to_str(self.wildcard, False)

        for node, node_text in [
            ('ValidityPeriod', self.valid_period),
            ('DomainName', self.domain_name),
            ('OriginalPartnerOrderID', self.order_partner_order_id),
            ('CSR', self.csr),
            ('WebServerType', self.web_server_type),
            ('RenewalIndicator', renewal_indicator),
            ('RenewalBehavior', self.renewal_behavior),
            ('SignatureHashAlgorithm', self.signature_hash_algorithm),
            ('SpecialInstructions', self.special_instructions),
            ('WildCard', wildcard),
            ('DNSNames', self.dnsnames)

        ]:
            utils.create_subelement_with_text(root, node, node_text)

        return root
Exemple #5
0
    def serialize(self):
        """Serializes the get order by partner order ID.

        The request model for the GetOrderByPartnerOrderID call in the Symantec
        SOAP XML API. Serializes all related sections to this request model.

        This will serialize the following:
            Query Request Header
            Query Options

        :return: root element for the get order by partner order id
        """
        root = etree.Element(
            'GetOrderByPartnerOrderID',
            nsmap=utils.DEFAULT_NS
        )

        query_request_header = self.request_header.serialize(
            order_type=False
        )
        query_options = self.query_options.serialize()

        request = etree.SubElement(root, 'Request')
        request.append(query_request_header)
        utils.create_subelement_with_text(
            request, 'PartnerOrderID', self.partner_order_id
        )
        request.append(query_options)

        return root
Exemple #6
0
    def serialize(self):
        """Serializes the modified orders request.

        The request model for the GetModifiedOrders call in the Symantec
        SOAP XML API. Serializes all related sections to this request model.

        This will serialize the following:
            Query Request Header
            Query Options

        :return: root element for the get modified order request
        """
        root = etree.Element('GetModifiedOrders', nsmap=utils.NS)

        query_request_header = self.request_header.serialize(
            order_type=False
        )
        query_options = self.query_options.serialize()

        request = etree.SubElement(root, 'Request')

        request.append(query_request_header)
        request.append(query_options)

        for node, node_text in [
            ('FromDate', self.from_date),
            ('ToDate', self.to_date)
        ]:
            utils.create_subelement_with_text(request, node, node_text)

        return root
Exemple #7
0
    def serialize(self):
        """Serializes the Order Parameters section for the request.

        note:: Symantec limits customers to 1, 12, 24, 36, and 48 month options
        for validity period.

        :return: root element of OrderParameters
        """

        root = etree.Element('OrderParameters')

        renewal_indicator = utils._boolean_to_str(self.renewal_indicator, True)
        wildcard = utils._boolean_to_str(self.wildcard, False)

        for node, node_text in [
            ('ValidityPeriod', self.valid_period),
            ('DomainName', self.domain_name),
            ('OriginalPartnerOrderID', self.order_partner_order_id),
            ('CSR', self.csr),
            ('WebServerType', self.web_server_type),
            ('RenewalIndicator', renewal_indicator),
            ('RenewalBehavior', self.renewal_behavior),
            ('SignatureHashAlgorithm', self.signature_hash_algorithm),
            ('SpecialInstructions', self.special_instructions),
            ('WildCard', wildcard),
            ('DNSNames', self.dnsnames)

        ]:
            utils.create_subelement_with_text(root, node, node_text)

        return root
    def serialize(self, order_type):
        """Serializes the request header.

        Each request model should call this in order to process the request.
        The request model will initiate serialization here.

        :order_type: a True or False value to create the proper XML header for
        the request.

        :return: root element for the request header
        """
        if order_type:
            root = etree.Element("OrderRequestHeader")
            for node, node_text in [
                ('ProductCode', self.product_code),
                ('PartnerOrderID', self.partner_order_id)
            ]:
                utils.create_subelement_with_text(root, node, node_text)

        else:
            root = etree.Element("QueryRequestHeader")

        utils.create_subelement_with_text(
            root, 'PartnerCode', self.partner_code
        )
        auth_token = etree.SubElement(root, "AuthToken")

        for node, node_text in [
            ("UserName", self.username),
            ("Password", self.password)
        ]:
            utils.create_subelement_with_text(auth_token, node, node_text)

        return root
    def serialize(self):
        """Serializes the Organization Info for the request.

        :return: root element for the organization info
        """
        root = etree.Element('OrganizationInfo')

        utils.create_subelement_with_text(
            root, 'OrganizationName', self.org_name
        )

        org_address = etree.SubElement(root, 'OrganizationAddress')

        for node, node_text in [
            ('AddressLine1', self.address_line_one),
            ('AddressLine2', self.address_line_two),
            ('AddressLine3', self.address_line_three),
            ('City', self.city),
            ('Region', self.region),
            ('PostalCode', self.postal_code),
            ('Country', self.country),
            ('Phone', self.phone)
        ]:
            utils.create_subelement_with_text(org_address, node, node_text)

        utils.create_subelement_with_text(root, 'DUNS', self.duns)

        return root
Exemple #10
0
    def serialize(self, order_type):
        """Serializes the request header.

        Each request model should call this in order to process the request.
        The request model will initiate serialization here.

        :order_type: a True or False value to create the proper XML header for
        the request.

        :return: root element for the request header
        """
        if order_type:
            root = etree.Element("OrderRequestHeader")
            for node, node_text in [
                ('ProductCode', self.product_code),
                ('PartnerOrderID', self.partner_order_id)
            ]:
                utils.create_subelement_with_text(root, node, node_text)

        else:
            root = etree.Element("QueryRequestHeader")

        utils.create_subelement_with_text(
            root, 'PartnerCode', self.partner_code
        )
        auth_token = etree.SubElement(root, "AuthToken")

        for node, node_text in [
            ("UserName", self.username),
            ("Password", self.password)
        ]:
            utils.create_subelement_with_text(auth_token, node, node_text)

        return root
Exemple #11
0
    def serialize(self):
        """Serializes the Organization Info for the request.

        :return: root element for the organization info
        """
        root = etree.Element('OrganizationInfo')

        utils.create_subelement_with_text(
            root, 'OrganizationName', self.org_name
        )

        org_address = etree.SubElement(root, 'OrganizationAddress')

        for node, node_text in [
            ('AddressLine1', self.address_line_one),
            ('AddressLine2', self.address_line_two),
            ('AddressLine3', self.address_line_three),
            ('City', self.city),
            ('Region', self.region),
            ('PostalCode', self.postal_code),
            ('Country', self.country),
            ('Phone', self.phone)
        ]:
            utils.create_subelement_with_text(org_address, node, node_text)

        utils.create_subelement_with_text(root, 'DUNS', self.duns)

        return root
Exemple #12
0
    def serialize(self, element_name):
        """Serializes the contact information section in the request.

        :param element_name: contact element type. Limited to Admin, Tech, and
         Billing.
        :return: the contact element that is to be used for request.
        """

        ele = etree.Element(element_name)
        for node, node_text in [('FirstName', self.first_name),
                                ('LastName', self.last_name),
                                ('Phone', self.phone), ('Email', self.email),
                                ('Title', self.title),
                                ('OrganizationName', self.org_name),
                                ('AddressLine1', self.address_line_one),
                                ('AddressLine2', self.address_line_two),
                                ('City', self.city), ('Region', self.region),
                                ('PostalCode', self.postal_code),
                                ('Country', self.country), ('Fax', self.fax)]:
            utils.create_subelement_with_text(ele, node, node_text)

        return ele
    def serialize(self):
        """Serialized the OrderChange section for request.

        :return: root element to be added to xml request
        """
        root = etree.Element('OrderChange')
        utils.create_subelement_with_text(root, 'ChangeType', self.change_type)
        if self.new_value:
            utils.create_subelement_with_text(root, 'NewValue', self.new_value)
        if self.old_value:
            utils.create_subelement_with_text(root, 'OldValue', self.old_value)

        return root
Exemple #14
0
    def serialize(self):
        """Serialized the OrderChange section for request.

        :return: root element to be added to xml request
        """
        root = etree.Element('OrderChange')
        utils.create_subelement_with_text(root, 'ChangeType', self.change_type)
        if self.new_value:
            utils.create_subelement_with_text(root, 'NewValue', self.new_value)
        if self.old_value:
            utils.create_subelement_with_text(root, 'OldValue', self.old_value)

        return root