| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package SRS::EPP::Command::Renew::Domain; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1926
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends 'SRS::EPP::Command::Renew'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use MooseX::Method::Signatures; |
|
9
|
|
|
|
|
|
|
use Crypt::Password; |
|
10
|
|
|
|
|
|
|
use SRS::EPP::Session; |
|
11
|
|
|
|
|
|
|
use XML::EPP::Domain; |
|
12
|
|
|
|
|
|
|
use XML::SRS::TimeStamp; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# for plugin system to connect |
|
15
|
|
|
|
|
|
|
sub xmlns { |
|
16
|
|
|
|
|
|
|
XML::EPP::Domain::Node::xmlns(); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
method duplicateRenew ( XML::SRS::TimeStamp $domainDate, Str $txnDate ) { |
|
20
|
|
|
|
|
|
|
# This is a bit mad! |
|
21
|
|
|
|
|
|
|
# The idea is that we just want to ensure that the same transaction doesn't |
|
22
|
|
|
|
|
|
|
# get repeated, and renew a domain twice. |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# We are going to be very forgiving here - if the |
|
25
|
|
|
|
|
|
|
# String provied as part of the EPP transaction is within a few days of the |
|
26
|
|
|
|
|
|
|
# billed_until date on the domain - we'll allow the renew to happen |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $domEpoch = $domainDate->epoch(); |
|
29
|
|
|
|
|
|
|
my $txnEpoch = XML::SRS::TimeStamp->new(timestamp => "$txnDate 00:00:00")->epoch(); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $diff = $domEpoch - $txnEpoch; |
|
32
|
|
|
|
|
|
|
return abs($diff) > (86400*2); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
method process( SRS::EPP::Session $session ) { |
|
36
|
|
|
|
|
|
|
$self->session($session); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $epp = $self->message; |
|
39
|
|
|
|
|
|
|
my $message = $epp->message; |
|
40
|
|
|
|
|
|
|
my $payload = $message->argument->payload; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return XML::SRS::Whois->new( |
|
43
|
|
|
|
|
|
|
domain => $payload->name(), |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has 'billed_until' => |
|
48
|
|
|
|
|
|
|
is => "rw", |
|
49
|
|
|
|
|
|
|
isa => "XML::SRS::TimeStamp", |
|
50
|
|
|
|
|
|
|
; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
method notify( SRS::EPP::SRSResponse @rs ) { |
|
53
|
|
|
|
|
|
|
my $epp = $self->message; |
|
54
|
|
|
|
|
|
|
my $eppMessage = $epp->message; |
|
55
|
|
|
|
|
|
|
my $eppPayload = $eppMessage->argument->payload; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $message = $rs[0]->message; |
|
58
|
|
|
|
|
|
|
my $response = $message->response; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
if ( ! $self->billed_until() ) { |
|
61
|
|
|
|
|
|
|
# This must be a response to our query TXN |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
if ( $response ) { |
|
64
|
|
|
|
|
|
|
if ( $response->status eq "Available" ) { |
|
65
|
|
|
|
|
|
|
return $self->make_response(code => 2303); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
if ( my $billDate = $response->billed_until() ) { |
|
68
|
|
|
|
|
|
|
if ( ! $self->duplicateRenew($billDate,$eppPayload->expiry_date) ) { |
|
69
|
|
|
|
|
|
|
$self->billed_until($response->billed_until()); |
|
70
|
|
|
|
|
|
|
return XML::SRS::Domain::Update->new( |
|
71
|
|
|
|
|
|
|
filter => [$response->name], |
|
72
|
|
|
|
|
|
|
action_id => $eppMessage->client_id || sprintf("auto.%x",time()), |
|
73
|
|
|
|
|
|
|
renew => 1, |
|
74
|
|
|
|
|
|
|
term => $eppPayload->period->value, |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
return $self->make_response(code => 2400); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# By now, we must be dealing with the response to our update TXN |
|
83
|
|
|
|
|
|
|
if ( ! $response ) { |
|
84
|
|
|
|
|
|
|
# We found the bill_date of the domain, but didn't update it |
|
85
|
|
|
|
|
|
|
# - Assume the domain isn't managed by this registrar |
|
86
|
|
|
|
|
|
|
return $self->make_response(code => 2201); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
if ( $response->can("billed_until") ) { |
|
90
|
|
|
|
|
|
|
# TODO, actual check for success? |
|
91
|
|
|
|
|
|
|
return $self->make_response(code => 1000); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
return $self->make_response(code => 2400); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |