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

filter: Statementstmt 25.4% 13 / 51 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 18.6% 17 / 91 CC 12 SCAR 31.0
CC
12
Cov
18%
info_parse
42.0
info
30.0
update
12.0
CRAP 22.3
« DRI/Data/Contact/BR.pm ↑ Summary DRI/Protocol/EPP/Extensions/PL/Contact.pm »
1 ## Domain Registry Interface, .CO.ZA Contact EPP extension commands
2 ## From http://registry.coza.net.za/doku.php?id=eppcontactextension
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::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 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 info => [ \&info, \&info_parse ],
31 update => [ \&update, undef ],
32 );
33  
34 0 return { 'contact' => \%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({ 'cozacontact' => 'http://co.za/epp/extensions/cozacontact-1-0' });
41 0 return;
42 }
43  
44 ####################################################################################################
45  
46 sub info
47 {
48 0 ▶ my ($epp,$c,$rp)=@_;
Subroutine info: not called CC=5 SCAR=34.0
Pod undocumented
49 0 my $mes=$epp->message();
50  
51 0 ▶ if (Net::DRI::Util::has_key($rp,'domain_listing') && $rp->{domain_listing})
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($rp, "domain_listing") and $rp->{"domain_listing"}) 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rp, "domain_listing") and $rp->{"domain_listing"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rp, "domain_listing") and $rp->{"domain_listing"}
Net::DRI::Util::has_key($rp, "domain_listing") $rp->{"domain_listing"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rp, "domain_listing")B= $rp->{"domain_listing"}
ABresult
0X0
100
111
52 {
53 0 my $eid=$mes->command_extension_register('cozacontact','info');
54 0 $mes->command_extension($eid,[['cozacontact:domainListing','true']]);
55 }
56  
57 0 ▶ if (Net::DRI::Util::has_key($rp,'balance') && $rp->{balance})
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($rp, "balance") and $rp->{"balance"}) 0 0 0
Condition0%0/3
Net::DRI::Util::has_key($rp, "balance") and $rp->{"balance"}
!ll&&!rl&&r
000
MC/DC0%0/2
Net::DRI::Util::has_key($rp, "balance") and $rp->{"balance"}
Net::DRI::Util::has_key($rp, "balance") $rp->{"balance"}
Truth table0%0/3
A and B
A= Net::DRI::Util::has_key($rp, "balance")B= $rp->{"balance"}
ABresult
0X0
100
111
58 {
59 0 my $eid=$mes->command_extension_register('cozacontact','info');
60 0 $mes->command_extension($eid,[['cozacontact:balance','true']]);
61 }
62 0 return;
63 }
64  
65 sub info_parse
66 {
67 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=6 SCAR=37.4
Pod undocumented
68 0 my $mes=$po->message();
69 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
70  
71 0 my $infdata=$mes->get_extension('cozacontact','infData');
72 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
73  
74 0 my %l;
75 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
76 {
77 0 my ($name,$node)=@$el;
78 0 ▶ next unless $name eq 'domain';
Branch: 1 branch
BranchTrueFalseTotal
unless $name eq "domain" 0 0 0
79 0 push @{$l{lc $node->getAttribute('level')}},$node->textContent();
80 }
81 0 $rinfo->{contact}->{$oname}->{domain_listing}=\%l;
82  
83 0 my $ns=$mes->ns('cozacontact');
84 0 my $balance=Net::DRI::Util::xml_traverse($infdata,$ns,'balance');
85 0 ▶ $rinfo->{registrar}->{$oname}->{balance}=0+$balance->textContent() if defined $balance;
Branch: 1 branch
BranchTrueFalseTotal
if defined $balance 0 0 0
86 0 return;
87 }
88  
89 sub update
90 {
91 0 ▶ my ($epp,$c,$todo)=@_;
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
92 0 my $mes=$epp->message();
93  
94 0 my $cancel=$todo->set('cancel_action');
95 0 ▶ return unless defined $cancel;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cancel 0 0 0
96  
97 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('cancel_action parameter must be PendingUpdate') unless $cancel=~m/^Pending(?:Update)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $cancel =~ /^Pending(?:Update)$/ 0 0 0
98 0 my $eid=$mes->command_extension_register('cozacontact','update',{cancelPendingAction=>$cancel});
99 0 return;
100 }
101  
102 ####################################################################################################
103 1 1;
104  
105 __END__
106  
107 =pod
108  
109 =head1 NAME
110  
111 Net::DRI::Protocol::EPP::Extensions::COZA::Contact - .CO.ZA Contact EPP Extension for Net::DRI
112  
113 =head1 DESCRIPTION
114  
115 Please see the README file for details.
116  
117 =head1 SUPPORT
118  
119 For now, support questions should be sent to:
120  
121 E<lt>netdri@dotandco.comE<gt>
122  
123 Please also see the SUPPORT file in the distribution.
124  
125 =head1 SEE ALSO
126  
127 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
128  
129 =head1 AUTHOR
130  
131 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
132  
133 =head1 COPYRIGHT
134  
135 Copyright (c) 2011,2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
136 All rights reserved.
137  
138 This program is free software; you can redistribute it and/or modify
139 it under the terms of the GNU General Public License as published by
140 the Free Software Foundation; either version 2 of the License, or
141 (at your option) any later version.
142  
143 See the LICENSE file that comes with this distribution for more details.
144  
145 =cut
146  
« DRI/Data/Contact/BR.pm ↑ Summary DRI/Protocol/EPP/Extensions/PL/Contact.pm »