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

filter: Statementstmt 18.4% 7 / 38 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 12.3% 9 / 73 CC 11 SCAR 31.5
CC
11
Cov
12%
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,2019 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,2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
65 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine create: not called CC=3 SCAR=24.8
Pod undocumented
79 0 my ($epp,$contact)=@_;
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 $epp->message()->command_extension('dnsbe', ['ext', ['create', ['contact', @n]]]);
88 0 return;
89 }
90  
91 sub update
92 0 ▶{
Subroutine update: not called CC=6 SCAR=37.4
Pod undocumented
93 0 my ($epp,$domain,$todo)=@_;
94  
95 0 my $newc=$todo->set('info');
96 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
97  
98 0 my @n;
99 0 ▶ push @n,['dnsbe:vat',$newc->vat()] if defined($newc->vat());
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->vat 0 0 0
100 0 ▶ push @n,['dnsbe:lang',$newc->lang()] if defined($newc->lang());
Branch: 1 branch
BranchTrueFalseTotal
if defined $newc->lang 0 0 0
101  
102 0 $epp->message()->command_extension('dnsbe', ['ext', ['update', ['contact', ['chg', @n]]]]);
103 0 return;
104 }
105  
106 sub info_parse
107 0 ▶{
Subroutine info_parse: not called CC=4 SCAR=30.0
Pod undocumented
108 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
109 0 my $mes=$po->message();
110 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
111  
112 0 my $infdata=$mes->get_extension('dnsbe','infData');
113 0 ▶ return unless $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless $infdata 0 0 0
114  
115 0 my $s=$rinfo->{contact}->{$oname}->{self};
116  
117 0 my $el=$infdata->getChildrenByTagNameNS($mes->ns('dnsbe'),'type');
118 0 $s->type($el->get_node(1)->getFirstChild()->getData());
119 0 $el=$infdata->getChildrenByTagNameNS($mes->ns('dnsbe'),'vat');
120 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
121 0 $el=$infdata->getChildrenByTagNameNS($mes->ns('dnsbe'),'lang');
122 0 $s->lang($el->get_node(1)->getFirstChild()->getData());
123 0 return;
124 }
125  
126 ####################################################################################################
127 1 1;
« DRI/Protocol/EPP/Extensions/Nomulus/Metadata.pm ↑ Summary DRI/Protocol/DAS/Message.pm »