| 1 | package WWW::eNom::Role::Command::Domain; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 47 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 47 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 47 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 47 | ▶ | use MooseX::Params::Validate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 47 | ▶ | use WWW::eNom::Types qw( Bool DomainName DomainNames PositiveInt ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 47 | ▶ | use WWW::eNom::Domain; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 47 | ▶ | use Data::Util qw( is_array_ref ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 47 | ▶ | use DateTime::Format::DateParse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 47 | ▶ | use Mozilla::PublicSuffix qw( public_suffix ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 47 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 47 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 47 | requires 'submit', 'get_contacts_by_domain_name', 'delete_private_nameserver'; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 47 | our $VERSION = 'v2.7.0'; # VERSION | |||||||||||||||||||||||||||
| 22 | # ABSTRACT: Domain Related Operations | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub get_domain_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_domain_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 26 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 29 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 30 | method => 'GetDomainInfo', | ||||||||||||||||||||||||||||
| 31 | params => { | ||||||||||||||||||||||||||||
| 32 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | }); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if( !exists $response->{GetDomainInfo} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | croak 'Response did not contain domain info'; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | # There is no way to ask eNom what the private nameservers are so we use | ||||||||||||||||||||||||||||
| 49 | # the fact that they must have the same root domain in order to differentiate | ||||||||||||||||||||||||||||
| 50 | # between private and "regular" nameservers | ||||||||||||||||||||||||||||
| 51 | 0 | my $nameservers = $self->get_domain_name_servers_by_name( $domain_name ); | |||||||||||||||||||||||||||
| 52 | my @private_nameservers = map { | ||||||||||||||||||||||||||||
| 53 | 0 | $self->retrieve_private_nameserver_by_name( $_ ) | |||||||||||||||||||||||||||
| 54 | 0 | } grep { $_ =~ m/\Q$domain_name/ } @{ $nameservers }; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | return WWW::eNom::Domain->construct_from_response( | ||||||||||||||||||||||||||||
| 57 | domain_info => $response->{GetDomainInfo}, | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | is_auto_renew => $self->get_is_domain_auto_renew_by_name( $domain_name ), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | is_locked => $self->get_is_domain_locked_by_name( $domain_name ), | ||||||||||||||||||||||||||||
| 60 | name_servers => $nameservers, | ||||||||||||||||||||||||||||
| 61 | scalar @private_nameservers ? ( private_nameservers => \@private_nameservers ) : ( ), | ||||||||||||||||||||||||||||
| 62 | contacts => $self->get_contacts_by_domain_name( $domain_name ), | ||||||||||||||||||||||||||||
| 63 | created_date => $self->get_domain_created_date_by_name( $domain_name ), | ||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 67 | 0 | croak $_; | |||||||||||||||||||||||||||
| 68 | 0 | }; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub get_is_domain_locked_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_is_domain_locked_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 73 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 76 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 77 | method => 'GetRegLock', | ||||||||||||||||||||||||||||
| 78 | params => { | ||||||||||||||||||||||||||||
| 79 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | }); | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if( $response->{RRPText} =~ m/Command blocked/ || $response->{RRPText} =~ m/Authorization error/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$response->{"RRPText"} =~ /Command blocked/ or $response->{"RRPText"} =~ /Authorization error/
MC/DC0%0/2
$response->{"RRPText"} =~ /Command blocked/ or $response->{"RRPText"} =~ /Authorization error/
$response->{"RRPText"} =~ /Command blocked/
$response->{"RRPText"} =~ /Authorization error/
Truth table0%0/3
A or B
A= $response->{"RRPText"} =~ /Command blocked/B= $response->{"RRPText"} =~ /Authorization error/
| |||||||||||||||||||||||||||||
| 85 | 0 | croak 'Domain owned by someone else'; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | if( $response->{RRPText} =~ m/Object does not exist/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | croak 'Domain is not registered'; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | croak $response->{RRPText}; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if( !exists $response->{'reg-lock'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | 0 | croak 'Response did not contain lock data'; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | return !!$response->{'reg-lock'}; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 102 | 0 | croak $_; | |||||||||||||||||||||||||||
| 103 | 0 | }; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub enable_domain_lock_by_name { | ||||||||||||||||||||||||||
|
Subroutine
enable_domain_lock_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 107 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 108 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | return $self->_set_domain_locking( | |||||||||||||||||||||||||||
| 111 | domain_name => $domain_name, | ||||||||||||||||||||||||||||
| 112 | is_locked => 1, | ||||||||||||||||||||||||||||
| 113 | ); | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub disable_domain_lock_by_name { | ||||||||||||||||||||||||||
|
Subroutine
disable_domain_lock_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 117 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 118 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | return $self->_set_domain_locking( | |||||||||||||||||||||||||||
| 121 | domain_name => $domain_name, | ||||||||||||||||||||||||||||
| 122 | is_locked => 0, | ||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub _set_domain_locking { | ||||||||||||||||||||||||||
|
Subroutine
_set_domain_locking: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 127 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 128 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 129 | \@_, | ||||||||||||||||||||||||||||
| 130 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 131 | is_locked => { isa => Bool }, | ||||||||||||||||||||||||||||
| 132 | ); | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 135 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 136 | method => 'SetRegLock', | ||||||||||||||||||||||||||||
| 137 | params => { | ||||||||||||||||||||||||||||
| 138 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 139 | 0 | ▶ | UnlockRegistrar => ( !$args{is_locked} ? 1 : 0 ), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | }); | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if( grep { $_ =~ m/domain is already/ } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | # NO OP, what I asked for is already done | ||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | return $self->get_domain_by_name( $args{domain_name} ); | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 156 | 0 | croak "$_"; | |||||||||||||||||||||||||||
| 157 | 0 | }; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub get_domain_name_servers_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_domain_name_servers_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 161 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 162 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 165 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 166 | method => 'GetDNS', | ||||||||||||||||||||||||||||
| 167 | params => { | ||||||||||||||||||||||||||||
| 168 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | }); | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 174 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | elsif( grep { $_ eq 'This domain name is expired and cannot be updated' } @{ $response->{errors} } ) { | |||||||||||||||||||||||||||
| 178 | 0 | return [ ]; | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | if( !exists $response->{dns} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | 0 | croak 'Response did not contain nameserver data'; | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | # If there is only one NS convert the scalar to an arrayref | ||||||||||||||||||||||||||||
| 189 | 0 | ▶ | return is_array_ref( $response->{dns} ) ? $response->{dns} : [ $response->{dns} ]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 192 | 0 | croak $_; | |||||||||||||||||||||||||||
| 193 | 0 | }; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub update_nameservers_for_domain_name { | ||||||||||||||||||||||||||
|
Subroutine
update_nameservers_for_domain_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 197 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 198 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 199 | \@_, | ||||||||||||||||||||||||||||
| 200 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 201 | ns => { isa => DomainNames }, | ||||||||||||||||||||||||||||
| 202 | ); | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 205 | my @initial_private_nameserver_names = grep { | ||||||||||||||||||||||||||||
| 206 | 0 | $_ =~ m/\Q$args{domain_name}/ | |||||||||||||||||||||||||||
| 207 | 0 | } @{ $self->get_domain_name_servers_by_name( $args{domain_name} ) }; | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 210 | method => 'ModifyNS', | ||||||||||||||||||||||||||||
| 211 | params => { | ||||||||||||||||||||||||||||
| 212 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 213 | 0 | map { 'NS' . ( $_ + 1 ) => $args{ns}->[ $_ ] } 0 .. ( scalar (@{ $args{ns} }) - 1) | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | }); | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if( grep { $_ =~ m/could not be registered/ } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 0 | croak 'Invalid Nameserver provided'; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | # Delete private nameservers that are no longer being used as authoritative | ||||||||||||||||||||||||||||
| 230 | 0 | for my $private_nameserver_name ( @initial_private_nameserver_names ) { | |||||||||||||||||||||||||||
| 231 | 0 | ▶ | if( grep { $_ eq $private_nameserver_name } @{ $args{ns} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 0 | next; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | $self->delete_private_nameserver( | ||||||||||||||||||||||||||||
| 236 | domain_name => $args{domain_name}, | ||||||||||||||||||||||||||||
| 237 | 0 | private_nameserver_name => $private_nameserver_name, | |||||||||||||||||||||||||||
| 238 | ); | ||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 242 | 0 | croak $_; | |||||||||||||||||||||||||||
| 243 | 0 | }; | |||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 0 | return $self->get_domain_by_name( $args{domain_name} ); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub get_is_domain_auto_renew_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_is_domain_auto_renew_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 250 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 251 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 254 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 255 | method => 'GetRenew', | ||||||||||||||||||||||||||||
| 256 | params => { | ||||||||||||||||||||||||||||
| 257 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | }); | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 263 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | 0 | elsif( grep { $_ eq 'This domain name is expired and cannot be updated' } @{ $response->{errors} } ) { | |||||||||||||||||||||||||||
| 266 | 0 | return !!0; | |||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 0 | ▶ | if( !exists $response->{'auto-renew'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 273 | 0 | croak 'Response did not contain renewal data'; | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | return !!$response->{'auto-renew'}; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 279 | 0 | croak $_; | |||||||||||||||||||||||||||
| 280 | 0 | }; | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 0 | ▶ | sub enable_domain_auto_renew_by_name { | ||||||||||||||||||||||||||
|
Subroutine
enable_domain_auto_renew_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 284 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 285 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | return $self->_set_domain_auto_renew({ | |||||||||||||||||||||||||||
| 288 | domain_name => $domain_name, | ||||||||||||||||||||||||||||
| 289 | is_auto_renew => 1, | ||||||||||||||||||||||||||||
| 290 | }); | ||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub disable_domain_auto_renew_by_name { | ||||||||||||||||||||||||||
|
Subroutine
disable_domain_auto_renew_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 294 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 295 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 0 | return $self->_set_domain_auto_renew({ | |||||||||||||||||||||||||||
| 298 | domain_name => $domain_name, | ||||||||||||||||||||||||||||
| 299 | is_auto_renew => 0, | ||||||||||||||||||||||||||||
| 300 | }); | ||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub _set_domain_auto_renew { | ||||||||||||||||||||||||||
|
Subroutine
_set_domain_auto_renew: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 304 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 305 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 306 | \@_, | ||||||||||||||||||||||||||||
| 307 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 308 | is_auto_renew => { isa => Bool }, | ||||||||||||||||||||||||||||
| 309 | privacy_is_auto_renew => { isa => Bool, optional => 1 }, | ||||||||||||||||||||||||||||
| 310 | ); | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 313 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 314 | method => 'SetRenew', | ||||||||||||||||||||||||||||
| 315 | params => { | ||||||||||||||||||||||||||||
| 316 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 317 | RenewFlag => ( $args{is_auto_renew} ? 1 : 0 ), | ||||||||||||||||||||||||||||
| 318 | 0 | ▶ | defined $args{privacy_is_auto_renew} ? ( WPPSRenew => ( $args{privacy_is_auto_renew} ? 1 : 0 ) ) : ( ), | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | }); | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 323 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 324 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | 0 | return $self->get_domain_by_name( $args{domain_name} ); | |||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 331 | 0 | croak "$_"; | |||||||||||||||||||||||||||
| 332 | 0 | }; | |||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | 0 | ▶ | sub get_domain_created_date_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_domain_created_date_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 337 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 338 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 341 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 342 | method => 'GetWhoisContact', | ||||||||||||||||||||||||||||
| 343 | params => { | ||||||||||||||||||||||||||||
| 344 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||
| 346 | }); | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if( grep { $_ eq 'No results found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | 0 | ▶ | if( !exists $response->{GetWhoisContacts}{'rrp-info'}{'created-date'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 357 | 0 | croak 'Response did not contain creation data'; | |||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | 0 | return DateTime::Format::DateParse->parse_datetime( $response->{GetWhoisContacts}{'rrp-info'}{'created-date'}, 'UTC' ); | |||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 364 | 0 | croak $_; | |||||||||||||||||||||||||||
| 365 | 0 | }; | |||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub renew_domain { | ||||||||||||||||||||||||||
|
Subroutine
renew_domain: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 371 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 372 | \@_, | ||||||||||||||||||||||||||||
| 373 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 374 | years => { isa => PositiveInt }, | ||||||||||||||||||||||||||||
| 375 | ); | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 378 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 379 | method => 'Extend', | ||||||||||||||||||||||||||||
| 380 | params => { | ||||||||||||||||||||||||||||
| 381 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 382 | NumYears => $args{years}, | ||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||
| 384 | 0 | }); | |||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 387 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 388 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 0 | ▶ | if( ( grep { $_ =~ qr/The number of years cannot/ } @{ $response->{errors} } ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {$_ =~ qr/The number of years cannot/;} @{$$response{"errors"};} or grep {$_ =~ qr/cannot be extended/;} @{$$response{"errors"};}
MC/DC0%0/2
grep {$_ =~ qr/The number of years cannot/;} @{$$response{"errors"};} or grep {$_ =~ qr/cannot be extended/;} @{$$response{"errors"};}
grep {$_ =~ qr/The number of years cannot/;} @{$$response{"errors"};}
grep {$_ =~ qr/cannot be extended/;} @{$$response{"errors"};}
Truth table0%0/3
A or B
A= grep {$_ =~ qr/The number of years cannot/;} @{$$response{"errors"};}B= grep {$_ =~ qr/cannot be extended/;} @{$$response{"errors"};}
| |||||||||||||||||||||||||||||
| 392 | 0 | || ( grep { $_ =~ qr/cannot be extended/ } @{ $response->{errors} } ) ) { | |||||||||||||||||||||||||||
| 393 | 0 | croak 'Requested renewal too long'; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | 0 | return $response->{OrderID}; | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 402 | 0 | croak $_; | |||||||||||||||||||||||||||
| 403 | 0 | }; | |||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | 0 | ▶ | sub email_epp_key_by_name { | ||||||||||||||||||||||||||
|
Subroutine
email_epp_key_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 407 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 408 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 411 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 412 | method => 'GetSubAccountPassword', | ||||||||||||||||||||||||||||
| 413 | params => { | ||||||||||||||||||||||||||||
| 414 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | }); | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if( grep { $_ eq 'Domain is not available to get password' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | # If there are no errors, assume success | ||||||||||||||||||||||||||||
| 427 | 0 | return; | |||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 430 | 0 | croak $_; | |||||||||||||||||||||||||||
| 431 | 0 | }; | |||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | 47 | 1; | |||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | __END__ | ||||||||||||||||||||||||||||