DRI/Protocol/EPP/Extensions/PL/Contact.pm

filter: Statementstmt 26.0% 13 / 50 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 17.7% 17 / 96 CC 14 SCAR 30.8
CC
14
Cov
17%
info_parse
42.0
add_individual_and_consent
30.0
info
20.0
CRAP 21.8
« DRI/Protocol/EPP/Extensions/COZA/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm »
1 ## Domain Registry Interface, .PL Contact EPP extension commands
2 ##
3 ## Copyright (c) 2006,2008,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::PL::Contact;
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  
23 =pod
24  
25 =head1 NAME
26  
27 Net::DRI::Protocol::EPP::Extensions::PL::Contact - .PL EPP Contact extension commands for Net::DRI
28  
29 =head1 DESCRIPTION
30  
31 Please see the README file for details.
32  
33 =head1 SUPPORT
34  
35 For now, support questions should be sent to:
36  
37 E<lt>netdri@dotandco.comE<gt>
38  
39 Please also see the SUPPORT file in the distribution.
40  
41 =head1 SEE ALSO
42  
43 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
44  
45 =head1 AUTHOR
46  
47 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
48  
49 =head1 COPYRIGHT
50  
51 Copyright (c) 2006,2008,2011,2013,2016,2019 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 state $cmds = { 'contact' => { create => [ \&create, undef ],
69 info => [ \&info, \&info_parse ],
70 update => [ \&update, undef ],
71 }
72 };
73  
74 0 return $cmds;
75 }
76  
77 ####################################################################################################
78  
79 sub add_individual_and_consent
80 0 ▶{
Subroutine add_individual_and_consent: not called CC=5 SCAR=34.0
Pod undocumented
81 0 my ($epp,$contact,$op)=@_;
82  
83 ## validate() has already been called
84 0 my $ind=$contact->individual();
85 0 my $cfp=$contact->consent_for_publishing();
86  
87 0 ▶ return unless (defined($ind) || defined($cfp));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ind or defined $cfp 0 0 0
Condition0%0/3
defined $ind or defined $cfp
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $ind or defined $cfp
defined $ind defined $cfp
Truth table0%0/3
A or B
A= defined $indB= defined $cfp
ABresult
1X1
011
000
88  
89 0 my @e;
90 0 ▶ push @e,['extcon:individual',$ind] if defined($ind);
Branch: 1 branch
BranchTrueFalseTotal
if defined $ind 0 0 0
91 0 ▶ push @e,['extcon:consentForPublishing',$cfp] if defined($cfp);
Branch: 1 branch
BranchTrueFalseTotal
if defined $cfp 0 0 0
92  
93 0 $epp->message()->command_extension('extcon', [$op, @e]);
94 0 return;
95 }
96  
97 sub create
98 0 ▶{
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
99 0 my ($epp,$contact)=@_;
100 0 return add_individual_and_consent($epp,$contact,'create');
101 }
102  
103 sub update
104 0 ▶{
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
105 0 my ($epp,$contact,$todo)=@_;
106 0 my $newc=$todo->set('info');
107 0 ▶ return unless $newc;
Branch: 1 branch
BranchTrueFalseTotal
unless $newc 0 0 0
108 0 return add_individual_and_consent($epp,$newc,'update');
109 }
110  
111 sub info
112 0 ▶{
Subroutine info: not called CC=4 SCAR=30.0
Pod undocumented
113 0 my ($epp,$contact,$ep)=@_;
114  
115 0 ▶ return unless (Net::DRI::Util::has_auth($ep) && exists $ep->{auth}->{pw});
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_auth($ep) and exists $ep->{"auth"}{"pw"} 0 0 0
Condition0%0/3
Net::DRI::Util::has_auth($ep) and exists $ep->{"auth"}{"pw"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_auth($ep) and exists $ep->{"auth"}{"pw"}
Net::DRI::Util::has_auth($ep) exists $ep->{"auth"}{"pw"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_auth($ep)B= exists $ep->{"auth"}{"pw"}
ABresult
0X0
100
111
116  
117 0 my %roid;
118 0 ▶ if (Net::DRI::Util::has_key($ep->{auth},'roid'))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($ep->{"auth"}, "roid")) 0 0 0
119 {
120 0 %roid = (roid => $ep->{auth}->{roid});
121 }
122 0 $epp->message()->command_extension('extcon', ['info', ['authInfo', ['pw', $ep->{auth}->{pw}, \%roid]]]);
123 0 return;
124 }
125  
126 sub info_parse
127 0 ▶{
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
128 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
129 0 my $mes=$po->message();
130 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
131  
132 0 my $infdata=$mes->get_extension('extcon','infData');
133 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
134  
135 0 my $contact=$rinfo->{contact}->{$oname}->{self};
136  
137 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
138 {
139 0 my ($name,$c)=@$el;
140 0 ▶ if ($name eq 'individual')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'individual') { } 0 0 0
elsif ($name eq 'consentForPublishing') { } 0 0 0
141 {
142 0 $contact->individual(Net::DRI::Util::xml_parse_boolean($c->textContent()));
143 } elsif ($name eq 'consentForPublishing')
144 {
145 0 $contact->consent_for_publishing(Net::DRI::Util::xml_parse_boolean($c->textContent()));
146 }
147 }
148 0 return;
149 }
150  
151 ####################################################################################################
152 1 1;
« DRI/Protocol/EPP/Extensions/COZA/Contact.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm »