DRI/Protocol/EPP/Extensions/SE/Extensions.pm

filter: Statementstmt 7.8% 16 / 205 Branchbran 0.0% 0 / 126 Conditioncond 0.0% 0 / 27 MC/DCmcdc 0.0% 0 / 17 Subroutinesub 23.8% 5 / 21 Podpod 0.0% 0 / 16 totaltotal 5.1% 21 / 412 CC 83 SCAR 42.8
CC
83
Cov
4%
domain_parse
132.0
contact_create
132.0
domain_transfer_parse
90.0
CRAP 72.5
« DRI/Protocol/EPP/Extensions/AT/Result.pm ↑ Summary DRI/Protocol/EPP/Extensions/Afilias/Association.pm »
1 ## Domain Registry Interface, .SE EPP Domain/Contact Extensions for Net::DRI
2 ## Contributed by Elias Sidenbladh and Ulrich Wisser from NIC SE
3 ##
4 ## Copyright (c) 2006,2008-2011,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 ####################################################################################################
15  
16 package Net::DRI::Protocol::EPP::Extensions::SE::Extensions;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use Net::DRI::Protocol::EPP::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::EPP::Extensions::SE::Extensions - .SE EPP Domain/Contact Extensions for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>netdri@dotandco.comE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
46  
47 =head1 AUTHOR
48  
49 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
50  
51 =head1 COPYRIGHT
52  
53 Copyright (c) 2006,2008-2011 Patrick Mevzek <netdri@dotandco.com>.
54 All rights reserved.
55  
56 This program is free software; you can redistribute it and/or modify
57 it under the terms of the GNU General Public License as published by
58 the Free Software Foundation; either version 2 of the License, or
59 (at your option) any later version.
60  
61 See the LICENSE file that comes with this distribution for more details.
62  
63 =cut
64  
65 ###################################################################################################
66  
67 sub register_commands {
68 0 ▶ my ( $class, $version ) = @_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my $domain = {
70 info => [ undef, \&domain_parse ],
71 create => [ undef, \&domain_parse ],
72 update => [ \&domain_update, \&domain_parse ],
73 transfer_request => [ \&domain_transfer, \&domain_transfer_parse ],
74 notifyDelete => [ undef, \&delete_parse ],
75 };
76 0 my $contact = {
77 info => [ undef, \&contact_parse ],
78 create => [ \&contact_create, undef ],
79 update => [ \&contact_update, undef ],
80 transfer_request => [ undef, \&contact_transfer_parse ],
81 };
82 0 my $host = {
83 info => [ undef, \&host_parse ],
84 transfer_request => [ undef, \&host_transfer_parse ],
85 };
86 0 my %session=(
87 'connect' => [ undef, \&parse_greeting ],
88 'noop' => [ undef, \&parse_greeting ],
89 );
90 0 return { 'domain' => $domain, 'contact' => $contact, 'host' => $host, session => \%session };
91 }
92  
93 sub capabilities_add {
94 0 ▶ return ( [ 'domain_update', 'client_delete', [ 'set', ] ], );
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
95 }
96 ###################################################################################################
97  
98 ## This was previously basically Extensions/SE/Message/_get_content
99 ## but since anyway it should be done properly by walking the XML tree inside of poking like this,
100 ## put it here to remove the SE/Message module
101 sub find_node
102 {
103 0 ▶ my ($mes,$nstag,$nodename)=@_;
Subroutine find_node: not called CC=5 SCAR=34.0
Pod undocumented
104 0 my $node=$mes->node_resdata();
105 0 ▶ return unless defined $node;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node 0 0 0
106 0 my $ns=$mes->ns($nstag);
107 0 ▶ $ns=$nstag unless defined $ns && $ns;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ns and $ns 0 0 0
Condition0%0/3
defined $ns and $ns
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ns and $ns
defined $ns $ns
Truth table0%0/3
A and B
A= defined $nsB= $ns
ABresult
0X0
100
111
108 0 my @tmp=$node->getElementsByTagNameNS($ns,$nodename);
109 0 ▶ return unless @tmp;
Branch: 1 branch
BranchTrueFalseTotal
unless @tmp 0 0 0
110 0 return $tmp[0];
111 }
112  
113 sub get_notify {
114 0 ▶ my $mes = shift;
Subroutine get_notify: not called CC=5 SCAR=34.0
Pod undocumented
115 0 my $ns=$mes->ns('iis');
116 # only one of these will be given, but we can't know which in advance
117 0 ▶ return 'create' if defined find_node($mes,$ns,'createNotify');
Branch: 1 branch
BranchTrueFalseTotal
if defined find_node($mes, $ns, "createNotify") 0 0 0
118 0 ▶ return 'update' if defined find_node($mes,$ns,'updateNotify');
Branch: 1 branch
BranchTrueFalseTotal
if defined find_node($mes, $ns, "updateNotify") 0 0 0
119 0 ▶ return 'delete' if defined find_node($mes,$ns,'deleteNotify');
Branch: 1 branch
BranchTrueFalseTotal
if defined find_node($mes, $ns, "deleteNotify") 0 0 0
120 0 ▶ return 'transfer' if defined find_node($mes,$ns,'transferNotify');
Branch: 1 branch
BranchTrueFalseTotal
if defined find_node($mes, $ns, "transferNotify") 0 0 0
121  
122 # done, no notify found
123 0 return;
124 }
125  
126 ##################################################################################################
127 ########### Query commands
128  
129 # parse domain info
130 sub domain_parse {
131 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine domain_parse: not called CC=11 SCAR=48.8
Pod undocumented
132 0 my $mes = $po->message();
133 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
134  
135 # only domain info should be parsed
136 0 ▶ return if ( ( !defined $otype ) || ( $otype ne 'domain' ) );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $otype or $otype ne "domain" 0 0 0
Condition0%0/3
not defined $otype or $otype ne "domain"
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $otype or $otype ne "domain"
not defined $otype $otype ne "domain"
Truth table0%0/3
not(A) or B
A= not defined $otypeB= $otype ne "domain"
ABresult
1X1
011
000
137  
138 # check for notify
139 0 my $notify = get_notify($mes);
140 0 ▶ $rinfo->{domain}->{$oname}->{notify} = $notify if defined $notify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $notify 0 0 0
141  
142 # get <iis:infData/> from <extension/>
143 0 my $infData = $mes->get_extension( $mes->ns('iis'), 'infData' );
144 0 ▶ return unless defined $infData;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infData 0 0 0
145  
146 # parse deleteDate (optional)
147 0 foreach my $el ( $infData->getElementsByTagNameNS( $mes->ns('iis'), 'delDate' ) ) {
148 0 $rinfo->{domain}->{$oname}->{delDate} = $po->parse_iso8601( $el->textContent() );
149 }
150  
151 # parse deactDate (optional)
152 0 foreach my $el ( $infData->getElementsByTagNameNS( $mes->ns('iis'), 'deactDate' ) ) {
153 0 $rinfo->{domain}->{$oname}->{deactDate} = $po->parse_iso8601( $el->textContent() );
154 }
155  
156 # parse relDate (optional)
157 0 foreach my $el ( $infData->getElementsByTagNameNS( $mes->ns('iis'), 'relDate' ) ) {
158 0 $rinfo->{domain}->{$oname}->{relDate} = $po->parse_iso8601( $el->textContent() );
159 }
160  
161 # parse state
162 0 foreach my $el ( $infData->getElementsByTagNameNS( $mes->ns('iis'), 'state' ) ) {
163 0 $rinfo->{domain}->{$oname}->{state} = $el->textContent();
164 }
165  
166 # parse clientDelete
167 0 foreach my $el ( $infData->getElementsByTagNameNS( $mes->ns('iis'), 'clientDelete' ) ) {
168 0 $rinfo->{domain}->{$oname}->{clientDelete} = $el->textContent();
169 }
170  
171 # done
172 0 return;
173 }
174  
175 # parse contact info
176 sub contact_parse {
177 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine contact_parse: not called CC=8 SCAR=42.8
Pod undocumented
178 0 my $mes = $po->message();
179 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
180  
181 # only contact info should be parsed
182 0 ▶ return if ( ( !defined $otype ) || ( $otype ne 'contact' ) );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $otype or $otype ne "contact" 0 0 0
Condition0%0/3
not defined $otype or $otype ne "contact"
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $otype or $otype ne "contact"
not defined $otype $otype ne "contact"
Truth table0%0/3
not(A) or B
A= not defined $otypeB= $otype ne "contact"
ABresult
1X1
011
000
183  
184 # check for notify
185 0 my $notify = get_notify($mes);
186 0 ▶ $rinfo->{contact}->{$oname}->{notify} = $notify if defined $notify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $notify 0 0 0
187  
188 # get <iis:infData/> from <extension/>
189 0 my $result = $mes->get_extension( $mes->ns('iis'), 'infData' );
190 0 ▶ return unless defined $result;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $result 0 0 0
191  
192 # parse orgno (mandatory)
193 0 foreach my $el ( $result->getElementsByTagNameNS( $mes->ns('iis'), 'orgno' ) ) {
194 0 $rinfo->{contact}->{$oname}->{self}->orgno( $el->textContent() );
195 }
196  
197 # parse vatno (optional)
198 0 foreach my $el ( $result->getElementsByTagNameNS( $mes->ns('iis'), 'vatno' ) ) {
199 0 $rinfo->{contact}->{$oname}->{self}->vatno( $el->textContent() );
200 }
201  
202 # done
203 0 return;
204 }
205  
206 sub host_parse {
207 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine host_parse: not called CC=5 SCAR=34.0
Pod undocumented
208 0 my $mes = $po->message();
209 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
210  
211 # only contact info should be parsed
212 0 ▶ return if ( ( !defined $otype ) || ( $otype ne 'host' ) );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $otype or $otype ne "host" 0 0 0
Condition0%0/3
not defined $otype or $otype ne "host"
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $otype or $otype ne "host"
not defined $otype $otype ne "host"
Truth table0%0/3
not(A) or B
A= not defined $otypeB= $otype ne "host"
ABresult
1X1
011
000
213  
214 # check for notify
215 0 my $notify = get_notify($mes);
216 0 ▶ $rinfo->{host}->{$oname}->{notify} = $notify if defined $notify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $notify 0 0 0
217  
218 # done
219 0 return;
220 }
221  
222 # parse <dom:trnData/>
223 sub domain_transfer_parse {
224 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine domain_transfer_parse: not called CC=9 SCAR=45.0
Pod undocumented
225 0 my $mes = $po->message();
226 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
227  
228 0 my $trndata = find_node($mes,$mes->ns('domain'),'infData');
229 0 ▶ $trndata = find_node($mes,$mes->ns('domain'), 'trnData' ) if !defined($trndata);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
230 0 ▶ return unless defined $trndata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
231  
232 0 foreach my $el (Net::DRI::Util::xml_list_children($trndata))
233 {
234 0 my ($name,$c)=@$el;
235 0 ▶ if ( $name eq 'name' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'name') { } 0 0 0
elsif ($name =~ /^(trStatus|reID|acID)$/) { } 0 0 0
elsif ($name =~ /^(reDate|acDate|exDate)$/) { } 0 0 0
236 0 $oname = $c->textContent();
237 0 $rinfo->{domain}->{$oname}->{action} = 'transfer';
238 0 $rinfo->{domain}->{$oname}->{exist} = 1;
239 }
240 elsif ( $name =~ m/^(trStatus|reID|acID)$/ ) {
241 0 $rinfo->{domain}->{$oname}->{$1} = $c->textContent();
242 }
243 elsif ( $name =~ m/^(reDate|acDate|exDate)$/ ) {
244 0 $rinfo->{domain}->{$oname}->{$1} = $po->parse_iso8601( $c->textContent() );
245 }
246 }
247  
248 # check for notify
249 0 my $notify = get_notify($mes, 'domain_transfer_parse');
250 0 ▶ $rinfo->{domain}->{$oname}->{notify} = $notify if defined $notify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $notify 0 0 0
251  
252 # done
253 0 return;
254 }
255  
256  
257 # parse <host:trnData/>
258 # copied from Net::DRI::Protocol::EPP::Core::Domain
259 sub host_transfer_parse {
260 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine host_transfer_parse: not called CC=9 SCAR=45.0
Pod undocumented
261 0 my $mes = $po->message();
262 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
263  
264 0 my $trndata = find_node($mes,$mes->ns('host'), 'infData' );
265 0 ▶ $trndata = find_node($mes,$mes->ns('host'), 'trnData' ) if !defined($trndata);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
266 0 ▶ return unless defined $trndata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
267  
268 0 foreach my $el (Net::DRI::Util::xml_list_children($trndata))
269 {
270 0 my ($name,$c)=@$el;
271 0 ▶ if ( $name eq 'name' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'name') { } 0 0 0
elsif ($name =~ /^(trStatus|reID|acID)$/) { } 0 0 0
elsif ($name =~ /^(reDate|acDate|exDate)$/) { } 0 0 0
272 0 $oname = $c->textContent();
273 0 $rinfo->{host}->{$oname}->{action} = 'transfer';
274 0 $rinfo->{host}->{$oname}->{exist} = 1;
275 }
276 elsif ( $name =~ m/^(trStatus|reID|acID)$/ ) {
277 0 $rinfo->{host}->{$oname}->{$1} = $c->textContent();
278 }
279 elsif ( $name =~ m/^(reDate|acDate|exDate)$/ ) {
280 0 $rinfo->{host}->{$oname}->{$1} = $po->parse_iso8601( $c->textContent() );
281 }
282 }
283  
284 # check for notify
285 0 my $notify = get_notify($mes);
286 0 ▶ $rinfo->{host}->{$oname}->{notify} = $notify if defined $notify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $notify 0 0 0
287  
288 # done
289 0 return;
290 }
291  
292 sub contact_transfer_parse {
293 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine contact_transfer_parse: not called CC=9 SCAR=45.0
Pod undocumented
294 0 my $mes = $po->message();
295 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
296  
297 0 my $trndata = find_node($mes,$mes->ns('contact'), 'infData' );
298 0 ▶ $trndata = find_node($mes,$mes->ns('contact'), 'trnData' ) if !defined($trndata);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
299 0 ▶ return unless defined $trndata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
300  
301 0 foreach my $el (Net::DRI::Util::xml_list_children($trndata))
302 {
303 0 my ($name,$c)=@$el;
304 0 ▶ if ( $name eq 'id' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq 'id') { } 0 0 0
elsif ($name =~ /^(trStatus|reID|acID)$/) { } 0 0 0
elsif ($name =~ /^(reDate|acDate|exDate)$/) { } 0 0 0
305 0 $oname = $c->textContent();
306 0 $rinfo->{contact}->{$oname}->{action} = 'transfer';
307 0 $rinfo->{contact}->{$oname}->{exist} = 1;
308 }
309 elsif ( $name =~ m/^(trStatus|reID|acID)$/ ) {
310 0 $rinfo->{contact}->{$oname}->{$1} = $c->textContent();
311 }
312 elsif ( $name =~ m/^(reDate|acDate|exDate)$/ ) {
313 0 $rinfo->{contact}->{$oname}->{$1} = $po->parse_iso8601( $c->textContent() );
314 }
315 }
316  
317 # check for notify
318 0 my $notify = get_notify($mes);
319 0 ▶ $rinfo->{contact}->{$oname}->{notify} = $notify if defined $notify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $notify 0 0 0
320  
321 # done
322 0 return;
323 }
324  
325 # parse delete message
326 sub delete_parse {
327 0 ▶ my ( $po, $otype, $oaction, $oname, $rinfo ) = @_;
Subroutine delete_parse: not called CC=8 SCAR=42.8
Pod undocumented
328 0 my $nametag;
329 0 my $mes = $po->message();
330 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
331  
332 # check for notify
333 0 my $notify = get_notify($mes);
334 0 ▶ return if ( ( !defined $notify ) || ( ( $notify ne 'delete' ) && ( $notify ne 'transfer' ) ) );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $notify or $notify ne "delete" and $notify ne "transfer" 0 0 0
Condition0%0/6
not defined $notify or $notify ne "delete" and $notify ne "transfer"
l!l&&r!l&&!r
000
$notify ne "delete" and $notify ne "transfer"
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $notify or $notify ne "delete" and $notify ne "transfer"
not defined $notify $notify ne "delete" $notify ne "transfer"
Truth table0%0/4
not(A) or B and C
A= not defined $notifyB= $notify ne "delete"C= $notify ne "transfer"
ABCresult
1XX1
0111
00X0
0100
335  
336 # check for host
337 0 my $host = find_node($mes,$mes->ns('host'), 'name' );
338 0 ▶ if ( defined $host ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $host) 0 0 0
339 0 $oname = $host->textContent();
340 0 $otype = 'host';
341 }
342  
343 # check for contact
344 0 my $contact = find_node($mes, $mes->ns('contact'), 'id' );
345 0 ▶ if ( defined $contact ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $contact) 0 0 0
346 0 $oname = $contact->textContent();
347 0 $otype = 'contact';
348 }
349  
350 # check for domain
351 0 my $domain = find_node($mes, $mes->ns('domain'), 'name' );
352 0 ▶ if ( defined $domain ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $domain) 0 0 0
353 0 $oname = $domain->textContent();
354 0 $otype = 'domain';
355 }
356  
357 0 $rinfo->{$otype}->{$oname}->{notify} = $notify;
358 0 $rinfo->{$otype}->{$oname}->{action} = $notify;
359 0 $rinfo->{$otype}->{$oname}->{exist} = 0;
360  
361 # done
362 0 return;
363 }
364  
365 # domain update command extension
366 sub domain_update {
367 0 ▶ my ( $epp, $domain, $rd ) = @_;
Subroutine domain_update: not called CC=4 SCAR=30.0
Pod undocumented
368 0 my @data = ();
369 0 my $mes = $epp->message();
370  
371 # iis:clientDelete
372 0 ▶ if ( exists $rd->{client_delete} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"client_delete"}) 0 0 0
373 0 ▶ Net::DRI::Exception::usererr_invalid_parameters("client_delete can only be '1' or '0'") if ( $rd->{client_delete}[2] !~ /^(0|1)$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $rd->{"client_delete"}[2] =~ /^(0|1)$/ 0 0 0
374 0 push @data, [ 'iis:clientDelete', $rd->{client_delete}[2] ];
375 }
376  
377 # only add extension if any data gets added
378 0 ▶ return unless @data;
Branch: 1 branch
BranchTrueFalseTotal
unless @data 0 0 0
379  
380 # create <iis:update/>
381 0 my $iis_extension = $mes->command_extension_register('iis','update');
382  
383 # now add extension to message
384 0 $mes->command_extension( $iis_extension, \@data );
385  
386 # done
387 0 return;
388 }
389  
390 sub domain_transfer {
391 0 ▶ my ( $epp, $domain, $rd ) = @_;
Subroutine domain_transfer: not called CC=3 SCAR=24.8
Pod undocumented
392 0 my @data = ();
393 0 my $mes = $epp->message();
394  
395 # new nameservers (optional)
396 0 ▶ push @data, [ 'iis:ns', map { [ 'iis:hostObj', $_ ] } $rd->{ns}->get_names() ] if Net::DRI::Util::has_ns($rd);
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_ns($rd) 0 0 0
397  
398 # only add body if any data gets added
399 0 ▶ return unless @data;
Branch: 1 branch
BranchTrueFalseTotal
unless @data 0 0 0
400  
401 # create <iis:transfer/>
402 0 my $iis_extension = $mes->command_extension_register('iis','transfer');
403  
404 # now add extension to message
405 0 $mes->command_extension( $iis_extension, \@data );
406  
407 # done
408 0 return;
409 }
410  
411 # contact create command extension
412 sub contact_create {
413 0 ▶ my ( $epp, $contact, $rd ) = @_;
Subroutine contact_create: not called CC=11 SCAR=48.8
Pod undocumented
414 0 my @data = ();
415 0 my $mes = $epp->message();
416  
417 # iis:orgno (mandatory)
418 0 my $orgno;
419 0 ▶ $orgno = $rd->{orgno} if exists( $rd->{orgno} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $rd->{"orgno"} 0 0 0
420 0 ▶ $orgno = $contact->{orgno} if exists( $contact->{orgno} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $contact->{"orgno"} 0 0 0
421 0 ▶ $orgno = $contact->orgno if $contact->can('orgno');
Branch: 1 branch
BranchTrueFalseTotal
if $contact->can("orgno") 0 0 0
422  
423 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Attribute orgno must exist') unless defined $orgno;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $orgno 0 0 0
424 0 push @data, [ 'iis:orgno', $orgno ];
425  
426 # iis:vatno (optional)
427 0 my $vatno;
428 0 ▶ $vatno = $rd->{orgno} if exists( $rd->{vatno} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $rd->{"vatno"} 0 0 0
429 0 ▶ $vatno = $contact->{vatno} if exists( $contact->{vatno} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $contact->{"vatno"} 0 0 0
430 0 ▶ $vatno = $contact->vatno if $contact->can('vatno');
Branch: 1 branch
BranchTrueFalseTotal
if $contact->can("vatno") 0 0 0
431 0 ▶ if ( exists( $rd->{vatno} ) && $vatno ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $rd->{"vatno"} and $vatno) 0 0 0
Condition0%0/3
exists $rd->{"vatno"} and $vatno
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rd->{"vatno"} and $vatno
exists $rd->{"vatno"} $vatno
Truth table0%0/3
A and B
A= exists $rd->{"vatno"}B= $vatno
ABresult
0X0
100
111
432 0 push @data, [ 'iis:vatno', $vatno ];
433 }
434  
435 # only add extension if any data gets added
436 0 ▶ return unless @data;
Branch: 1 branch
BranchTrueFalseTotal
unless @data 0 0 0
437  
438 # create <iis:create/>
439 0 my $iis_extension = $mes->command_extension_register('iis','create');
440  
441 # now add extension to message
442 0 $mes->command_extension( $iis_extension, \@data );
443  
444 # done
445 0 return;
446 }
447  
448 # contact update command extension
449 sub contact_update {
450 0 ▶ my ( $epp, $contact, $rd ) = @_;
Subroutine contact_update: not called CC=7 SCAR=40.3
Pod undocumented
451 0 my @data = ();
452 0 my $mes = $epp->message();
453  
454 # get the new contact information
455 0 my $newc = $rd->set('info');
456 0 ▶ return unless defined $newc && ref $newc;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $newc and ref $newc 0 0 0
Condition0%0/3
defined $newc and ref $newc
!ll&&!rl&&r
000
MC/DC0%0/2
defined $newc and ref $newc
defined $newc ref $newc
Truth table0%0/3
A and B
A= defined $newcB= ref $newc
ABresult
0X0
100
111
457  
458 # iis:orgno (mandatory)
459 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Attribute orgno can not be updated') if exists( $newc->{orgno} );
Branch: 1 branch
BranchTrueFalseTotal
if exists $newc->{"orgno"} 0 0 0
460  
461 # iis:vatno (optional)
462 0 ▶ if ( exists( $newc->{vatno} ) && defined $newc->{vatno} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $newc->{"vatno"} and defined $newc->{"vatno"}) 0 0 0
Condition0%0/3
exists $newc->{"vatno"} and defined $newc->{"vatno"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $newc->{"vatno"} and defined $newc->{"vatno"}
exists $newc->{"vatno"} defined $newc->{"vatno"}
Truth table0%0/3
A and B
A= exists $newc->{"vatno"}B= defined $newc->{"vatno"}
ABresult
0X0
100
111
463 0 push @data, [ 'iis:vatno', $newc->{vatno} ];
464 }
465  
466 # only add extension if any data gets added
467 0 ▶ return unless @data;
Branch: 1 branch
BranchTrueFalseTotal
unless @data 0 0 0
468  
469 # create <iis:update/>
470 0 my $iis_extension = $mes->command_extension_register('iis','update');
471  
472 # now add extension to message
473 0 $mes->command_extension( $iis_extension, \@data );
474  
475 # done
476 0 return;
477 }
478  
479 ####################################################################################################
480 ## Session commands, adapt to server greeting
481  
482 sub parse_greeting
483 {
484 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine parse_greeting: not called CC=2 SCAR=17.9
Pod undocumented
485 0 my $mes=$po->message();
486  
487 0 ▶ return unless defined $mes->node_greeting(); ## only work here for true greeting reply handling, not for all polling responses !
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mes->node_greeting 0 0 0
488  
489 0 $po->switch_to_highest_namespace_version('iis');
490 0 return;
491 }
492  
493 ####################################################################################################
494 1 1;
« DRI/Protocol/EPP/Extensions/AT/Result.pm ↑ Summary DRI/Protocol/EPP/Extensions/Afilias/Association.pm »