| 1 | package IO::EPP::HosterKZ; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | IO::EPP::HosterKZ | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | use IO::EPP::HosterKZ; | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # All queries are atomic, creating an object doesn't make sense | ||||||||||||||||||||||||||||
| 14 | sub make_request { | ||||||||||||||||||||||||||||
| 15 | my ( $action, $params ) = @_; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | $params->{user} = 'login'; | ||||||||||||||||||||||||||||
| 18 | $params->{pass} = 'xxxxx'; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # Parameters for LWP | ||||||||||||||||||||||||||||
| 21 | my %sock_params = ( | ||||||||||||||||||||||||||||
| 22 | PeerHost => 'https://billing.hoster.kz/api/', | ||||||||||||||||||||||||||||
| 23 | PeerPort => 443, | ||||||||||||||||||||||||||||
| 24 | Timeout => 30, | ||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | $params->{sock_params} = \%sock_params; | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | return IO::EPP::HosterKZ::make_request( $action, $params ); | ||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | # Check domain | ||||||||||||||||||||||||||||
| 33 | my ( $answ, $msg ) = make_request( 'check_domains', { domains => [ 'hoster.kz' ] } ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | Work with reseller hoster.kz epp api | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | The module works via LWP | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | Features: | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =over 3 | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =item * | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | not the full epp protocol | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =item * | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | works over https | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =item * | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | there are no login and logout commands | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =item * | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | no session | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =item * | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | no epp header in request, but has in answer | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =item * | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | need name in update_contact | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =item * | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | not has epp poll | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =item * | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | transfer without renew | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =item * | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | many features at prolongation and autorenew | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =back | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | Documentation: | ||||||||||||||||||||||||||||
| 84 | L<https://hoster.kz/upload/api_hosterkz.pdf> | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 1 | ▶ | use HTTP::Request::Common qw(POST); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 89 | 1 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | 1 | ▶ | use Time::HiRes qw(time); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 1 | ▶ | use IO::EPP::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 93 | 1 | ▶ | use parent qw( IO::EPP::Base ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 96 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | sub make_request { | ||||||||||||||||||||||||||||
| 100 | 0 | ▶ | my ( $action, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
make_request: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | $params = IO::EPP::Base::recursive_utf8_unflaged( $params ); # LWP does not support utf8 flag | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | my ( $self, $code, $msg, $answ ); | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | unless ( $params->{conn} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | # Default: | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $params->{sock_params}{PeerHost} ||= 'https://billing.hoster.kz/api/'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$params->{"sock_params"}{"PeerHost"} ||= "https://billing.hoster.kz/api/"
MC/DC0%0/1
$params->{"sock_params"}{"PeerHost"} ||= "https://billing.hoster.kz/api/"
$params->{"sock_params"}{"PeerHost"}
Truth table0%0/2
A
A= $params->{"sock_params"}{"PeerHost"}
| |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $params->{sock_params}{PeerPort} ||= 443; | ||||||||||||||||||||||||||
|
Condition0%0/2
$params->{"sock_params"}{"PeerPort"} ||= 443
MC/DC0%0/1
$params->{"sock_params"}{"PeerPort"} ||= 443
$params->{"sock_params"}{"PeerPort"}
Truth table0%0/2
A
A= $params->{"sock_params"}{"PeerPort"}
| |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ( $self, $code, $msg ) = __PACKAGE__->new( $params ); | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | unless ( $code and $code == 1000 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$code and $code == 1000
MC/DC0%0/2
$code and $code == 1000
$code
$code == 1000
Truth table0%0/3
A and B
A= $codeB= $code == 1000
| |||||||||||||||||||||||||||||
| 114 | 0 | goto END_MR; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | else { | ||||||||||||||||||||||||||||
| 118 | 0 | $self = $params->{conn}; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 0 | $self->{critical_error} = ''; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ( $self->can( $action ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | ( $answ, $code, $msg ) = $self->$action( $params ); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | else { | ||||||||||||||||||||||||||||
| 127 | 0 | $msg = "undefined command <$action>, request cancelled"; | |||||||||||||||||||||||||||
| 128 | 0 | $code = 0; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | END_MR: | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $msg .= '; ' . $self->{critical_error} if $self->{critical_error}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 0 | my $full_answ = "code: $code\nmsg: $msg"; | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $answ = {} unless $answ && ref $answ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$answ and ref $answ
MC/DC0%0/2
$answ and ref $answ
$answ
ref $answ
Truth table0%0/3
A and B
A= $answB= ref $answ
| |||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 0 | $answ->{code} = $code; | |||||||||||||||||||||||||||
| 141 | 0 | $answ->{msg} = $msg; | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | return wantarray ? ( $answ, $full_answ, $self ) : $answ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =head1 METHODS | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | =head2 req | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | Completely replaces IO::EPP::Base::req because it works via LWP | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =cut | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | sub req { | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my ( $self, $out_data, $info ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
req: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | $out_data =~ s/^\n//s; | |||||||||||||||||||||||||||
| 160 | 0 | $out_data =~ s/\n<\/epp>//; # !!! | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | $info ||= ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$info ||= ""
MC/DC0%0/1
$info ||= ""
$info
Truth table0%0/2
A
A= $info
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if ( $out_data ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | my $d = $out_data; | |||||||||||||||||||||||||||
| 166 | # remove password, authinfo from log | ||||||||||||||||||||||||||||
| 167 | 0 | $d =~ s/<pw>[^<>]+<\/pw>/<pw>xxxxx<\/pw>/; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 0 | $self->epp_log( "$info request:\n$d" ); | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | my $THRESHOLD = 100000000; | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | my $start_time = time; | |||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | #my $cookie = HTTP::Cookies->new; | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | my $ua = LWP::UserAgent->new( | |||||||||||||||||||||||||||
| 179 | agent => 'EppBot/7.02 (Perl; Linux i686; ru, en_US)', | ||||||||||||||||||||||||||||
| 180 | parse_head => 0, | ||||||||||||||||||||||||||||
| 181 | #keep_alive => 30, | ||||||||||||||||||||||||||||
| 182 | #cookie_jar => $cookie, | ||||||||||||||||||||||||||||
| 183 | #%ua_params, | ||||||||||||||||||||||||||||
| 184 | ); | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | my $in_data; | |||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | eval { | ||||||||||||||||||||||||||||
| 189 | 0 | ▶ | local $SIG{ALRM} = sub { die "connection timeout\n" }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | alarm 120; | |||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | my $req = POST $self->{url}, [ | ||||||||||||||||||||||||||||
| 194 | login => $self->{user}, | ||||||||||||||||||||||||||||
| 195 | psw => $self->{pass}, | ||||||||||||||||||||||||||||
| 196 | 0 | xml => $out_data, | |||||||||||||||||||||||||||
| 197 | ]; | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | my $res = $ua->request( $req ); | |||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | alarm 0; | |||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ( $res->is_success ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | $in_data = $res->content; | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | die "data length is zero\n" unless $in_data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 0 | my $data_size = length $in_data; | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | ▶ | die "data length is $data_size which exceeds $THRESHOLD\n" if $data_size > $THRESHOLD; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | else { | ||||||||||||||||||||||||||||
| 213 | 0 | die "fail answer: " . $res->as_string . "\n"; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | 1; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | 0 | ▶ | or do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | 0 | my $err = $@; | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | alarm 0; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | my $req_time = sprintf( '%0.4f', time - $start_time ); | |||||||||||||||||||||||||||
| 224 | 0 | $self->epp_log( "req_time: $req_time\n$info req error: $err" ); | |||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | $self->{critical_error} = "req error: $err"; | |||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | return; | |||||||||||||||||||||||||||
| 229 | }; | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 0 | my $req_time = sprintf( '%0.4f', time - $start_time ); | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | # "Authentication error" - work with normal code & msg | ||||||||||||||||||||||||||||
| 234 | # "User regikz_user already has more than.*active connections" - we did not see yet | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 0 | $self->epp_log( "req_time: $req_time\n$info answer:\n$in_data\n" ); | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | return $in_data; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | sub new { | ||||||||||||||||||||||||||||
| 243 | 0 | ▶ | my ( $package, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 0 | my ( $self, $code, $msg ); | |||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | my $sock_params = delete $params->{sock_params}; | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | my $test = delete $params->{test_mode}; | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | $self = bless { | ||||||||||||||||||||||||||||
| 252 | sock => 'https', # no session | ||||||||||||||||||||||||||||
| 253 | user => delete $params->{user}, | ||||||||||||||||||||||||||||
| 254 | pass => delete $params->{pass}, # !!! Send login and password with each request | ||||||||||||||||||||||||||||
| 255 | url => $sock_params->{PeerHost}, | ||||||||||||||||||||||||||||
| 256 | local_ip => $sock_params->{LocalAddr}, | ||||||||||||||||||||||||||||
| 257 | timeout => $sock_params->{Timeout}, | ||||||||||||||||||||||||||||
| 258 | tld => $params->{tld} || '', | ||||||||||||||||||||||||||||
| 259 | server => delete $params->{server}, | ||||||||||||||||||||||||||||
| 260 | log_name => delete $params->{log_name}, | ||||||||||||||||||||||||||||
| 261 | log_fn => delete $params->{log_fn}, | ||||||||||||||||||||||||||||
| 262 | 0 | ▶ | no_log => delete $params->{no_log} || 0, | ||||||||||||||||||||||||||
|
Condition0%0/4
$params->{'tld'} || ''
delete $params->{'no_log'} || 0
MC/DC0%0/1
$params->{'tld'} || ''
$params->{'tld'}
MC/DC0%0/1
delete $params->{'no_log'} || 0
delete $params->{'no_log'}
Truth table0%0/2
A
A= $params->{'tld'}
Truth table0%0/2
A
A= delete $params->{'no_log'}
| |||||||||||||||||||||||||||||
| 263 | test => $test, | ||||||||||||||||||||||||||||
| 264 | critical_error => undef, | ||||||||||||||||||||||||||||
| 265 | }, $package; | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 0 | $self->set_urn(); | |||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 0 | $self->set_log_vars( $params ); | |||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | $self->epp_log( "Connect to $$sock_params{PeerHost}\n" ); | |||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 0 | ▶ | return wantarray ? ( $self, '1000', 'ok' ) : $self; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | sub set_urn { | ||||||||||||||||||||||||||||
| 278 | $_[0]->{urn} = { | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | head => '', # !!! | ||||||||||||||||||||||||||
|
Subroutine
set_urn: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 280 | cont => $IO::EPP::Base::epp_cont_urn, | ||||||||||||||||||||||||||||
| 281 | host => $IO::EPP::Base::epp_host_urn, | ||||||||||||||||||||||||||||
| 282 | dom => $IO::EPP::Base::epp_dom_urn, | ||||||||||||||||||||||||||||
| 283 | }; | ||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | sub create_contact { | ||||||||||||||||||||||||||||
| 288 | 0 | ▶ | my ( $self, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
create_contact: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 0 | $params->{cont_id} = IO::EPP::Base::gen_id( 16 ); | |||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 0 | $params->{authinfo} = IO::EPP::Base::gen_pw( 16 ); | |||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | 0 | return $self->SUPER::create_contact( $params ); | |||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | sub update_contact { | ||||||||||||||||||||||||||||
| 299 | 0 | ▶ | my ( $self, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
update_contact: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | $params->{company} =~ s/&/&/g | ||||||||||||||||||||||||||||
| 302 | 0 | ▶ | if $params->{company}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 0 | $params->{need_name} = 1; | |||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | return $self->SUPER::update_contact( $params ); | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | =head2 create_domain | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | Since September 7, 2010, for Kazakhstan domains, you need to fill in data on the location of the server equipment | ||||||||||||||||||||||||||||
| 312 | on which the site is located, accessible by this domain name. | ||||||||||||||||||||||||||||
| 313 | The server equipment should be located on the territory of Kazakhstan. | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | C<server_loc> -- hashref with parameters: | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | C<srvloc_state> -- server location area or region; | ||||||||||||||||||||||||||||
| 318 | C<srvloc_city> -- city; | ||||||||||||||||||||||||||||
| 319 | C<srvloc_street> -- address in the city. | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =cut | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | sub create_domain { | ||||||||||||||||||||||||||||
| 324 | 0 | ▶ | my ( $self, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
create_domain: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 0 | ▶ | $params->{authinfo} ||= IO::EPP::Base::gen_pw( 16 ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$params->{"authinfo"} ||= IO::EPP::Base::gen_pw(16)
MC/DC0%0/2
$params->{"authinfo"} ||= IO::EPP::Base::gen_pw(16)
$params->{"authinfo"}
IO::EPP::Base::gen_pw(16)
Truth table0%0/3
A ||= B
A= $params->{"authinfo"}B= IO::EPP::Base::gen_pw(16)
| |||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | 0 | ▶ | if ( $params->{server_loc} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | 0 | my $server_loc = delete $params->{server_loc}; | |||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | $params->{extension} = | ||||||||||||||||||||||||||||
| 332 | ' <srvloc:create xmlns:srvloc="urn:kaznic:params:xml:ns:srvloc-1.0" xsi:schemaLocation="urn:kaznic:params:xml:ns:srvloc-1.0 srvloc-1.0.xsd"> | ||||||||||||||||||||||||||||
| 333 | <srvloc:street>'.$server_loc->{srvloc_street}.'</srvloc:street> | ||||||||||||||||||||||||||||
| 334 | <srvloc:city>'.$server_loc->{srvloc_city}.'</srvloc:city> | ||||||||||||||||||||||||||||
| 335 | 0 | <srvloc:sp>'.$server_loc->{srvloc_state}.'</srvloc:sp> | |||||||||||||||||||||||||||
| 336 | </srvloc:create>'; | ||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 0 | return $self->SUPER::create_domain( $params ); | |||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | sub transfer { | ||||||||||||||||||||||||||||
| 344 | 0 | ▶ | my ( $self, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
transfer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 0 | $params->{authinfo} =~ s/&/&/g; | |||||||||||||||||||||||||||
| 347 | 0 | $params->{authinfo} =~ s/</</g; | |||||||||||||||||||||||||||
| 348 | 0 | $params->{authinfo} =~ s/>/>/g; | |||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | 0 | return $self->SUPER::request_transfer( $params ); | |||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | =head2 update_domain | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | See L</create_domain> for C<server_loc> parameters. | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | =cut | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | sub update_domain { | ||||||||||||||||||||||||||||
| 360 | 0 | ▶ | my ( $self, $params ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
update_domain: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if ( $params->{server_loc} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 363 | 0 | my $server_loc = delete $params->{server_loc}; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | $params->{extension} = | ||||||||||||||||||||||||||||
| 366 | ' <srvloc:create xmlns:srvloc="urn:kaznic:params:xml:ns:srvloc-1.0" xsi:schemaLocation="urn:kaznic:params:xml:ns:srvloc-1.0 srvloc-1.0.xsd"> | ||||||||||||||||||||||||||||
| 367 | <srvloc:street>'.$server_loc->{srvloc_street}.'</srvloc:street> | ||||||||||||||||||||||||||||
| 368 | <srvloc:city>'.$server_loc->{srvloc_city}.'</srvloc:city> | ||||||||||||||||||||||||||||
| 369 | 0 | <srvloc:sp>'.$server_loc->{srvloc_state}.'</srvloc:sp> | |||||||||||||||||||||||||||
| 370 | </srvloc:create>'; | ||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | return $self->SUPER::update_domain( $params ); | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | =head2 logout | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | For replace IO::EPP::Base::logout. | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | Do nothing. | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | =cut | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | sub logout { | ||||||||||||||||||||||||||||
| 385 | 0 | ▶ | my ( $self ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
logout: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 0 | $self->epp_log( "</logout>" ); | |||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 0 | delete $self->{sock}; | |||||||||||||||||||||||||||
| 390 | 0 | delete $self->{user}; | |||||||||||||||||||||||||||
| 391 | 0 | delete $self->{pass}; | |||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | 0 | return ( undef, '1500', 'ok' ); | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | sub DESTROY { | ||||||||||||||||||||||||||||
| 398 | 0 | ▶ | my ( $self ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | 0 | local ($!, $@, $^E, $?); # Protection against action-at-distance | |||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | 0 | $self->logout(); | |||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if ( $self->{log_fh} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 405 | 0 | close $self->{log_fh}; | |||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 0 | delete $self->{log_fh}; | |||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | 1 | 1; | |||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | __END__ | ||||||||||||||||||||||||||||