DRI/Protocol/EPP/Extensions/CIRA/Domain.pm

filter: Statementstmt 21.6% 13 / 60 Branchbran 0.0% 0 / 34 Conditioncond 0.0% 0 / 51 MC/DCmcdc 0.0% 0 / 26 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 9.2% 17 / 183 CC 36 SCAR 53.5
CC
36
Cov
9%
transfer_request
306.0
create
240.0
info_parse
42.0
CRAP 210.7
« DRI/Protocol/EPP/Extensions/ASIA/CED.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Domain.pm »
1 ## Domain Registry Interface, CIRA EPP Domain extensions
2 ##
3 ## Copyright (c) 2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::EPP::Extensions::CIRA::Domain;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 ####################################################################################################
24  
25 sub register_commands
26 {
27 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my %tmp=(
29 info => [ undef, \&info_parse],
30 create => [ \&create, undef ],
31 transfer_request => [ \&transfer_request, undef ],
32 );
33  
34 0 return { 'domain' => \%tmp };
35 }
36  
37 ####################################################################################################
38  
39 sub info_parse
40 {
41 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
42 0 my $mes=$po->message();
43 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
44  
45 0 my $infdata=$mes->get_extension('cira','ciraInfo');
46 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
47  
48 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
49 {
50 0 my ($name,$c)=@$el;
51 0 ▶ if ($name eq 'domainStageOfLife')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'domainStageOfLife') { } 0 0 0
elsif ($name eq 'domainStageOfLifeEnd') { } 0 0 0
52 {
53 0 $rinfo->{domain}->{$oname}->{stage_of_life}=$c->textContent();
54 } elsif ($name eq 'domainStageOfLifeEnd')
55 {
56 0 $rinfo->{domain}->{$oname}->{stage_of_life_end}=$po->parse_iso8601($c->textContent());
57 }
58 }
59 0 return;
60 }
61  
62 sub create
63 {
64 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create: not called CC=15 SCAR=54.8
Pod undocumented
65 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('contacts are mandatory in .CA for domain_create') unless Net::DRI::Util::has_contact($rd);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_contact($rd) 0 0 0
66 0 my $cs=$rd->{contact};
67 0 my @c=$cs->get('registrant');
68 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('one registrant is mandatory in .CA for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1));
Branch: 1 branch
BranchTrueFalseTotal
unless @c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1) 0 0 0
Condition0%0/9
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")
!ll&&!rl&&r
000
MC/DC0%0/4
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
@c == 1 Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") length $c[0]->srid $c[0]->validate(1)
Truth table0%0/5
A and B and C and D
A= @c == 1B= Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")C= length $c[0]->sridD= $c[0]->validate(1)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
69 0 @c=$cs->get('admin');
70 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('one admin contact is mandatory in .CA for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1));
Branch: 1 branch
BranchTrueFalseTotal
unless @c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1) 0 0 0
Condition0%0/9
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")
!ll&&!rl&&r
000
MC/DC0%0/4
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
@c == 1 Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") length $c[0]->srid $c[0]->validate(1)
Truth table0%0/5
A and B and C and D
A= @c == 1B= Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")C= length $c[0]->sridD= $c[0]->validate(1)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
71 0 @c=$cs->get('tech');
72 0 ▶ return unless @c;
Branch: 1 branch
BranchTrueFalseTotal
unless @c 0 0 0
73 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('only up to 3 tech contacts are possible in .CA for domain_create') if (scalar(@c)!=scalar(grep { Net::DRI::Util::isa_contact($_,'Net::DRI::Data::Contact::CIRA') && length $_->srid() && $_->validate(1) } @c) || @c>3);
Branch: 2 branches
BranchTrueFalseTotal
if scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) or @c > 3 0 0 0
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1) 0 0 0
Condition0%0/6
scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) or @c > 3
l!l&&r!l&&!r
000
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) or @c > 3
scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) @c > 3
MC/DC0%0/2
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") length $_->srid
Truth table0%0/3
A or B
A= scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c)B= @c > 3
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA")B= length $_->srid
ABresult
0X0
100
111
74 0 return;
75 }
76  
77 sub transfer_request
78 {
79 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine transfer_request: not called CC=17 SCAR=57.2
Pod undocumented
80  
81 0 ▶ return unless Net::DRI::Util::has_contact($rd);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_contact($rd) 0 0 0
82  
83 0 my @n;
84 0 my $cs=$rd->{contact};
85 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('Both registrant and admin contacts are required for .CA domain name transfer if contacts are provided') unless ($cs->has_type('registrant') && $cs->has_type('admin'));
Branch: 1 branch
BranchTrueFalseTotal
unless $cs->has_type("registrant") and $cs->has_type("admin") 0 0 0
Condition0%0/3
$cs->has_type("registrant") and $cs->has_type("admin")
!ll&&!rl&&r
000
MC/DC0%0/2
$cs->has_type("registrant") and $cs->has_type("admin")
$cs->has_type("registrant") $cs->has_type("admin")
Truth table0%0/3
A and B
A= $cs->has_type("registrant")B= $cs->has_type("admin")
ABresult
0X0
100
111
86 0 my @c=$cs->get('registrant');
87 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('only one registrant is mandatory in .CA for domain_transfer_start if contacts are provided') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1));
Branch: 1 branch
BranchTrueFalseTotal
unless @c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1) 0 0 0
Condition0%0/9
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")
!ll&&!rl&&r
000
MC/DC0%0/4
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
@c == 1 Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") length $c[0]->srid $c[0]->validate(1)
Truth table0%0/5
A and B and C and D
A= @c == 1B= Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")C= length $c[0]->sridD= $c[0]->validate(1)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
88 0 push @n,['cira:registrant',$c[0]->srid()];
89 0 @c=$cs->get('admin');
90 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('only one admin contact is mandatory in .CA for domain_transfer_start if contacts are provided') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::CIRA') && length $c[0]->srid() && $c[0]->validate(1));
Branch: 1 branch
BranchTrueFalseTotal
unless @c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1) 0 0 0
Condition0%0/9
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid
!ll&&!rl&&r
000
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")
!ll&&!rl&&r
000
MC/DC0%0/4
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") and length $c[0]->srid and $c[0]->validate(1)
@c == 1 Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA") length $c[0]->srid $c[0]->validate(1)
Truth table0%0/5
A and B and C and D
A= @c == 1B= Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::CIRA")C= length $c[0]->sridD= $c[0]->validate(1)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
91 0 push @n,['cira:contact',{type=>'admin'},$c[0]->srid()];
92 0 @c=$cs->get('tech');
93 0 ▶ if (@c)
Branch: 1 branch
BranchTrueFalseTotal
if (@c) 0 0 0
94 {
95 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('only up to 3 tech contacts are possible in .CA for domain_transfer_start') if (scalar(@c)!=scalar(grep { Net::DRI::Util::isa_contact($_,'Net::DRI::Data::Contact::CIRA') && length $_->srid() && $_->validate(1) } @c) || @c>3);
Branch: 2 branches
BranchTrueFalseTotal
if scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) or @c > 3 0 0 0
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1) 0 0 0
Condition0%0/6
scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) or @c > 3
l!l&&r!l&&!r
000
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) or @c > 3
scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c) @c > 3
MC/DC0%0/2
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid
Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") length $_->srid
Truth table0%0/3
A or B
A= scalar @c != scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA") and length $_->srid and $_->validate(1);} @c)B= @c > 3
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::CIRA")B= length $_->srid
ABresult
0X0
100
111
96 0 push @n,map { ['cira:contact',{type=>'tech'},$_->srid()] } @c;
97 }
98  
99 0 my $mes=$epp->message();
100 0 my $eid=$mes->command_extension_register('cira','ciraTransfer');
101 0 $mes->command_extension($eid,['cira:ciraChg',@n]);
102 0 return;
103 }
104  
105 ####################################################################################################
106 1 1;
107  
108 __END__
109  
110 =pod
111  
112 =head1 NAME
113  
114 Net::DRI::Protocol::EPP::Extensions::CIRA::Domain - CIRA (.CA) EPP Domain extensions for Net::DRI
115  
116 =head1 DESCRIPTION
117  
118 Please see the README file for details.
119  
120 =head1 SUPPORT
121  
122 For now, support questions should be sent to:
123  
124 E<lt>netdri@dotandco.comE<gt>
125  
126 Please also see the SUPPORT file in the distribution.
127  
128 =head1 SEE ALSO
129  
130 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
131  
132 =head1 AUTHOR
133  
134 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
135  
136 =head1 COPYRIGHT
137  
138 Copyright (c) 2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
139 All rights reserved.
140  
141 This program is free software; you can redistribute it and/or modify
142 it under the terms of the GNU General Public License as published by
143 the Free Software Foundation; either version 2 of the License, or
144 (at your option) any later version.
145  
146 See the LICENSE file that comes with this distribution for more details.
147  
148 =cut
149  
« DRI/Protocol/EPP/Extensions/ASIA/CED.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Domain.pm »