DRI/Protocol/EPP/Extensions/VeriSign/PremiumDomain.pm

filter: Statementstmt 29.0% 16 / 55 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 6 totaltotal 22.1% 21 / 95 CC 13 SCAR 34.2
CC
13
Cov
21%
check_parse
72.0
check
20.0
update
12.0
CRAP 30.6
« DRI/Protocol/EPP/Extensions/ResellerInfo.pm ↑ Summary DRI/Protocol/EPP/Extensions/NeuLevel/WhoisType.pm »
1 ## Domain Registry Interface, VeriSign EPP Premium Domain Extension
2 ##
3 ## Copyright (c) 2010,2012,2013,2016,2018-2019 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::VeriSign::PremiumDomain;
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 1 ▶use feature 'state';
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  
30 0 state $cmds = { 'domain' => { 'check' => [ \&check, \&check_parse ],
31 'update' => [ \&update, undef ],
32 } };
33 0 return $cmds;
34 }
35  
36 0 ▶sub capabilities_add { return ('domain_update','premium_short_name',['set']); }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
37  
38 sub setup
39 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my ($class,$po,$version)=@_;
41 0 state $rns = { 'premiumdomain' => 'http://www.verisign.com/epp/premiumdomain-1.0' };
42 0 $po->ns($rns);
43 0 return;
44 }
45  
46 ####################################################################################################
47  
48 sub check
49 0 ▶{
Subroutine check: not called CC=4 SCAR=30.0
Pod undocumented
50 0 my ($epp,$domain,$rd)=@_;
51  
52 0 my $pd;
53 0 ▶ if (Net::DRI::Util::has_key($rd,'premium_domain'))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($rd, 'premium_domain')) { } 0 0 0
54 {
55 0 $pd=$rd->{premium_domain};
56 } else
57 {
58 0 my $def=$epp->default_parameters();
59 0 ▶ if (Net::DRI::Util::has_key($def,'premium_domain'))
Branch: 1 branch
BranchTrueFalseTotal
if (Net::DRI::Util::has_key($def, 'premium_domain')) { } 0 0 0
60 {
61 0 $pd=$def->{premium_domain};
62 } else
63 {
64 0 Net::DRI::Exception::usererr_insufficient_parameters('Premium domain flag must be provided');
65 }
66 }
67 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Premium domain flag must be true/false/1/0') unless Net::DRI::Util::xml_is_boolean($pd);
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::xml_is_boolean($pd) 0 0 0
68  
69 0 $epp->message()->command_extension('premiumdomain', ['check', ['flag', $pd]]);
70 0 return;
71 }
72  
73 sub check_parse
74 0 ▶{
Subroutine check_parse: not called CC=8 SCAR=42.8
Pod undocumented
75 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
76 0 my $mes=$po->message();
77 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
78  
79 0 my $chkdata=$mes->get_extension('premiumdomain','chkData');
80 0 ▶ return unless defined $chkdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $chkdata 0 0 0
81  
82 0 foreach my $cd ($chkdata->getChildrenByTagNameNS($mes->ns('premiumdomain'),'cd'))
83 {
84 0 my $domain;
85 0 foreach my $el (Net::DRI::Util::xml_list_children($cd))
86 {
87 0 my ($n,$c)=@$el;
88 0 ▶ if ($n eq 'name')
Branch: 3 branches
BranchTrueFalseTotal
if ($n eq 'name') { } 0 0 0
elsif ($n eq 'price') { } 0 0 0
elsif ($n eq 'renewalPrice') { } 0 0 0
89 {
90 0 $domain=lc($c->textContent());
91 0 $rinfo->{domain}->{$domain}->{is_premium}=Net::DRI::Util::xml_parse_boolean($c->getAttribute('premium'));
92 } elsif ($n eq 'price')
93 {
94 0 $rinfo->{domain}->{$domain}->{price}={ amount => 0+$c->textContent(), unit => $c->getAttribute('unit') };
95 } elsif ($n eq 'renewalPrice')
96 {
97 0 $rinfo->{domain}->{$domain}->{renewal_price}={ amount => 0+$c->textContent(), unit => $c->getAttribute('unit') };
98 }
99 }
100 }
101 0 return;
102 }
103  
104 sub update
105 0 ▶{
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
106 0 my ($po,$domain,$todo)=@_;
107  
108 0 my $chg=$todo->set('premium_short_name');
109 0 ▶ return unless defined $chg && length $chg;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $chg and length $chg 0 0 0
Condition0%0/3
defined $chg and length $chg
!ll&&!rl&&r
000
MC/DC0%0/2
defined $chg and length $chg
defined $chg length $chg
Truth table0%0/3
A and B
A= defined $chgB= length $chg
ABresult
0X0
100
111
110  
111 0 $po->message()->command_extension('premiumdomain', ['reassign', ['premiumdomain:shortName',$chg]]);
112 0 return;
113 }
114  
115 #########################################################################################################
116 1 1;
117  
118 __END__
« DRI/Protocol/EPP/Extensions/ResellerInfo.pm ↑ Summary DRI/Protocol/EPP/Extensions/NeuLevel/WhoisType.pm »