DRI/Protocol/EPP/Extensions/ASIA/CED.pm

filter: Statementstmt 9.0% 7 / 77 Branchbran 0.0% 0 / 64 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 5 totaltotal 4.6% 9 / 193 CC 41 SCAR 53.5
CC
41
Cov
4%
user_create
380.0
user_info
132.0
user_update
110.0
CRAP 209.7
« DRI/Transport/Socket.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Domain.pm »
1 ## Domain Registry Interface, ASIA CED extension
2 ##
3 ## Copyright (c) 2007,2008,2019 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>. All rights reserved.
4 ## (c) 2010,2013,2016 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::ASIA::CED;
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 =pod
22  
23 =head1 NAME
24  
25 Net::DRI::Protocol::EPP::Extensions::ASIA::CED - .ASIA EPP CED extensions for Net::DRI
26  
27 =head1 DESCRIPTION
28  
29 Please see the README file for details.
30  
31 =head1 SUPPORT
32  
33 For now, support questions should be sent to:
34  
35 E<lt>netdri@dotandco.comE<gt>
36  
37 Please also see the SUPPORT file in the distribution.
38  
39 =head1 SEE ALSO
40  
41 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> and
42 E<lt>http://oss.bdsprojects.net/projects/netdri/E<gt>
43  
44 =head1 AUTHOR
45  
46 Tonnerre Lombard E<lt>tonnerre.lombard@sygroup.chE<gt>
47  
48 =head1 COPYRIGHT
49  
50 Copyright (c) 2007,2008,2019 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>
51 (c) 2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>
52 All rights reserved.
53  
54 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
56 the Free Software Foundation; either version 2 of the License, or
57 (at your option) any later version.
58  
59 See the LICENSE file that comes with this distribution for more details.
60  
61 =cut
62  
63 ####################################################################################################
64  
65 sub register_commands
66 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
67 0 my ($class,$version)=@_;
68 0 my %contacttmp=(
69 create => [ \&user_create, undef ],
70 update => [ \&user_update, undef ],
71 info => [ undef, \&user_info ]
72 );
73  
74 0 return { 'contact' => \%contacttmp };
75 }
76  
77 ####################################################################################################
78  
79 # automatically put type/form in other fields if not in the list of allowed
80 sub auto_cedother
81 0 ▶{
Subroutine auto_cedother: not called CC=4 SCAR=30.0
Pod undocumented
82 0 my $contact = shift;
83 0 ▶ return $contact unless $contact->cedinum();
Branch: 1 branch
BranchTrueFalseTotal
unless $contact->cedinum 0 0 0
84 0 my $etype = lc($contact->cedetype());
85 0 ▶ unless ($etype =~ m/^(naturalperson|corporation|cooperative|partnership|government|politicalparty|society|institution|other)$/)
Branch: 1 branch
BranchTrueFalseTotal
unless ($etype =~ /^(naturalperson|corporation|cooperative|partnership|government|politicalparty|society|institution|other)$/) 0 0 0
86 {
87 0 $contact->cedothertype($contact->cedetype());
88 0 $contact->cedetype('other');
89 }
90 0 my $iform = $contact->cediform();
91 0 ▶ unless ($iform =~ m/^(passport|certificate|legislation|societyregistry|politicalpartyregistry|other)$/)
Branch: 1 branch
BranchTrueFalseTotal
unless ($iform =~ /^(passport|certificate|legislation|societyregistry|politicalpartyregistry|other)$/) 0 0 0
92 {
93 0 $contact->cedoiform($contact->cediform());
94 0 $contact->cediform('other');
95 }
96 0 return $contact;
97 }
98  
99 sub user_create
100 0 ▶{
Subroutine user_create: not called CC=19 SCAR=59.4
Pod undocumented
101 0 my ($epp,$contact,$rd)=@_;
102  
103 0 ▶ return unless Net::DRI::Util::isa_contact($contact, 'Net::DRI::Data::Contact::ASIA');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact, "Net::DRI::Data::Contact::ASIA") 0 0 0
104  
105 0 $contact = auto_cedother($contact);
106 0 my @ceddata;
107 0 ▶ push(@ceddata, ['asia:ccLocality', $contact->cedcc()]) if defined $contact->cedcc() && length $contact->cedcc();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedcc and length $contact->cedcc 0 0 0
Condition0%0/3
defined $contact->cedcc and length $contact->cedcc
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedcc and length $contact->cedcc
defined $contact->cedcc length $contact->cedcc
Truth table0%0/3
A and B
A= defined $contact->cedccB= length $contact->cedcc
ABresult
0X0
100
111
108 0 ▶ push(@ceddata, ['asia:localitySp', $contact->cedsp()]) if defined $contact->cedsp() && length $contact->cedsp();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedsp and length $contact->cedsp 0 0 0
Condition0%0/3
defined $contact->cedsp and length $contact->cedsp
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedsp and length $contact->cedsp
defined $contact->cedsp length $contact->cedsp
Truth table0%0/3
A and B
A= defined $contact->cedspB= length $contact->cedsp
ABresult
0X0
100
111
109 0 ▶ push(@ceddata, ['asia:localityCity', $contact->cedcity()]) if defined $contact->cedcity() && length $contact->cedcity();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedcity and length $contact->cedcity 0 0 0
Condition0%0/3
defined $contact->cedcity and length $contact->cedcity
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedcity and length $contact->cedcity
defined $contact->cedcity length $contact->cedcity
Truth table0%0/3
A and B
A= defined $contact->cedcityB= length $contact->cedcity
ABresult
0X0
100
111
110 0 ▶ push(@ceddata, ['asia:legalEntityType', $contact->cedetype()]) if defined $contact->cedetype() && length $contact->cedetype();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedetype and length $contact->cedetype 0 0 0
Condition0%0/3
defined $contact->cedetype and length $contact->cedetype
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedetype and length $contact->cedetype
defined $contact->cedetype length $contact->cedetype
Truth table0%0/3
A and B
A= defined $contact->cedetypeB= length $contact->cedetype
ABresult
0X0
100
111
111 0 ▶ push(@ceddata, ['asia:identForm', $contact->cediform()]) if defined $contact->cediform() && length $contact->cediform();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cediform and length $contact->cediform 0 0 0
Condition0%0/3
defined $contact->cediform and length $contact->cediform
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cediform and length $contact->cediform
defined $contact->cediform length $contact->cediform
Truth table0%0/3
A and B
A= defined $contact->cediformB= length $contact->cediform
ABresult
0X0
100
111
112 0 ▶ push(@ceddata, ['asia:identNumber', $contact->cedinum()]) if defined $contact->cedinum() && length $contact->cedinum();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedinum and length $contact->cedinum 0 0 0
Condition0%0/3
defined $contact->cedinum and length $contact->cedinum
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedinum and length $contact->cedinum
defined $contact->cedinum length $contact->cedinum
Truth table0%0/3
A and B
A= defined $contact->cedinumB= length $contact->cedinum
ABresult
0X0
100
111
113 0 ▶ push(@ceddata, ['asia:otherLEType', $contact->cedothertype()]) if defined $contact->cedothertype() && length $contact->cedothertype();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedothertype and length $contact->cedothertype 0 0 0
Condition0%0/3
defined $contact->cedothertype and length $contact->cedothertype
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedothertype and length $contact->cedothertype
defined $contact->cedothertype length $contact->cedothertype
Truth table0%0/3
A and B
A= defined $contact->cedothertypeB= length $contact->cedothertype
ABresult
0X0
100
111
114 0 ▶ push(@ceddata, ['asia:otherIdentForm', $contact->cedoiform()]) if defined $contact->cedoiform() && length $contact->cedoiform();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedoiform and length $contact->cedoiform 0 0 0
Condition0%0/3
defined $contact->cedoiform and length $contact->cedoiform
!ll&&!rl&&r
000
MC/DC0%0/2
defined $contact->cedoiform and length $contact->cedoiform
defined $contact->cedoiform length $contact->cedoiform
Truth table0%0/3
A and B
A= defined $contact->cedoiformB= length $contact->cedoiform
ABresult
0X0
100
111
115  
116 0 ▶ return unless @ceddata;
Branch: 1 branch
BranchTrueFalseTotal
unless @ceddata 0 0 0
117  
118 0 $epp->message()->command_extension('asia', ['create', ['cedData', @ceddata]]);
119 0 return;
120 }
121  
122 sub user_update
123 0 ▶{
Subroutine user_update: not called CC=10 SCAR=47.0
Pod undocumented
124 0 my ($epp,$contact,$todo)=@_;
125 0 my $newc=$todo->set('info');
126  
127 0 $contact = auto_cedother($contact);
128 0 my @ceddata;
129 0 ▶ push(@ceddata, ['asia:ccLocality', $contact->cedcc()]) if defined $contact->cedcc();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedcc 0 0 0
130 0 ▶ push(@ceddata, ['asia:localitySp', $contact->cedsp()]) if defined $contact->cedsp();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedsp 0 0 0
131 0 ▶ push(@ceddata, ['asia:localityCity', $contact->cedcity()]) if defined $contact->cedcity();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedcity 0 0 0
132 0 ▶ push(@ceddata, ['asia:legalEntityType', $contact->cedetype()]) if defined $contact->cedetype();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedetype 0 0 0
133 0 ▶ push(@ceddata, ['asia:identForm', $contact->cediform()]) if defined $contact->cediform();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cediform 0 0 0
134 0 ▶ push(@ceddata, ['asia:identNumber', $contact->cedinum()]) if defined $contact->cedinum();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedinum 0 0 0
135 0 ▶ push(@ceddata, ['asia:otherLEType', $contact->cedothertype()]) if defined $contact->cedothertype();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedothertype 0 0 0
136 0 ▶ push(@ceddata, ['asia:otherIdentForm', $contact->cedoiform()]) if defined $contact->cedoiform();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedoiform 0 0 0
137  
138 0 ▶ return unless @ceddata;
Branch: 1 branch
BranchTrueFalseTotal
unless @ceddata 0 0 0
139  
140 0 $epp->message()->command_extension('asia', ['update', ['chg', ['cedData', @ceddata]]]);
141 0 return;
142 }
143  
144 sub user_info
145 0 ▶{
Subroutine user_info: not called CC=11 SCAR=48.8
Pod undocumented
146 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
147 0 my $mes=$po->message();
148 0 my $infdata=$mes->get_extension('asia','infData');
149 0 my $ceddata;
150 0 my $contact = $rinfo->{$otype}->{$oname}->{self};
151 0 my $c;
152  
153 0 my $ns=$mes->ns('asia');
154 0 ▶ $ceddata = $infdata->getElementsByTagNameNS($ns, 'cedData')->shift() if (defined($infdata));
Branch: 1 branch
BranchTrueFalseTotal
if defined $infdata 0 0 0
155 0 ▶ return unless ($ceddata);
Branch: 1 branch
BranchTrueFalseTotal
unless $ceddata 0 0 0
156  
157 0 $c = $ceddata->getElementsByTagNameNS($ns,'ccLocality');
158 0 ▶ $contact->cedcc($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
159  
160 0 $c = $ceddata->getElementsByTagNameNS($ns,'localitySp');
161 0 ▶ $contact->cedsp($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
162  
163 0 $c = $ceddata->getElementsByTagNameNS($ns,'localityCity');
164 0 ▶ $contact->cedcity($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
165  
166 0 $c = $ceddata->getElementsByTagNameNS($ns,'legalEntityType');
167 0 ▶ $contact->cedetype($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
168  
169 0 $c = $ceddata->getElementsByTagNameNS($ns,'identForm');
170 0 ▶ $contact->cediform($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
171  
172 0 $c = $ceddata->getElementsByTagNameNS($ns,'identNumber');
173 0 ▶ $contact->cedinum($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
174  
175 0 $c = $ceddata->getElementsByTagNameNS($ns,'otherLEType');
176 0 ▶ $contact->cedothertype($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
177  
178 0 $c = $ceddata->getElementsByTagNameNS($ns,'otherIdentForm');
179 0 ▶ $contact->cedoiform($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
180  
181 0 return;
182 }
183  
184 ####################################################################################################
185 1 1;
« DRI/Transport/Socket.pm ↑ Summary DRI/Protocol/EPP/Extensions/TCI/Domain.pm »