Creates a new SSL certificate. Returns the following information:

    - Whether or not the SSL order was successful
    - The certificate ID
    - The order ID
    - The transaction ID
    - The amount charged for the order
    - The date on which the certificate was created
    - The date on which the certificate will expire
    - The type of SSL certificate
    - The number of years for which the certificate was purchased
    - The current status of the SSL certificate

    years : 1
        Number of years to register

    certificate_type
        Type of SSL Certificate. Possible values include:

        - EV Multi Domain SSL
        - EV SSL
        - EV SSL SGC
        - EssentialSSL
        - EssentialSSL Wildcard
        - InstantSSL
        - InstantSSL Pro
        - Multi Domain SSL
        - PositiveSSL
        - PositiveSSL Multi Domain
        - PositiveSSL Wildcard
        - PremiumSSL
        - PremiumSSL Wildcard
        - QuickSSL Premium
        - RapidSSL
        - RapidSSL Wildcard
        - SGC Supercert
        - SSL Web Server
        - SSL Webserver EV
        - SSL123
        - Secure Site
        - Secure Site Pro
        - Secure Site Pro with EV
        - Secure Site with EV
        - True BusinessID
        - True BusinessID Multi Domain
        - True BusinessID Wildcard
        - True BusinessID with EV
        - True BusinessID with EV Multi Domain
        - Unified Communications

    promotional_code
        An optional promo code to use when creating the certificate

    sans_to_add : 0
        This parameter defines the number of add-on domains to be purchased in
        addition to the default number of domains included with a multi-domain
        certificate. Each certificate that supports SANs has the default number
        of domains included. You may check the default number of domains
        included and the maximum number of domains that can be added to it in
        the table below.

    +----------+----------------+----------------------+-------------------+----------------+
    | Provider | Product name   | Default number of    | Maximum number of | Maximum number |
    |          |                | domains (domain from | total domains     | of domains     |
    |          |                | CSR is counted here) |                   | that can be    |
    |          |                |                      |                   | passed in      |
    |          |                |                      |                   | sans_to_add    |
    |          |                |                      |                   | parameter      |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | PositiveSSL    | 3                    | 100               | 97             |
    |          | Multi-Domain   |		       |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | Multi-Domain   | 3                    | 100               | 97   	    |
    |          | SSL            |		       |                   |		    |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | EV Multi-      | 3                    | 100               | 97             |
    |          | Domain SSL     |		       |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | Unified        | 3                    | 100               | 97             |
    |          | Communications |                      |  		   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | GeoTrust | QuickSSL       | 1                    | 1 domain +        | The only       |
    |          | Premium        |                      | 4 subdomains      | supported      |
    |          |                |                      |                   | value is 4     |
    +----------+----------------+----------------------+-------------------+----------------+
    | GeoTrust | True           | 5                    | 25                | 20             |
    |          | BusinessID     |                      |		   |                |
    |          | with EV        |                      |                   |                |
    |          | Multi-Domain   |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | GeoTrust | True Business  | 5                    | 25                | 20             |
    |          | ID Multi-      |                      |                   |                |
    |          | Domain         |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Thawte   | SSL Web        | 1                    | 25                | 24             |
    |          | Server         |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Thawte   | SSL Web        | 1                    | 25                | 24             |
    |          | Server with    |                      |                   |                |
    |          | EV             |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Thawte   | SGC Supercerts | 1                    | 25                | 24             |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    |          | Pro with EV    |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    |          | with EV        |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    |          | Pro            |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_ssl.create 2 RapidSSL

def create(years, certificate_type, promotion_code=None, sans_to_add=None):
    '''
    Creates a new SSL certificate. Returns the following information:

    - Whether or not the SSL order was successful
    - The certificate ID
    - The order ID
    - The transaction ID
    - The amount charged for the order
    - The date on which the certificate was created
    - The date on which the certificate will expire
    - The type of SSL certificate
    - The number of years for which the certificate was purchased
    - The current status of the SSL certificate

    years : 1
        Number of years to register

    certificate_type
        Type of SSL Certificate. Possible values include:

        - EV Multi Domain SSL
        - EV SSL
        - EV SSL SGC
        - EssentialSSL
        - EssentialSSL Wildcard
        - InstantSSL
        - InstantSSL Pro
        - Multi Domain SSL
        - PositiveSSL
        - PositiveSSL Multi Domain
        - PositiveSSL Wildcard
        - PremiumSSL
        - PremiumSSL Wildcard
        - QuickSSL Premium
        - RapidSSL
        - RapidSSL Wildcard
        - SGC Supercert
        - SSL Web Server
        - SSL Webserver EV
        - SSL123
        - Secure Site
        - Secure Site Pro
        - Secure Site Pro with EV
        - Secure Site with EV
        - True BusinessID
        - True BusinessID Multi Domain
        - True BusinessID Wildcard
        - True BusinessID with EV
        - True BusinessID with EV Multi Domain
        - Unified Communications

    promotional_code
        An optional promo code to use when creating the certificate

    sans_to_add : 0
        This parameter defines the number of add-on domains to be purchased in
        addition to the default number of domains included with a multi-domain
        certificate. Each certificate that supports SANs has the default number
        of domains included. You may check the default number of domains
        included and the maximum number of domains that can be added to it in
        the table below.

    +----------+----------------+----------------------+-------------------+----------------+
    | Provider | Product name   | Default number of    | Maximum number of | Maximum number |
    |          |                | domains (domain from | total domains     | of domains     |
    |          |                | CSR is counted here) |                   | that can be    |
    |          |                |                      |                   | passed in      |
    |          |                |                      |                   | sans_to_add    |
    |          |                |                      |                   | parameter      |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | PositiveSSL    | 3                    | 100               | 97             |
    |          | Multi-Domain   |		       |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | Multi-Domain   | 3                    | 100               | 97   	    |
    |          | SSL            |		       |                   |		    |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | EV Multi-      | 3                    | 100               | 97             |
    |          | Domain SSL     |		       |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Comodo   | Unified        | 3                    | 100               | 97             |
    |          | Communications |                      |  		   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | GeoTrust | QuickSSL       | 1                    | 1 domain +        | The only       |
    |          | Premium        |                      | 4 subdomains      | supported      |
    |          |                |                      |                   | value is 4     |
    +----------+----------------+----------------------+-------------------+----------------+
    | GeoTrust | True           | 5                    | 25                | 20             |
    |          | BusinessID     |                      |		   |                |
    |          | with EV        |                      |                   |                |
    |          | Multi-Domain   |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | GeoTrust | True Business  | 5                    | 25                | 20             |
    |          | ID Multi-      |                      |                   |                |
    |          | Domain         |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Thawte   | SSL Web        | 1                    | 25                | 24             |
    |          | Server         |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Thawte   | SSL Web        | 1                    | 25                | 24             |
    |          | Server with    |                      |                   |                |
    |          | EV             |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Thawte   | SGC Supercerts | 1                    | 25                | 24             |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    |          | Pro with EV    |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    |          | with EV        |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    +----------+----------------+----------------------+-------------------+----------------+
    | Symantec | Secure Site    | 1                    | 25                | 24             |
    |          | Pro            |                      |                   |                |
    +----------+----------------+----------------------+-------------------+----------------+

    CLI Example:

    .. code-block:: bash

        salt 'my-minion' namecheap_ssl.create 2 RapidSSL
    '''
    valid_certs = ('QuickSSL Premium',
                   'RapidSSL',
                   'RapidSSL Wildcard',
                   'PremiumSSL',
                   'InstantSSL',
                   'PositiveSSL',
                   'PositiveSSL Wildcard',
                   'True BusinessID with EV',
                   'True BusinessID',
                   'True BusinessID Wildcard',
                   'True BusinessID Multi Domain',
                   'True BusinessID with EV Multi Domain',
                   'Secure Site',
                   'Secure Site Pro',
                   'Secure Site with EV',
                   'Secure Site Pro with EV',
                   'EssentialSSL',
                   'EssentialSSL Wildcard',
                   'InstantSSL Pro',
                   'PremiumSSL Wildcard',
                   'EV SSL',
                   'EV SSL SGC',
                   'SSL123',
                   'SSL Web Server',
                   'SGC Supercert',
                   'SSL Webserver EV',
                   'EV Multi Domain SSL',
                   'Multi Domain SSL',
                   'PositiveSSL Multi Domain',
                   'Unified Communications',
                   )

    if certificate_type not in valid_certs:
        log.error('Invalid option for certificate_type=%s', certificate_type)
        raise Exception('Invalid option for certificate_type=' + certificate_type)

    if years < 1 or years > 5:
        log.error('Invalid option for years=%s', years)
        raise Exception('Invalid option for years=' + six.text_type(years))

    opts = salt.utils.namecheap.get_opts('namecheap.ssl.create')

    opts['Years'] = years
    opts['Type'] = certificate_type
    if promotion_code is not None:
        opts['PromotionCode'] = promotion_code
    if sans_to_add is not None:
        opts['SANStoADD'] = sans_to_add

    response_xml = salt.utils.namecheap.post_request(opts)
    if response_xml is None:
        return {}

    sslcreateresult = response_xml.getElementsByTagName('SSLCreateResult')[0]
    sslcertinfo = sslcreateresult.getElementsByTagName('SSLCertificate')[0]

    result = salt.utils.namecheap.atts_to_dict(sslcreateresult)
    result.update(salt.utils.namecheap.atts_to_dict(sslcertinfo))
    return result