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

filter: Statementstmt 16.6% 7 / 42 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 4 totaltotal 11.6% 9 / 77 CC 11 SCAR 31.5
CC
11
Cov
11%
update
42.0
info_parse
20.0
create
12.0
CRAP 23.2
« DRI/Protocol/EPP/Extensions/Nomulus/Metadata.pm ↑ Summary DRI/Protocol/DAS/Message.pm »
1 ## Domain Registry Interface, DNSBE Contact EPP extension commands
2 ## (based on Registration_guidelines_v4_7_2-Part_4-epp.pdf)
3 ##
4 ## Copyright (c) 2006,2008,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::DNSBE::Contact;
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::DNSBE::Contact - DNSBE EPP Contact extension commands 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>
42  
43 =head1 AUTHOR
44  
45 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
46  
47 =head1 COPYRIGHT
48  
49 Copyright (c) 2006,2008,2013,2016 Patrick Mevzek <netdri@dotandco.com>.
50 All rights reserved.
51  
52 This program is free software; you can redistribute it and/or modify
53 it under the terms of the GNU General Public License as published by
54 the Free Software Foundation; either version 2 of the License, or
55 (at your option) any later version.
56  
57 See the LICENSE file that comes with this distribution for more details.
58  
59 =cut
60  
61 ####################################################################################################
62  
63 sub register_commands
64 {
65 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
66 0 my %tmp=(
67 create => [ \&create, undef ],
68 update => [ \&update, undef ],
69 info => [ undef, \&info_parse ],
70 );
71  
72 0 return { 'contact' => \%tmp };
73 }
74  
75 ####################################################################################################
76  
77 sub create
78 {
79 0 ▶ my ($epp,$contact)=@_;
Subroutine create: not called CC=3 SCAR=24.8
Pod undocumented
80  
81 ## validate() has been called, we are sure that type & lang exists
82 0 my @n;
83 0 ▶ push @n,['dnsbe:type',($contact->type() eq 'registrant')? 'licensee' : $contact->type()];
Branch: 1 branch
BranchTrueFalseTotal
$contact->type eq 'registrant' ? : 0 0 0
84 0 ▶ push @n,['dnsbe:vat',$contact->vat()] if $contact->vat();
Branch: 1 branch
BranchTrueFalseTotal
if $contact->vat 0 0 0
85 0 push @n,['dnsbe:lang',$contact->lang()];
86  
87 0 my $mes=$epp->message();
88 0 my $eid=$mes->command_extension_register('dnsbe', 'ext');
89 0 $mes->command_extension($eid,['dnsbe:create',['dnsbe:contact',@n]]);
90 0 return;
91 }
92  
93 sub update
94 {
95 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=6 SCAR=37.4
Pod undocumented
96  
97 0 my $newc=$todo->set('info');
98 0 ▶ return unless ($newc && (defined($newc->vat()) || defined($newc->lang())));
Branch: 1 branch
BranchTrueFalseTotal
unless $newc and defined $newc->vat || defined $newc->lang 0 0 0
Condition0%0/6
$newc and defined $newc->vat || defined $newc->lang
!ll&&!rl&&r
000
defined $newc->vat or defined $newc->lang
l!l&&r!l&&!r
000
MC/DC0%0/3
$newc and defined $newc->vat || defined $newc->lang
$newc defined $newc->vat defined $newc->lang
Truth table0%0/4
A and B or C
A= $newcB= defined $newc->vatC= defined $newc->lang
ABCresult
0XX0
1000
11X1
1011
99  
100 0 my @n;
101 0 ▶ push @n,['dnsbe:vat',$newc->vat()] if defined($newc->vat());
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->vat 0 0 0
102 0 ▶ push @n,['dnsbe:lang',$newc->lang()] if defined($newc->lang());
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->lang 0 0 0
103  
104 0 my $mes=$epp->message();
105 0 my $eid=$mes->command_extension_register('dnsbe', 'ext');
106 0 $mes->command_extension($eid,['dnsbe:update',['dnsbe:contact',['dnsbe:chg',@n]]]);
107 0 return;
108 }
109  
110 sub info_parse
111 {
112 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=4 SCAR=30.0
Pod undocumented
113 0 my $mes=$po->message();
114 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
115  
116 0 my $infdata=$mes->get_extension('dnsbe','infData');
117 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
118  
119 0 my $s=$rinfo->{contact}->{$oname}->{self};
120  
121 0 my $el=$infdata->getChildrenByTagNameNS($mes->ns('dnsbe'),'type');
122 0 $s->type($el->get_node(1)->getFirstChild()->getData());
123 0 $el=$infdata->getChildrenByTagNameNS($mes->ns('dnsbe'),'vat');
124 0 ▶ $s->vat($el->get_node(1)->getFirstChild()->getData()) if defined($el->get_node(1));
Branch: 1 branch
BranchTrueFalseTotal
if defined $el->get_node(1) 0 0 0
125 0 $el=$infdata->getChildrenByTagNameNS($mes->ns('dnsbe'),'lang');
126 0 $s->lang($el->get_node(1)->getFirstChild()->getData());
127 0 return;
128 }
129  
130 ####################################################################################################
131 1 1;
« DRI/Protocol/EPP/Extensions/Nomulus/Metadata.pm ↑ Summary DRI/Protocol/DAS/Message.pm »