Try to renew the specified expiring domain name for a specified number of years

    domain_name
        The domain name to be renewed

    years
        Number of years to renew

    Returns the following information:

    - Whether or not the domain was renewed successfully
    - The domain ID
    - The order ID
    - The transaction ID
    - The amount charged for renewal

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.renew my-domain-name 5

def renew(domain_name, years, promotion_code=None):
    '''
    Try to renew the specified expiring domain name for a specified number of years

    domain_name
        The domain name to be renewed

    years
        Number of years to renew

    Returns the following information:

    - Whether or not the domain was renewed successfully
    - The domain ID
    - The order ID
    - The transaction ID
    - The amount charged for renewal

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_domains.renew my-domain-name 5
    '''

    opts = salt.utils.namecheap.get_opts('namecheap.domains.renew')
    opts['DomainName'] = domain_name
    opts['Years'] = years
    if promotion_code is not None:
        opts['PromotionCode'] = promotion_code

    response_xml = salt.utils.namecheap.post_request(opts)

    if response_xml is None:
        return {}

    domainrenewresult = response_xml.getElementsByTagName("DomainRenewResult")[0]
    return salt.utils.namecheap.xml_to_dict(domainrenewresult)