The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::eNom::Role::Command::Service - Addon Services That Can Be Purchased

SYNOPSIS

    use WWW::eNom;

    my $api = WWW::eNom->new( ... );

    # Get wholesale price for Domain privacy
    my $domain_privacy_wholesale_price = $api->get_domain_privacy_wholesale_price();

    # Purchase Domain Privacy
    my $order_id = $api->purchase_domain_privacy_for_domain( 'drzigman.com' );

    # Get If Privacy Has Been Purchased
    my $is_privacy_purchased = $api->get_is_privacy_purchased_by_name( 'drzigman.com' );

    # Enable Domain Privacy
    my $updated_domain = $api->enable_privacy_by_name( 'drzigman.com' );

    # Disable Domain Privacy
    my $updated_domain = $api->disable_privacy_by_name( 'drzigman.com' );

    # Get Privacy Expiration Date
    my $privacy_expiration_date = $api->get_privacy_expiration_date_by_name( 'drzigman.com' );

    # Get is Privacy Auto Renew
    my $is_privacy_auto_renew = $api->get_is_privacy_auto_renew_by_name( 'drzigman.com' );

    my $domain = WWW::eNom::Domain->new( ... );

    # Enable Auto Renew for Domain Privacy
    my $updated_domain = $api->enable_privacy_auto_renew_for_domain( $domain );

    # Disable Auto Renew for Domain Privacy
    my $updated_domain = $api->disable_privacy_auto_renew_for_domain( $domain );

    # Renew Domain privacy
    my $order_id = $api->renew_privacy({
        domain_name => 'drzigman.com',
        years       => 1,
    });

REQUIRES

submit

DESCRIPTION

Implements addon service related API calls (such as WPPS Service, what eNom calls Privacy Protection).

METHODS

get_domain_privacy_wholesale_price

    use Math::Currency;

    my $domain_privacy_wholesale_price = $api->get_domain_privacy_wholesale_price();

Returns the wholesale price per year (the price you as the reseller pay, not what you want to charge your customers) for domain privacy as a Math::Currency object.

purchase_domain_privacy_for_domain

    # Be sure to wrap this in a try/catch block, presented here for clarity
    my $order_id = $api->purchase_domain_privacy_for_domain( 'drzigman.com' );

Abstraction of the PurchaseServices for ID Protect eNom API Call. Given a FQDN, attempts to purchase Domain Privacy for the specified domain. On success, the OrderID of this purchase is returned.

There are several reason this method could fail and croak.

Domain not found in account
Domain privacy is already purchased for this domain
Unknown error

This is almost always caused by attempting to add privacy protection to a public suffix that does not support it.

Noting this, consumers should take care to ensure safe handling of these potential errors.

get_is_privacy_purchased_by_name

    my $is_privacy_purchased = $api->get_is_privacy_purchased_by_name( 'drzigman.com' );

Abstraction of the GetWPPSInfo eNom API Call. Given a FQDN, returns a truthy value if privacy has been purchased regardless of if it is active or not and a falsey value if privacy has not been purchased regardless of it is active or not.

If the domain is not registered or is registered to someone else this method will croak.

enable_privacy_by_name

    my $updated_domain = $api->enable_privacy_by_name( 'drzigman.com' );

Abstraction of the EnableServices eNom API Call. Given a FQDN, enables Domain Privacy for it. If privacy is already active this method is effectively a NO OP. If domain privacy has not been purchased for this domain, this method will buy and activate it automatically. In this case the auto renew will match that of the domain and enough Domain Privacy will be purchased to cover the registration length remaining. Domain privacy is not free, so you may wish to check get_is_privacy_purchased_by_name before making this call if you do not wish to purchase privacy.

If the domain is not registered or is registered to someone else this method will croak.

disable_privacy_by_name

    my $updated_domain = $api->disable_privacy_by_name( 'drzigman.com' );

Abstraction of the DisableServices eNom API Call. Given a FQDN, disables Domain Privacy for it. If privacy is not currently active (or if it has never been purchased for this domain) this method is effective a NO OP.

If the domain is not registered or is registered to someone else this method will croak.

get_is_privacy_auto_renew_by_name

    my $is_privacy_auto_renew = $api->get_is_privacy_auto_renew_by_name( 'drzigman.com' );

Abstraction of the GetWPPSInfo eNom API Call. Given a FQDN, returns a truthy value if auto renew is enabled for domain privacy and a falsey value if auto renew is disabled for domain privacy.

If the domain is not registered or is registered to someone else this method will croak.

NOTE If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.

get_privacy_expiration_date_by_name

    my $privacy_expiration_date = $api->get_privacy_expiration_date_by_name( 'drzigman.com' );

Abstraction of the GetWPPSInfo eNom API Call. Given a FQDN, returns a DateTime object representing when domain privacy will expire.

If the domain is not registered or is registered to someone else this method will croak.

NOTE If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.

enable_privacy_auto_renew_for_domain

    my $domain         = WWW::eNom::Domain->new( ... );
    my $updated_domain = $api->enable_privacy_auto_renew_for_domain( $domain );

Abstraction of the SetRenew eNom API Call. Given an instance of WWW::eNom::Domain enables auto renew of domain privacy. If the domain privacy is already set to auto renew this method is effectively a NO OP.

NOTE If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.

disable_privacy_auto_renew_for_domain

    my $domain         = WWW::eNom::Domain->new( ... );
    my $updated_domain = $api->disable_privacy_auto_renew_for_domain( $domain );

Abstraction of the SetRenew eNom API Call. Given an instance of WWW::eNom::Domain disables auto renew of domain privacy. If the domain privacy is already set not to auto renew this method is effectively a NO OP.

If the domain is not registered or is registered to someone else this method will croak.

NOTE If the specified domain does not have domain privacy this method will croak with the message 'Domain does not have privacy'.

renew_privacy

    my $order_id = $api->renew_privacy({
        domain_name => 'drzigman.com',
        years       => 1,
    });

Abstraction of the RenewServices eNom API Call. Given a FQDN and a number of years, renews domain privacy. Returned is the order id.

There are several reasons this method could croak:

Requested renewal too long

If you request a renewal longer than 10 years.

Domain does not have privacy

If the domain does not have privacy

If the domain is not registered or is registered to someone else this method will croak.