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

filter: Statementstmt 26.0% 13 / 50 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 18.2% 17 / 93 CC 13 SCAR 28.5
CC
13
Cov
17%
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-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::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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
39 0 my ($class,$po,$version)=@_;
40 0 $po->ns({ 'cozadomain' => 'http://co.za/epp/extensions/cozadomain-1-0' });
41 0 return;
42 }
43  
44 ####################################################################################################
45  
46 sub update
47 0 ▶{
Subroutine update: not called CC=5 SCAR=34.0
Pod undocumented
48 0 my ($epp,$domain,$todo)=@_;
49  
50 0 my $autorenew=$todo->set('auto_renew');
51 0 ▶ if (defined $autorenew)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $autorenew) 0 0 0
52 {
53 0 ▶ $epp->message()->command_extension('cozadomain', ['update', ['chg', ['autorenew', $autorenew ? 'true' : 'false']]]);
Branch: 1 branch
BranchTrueFalseTotal
$autorenew ? : 0 0 0
54 0 return;
55 }
56  
57 0 my $cancel=$todo->set('cancel_action');
58 0 ▶ if (defined $cancel)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cancel) 0 0 0
59 {
60 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
61 0 $epp->message()->command_extension('cozadomain', ['update', {cancelPendingAction=>$cancel}]);
62 }
63 0 return;
64 }
65  
66 sub update_parse
67 0 ▶{
Subroutine update_parse: not called CC=3 SCAR=24.8
Pod undocumented
68 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
69 0 my $mes=$po->message();
70 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
71  
72 0 my $updata=$mes->get_extension('cozadomain','cozaData');
73 0 ▶ return unless defined $updata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $updata 0 0 0
74  
75 ## We do not parse the <cozadomain:detail result="success">AutoRenew 'False' successful</cozadomain:detail>
76 0 return;
77 }
78  
79 sub info
80 0 ▶{
Subroutine info: not called CC=3 SCAR=24.8
Pod undocumented
81 0 my ($epp,$domain,$rp)=@_;
82  
83 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
84  
85 0 $epp->message()->command_extension('cozadomain', ['info', ['transferQuote','true']]);
86 0 return;
87 }
88  
89 sub info_parse
90 0 ▶{
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
91 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
92 0 my $mes=$po->message();
93 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
94  
95 0 my $infdata=$mes->get_extension('cozadomain','infData');
96 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
97  
98 0 my $ns=$mes->ns('cozadomain');
99 0 my $autorenew=Net::DRI::Util::xml_traverse($infdata,$ns,'autorenew');
100 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
101  
102 0 my $cost=Net::DRI::Util::xml_traverse($infdata,$ns,'transferQuoteRes','cost');
103 0 ▶ $rinfo->{domain}->{$oname}->{transfer_cost}=0+$cost->textContent() if defined $cost;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cost 0 0 0
104 0 return;
105 }
106  
107 ####################################################################################################
108 1 1;
109  
110 __END__
« DRI/Protocol/EPP/Extensions/ISPAPI/KeyValue.pm ↑ Summary DRI/Protocol/DAS/SIDN/Domain.pm »