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

filter: Statementstmt 26.2% 16 / 61 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 5 totaltotal 16.9% 21 / 124 CC 20 SCAR 36.7
CC
20
Cov
16%
create
72.0
info_parse
56.0
delete_cancel
20.0
CRAP 39.1
« DRI/Protocol/EPP/Extensions/Afilias/Message.pm ↑ Summary DRI/Protocol/EPP/Extensions/AusRegistry/IDN.pm »
1 ## Domain Registry Interface, SIDN EPP Domain extensions
2 ##
3 ## Copyright (c) 2009-2011,2013,2016,2019 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::SIDN::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 1 ▶use feature 'state';
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  
24 ####################################################################################################
25  
26 sub register_commands
27 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my ($class,$version)=@_;
29 0 state $domain = {
30 info => [ undef, \&info_parse],
31 create => [ \&create, undef ],
32 delete_cancel => [ \&delete_cancel, undef ],
33 transfer_request => [ undef, \&transfer_parse ],
34 };
35 0 state $commands = { 'domain' => $domain };
36  
37 0 return $commands;
38 }
39  
40 ####################################################################################################
41  
42 sub info_parse
43 0 ▶{
Subroutine info_parse: not called CC=7 SCAR=40.3
Pod undocumented
44 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
45 0 my $mes=$po->message();
46 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
47  
48 0 my $infdata=$mes->get_extension('sidn','ext');
49 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
50  
51 0 my $ns=$mes->ns('sidn');
52 0 $infdata=Net::DRI::Util::xml_traverse($infdata,$ns,'infData','domain');
53 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
54  
55 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
56 {
57 0 my ($name,$c)=@$el;
58 0 ▶ if ($name eq 'optOut')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'optOut') { } 0 0 0
elsif ($name eq 'limited') { } 0 0 0
59 {
60 0 $rinfo->{domain}->{$oname}->{opt_out}=Net::DRI::Util::xml_parse_boolean($c->textContent());
61 } elsif ($name eq 'limited')
62 {
63 0 $rinfo->{domain}->{$oname}->{limited}=Net::DRI::Util::xml_parse_boolean($c->textContent());
64 }
65 }
66 0 return;
67 }
68  
69 sub create
70 0 ▶{
Subroutine create: not called CC=8 SCAR=42.8
Pod undocumented
71 0 my ($epp,$domain,$rd)=@_;
72 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('contacts are mandatory in .NL for domain_create') unless Net::DRI::Util::has_contact($rd);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_contact($rd) 0 0 0
73 0 my $cs=$rd->{contact};
74 0 my @c=$cs->get('registrant');
75 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('one registrant is mandatory in .NL for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::SIDN'));
Branch: 1 branch
BranchTrueFalseTotal
unless @c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN") 0 0 0
Condition0%0/3
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
!ll&&!rl&&r
000
MC/DC0%0/2
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
@c == 1 Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
Truth table0%0/3
A and B
A= @c == 1B= Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
ABresult
0X0
100
111
76 0 @c=$cs->get('admin');
77 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('one admin contact is mandatory in .NL for domain_create') unless (@c==1 && Net::DRI::Util::isa_contact($c[0],'Net::DRI::Data::Contact::SIDN'));
Branch: 1 branch
BranchTrueFalseTotal
unless @c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN") 0 0 0
Condition0%0/3
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
!ll&&!rl&&r
000
MC/DC0%0/2
@c == 1 and Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
@c == 1 Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
Truth table0%0/3
A and B
A= @c == 1B= Net::DRI::Util::isa_contact($c[0], "Net::DRI::Data::Contact::SIDN")
ABresult
0X0
100
111
78 0 @c=$cs->get('tech');
79 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('at least one tech contact is mandatory in .NL for domain_create') unless (@c >= 1 && scalar(@c)==scalar(grep { Net::DRI::Util::isa_contact($_,'Net::DRI::Data::Contact::SIDN') } @c));
Branch: 1 branch
BranchTrueFalseTotal
unless @c >= 1 and scalar @c == scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::SIDN");} @c) 0 0 0
Condition0%0/3
@c >= 1 and scalar @c == scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::SIDN");} @c)
!ll&&!rl&&r
000
MC/DC0%0/2
@c >= 1 and scalar @c == scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::SIDN");} @c)
@c >= 1 scalar @c == scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::SIDN");} @c)
Truth table0%0/3
A and B
A= @c >= 1B= scalar @c == scalar grep({Net::DRI::Util::isa_contact($_, "Net::DRI::Data::Contact::SIDN");} @c)
ABresult
0X0
100
111
80 0 return;
81 }
82  
83 sub delete_cancel
84 0 ▶{
Subroutine delete_cancel: not called CC=4 SCAR=30.0
Pod undocumented
85 0 my ($epp,$domain,$rd)=@_;
86  
87 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',2,'Domain name needed') unless defined($domain) && $domain;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $domain and $domain 0 0 0
Condition0%0/3
defined $domain and $domain
!ll&&!rl&&r
000
MC/DC0%0/2
defined $domain and $domain
defined $domain $domain
Truth table0%0/3
A and B
A= defined $domainB= $domain
ABresult
0X0
100
111
88 0 ▶ Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::is_hostname($domain) 0 0 0
89  
90 0 my $mes=$epp->message();
91 0 $mes->command_extension('sidn', ['command', ['domainCancelDelete', ['name',$domain]], ['clTRID',$mes->cltrid()]]);
92 0 return;
93 }
94  
95 sub transfer_parse
96 0 ▶{
Subroutine transfer_parse: not called CC=4 SCAR=30.0
Pod undocumented
97 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
98 0 my $mes=$po->message();
99 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
100  
101 0 my $trndata=$mes->get_response('sidn','ext');
102 0 ▶ return unless defined $trndata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $trndata 0 0 0
103  
104 0 my $ns=$mes->ns('sidn');
105 0 my $pw=Net::DRI::Util::xml_traverse($trndata,$ns,'trnData','pw');
106 0 ▶ return unless defined $pw;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pw 0 0 0
107  
108 0 $rinfo->{domain}->{$oname}->{transfer_new_token}=$pw->textContent();
109 0 return;
110 }
111  
112 ####################################################################################################
113 1 1;
114  
115 __END__
« DRI/Protocol/EPP/Extensions/Afilias/Message.pm ↑ Summary DRI/Protocol/EPP/Extensions/AusRegistry/IDN.pm »