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

filter: Statementstmt 8.6% 7 / 81 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.5% 9 / 197 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/CIRA/Domain.pm »
1 ## Domain Registry Interface, ASIA CED extension
2 ##
3 ## Copyright (c) 2007,2008 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 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 {
67 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
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 {
82 0 ▶ my $contact = shift;
Subroutine auto_cedother: not called CC=4 SCAR=30.0
Pod undocumented
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 {
101 0 ▶ my ($epp,$contact,$rd)=@_;
Subroutine user_create: not called CC=19 SCAR=59.4
Pod undocumented
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 my $mes=$epp->message();
119 0 my $eid=$mes->command_extension_register('asia', 'create');
120 0 $mes->command_extension($eid,['asia:cedData', @ceddata]);
121 0 return;
122 }
123  
124 sub user_update
125 {
126 0 ▶ my ($epp,$contact,$todo)=@_;
Subroutine user_update: not called CC=10 SCAR=47.0
Pod undocumented
127 0 my $newc=$todo->set('info');
128  
129 0 $contact = auto_cedother($contact);
130 0 my @ceddata;
131 0 ▶ push(@ceddata, ['asia:ccLocality', $contact->cedcc()]) if defined $contact->cedcc();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedcc 0 0 0
132 0 ▶ push(@ceddata, ['asia:localitySp', $contact->cedsp()]) if defined $contact->cedsp();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedsp 0 0 0
133 0 ▶ push(@ceddata, ['asia:localityCity', $contact->cedcity()]) if defined $contact->cedcity();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedcity 0 0 0
134 0 ▶ push(@ceddata, ['asia:legalEntityType', $contact->cedetype()]) if defined $contact->cedetype();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedetype 0 0 0
135 0 ▶ push(@ceddata, ['asia:identForm', $contact->cediform()]) if defined $contact->cediform();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cediform 0 0 0
136 0 ▶ push(@ceddata, ['asia:identNumber', $contact->cedinum()]) if defined $contact->cedinum();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedinum 0 0 0
137 0 ▶ push(@ceddata, ['asia:otherLEType', $contact->cedothertype()]) if defined $contact->cedothertype();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedothertype 0 0 0
138 0 ▶ push(@ceddata, ['asia:otherIdentForm', $contact->cedoiform()]) if defined $contact->cedoiform();
Branch: 1 branch
BranchTrueFalseTotal
if defined $contact->cedoiform 0 0 0
139  
140 0 ▶ return unless @ceddata;
Branch: 1 branch
BranchTrueFalseTotal
unless @ceddata 0 0 0
141  
142 0 my $mes=$epp->message();
143 0 my $eid=$mes->command_extension_register('asia', 'update');
144 0 $mes->command_extension($eid,['asia:chg', ['asia:cedData', @ceddata]]);
145 0 return;
146 }
147  
148 sub user_info
149 {
150 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine user_info: not called CC=11 SCAR=48.8
Pod undocumented
151 0 my $mes=$po->message();
152 0 my $infdata=$mes->get_extension('asia','infData');
153 0 my $ceddata;
154 0 my $contact = $rinfo->{$otype}->{$oname}->{self};
155 0 my $c;
156  
157 0 my $ns=$mes->ns('asia');
158 0 ▶ $ceddata = $infdata->getElementsByTagNameNS($ns, 'cedData')->shift() if (defined($infdata));
Branch: 1 branch
BranchTrueFalseTotal
if defined $infdata 0 0 0
159 0 ▶ return unless ($ceddata);
Branch: 1 branch
BranchTrueFalseTotal
unless $ceddata 0 0 0
160  
161 0 $c = $ceddata->getElementsByTagNameNS($ns,'ccLocality');
162 0 ▶ $contact->cedcc($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
163  
164 0 $c = $ceddata->getElementsByTagNameNS($ns,'localitySp');
165 0 ▶ $contact->cedsp($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
166  
167 0 $c = $ceddata->getElementsByTagNameNS($ns,'localityCity');
168 0 ▶ $contact->cedcity($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
169  
170 0 $c = $ceddata->getElementsByTagNameNS($ns,'legalEntityType');
171 0 ▶ $contact->cedetype($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
172  
173 0 $c = $ceddata->getElementsByTagNameNS($ns,'identForm');
174 0 ▶ $contact->cediform($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
175  
176 0 $c = $ceddata->getElementsByTagNameNS($ns,'identNumber');
177 0 ▶ $contact->cedinum($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
178  
179 0 $c = $ceddata->getElementsByTagNameNS($ns,'otherLEType');
180 0 ▶ $contact->cedothertype($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
181  
182 0 $c = $ceddata->getElementsByTagNameNS($ns,'otherIdentForm');
183 0 ▶ $contact->cedoiform($c->shift()->getFirstChild()->getData()) if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
184  
185 0 return;
186 }
187  
188 ####################################################################################################
189 1 1;
« DRI/Transport/Socket.pm ↑ Summary DRI/Protocol/EPP/Extensions/CIRA/Domain.pm »