DRI/Protocol/EPP/Extensions/ResellerInfo.pm

filter: Statementstmt 23.2% 13 / 56 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 33.3% 4 / 12 Podpod 0.0% 0 / 7 totaltotal 16.3% 17 / 104 CC 14 SCAR 34.2
CC
14
Cov
16%
update_build
72.0
info_parse
30.0
_add_id
6.0
CRAP 30.5
« DRI/Transport/SOAP.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/PremiumDomain.pm »
1 ## Domain Registry Interface, Reseller Extension Mapping for EPP
2 ##
3 ## Copyright (c) 2015,2016,2018 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::ResellerInfo;
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  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 ####################################################################################################
24  
25 sub register_commands
26 {
27 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my %dhc = ( info => [ undef, \&info_parse ],
29 create => [ \&create_build, undef ],
30 update => [ \&update_build, undef ] );
31  
32 0 return { 'domain' => \%dhc, 'host' => \%dhc, 'contact' => \%dhc };
33 }
34  
35 sub setup
36 {
37 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
38 0 $po->ns({ 'resellerext' => 'urn:ietf:params:xml:ns:resellerext-1.0' });
39 0 return;
40 }
41  
42 0 ▶sub capabilities_add { return ('domain_update','reseller',[qw/add del set/]); }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
43  
44 0 ▶sub implements { return 'https://tools.ietf.org/html/draft-zhou-eppext-reseller-03'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
45  
46 ####################################################################################################
47  
48 sub info_parse
49 {
50 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
51 0 my $mes=$po->message();
52 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
53  
54 0 my $data=$mes->get_extension('resellerext', 'infData');
55 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
56  
57 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
58 {
59 0 my ($name,$node)=@$el;
60 0 ▶ if ($name eq 'id')
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "id") 0 0 0
61 {
62 0 $rinfo->{$otype}->{$oname}->{reseller}=$node->textContent();
63 }
64 }
65  
66 0 return;
67 }
68  
69 sub _add_id
70 {
71 0 ▶ my ($id)=@_;
Subroutine _add_id: not called CC=2 SCAR=17.9
72 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid syntax for reseller id: '.$id) unless Net::DRI::Util::xml_is_token($id,3,16);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_token($id, 3, 16) 0 0 0
73 0 return (['resellerext:id',$id]);
74 }
75  
76 sub create_build
77 {
78 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create_build: not called CC=2 SCAR=17.9
Pod undocumented
79 0 my $mes=$epp->message();
80  
81 0 ▶ return unless Net::DRI::Util::has_key($rd,'reseller');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "reseller") 0 0 0
82 0 my @d=_add_id($rd->{reseller});
83  
84 0 my $eid=$mes->command_extension_register('resellerext','create');
85 0 $mes->command_extension($eid,\@d);
86  
87 0 return;
88 }
89  
90 sub update_build
91 {
92 0 ▶ my ($epp,$domain,$todo,$rp)=@_;
Subroutine update_build: not called CC=8 SCAR=42.8
Pod undocumented
93  
94 0 my $add=$todo->add('reseller');
95 0 my $del=$todo->del('reseller');
96 0 my $set=$todo->set('reseller');
97  
98 0 ▶ return unless defined $add || defined $del || defined $set;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $add or defined $del or defined $set 0 0 0
Condition0%0/6
defined $add or defined $del or defined $set
l!l&&r!l&&!r
000
defined $add or defined $del
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $add or defined $del or defined $set
defined $add defined $del defined $set
Truth table0%0/4
A or B or C
A= defined $addB= defined $delC= defined $set
ABCresult
1XX1
01X1
0011
0000
99 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Incompatible changeset for reseller: only add or del or set') if 1 < grep { defined } ($add,$del,$set);
Branch: 1 branch
BranchTrueFalseTotal
if 1 < grep({defined $_;} $add, $del, $set) 0 0 0
100  
101 0 my @n;
102 0 ▶ push @n,['resellerext:add',_add_id($add)] if defined $add;
Branch: 1 branch
BranchTrueFalseTotal
if defined $add 0 0 0
103 0 ▶ push @n,['resellerext:rem',_add_id($del)] if defined $del;
Branch: 1 branch
BranchTrueFalseTotal
if defined $del 0 0 0
104 0 ▶ push @n,['resellerext:chg',_add_id($set)] if defined $set;
Branch: 1 branch
BranchTrueFalseTotal
if defined $set 0 0 0
105  
106 0 my $mes=$epp->message();
107 0 my $eid=$mes->command_extension_register('resellerext','update');
108 0 $mes->command_extension($eid,\@n);
109 0 return;
110 }
111  
112  
113 ####################################################################################################
114 1 1;
115  
116 __END__
117  
118 =pod
119  
120 =head1 NAME
121  
122 Net::DRI::Protocol::EPP::Extensions::ResellerInfo - EPP Reseller Extension mapping (draft-zhou-eppext-reseller-03) for Net::DRI
123  
124 =head1 DESCRIPTION
125  
126 Please see the README file for details.
127  
128 =head1 SUPPORT
129  
130 For now, support questions should be sent to:
131  
132 E<lt>netdri@dotandco.comE<gt>
133  
134 Please also see the SUPPORT file in the distribution.
135  
136 =head1 SEE ALSO
137  
138 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
139  
140 =head1 AUTHOR
141  
142 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
143  
144 =head1 COPYRIGHT
145  
146 Copyright (c) 2015,2016,2018 Patrick Mevzek <netdri@dotandco.com>.
147 All rights reserved.
148  
149 This program is free software; you can redistribute it and/or modify
150 it under the terms of the GNU General Public License as published by
151 the Free Software Foundation; either version 2 of the License, or
152 (at your option) any later version.
153  
154 See the LICENSE file that comes with this distribution for more details.
155  
156 =cut
« DRI/Transport/SOAP.pm ↑ Summary DRI/Protocol/EPP/Extensions/VeriSign/PremiumDomain.pm »