DRI/Protocol/EPP/Extensions/IT/Notifications.pm

filter: Statementstmt 13.2% 7 / 53 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 22.2% 2 / 9 Podpod 0.0% 0 / 7 totaltotal 10.3% 9 / 87 CC 13 SCAR 26.8
CC
13
Cov
10%
parse_chgstatus
30.0
parse_dnserror
20.0
retrieve_ext
12.0
CRAP 14.6
« DRI/Protocol/AFNIC/WS/Domain.pm ↑ Summary DRI/Protocol/Whois/Domain/MOBI.pm »
1 ## Domain Registry Interface, .IT message extensions
2 ##
3 ## Copyright (C) 2009-2010,2013,2016 Tower Technologies. All rights reserved.
4 ##
5 ## This program free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License v2.
7 ##
8  
9 package Net::DRI::Protocol::EPP::Extensions::IT::Notifications;
10  
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =pod
15  
16 =head1 NAME
17  
18 Net::DRI::Protocol::EPP::Extensions::IT::Notifications - .IT EPP Notifications Parsing for Net::DRI
19  
20 =head1 SUPPORT
21  
22 For now, support questions should be sent to:
23  
24 E<lt>noc@towertech.itE<gt>
25  
26 Please also see the SUPPORT file in the distribution.
27  
28 =head1 AUTHOR
29  
30 Alessandro Zummo, E<lt>a.zummo@towertech.itE<gt>
31  
32 =head1 COPYRIGHT
33  
34 Copyright (C) 2009-2010,2013,2016 Tower Technologies.
35 All rights reserved.
36  
37 This program is free software; you can redistribute it and/or modify
38 it under the terms of the GNU General Public License v2 as published by
39 the Free Software Foundation.
40  
41 See the LICENSE file that comes with this distribution for more details.
42  
43  
44 =cut
45  
46 sub register_commands
47 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my ($class, $version) = @_;
49  
50 0 my $ops = {
51 'review_credit' => [ undef, \&parse_credit ],
52 'review_passwd' => [ undef, \&parse_reminder ],
53 'review_simple' => [ undef, \&parse_simple ],
54 'review_change' => [ undef, \&parse_chgstatus ],
55 'review_dnserror' => [ undef, \&parse_dnserror ],
56 };
57  
58 return {
59 0 'message' => $ops,
60 };
61 }
62  
63 sub retrieve_ext
64 0 ▶{
Subroutine retrieve_ext: not called CC=3 SCAR=24.8
Pod undocumented
65 0 my ($po,$ns,$node)=@_;
66 0 my $msg = $po->message;
67 0 ▶ return unless $msg->is_success;
Branch: 1 branch
BranchTrueFalseTotal
unless $msg->is_success 0 0 0
68 0 my $ext = $msg->get_extension($ns,$node);
69 0 ▶ return unless defined $ext;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext 0 0 0
70 0 my $id = $msg->msg_id;
71 0 return ($ext,$id);
72 }
73  
74 sub parse_credit
75 0 ▶{
Subroutine parse_credit: not called CC=2 SCAR=17.9
Pod undocumented
76 0 my ($po, $type, $action, $name, $rinfo) = @_;
77 0 my ($ext,$id)=retrieve_ext($po,'it_epp','creditMsgData');
78 0 ▶ return unless defined $ext;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext 0 0 0
79  
80 0 $rinfo->{'message'}->{$id}->{credit}=($ext->getElementsByTagName('extepp:credit'))[0]->textContent; ## TODO: use xml_child_content() instead
81 0 return;
82 }
83  
84 sub parse_reminder
85 0 ▶{
Subroutine parse_reminder: not called CC=2 SCAR=17.9
Pod undocumented
86 0 my ($po, $type, $action, $name, $rinfo) = @_;
87 0 my ($ext,$id)=retrieve_ext($po,'it_epp','passwdReminder');
88 0 ▶ return unless defined $ext;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext 0 0 0
89  
90 0 $rinfo->{'message'}->{$id}->{'passwd_expires_on'}= ($ext->getElementsByTagName('extepp:exDate'))[0]->textContent; ## TODO: use xml_child_content() instead + convert date to DateTime object ?
91 0 return;
92 }
93  
94 sub parse_simple
95 0 ▶{
Subroutine parse_simple: not called CC=2 SCAR=17.9
Pod undocumented
96 0 my ($po, $type, $action, $name, $rinfo) = @_;
97 0 my ($ext,$id)=retrieve_ext($po,'extdom','simpleMsgData');
98 0 ▶ return unless defined $ext;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext 0 0 0
99  
100 0 $rinfo->{'message'}->{$id}->{'domain'}=($ext->getElementsByTagName('extdom:name'))[0]->textContent; ## TODO: use xml_child_content() instead
101 0 return;
102 }
103  
104 sub parse_chgstatus
105 0 ▶{
Subroutine parse_chgstatus: not called CC=5 SCAR=34.0
Pod undocumented
106 0 my ($po, $type, $action, $name, $rinfo) = @_;
107 0 my ($ext,$id)=retrieve_ext($po,'extdom','chgStatusMsgData');
108 0 ▶ return unless defined $ext;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext 0 0 0
109  
110 0 $rinfo->{'message'}->{$id}->{'domain'}=($ext->getElementsByTagName('extdom:name'))[0]->textContent; ## TODO: use xml_child_content() instead
111  
112 0 foreach ($ext->findnodes('//extdom:targetStatus/*')) {
113  
114 0 ▶ $rinfo->{'message'}->{$id}->{'status'} = $_->getAttribute('s')
Branch: 1 branch
BranchTrueFalseTotal
if $_->nodeName eq "domain:status" 0 0 0
115 if $_->nodeName eq 'domain:status';
116  
117 0 ▶ $rinfo->{'message'}->{$id}->{'own_status'} = $_->getAttribute('s')
Branch: 1 branch
BranchTrueFalseTotal
if $_->nodeName eq "extdom:ownStatus" 0 0 0
118 if $_->nodeName eq 'extdom:ownStatus'; ## TODO : what is the difference between the two statuses ? + create a true StatusList object
119 }
120 0 return;
121 }
122  
123 sub parse_dnserror
124 0 ▶{
Subroutine parse_dnserror: not called CC=4 SCAR=30.0
Pod undocumented
125 0 my ($po, $type, $action, $name, $rinfo) = @_;
126 0 my ($ext,$id)=retrieve_ext($po,'extdom','dnsErrorMsgData');
127 0 ▶ return unless defined $ext;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ext 0 0 0
128  
129 0 $rinfo->{'message'}->{$id}->{'domain'}
130 = ($ext->getElementsByTagName('extdom:domain'))[0]
131 ->getAttribute('name'); ## TODO: use xml_child_content() instead
132  
133 0 $rinfo->{'message'}->{$id}->{'status'}
134 = ($ext->getElementsByTagName('extdom:domain'))[0]
135 ->getAttribute('status'); ## TODO: use xml_child_content() instead
136  
137 0 $rinfo->{'message'}->{$id}->{'response_id'}
138 = ($ext->getElementsByTagName('extdom:responseId'))[0]->textContent; ## TODO: use xml_child_content() instead
139  
140 0 $rinfo->{'message'}->{$id}->{'validation_date'}
141 = ($ext->getElementsByTagName('extdom:validationDate'))[0]->textContent; ## TODO: use xml_child_content() instead
142  
143 0 foreach my $test ($ext->findnodes('//extdom:test')) {
144  
145 0 my $name = $test->getAttribute('name');
146  
147 0 $rinfo->{'message'}->{$id}->{'test'}{$name}{'status'} = $test->getAttribute('status');
148  
149 0 foreach my $dns ($test->findnodes('./extdom:dns')) {
150  
151 0 $rinfo->{'message'}->{$id}->{'test'}{$name}{'dns'}{$dns->getAttribute('name')}
152 = $dns->getAttribute('status');
153 }
154 }
155 0 return;
156 }
157  
158 1 1;
« DRI/Protocol/AFNIC/WS/Domain.pm ↑ Summary DRI/Protocol/Whois/Domain/MOBI.pm »