| 1 | package WWW::eNom::Role::Command::Service; | ||||||||||||||||||||||||||||
| 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 Domain DomainName PositiveInt ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 47 | ▶ | use DateTime::Format::DateParse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 47 | ▶ | use Math::Currency; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 47 | ▶ | use POSIX qw( ceil ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 47 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 47 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 47 | requires 'submit', '_set_domain_auto_renew', 'get_domain_by_name'; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 47 | our $VERSION = 'v2.7.0'; # VERSION | |||||||||||||||||||||||||||
| 21 | # ABSTRACT: Addon Services That Can Be Purchased | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub get_domain_privacy_wholesale_price { | ||||||||||||||||||||||||||
|
Subroutine
get_domain_privacy_wholesale_price: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 27 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 28 | method => 'PE_GetProductPrice', | ||||||||||||||||||||||||||||
| 29 | params => { | ||||||||||||||||||||||||||||
| 30 | ProductType => 72, | ||||||||||||||||||||||||||||
| 31 | }, | ||||||||||||||||||||||||||||
| 32 | }); | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | if( !exists $response->{productprice}{price} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | croak 'Response did not contain price info'; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | return Math::Currency->new( $response->{productprice}{price} ); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 45 | 0 | croak $_; | |||||||||||||||||||||||||||
| 46 | 0 | }; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub purchase_domain_privacy_for_domain { | ||||||||||||||||||||||||||
|
Subroutine
purchase_domain_privacy_for_domain: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 51 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 52 | \@_, | ||||||||||||||||||||||||||||
| 53 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 54 | years => { isa => PositiveInt, default => 1 }, | ||||||||||||||||||||||||||||
| 55 | is_auto_renew => { isa => Bool, default => 0 }, | ||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 59 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 60 | method => 'PurchaseServices', | ||||||||||||||||||||||||||||
| 61 | params => { | ||||||||||||||||||||||||||||
| 62 | Service => 'WPPS', | ||||||||||||||||||||||||||||
| 63 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 64 | NumYears => $args{years}, | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | RenewName => ( $args{is_auto_renew} ? 1 : 0 ), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | }); | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if( grep { $_ eq 'ID Protection is already active for this domain' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 0 | croak 'Domain privacy is already purchased for this domain'; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | return $response->{OrderID}; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 84 | 0 | croak $_; | |||||||||||||||||||||||||||
| 85 | 0 | }; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub get_is_privacy_purchased_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_is_privacy_purchased_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 90 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 93 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 94 | method => 'GetWPPSInfo', | ||||||||||||||||||||||||||||
| 95 | params => { | ||||||||||||||||||||||||||||
| 96 | Domain => $domain_name | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | }); | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | return !!( $response->{GetWPPSInfo}{WPPSExists} == 1 ); | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 109 | 0 | croak $_; | |||||||||||||||||||||||||||
| 110 | 0 | }; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub enable_privacy_by_name { | ||||||||||||||||||||||||||
|
Subroutine
enable_privacy_by_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 115 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if( !$self->get_is_privacy_purchased_by_name( $domain_name ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | my $domain = $self->get_domain_by_name( $domain_name ); | |||||||||||||||||||||||||||
| 119 | 0 | my $years = $domain->expiration_date->year - DateTime->now->year; | |||||||||||||||||||||||||||
| 120 | 0 | ▶ | $years == 0 and $years = 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | $self->purchase_domain_privacy_for_domain( | |||||||||||||||||||||||||||
| 123 | domain_name => $domain_name, | ||||||||||||||||||||||||||||
| 124 | years => $years, | ||||||||||||||||||||||||||||
| 125 | is_auto_renew => $domain->is_auto_renew, | ||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | else { | ||||||||||||||||||||||||||||
| 129 | 0 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 130 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 131 | method => 'EnableServices', | ||||||||||||||||||||||||||||
| 132 | params => { | ||||||||||||||||||||||||||||
| 133 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 134 | Service => 'WPPS', | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | }); | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if( grep { $_ eq 'Unable to activate service for this domain' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | # NO OP | ||||||||||||||||||||||||||||
| 145 | 0 | return; | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 152 | 0 | croak $_; | |||||||||||||||||||||||||||
| 153 | 0 | }; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | return $self->get_domain_by_name( $domain_name ); | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub disable_privacy_by_name { | ||||||||||||||||||||||||||
|
Subroutine
disable_privacy_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 160 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 161 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 164 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 165 | method => 'DisableServices', | ||||||||||||||||||||||||||||
| 166 | params => { | ||||||||||||||||||||||||||||
| 167 | Domain => $domain_name, | ||||||||||||||||||||||||||||
| 168 | Service => 'WPPS', | ||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | }); | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if( ( grep { $_ eq 'ID Protect is not purchased for this domain' } @{ $response->{errors} } ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};} or grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
MC/DC0%0/2
grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};} or grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};}
grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
Truth table0%0/3
A or B
A= grep {$_ eq "ID Protect is not purchased for this domain";} @{$$response{"errors"};}B= grep {$_ eq "Unable to disable service for this domain";} @{$$response{"errors"};}
| |||||||||||||||||||||||||||||
| 178 | 0 | || ( grep { $_ eq 'Unable to disable service for this domain' } @{ $response->{errors} } ) ) { | |||||||||||||||||||||||||||
| 179 | # NO OP | ||||||||||||||||||||||||||||
| 180 | 0 | return; | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 187 | 0 | croak $_; | |||||||||||||||||||||||||||
| 188 | 0 | }; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 0 | return $self->get_domain_by_name( $domain_name ); | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | sub get_is_privacy_auto_renew_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_is_privacy_auto_renew_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 194 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 195 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 198 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 199 | method => 'GetWPPSInfo', | ||||||||||||||||||||||||||||
| 200 | params => { | ||||||||||||||||||||||||||||
| 201 | Domain => $domain_name | ||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | }); | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if( $response->{GetWPPSInfo}{WPPSExists} == 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 0 | croak 'Domain does not have privacy'; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if( !$response->{GetWPPSInfo}{WPPSAutoRenew} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 0 | croak 'Response did not contain privacy renewal data'; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 0 | return !!( $response->{GetWPPSInfo}{WPPSAutoRenew} eq 'Yes' ); | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 222 | 0 | croak $_; | |||||||||||||||||||||||||||
| 223 | 0 | }; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub get_privacy_expiration_date_by_name { | ||||||||||||||||||||||||||
|
Subroutine
get_privacy_expiration_date_by_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 227 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 228 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 231 | 0 | my $response = $self->submit({ | |||||||||||||||||||||||||||
| 232 | method => 'GetWPPSInfo', | ||||||||||||||||||||||||||||
| 233 | params => { | ||||||||||||||||||||||||||||
| 234 | Domain => $domain_name | ||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | }); | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if( $response->{GetWPPSInfo}{WPPSExists} == 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 0 | croak 'Domain does not have privacy'; | |||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if( !$response->{GetWPPSInfo}{WPPSExpDate} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 249 | 0 | croak 'Response did not contain privacy expiration data'; | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 0 | return DateTime::Format::DateParse->parse_datetime( $response->{GetWPPSInfo}{WPPSExpDate} ); | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 255 | 0 | croak $_; | |||||||||||||||||||||||||||
| 256 | 0 | }; | |||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub enable_privacy_auto_renew_for_domain { | ||||||||||||||||||||||||||
|
Subroutine
enable_privacy_auto_renew_for_domain: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 260 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 261 | 0 | my ( $domain ) = pos_validated_list( \@_, { isa => Domain } ); | |||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 0 | my $current_is_privacy_auto_renew = $self->get_is_privacy_auto_renew_by_name( $domain->name ); | |||||||||||||||||||||||||||
| 264 | 0 | ▶ | if( $current_is_privacy_auto_renew ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | 0 | return $domain; | |||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | return $self->_set_domain_auto_renew({ | |||||||||||||||||||||||||||
| 269 | domain_name => $domain->name, | ||||||||||||||||||||||||||||
| 270 | is_auto_renew => $domain->is_auto_renew, | ||||||||||||||||||||||||||||
| 271 | privacy_is_auto_renew => 1, | ||||||||||||||||||||||||||||
| 272 | }); | ||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub disable_privacy_auto_renew_for_domain { | ||||||||||||||||||||||||||
|
Subroutine
disable_privacy_auto_renew_for_domain: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 276 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 277 | 0 | my ( $domain ) = pos_validated_list( \@_, { isa => Domain } ); | |||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 0 | my $current_is_privacy_auto_renew = $self->get_is_privacy_auto_renew_by_name( $domain->name ); | |||||||||||||||||||||||||||
| 280 | 0 | ▶ | if( !$current_is_privacy_auto_renew ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 281 | 0 | return $domain; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 0 | return $self->_set_domain_auto_renew({ | |||||||||||||||||||||||||||
| 285 | domain_name => $domain->name, | ||||||||||||||||||||||||||||
| 286 | is_auto_renew => $domain->is_auto_renew, | ||||||||||||||||||||||||||||
| 287 | privacy_is_auto_renew => 0, | ||||||||||||||||||||||||||||
| 288 | }); | ||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub renew_privacy { | ||||||||||||||||||||||||||
|
Subroutine
renew_privacy: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 292 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 293 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 294 | \@_, | ||||||||||||||||||||||||||||
| 295 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 296 | years => { isa => PositiveInt }, | ||||||||||||||||||||||||||||
| 297 | ); | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 0 | ▶ | return try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 300 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 301 | method => 'RenewServices', | ||||||||||||||||||||||||||||
| 302 | params => { | ||||||||||||||||||||||||||||
| 303 | Service => 'WPPS', | ||||||||||||||||||||||||||||
| 304 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 305 | NumYears => $args{years}, | ||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | 0 | }); | |||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 311 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if( grep { $_ eq 'Unable to renew ID Protect for this domain.' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 0 | croak 'Domain does not have privacy'; | |||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 0 | ▶ | if( grep { $_ =~ qr/The number of years cannot/ } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 319 | 0 | croak 'Requested renewal too long'; | |||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | 0 | return $response->{OrderID}; | |||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 328 | 0 | croak $_; | |||||||||||||||||||||||||||
| 329 | 0 | }; | |||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 47 | 1; | |||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | __END__ | ||||||||||||||||||||||||||||