| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package SRS::EPP::Command::Transfer::Domain; |
|
3
|
|
|
|
|
|
|
{ |
|
4
|
|
|
|
|
|
|
$SRS::EPP::Command::Transfer::Domain::VERSION = '0.22'; |
|
5
|
|
|
|
|
|
|
} |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
3289
|
use Moose; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
|
|
extends 'SRS::EPP::Command::Transfer'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
13651
|
use MooseX::Params::Validate; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
37
|
|
|
11
|
1
|
|
|
1
|
|
438
|
use Moose::Util::TypeConstraints(); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
22
|
|
|
12
|
1
|
|
|
1
|
|
97
|
use SRS::EPP::Session; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use XML::EPP::Domain; |
|
14
|
|
|
|
|
|
|
use XML::SRS::TimeStamp; |
|
15
|
|
|
|
|
|
|
use XML::SRS::Types; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# for plugin system to connect |
|
18
|
|
|
|
|
|
|
sub xmlns { |
|
19
|
|
|
|
|
|
|
XML::EPP::Domain::Node::xmlns(); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub process { |
|
23
|
|
|
|
|
|
|
my $self = shift; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my ( $session ) = pos_validated_list( |
|
26
|
|
|
|
|
|
|
\@_, |
|
27
|
|
|
|
|
|
|
{ isa => 'SRS::EPP::Session' }, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$self->session($session); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $epp = $self->message; |
|
33
|
|
|
|
|
|
|
my $message = $epp->message; |
|
34
|
|
|
|
|
|
|
my $payload = $message->argument->payload; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $op = $message->argument->op; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
if ($op eq 'request') { |
|
39
|
|
|
|
|
|
|
# Get the auth info (could do some more validation here...) |
|
40
|
|
|
|
|
|
|
my $auth = $payload->auth_info(); |
|
41
|
|
|
|
|
|
|
my $pass = $auth->pw(); |
|
42
|
|
|
|
|
|
|
my $udaiType = Moose::Util::TypeConstraints::find_type_constraint("XML::SRS::UDAI"); |
|
43
|
|
|
|
|
|
|
if ( !$udaiType->check($pass->content()) ) { |
|
44
|
|
|
|
|
|
|
return $self->make_response(code => 2202); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my %renew_params; |
|
48
|
|
|
|
|
|
|
if ($payload->period) { |
|
49
|
|
|
|
|
|
|
# If they've provided a period, we need to set the term to the one provided, |
|
50
|
|
|
|
|
|
|
# and renew the domain |
|
51
|
|
|
|
|
|
|
$renew_params{term} = $payload->period->months; |
|
52
|
|
|
|
|
|
|
$renew_params{renew} = 1; |
|
53
|
|
|
|
|
|
|
$renew_params{cancel} = 0; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return ( |
|
57
|
|
|
|
|
|
|
XML::SRS::Whois->new( |
|
58
|
|
|
|
|
|
|
domain => $payload->name, |
|
59
|
|
|
|
|
|
|
full => 0, |
|
60
|
|
|
|
|
|
|
), |
|
61
|
|
|
|
|
|
|
XML::SRS::Domain::Update->new( |
|
62
|
|
|
|
|
|
|
filter => [$payload->name], |
|
63
|
|
|
|
|
|
|
action_id => $self->client_id || $self->server_id, |
|
64
|
|
|
|
|
|
|
udai => $pass->content(), |
|
65
|
|
|
|
|
|
|
convert_contacts_to_handles => 1, |
|
66
|
|
|
|
|
|
|
%renew_params, |
|
67
|
|
|
|
|
|
|
), |
|
68
|
|
|
|
|
|
|
); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
else { |
|
71
|
|
|
|
|
|
|
my $msg = "This server does not support pending transfers"; |
|
72
|
|
|
|
|
|
|
return $self->make_response(code => 2102, extra => $msg); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub notify { |
|
77
|
|
|
|
|
|
|
my $self = shift; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my ( $rs ) = pos_validated_list( |
|
80
|
|
|
|
|
|
|
\@_, |
|
81
|
|
|
|
|
|
|
{ isa => 'ArrayRef[SRS::EPP::SRSResponse]' }, |
|
82
|
|
|
|
|
|
|
); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $epp = $self->message; |
|
85
|
|
|
|
|
|
|
my $payload = $epp->message->argument->payload; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
for (@$rs) { |
|
88
|
|
|
|
|
|
|
my $message = $_->message; |
|
89
|
|
|
|
|
|
|
my $response = $message->response; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
if ($response) { |
|
92
|
|
|
|
|
|
|
if ( $message->action() eq "Whois" ) { |
|
93
|
|
|
|
|
|
|
if ( $response->status eq "Available" ) { |
|
94
|
|
|
|
|
|
|
return $self->make_response(code => 2303); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
if ( $message->action() eq "DomainUpdate" ) { |
|
98
|
|
|
|
|
|
|
if ( $response->isa("XML::SRS::Domain") ) { |
|
99
|
|
|
|
|
|
|
my $exDate; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# If the domain is PendingRelease, we return the cancelled date as the exDate |
|
102
|
|
|
|
|
|
|
$exDate = $response->cancelled_date if $response->status eq 'PendingRelease'; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# If the request updated the period, we return the billed until as the exDate |
|
105
|
|
|
|
|
|
|
$exDate = $response->billed_until if $payload->period; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my $epp_resp = XML::EPP::Domain::Transfer::Response->new( |
|
108
|
|
|
|
|
|
|
name => $response->name, |
|
109
|
|
|
|
|
|
|
trStatus => 'serverApproved', |
|
110
|
|
|
|
|
|
|
requester => $response->registrar_id, |
|
111
|
|
|
|
|
|
|
requested => |
|
112
|
|
|
|
|
|
|
$response->audit->when->begin->timestamptz, |
|
113
|
|
|
|
|
|
|
action_id => $response->registrar_id, |
|
114
|
|
|
|
|
|
|
action_date => |
|
115
|
|
|
|
|
|
|
$response->audit->when->begin->timestamptz, |
|
116
|
|
|
|
|
|
|
($exDate ? (expiry_date => $exDate->timestamptz) : ()), |
|
117
|
|
|
|
|
|
|
); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
return $self->make_response( |
|
120
|
|
|
|
|
|
|
code => 1000, |
|
121
|
|
|
|
|
|
|
payload => $epp_resp, |
|
122
|
|
|
|
|
|
|
); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
return $self->make_response(code => 2400); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub make_error_response { |
|
132
|
|
|
|
|
|
|
my $self = shift; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
my ( $srs_errors ) = pos_validated_list( |
|
135
|
|
|
|
|
|
|
\@_, |
|
136
|
|
|
|
|
|
|
{ isa => 'ArrayRef[XML::SRS::Error]' }, |
|
137
|
|
|
|
|
|
|
); |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# If we get the below error, it's because we've tried to transfer a domain |
|
140
|
|
|
|
|
|
|
# the registrar already owns. We don't want to return this to the client. |
|
141
|
|
|
|
|
|
|
foreach my $srs_error (@$srs_errors) { |
|
142
|
|
|
|
|
|
|
if ($srs_error->error_id eq 'CONVERT_TO_HANDLES_ONLY_FOR_TRANSFER') { |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
my $epp = $self->message; |
|
145
|
|
|
|
|
|
|
my $message = $epp->message; |
|
146
|
|
|
|
|
|
|
my $payload = $message->argument->payload; |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
return $self->make_response( |
|
149
|
|
|
|
|
|
|
Error => ( |
|
150
|
|
|
|
|
|
|
code => 2002, |
|
151
|
|
|
|
|
|
|
exception => XML::EPP::Error->new( |
|
152
|
|
|
|
|
|
|
value => $payload->name, |
|
153
|
|
|
|
|
|
|
reason => |
|
154
|
|
|
|
|
|
|
'Cannot transfer a domain you already own', |
|
155
|
|
|
|
|
|
|
), |
|
156
|
|
|
|
|
|
|
) |
|
157
|
|
|
|
|
|
|
); |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
return $self->SUPER::make_error_response($srs_errors); |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; |