line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, VeriSign EPP Premium Domain Extension |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2010,2012,2013 Patrick Mevzek . 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
|
|
|
1
|
|
941
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
21
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
494
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#################################################################################################### |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub register_commands |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return { 'domain' => { 'check' => [ \&check, \&check_parse ], |
30
|
|
|
|
|
|
|
'update' => [ \&update, undef ], |
31
|
|
|
|
|
|
|
} }; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
0
|
|
sub capabilities_add { return ('domain_update','premium_short_name',['set']); } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub setup |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
39
|
0
|
|
|
|
|
|
$po->ns({ 'premiumdomain' => [ 'http://www.verisign.com/epp/premiumdomain-1.0','premiumdomain-1.0.xsd' ] }); |
40
|
0
|
|
|
|
|
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#################################################################################################### |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub check |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
48
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $pd; |
51
|
0
|
0
|
|
|
|
|
if (Net::DRI::Util::has_key($rd,'premium_domain')) |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
|
|
|
$pd=$rd->{premium_domain}; |
54
|
|
|
|
|
|
|
} else |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
|
my $def=$epp->default_parameters(); |
57
|
0
|
0
|
|
|
|
|
if (Net::DRI::Util::has_key($def,'premium_domain')) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
$pd=$def->{premium_domain}; |
60
|
|
|
|
|
|
|
} else |
61
|
|
|
|
|
|
|
{ |
62
|
0
|
|
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Premium domain flag must be provided'); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Premium domain flag must be true/false/1/0') unless Net::DRI::Util::xml_is_boolean($pd); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('premiumdomain:check',sprintf('xmlns:premiumdomain="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('premiumdomain'))); |
68
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['premiumdomain:flag',$pd]); |
69
|
0
|
|
|
|
|
|
return; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub check_parse |
73
|
|
|
|
|
|
|
{ |
74
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
75
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
76
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $chkdata=$mes->get_extension('premiumdomain','chkData'); |
79
|
0
|
0
|
|
|
|
|
return unless defined $chkdata; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
foreach my $cd ($chkdata->getChildrenByTagNameNS($mes->ns('premiumdomain'),'cd')) |
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
|
my $domain; |
84
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($cd)) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
|
my ($n,$c)=@$el; |
87
|
0
|
0
|
|
|
|
|
if ($n eq 'name') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
|
|
|
$domain=lc($c->textContent()); |
90
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{is_premium}=Net::DRI::Util::xml_parse_boolean($c->getAttribute('premium')); |
91
|
|
|
|
|
|
|
} elsif ($n eq 'price') |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{price}={ amount => 0+$c->textContent(), unit => $c->getAttribute('unit') }; |
94
|
|
|
|
|
|
|
} elsif ($n eq 'renewalPrice') |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
|
|
|
$rinfo->{domain}->{$domain}->{renewal_price}={ amount => 0+$c->textContent(), unit => $c->getAttribute('unit') }; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
0
|
|
|
|
|
|
return; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub update |
104
|
|
|
|
|
|
|
{ |
105
|
0
|
|
|
0
|
0
|
|
my ($po,$domain,$todo)=@_; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $chg=$todo->set('premium_short_name'); |
108
|
0
|
0
|
0
|
|
|
|
return unless defined $chg && length $chg; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
111
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('premiumdomain:reassign',sprintf('xmlns:premiumdomain="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('premiumdomain'))); |
112
|
0
|
|
|
|
|
|
$mes->command_extension($eid,['premiumdomain:shortName',$chg]); |
113
|
0
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
######################################################################################################### |
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |