DRI/Protocol/EPP/Extensions/ContactVerification.pm

filter: Statementstmt 27.0% 13 / 48 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 22.3% 17 / 76 CC 11 SCAR 33.7
CC
11
Cov
21%
info_parse
56.0
check_parse
30.0
register_commands
2.0
CRAP 29.1
« DRI/Util.pm ↑ Summary DRI/Protocol/EPP/Extensions/DomainVerification.pm »
1 ## Domain Registry Interface, Contact Verification Extension Mapping for EPP
2 ##
3 ## Copyright (c) 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::ContactVerification;
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  
23 ####################################################################################################
24  
25 sub register_commands
26 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my ($class,$version)=@_;
28 0 state $rcmds = { 'contact' => { 'check' => [ undef, \&check_parse ],
29 'check_multi' => [ undef, \&check_parse ],
30 'info' => [ undef, \&info_parse ],
31 },
32 };
33 0 return $rcmds;
34 }
35  
36 sub setup
37 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my ($class,$po,$version)=@_;
39 0 state $rns = { 'vericontact' => 'urn:ietf:params:xml:ns:vericontact-1.0' };
40 0 $po->ns($rns);
41 0 return;
42 }
43  
44 0 ▶sub implements { return 'https://tools.ietf.org/html/draft-wang-eppext-contact-verification-01'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
45  
46 ####################################################################################################
47  
48 sub check_parse
49 0 ▶{
Subroutine check_parse: not called CC=5 SCAR=34.0
Pod undocumented
50 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
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('vericontact', 'chkData');
55 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
56  
57 0 my %r;
58 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
59 {
60 0 my ($name,$node)=@$el;
61 0 ▶ if ($name eq 'distinction')
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "distinction") 0 0 0
62 {
63  
64 0 $rinfo->{'contact'}->{$node->getAttribute('id')}->{restriction}->{type}=$node->getAttribute('type');
65 }
66 }
67  
68 0 return;
69 }
70  
71 sub info_parse
72 0 ▶{
Subroutine info_parse: not called CC=7 SCAR=40.3
Pod undocumented
73 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
74 0 my $mes=$po->message();
75 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
76  
77 0 my $ns=$mes->ns('vericontact');
78 0 my $data=$mes->get_extension('vericontact', 'infData');
79 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
80  
81 0 my %r;
82 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
83 {
84 0 my ($name,$node)=@$el;
85 0 ▶ if ($name eq 'status')
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq 'status') { } 0 0 0
elsif ($name eq 'history') { } 0 0 0
86 {
87 0 $r{status}=$node->textContent();
88 } elsif ($name eq 'history')
89 {
90 0 foreach my $record (Net::DRI::Util::xml_list_children($node, 'record'))
91 {
92 0 push @{$r{history}}, { date => $po->parse_iso8601(Net::DRI::Util::xml_child_content($record, $ns, 'date')),
93 op => Net::DRI::Util::xml_child_content($record, $ns, 'op'),
94 clID => Net::DRI::Util::xml_child_content($record, $ns, 'clID'),
95 };
96 }
97 }
98 }
99  
100 0 $rinfo->{$otype}->{$oname}->{restriction}=\%r;
101  
102 0 return;
103 }
104  
105 ####################################################################################################
106 1 1;
107  
108 __END__
« DRI/Util.pm ↑ Summary DRI/Protocol/EPP/Extensions/DomainVerification.pm »