line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Registrar Registration Expiration Date for EPP |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2016 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::ICANN::RegistrarExpirationDate; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
928
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
18
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
19
|
1
|
|
|
1
|
|
4
|
use feature 'state'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
2
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
22
|
1
|
|
|
1
|
|
2
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
411
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#################################################################################################### |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub register_commands |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
29
|
0
|
|
|
|
|
|
state $rmcds = { 'domain' => { 'info' => [ undef, \&parse ], |
30
|
|
|
|
|
|
|
'transfer_query' => [ undef, \&parse ], |
31
|
|
|
|
|
|
|
'create' => [ \&build, undef ], |
32
|
|
|
|
|
|
|
'renew' => [ \&build, undef ], |
33
|
|
|
|
|
|
|
'transfer_request' => [ \&build, undef ], |
34
|
|
|
|
|
|
|
'update' => [ \&build_update, undef ], |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
}; |
37
|
0
|
|
|
|
|
|
return $rmcds; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub setup |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
44
|
0
|
|
|
|
|
|
state $rns = { 'rrExDate' => [ 'urn:ietf:params:xml:ns:rrExDate-1.0', 'rrExDate-1.0.xsd' ]}; |
45
|
0
|
|
|
|
|
|
$po->ns($rns); |
46
|
0
|
|
|
|
|
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
0
|
|
sub capabilities_add { state $rcaps = ['domain_update','registrar_expiration_date',['set']]; return $rcaps; } |
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
0
|
|
sub implements { return 'https://tools.ietf.org/html/draft-lozano-ietf-eppext-registrar-expiration-date-00'; } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#################################################################################################### |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub parse |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
58
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
59
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $ns = $mes->ns('rrExDate'); |
62
|
0
|
|
|
|
|
|
my $data = $mes->get_extension($ns, 'rrExDateData'); |
63
|
0
|
0
|
|
|
|
|
return unless defined $data; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$rinfo->{$otype}->{$oname}->{registrar_expiration_date} = $po->parse_iso8601(Net::DRI::Util::xml_child_content($data, $ns, 'exDate')); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub build |
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$rd)=@_; |
73
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
return unless Net::DRI::Util::has_key($rd,'registrar_expiration_date'); |
76
|
0
|
|
|
|
|
|
my $date = $rd->{'registrar_expiration_date'}; |
77
|
0
|
0
|
0
|
|
|
|
$date = $date->clone()->set_time_zone('UTC')->strftime('%FT%T.%1NZ') if (ref $date && Net::DRI::Util::check_isa($date,'DateTime')); |
78
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid date specification for "registrar_expiration_date": '.$date) unless $date=~m/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('rrExDate', 'rrExDateData'); |
81
|
0
|
|
|
|
|
|
$mes->command_extension($eid, [ 'rrExDate:exDate', $date ]); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub build_update |
87
|
|
|
|
|
|
|
{ |
88
|
0
|
|
|
0
|
0
|
|
my ($epp,$domain,$todo)=@_; |
89
|
0
|
|
|
|
|
|
my $toset=$todo->set('registrar_expiration_date'); |
90
|
0
|
0
|
|
|
|
|
return unless defined $toset; |
91
|
0
|
|
|
|
|
|
return build($epp,$domain,{registrar_expiration_date => $toset}); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#################################################################################################### |
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |