DRI/Protocol/EPP/Extensions/COZA/Domain.pm

filter: Statementstmt 24.0% 13 / 54 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 17.5% 17 / 97 CC 13 SCAR 28.5
CC
13
Cov
16%
update
30.0
info_parse
30.0
update_parse
12.0
CRAP 17.3
« DRI/Protocol/EPP/Extensions/ISPAPI/KeyValue.pm ↑ Summary DRI/Protocol/DAS/SIDN/Domain.pm »
1 ## Domain Registry Interface, .CO.ZA Domain EPP extension commands
2 ## From http://registry.coza.net.za/doku.php?id=eppdomainextension
3 ##
4 ## Copyright (c) 2011,2013,2018 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::COZA::Domain;
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 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 ####################################################################################################
25  
26 sub register_commands
27 {
28 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
29 0 my %tmp=(
30 update => [ \&update , \&update_parse ],
31 info => [ \&info , \&info_parse ],
32 );
33  
34 0 return { 'domain' => \%tmp };
35 }
36  
37 sub setup
38 {
39 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
40 0 $po->ns({ 'cozadomain' => 'http://co.za/epp/extensions/cozadomain-1-0' });
41 0 return;
42 }
43  
44 ####################################################################################################
45  
46 sub update
47 {
48 0 ▶ my ($epp,$domain,$todo)=@_;
Subroutine update: not called CC=5 SCAR=34.0
Pod undocumented
49 0 my $mes=$epp->message();
50  
51 0 my $autorenew=$todo->set('auto_renew');
52 0 ▶ if (defined $autorenew)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $autorenew) 0 0 0
53 {
54 0 my $eid=$mes->command_extension_register('cozadomain','update');
55 0 ▶ $mes->command_extension($eid,[['cozadomain:chg',['cozadomain:autorenew',$autorenew ? 'true' : 'false']]]);
Branch: 1 branch
BranchTrueFalseTotal
$autorenew ? : 0 0 0
56 0 return;
57 }
58  
59 0 my $cancel=$todo->set('cancel_action');
60 0 ▶ if (defined $cancel)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cancel) 0 0 0
61 {
62 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('cancel_action parameter must be PendingUpdate or PendingSuspension') unless $cancel=~m/^Pending(?:Update|Suspension)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $cancel =~ /^Pending(?:Update|Suspension)$/ 0 0 0
63 0 my $eid=$mes->command_extension_register('cozadomain','update',{cancelPendingAction=>$cancel});
64 }
65 0 return;
66 }
67  
68 sub update_parse
69 {
70 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine update_parse: not called CC=3 SCAR=24.8
Pod undocumented
71 0 my $mes=$po->message();
72 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
73  
74 0 my $updata=$mes->get_extension('cozadomain','cozaData');
75 0 ▶ return unless defined $updata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $updata 0 0 0
76  
77 ## We do not parse the <cozadomain:detail result="success">AutoRenew 'False' successful</cozadomain:detail>
78 0 return;
79 }
80  
81 sub info
82 {
83 0 ▶ my ($epp,$domain,$rp)=@_;
Subroutine info: not called CC=3 SCAR=24.8
Pod undocumented
84 0 my $mes=$epp->message();
85  
86 0 ▶ return unless Net::DRI::Util::has_key($rp,'transfer_cost') && $rp->{transfer_cost};
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rp, "transfer_cost") and $rp->{"transfer_cost"} 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rp, "transfer_cost") and $rp->{"transfer_cost"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rp, "transfer_cost") and $rp->{"transfer_cost"}
Net::DRI::Util::has_key($rp, "transfer_cost") $rp->{"transfer_cost"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rp, "transfer_cost")B= $rp->{"transfer_cost"}
ABresult
0X0
100
111
87  
88 0 my $eid=$mes->command_extension_register('cozadomain','info');
89 0 $mes->command_extension($eid,[['cozadomain:transferQuote','true']]);
90 0 return;
91 }
92  
93 sub info_parse
94 {
95 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
96 0 my $mes=$po->message();
97 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
98  
99 0 my $infdata=$mes->get_extension('cozadomain','infData');
100 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
101  
102 0 my $ns=$mes->ns('cozadomain');
103 0 my $autorenew=Net::DRI::Util::xml_traverse($infdata,$ns,'autorenew');
104 0 ▶ $rinfo->{domain}->{$oname}->{auto_renew}=Net::DRI::Util::xml_parse_boolean($autorenew->textContent()) if defined $autorenew;
Branch: 1 branch
BranchTrueFalseTotal
if defined $autorenew 0 0 0
105  
106 0 my $cost=Net::DRI::Util::xml_traverse($infdata,$ns,'transferQuoteRes','cost');
107 0 ▶ $rinfo->{domain}->{$oname}->{transfer_cost}=0+$cost->textContent() if defined $cost;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cost 0 0 0
108 0 return;
109 }
110  
111 ####################################################################################################
112 1 1;
113  
114 __END__
115  
116 =pod
117  
118 =head1 NAME
119  
120 Net::DRI::Protocol::EPP::Extensions::COZA::Domain - .CO.ZA Domain EPP Extension for Net::DRI
121  
122 =head1 DESCRIPTION
123  
124 Please see the README file for details.
125  
126 =head1 SUPPORT
127  
128 For now, support questions should be sent to:
129  
130 E<lt>netdri@dotandco.comE<gt>
131  
132 Please also see the SUPPORT file in the distribution.
133  
134 =head1 SEE ALSO
135  
136 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
137  
138 =head1 AUTHOR
139  
140 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
141  
142 =head1 COPYRIGHT
143  
144 Copyright (c) 2011,2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
145 All rights reserved.
146  
147 This program is free software; you can redistribute it and/or modify
148 it under the terms of the GNU General Public License as published by
149 the Free Software Foundation; either version 2 of the License, or
150 (at your option) any later version.
151  
152 See the LICENSE file that comes with this distribution for more details.
153  
154 =cut
« DRI/Protocol/EPP/Extensions/ISPAPI/KeyValue.pm ↑ Summary DRI/Protocol/DAS/SIDN/Domain.pm »