EPP/Afilias.pm

filter: Statementstmt 19.1% 14 / 73 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 30.7% 4 / 13 Podpod 100% 9 / 9 totaltotal 17.2% 27 / 157 SCAR 59.7
CC
23
Cov
11%
make_request
156.0
login
30.0
new
20.0
CRAP 390.0
« EPP/HosterKZ.pm ↑ Summary EPP/CoCCA.pm »
1 package IO::EPP::Afilias;
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 IO::EPP::Afilias
8  
9 =head1 SYNOPSIS
10  
11 use IO::EPP::Afilias;
12  
13 # Parameters for IO::Socket::SSL
14 my %sock_params = (
15 PeerHost => 'epp.afilias.net',
16 PeerPort => 700,
17 SSL_key_file => 'key_file.pem',
18 SSL_cert_file => 'cert_file.pem',
19 Timeout => 30,
20 );
21  
22 # Create object, get greeting and call login()
23 my $conn = IO::EPP::Afilias->new( {
24 user => '12345-XX',
25 pass => 'XXXXXXXX',
26 sock_params => \%sock_params,
27 server => 'afilias', # or 'pir', ...
28 test_mode => 0, # real connect
29 } );
30  
31 # Check domain
32 my ( $answ, $code, $msg ) = $conn->check_domains( { domains => [ 'org.info' ] } );
33  
34 # Call logout() and destroy object
35 undef $conn;
36  
37 =head1 DESCRIPTION
38  
39 working with registries that have Afilias backend.
40  
41 Frontends: Afilias, PIR, DotAsia, ...
42  
43 Feature: at the initial request, you must specify the server parameter for activation the necessary extensions.
44  
45 Now it is C<afilias> or C<pir>.
46  
47 =head1 AUTHORS
48  
49 Vadim Likhota <vadiml@cpan.org>
50  
51 =cut
52  
53 1 ▶use IO::EPP::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 1 ▶use parent qw( IO::EPP::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
55  
56 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59  
60 1 my $rgp_ext = 'xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd"';
61  
62 sub make_request {
63 0 ▶ my ( $action, $params ) = @_;
Subroutine make_request: not called CC=12 SCAR=50.5
Pod documented
64  
65 0 my ( $self, $code, $msg, $answ );
66  
67 0 ▶ unless ( $params->{conn} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{'conn'}) { } 0 0 0
68 0 ▶ $params->{sock_params}{PeerHost} ||= 'epp.afilias.net';
Condition0%0/2
$params->{"sock_params"}{"PeerHost"} ||= "epp.afilias.net"
l!l
00
MC/DC0%0/1
$params->{"sock_params"}{"PeerHost"} ||= "epp.afilias.net"
$params->{"sock_params"}{"PeerHost"}
Truth table0%0/2
A
A= $params->{"sock_params"}{"PeerHost"}
Aresult
11
00
69 0 ▶ $params->{sock_params}{PeerPort} ||= 700;
Condition0%0/2
$params->{"sock_params"}{"PeerPort"} ||= 700
l!l
00
MC/DC0%0/1
$params->{"sock_params"}{"PeerPort"} ||= 700
$params->{"sock_params"}{"PeerPort"}
Truth table0%0/2
A
A= $params->{"sock_params"}{"PeerPort"}
Aresult
11
00
70  
71 0 ( $self, $code, $msg ) = __PACKAGE__->new( $params );
72  
73 0 ▶ unless ( $code and $code == 1000 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code and $code == 1000) 0 0 0
Condition0%0/3
$code and $code == 1000
!ll&&!rl&&r
000
MC/DC0%0/2
$code and $code == 1000
$code $code == 1000
Truth table0%0/3
A and B
A= $codeB= $code == 1000
ABresult
0X0
100
111
74 0 goto END_MR;
75 }
76 }
77 else {
78 0 $self = $params->{conn};
79 }
80  
81  
82 0 $self->{critical_error} = '';
83  
84 0 ▶ if ( $self->can( $action ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can($action)) { } 0 0 0
85 0 ( $answ, $code, $msg ) = $self->$action( $params );
86 }
87 else {
88 0 $msg = "undefined command <$action>, request cancelled";
89 0 $code = 0;
90 }
91  
92  
93 END_MR:
94  
95 0 ▶ $msg .= '; ' . $self->{critical_error} if $self->{critical_error};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"critical_error"} 0 0 0
96  
97 0 ▶ $code //= '';
Condition0%0/2
$code //= ""
l!l
00
MC/DC0%0/1
$code //= ""
$code
Truth table0%0/2
A
A= $code
Aresult
11
00
98  
99 0 my $full_answ = "code: $code\nmsg: $msg";
100  
101 0 ▶ $answ = {} unless $answ && ref $answ;
Branch: 1 branch
BranchTrueFalseTotal
unless $answ and ref $answ 0 0 0
Condition0%0/3
$answ and ref $answ
!ll&&!rl&&r
000
MC/DC0%0/2
$answ and ref $answ
$answ ref $answ
Truth table0%0/3
A and B
A= $answB= ref $answ
ABresult
0X0
100
111
102  
103 0 $answ->{code} = $code;
104 0 $answ->{msg} = $msg;
105  
106 0 ▶ return wantarray ? ( $answ, $full_answ, $self ) : $answ;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
107 }
108  
109 =head1 METHODS
110  
111 =head2 new
112  
113 See description in L<IO::EPP::Base/new>
114  
115 Requires the C<server> field to be specified, which can have values: C<pir> for .org/.ngo/.ong/.орг/.संगठन/.机构, C<afilias> for other tlds.
116  
117 =cut
118  
119 sub new {
120 0 ▶ my ( $package, $params ) = @_;
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
121  
122 0 ▶ unless ( $params->{server} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($params->{"server"}) 0 0 0
123 0 ▶ if ( $params->{sock_params}{PeerHost} =~ /\.afilias.net$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($params->{'sock_params'}{'PeerHost'} =~ /\.afilias.net$/) { } 0 0 0
elsif ($params->{'sock_params'}{'PeerHost'} =~ /\.publicinterestregistry.net$/) { } 0 0 0
124 0 $params->{server} = 'afilias';
125 }
126 elsif ( $params->{sock_params}{PeerHost} =~ /\.publicinterestregistry.net$/ ) {
127 0 $params->{server} = 'pir';
128 }
129 }
130  
131 0 return $package->SUPER::new( $params );
132 }
133  
134 =head2 login
135  
136 Ext params for login,
137  
138 INPUT: new password for change
139  
140 =cut
141  
142 sub login {
143 0 ▶ my ( $self, $pw ) = @_;
Subroutine login: not called CC=5 SCAR=34.0
Pod documented
144  
145 0 my $svcs = '
146 <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
147 <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
148 <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>';
149  
150 0 my $extension = '
151 <extURI>urn:afilias:params:xml:ns:oxrs-1.1</extURI>
152 <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
153 <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
154 <extURI>urn:ietf:params:xml:ns:launch-1.0</extURI>';
155  
156  
157 0 ▶ if ( $self->{server} and $self->{server} eq 'afilias' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'server'} and $self->{'server'} eq 'afilias') { } 0 0 0
elsif ($self->{'server'} and $self->{'server'} eq 'pir') { } 0 0 0
Condition0%0/3
$self->{"server"} and $self->{"server"} eq "afilias"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"server"} and $self->{"server"} eq "afilias"
$self->{"server"} $self->{"server"} eq "afilias"
Truth table0%0/3
A and B
A= $self->{"server"}B= $self->{"server"} eq "afilias"
ABresult
0X0
100
111
158 0 $extension .= '
159 <extURI>urn:afilias:params:xml:ns:idn-1.0</extURI>
160 <extURI>urn:afilias:params:xml:ns:ipr-1.1</extURI>
161 <extURI>urn:ietf:params:xml:ns:fee-0.8</extURI>';
162 }
163 ▶ elsif ( $self->{server} and $self->{server} eq 'pir' ) {
Condition0%0/3
$self->{"server"} and $self->{"server"} eq "pir"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"server"} and $self->{"server"} eq "pir"
$self->{"server"} $self->{"server"} eq "pir"
Truth table0%0/3
A and B
A= $self->{"server"}B= $self->{"server"} eq "pir"
ABresult
0X0
100
111
164 0 $extension .= '
165 <extURI>urn:afilias:params:xml:ns:idn-1.0</extURI>
166 <extURI>urn:afilias:params:xml:ns:trademark-1.0</extURI>';
167 }
168  
169 0 return $self->SUPER::login( $pw, $svcs, $extension );
170 }
171  
172  
173 sub create_contact {
174 0 ▶ my ( $self, $params ) = @_;
Subroutine create_contact: not called CC=1 SCAR=6.9
Pod documented
175  
176 0 $params->{authinfo} = IO::EPP::Base::gen_pw( 16 );
177  
178 # contact:disclose flag not supported, need to use personal service of hiding of contacts
179  
180 # $params->{pp_ext} = '
181 # <contact:disclose flag="'.$visible.'">
182 # <contact:voice/>
183 # <contact:email/>
184 # </contact:disclose>';
185  
186 0 return $self->SUPER::create_contact( $params );
187 }
188  
189 =head2 check_domains, create_domain
190  
191 For IDN domains you need to specify the language code in the C<idn_lang> field
192  
193 List of IDN characters for all zones see in L<https://www.iana.org/domains/idn-tables>
194  
195 =cut
196  
197 sub check_domains {
198 0 ▶ my ( $self, $params ) = @_;
Subroutine check_domains: not called CC=2 SCAR=17.9
Pod documented
199  
200 0 ▶ if ( $params->{lang} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"lang"}) 0 0 0
201 $params->{extension} = '
202 <idn:check xmlns:idn="urn:iana:xml:ns:idn" xsi:schemaLocation="urn:iana:xml:ns:idn idn.xsd">
203 0 <idn:script>' . $params->{idn_lang} . '</idn:script>
204 </idn:check>'
205 }
206  
207 0 return $self->SUPER::check_domains( $params );
208 }
209  
210  
211 sub create_domain {
212 0 ▶ my ( $self, $params ) = @_;
Subroutine create_domain: not called CC=3 SCAR=24.8
Pod documented
213  
214 0 ▶ $params->{authinfo} ||= IO::EPP::Base::gen_pw( 16 );
Condition0%0/3
$params->{"authinfo"} ||= IO::EPP::Base::gen_pw(16)
l!l&&r!l&&!r
000
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)
ABresult
1X1
011
000
215  
216 0 my $extension = '';
217  
218 0 ▶ if ( $params->{lang} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"lang"}) 0 0 0
219 $extension = '
220 <idn:create xmlns:idn="urn:iana:xml:ns:idn" xsi:schemaLocation="urn:iana:xml:ns:idn idn.xsd">
221 0 <idn:script>' . $params->{idn_lang} . '</idn:script>
222 </idn:create>'
223 }
224  
225 0 return $self->SUPER::create_domain( $params );
226 }
227  
228  
229 sub transfer {
230 0 ▶ my ( $self, $params ) = @_;
Subroutine transfer: not called CC=2 SCAR=17.9
Pod documented
231  
232 0 ▶ if ( $params->{authinfo} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"authinfo"}) 0 0 0
233 0 $params->{authinfo} =~ s/&/&amp;/g;
234 0 $params->{authinfo} =~ s/</&lt;/g;
235 0 $params->{authinfo} =~ s/>/&gt;/g;
236 }
237  
238 0 return $self->SUPER::transfer( $params );
239 }
240  
241  
242 =head2 restore_domain
243  
244 first call for restore_domain
245  
246 =cut
247  
248 sub restore_domain {
249 0 ▶ my ( $self, $params ) = @_;
Subroutine restore_domain: not called CC=1 SCAR=6.9
Pod documented
250  
251 0 $params->{extension} = "
252 <rgp:update $rgp_ext>
253 <rgp:restore op=\"request\"/>
254 </rgp:update>";
255  
256 0 return $self->SUPER::update_domain( $params );
257 }
258  
259 =head2 confirmations_restore_domain
260  
261 second call for restore_domain
262  
263 C<pre_data> -- whois before delete
264 C<post_data> -- whois on now
265 C<del_time> -- delete domain date-time, see. upd_date in domain:info before call restore_domain
266 C<rest_time> -- date-time of sending the redemption request in UTC.
267 C<reason> -- restore reason, variants:
268 C<Registrant Error>, C<Registrar Error>, C<Judicial / Arbitral / Administrative / UDRP Order>.
269  
270 The following parameters have already been defined:
271  
272 C<statement> -- write that this is all for the client, not for us,
273 since the phrase is standard, you only need to substitute the company and the position of the one who buys the domain: C<company>, C<position>
274 C<other> -- can and without other.
275  
276 Instead, you need to pass:
277  
278 C<company> -- name of your organization and its ID in the registry;
279 C<position> -- name, surname and position of the employee who is responsible for the purchase of remote domains.
280  
281 =cut
282  
283 sub confirmations_restore_domain {
284 0 ▶ my ( $self, $params ) = @_;
Subroutine confirmations_restore_domain: not called CC=1 SCAR=6.9
Pod documented
285  
286 0 $params->{extension} = <<RGPEXT;
287 <rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd">
288 <rgp:restore op="report">
289 <rgp:report>
290 <rgp:preData>$$params{pre_data}</rgp:preData>
291 <rgp:postData>$$params{post_data}</rgp:postData>
292 <rgp:delTime>$$params{del_time}</rgp:delTime>
293 <rgp:resTime>$$params{rest_time}</rgp:resTime>
294 <rgp:resReason>$$params{reason}</rgp:resReason>
295 <rgp:statement>$$params{company}, attests that we have not restored the name above in order to assume the rights to use or sell the Registered Name ourselves or for any third party
296 $$params{company}, attests that the information in this report is true to the best of our knowledge,
297 and we acknowledge that intentionally suplying false informationin the Restore Report shall constitute an incurable material breach of the Registry-Registrar Agreement</rgp:statement>
298 <rgp:statement>I, $$params{position}, attest that I am duly authorized to submit Restore Reports on behalf of $$params{company}</rgp:statement>
299 <rgp:other/>
300 </rgp:report>
301 </rgp:restore>
302 </rgp:update>
303 RGPEXT
304  
305 0 return $self->SUPER::update_domain( $params );
306 }
307  
308  
309 1 1;
310  
311 __END__
« EPP/HosterKZ.pm ↑ Summary EPP/CoCCA.pm »