| 1 | |||
| 2 | |||
| 3 | package SRS::EPP::Command::Transfer::Domain; | ||
| 4 | |||
| 5 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | extends 'SRS::EPP::Command::Transfer'; | ||
| 7 | |||
| 8 | 1 | ▶ | use MooseX::Method::Signatures; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Crypt::Password; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use SRS::EPP::Session; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 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 process( SRS::EPP::Session $session ) { | ||
| 20 | $self->session($session); | ||
| 21 | |||
| 22 | my $epp = $self->message; | ||
| 23 | my $message = $epp->message; | ||
| 24 | my $payload = $message->argument->payload; | ||
| 25 | |||
| 26 | my $op = $message->argument->op; | ||
| 27 | |||
| 28 | if ( $op eq "request" ) { | ||
| 29 | # Get the auth info (could do some more validation here...) | ||
| 30 | my $auth = $payload->auth_info(); | ||
| 31 | my $pass = $auth->pw(); | ||
| 32 | return ( | ||
| 33 | XML::SRS::Whois->new( | ||
| 34 | domain => $payload->name, | ||
| 35 | full => 0, | ||
| 36 | ), | ||
| 37 | XML::SRS::Domain::Update->new( | ||
| 38 | filter => [$payload->name], | ||
| 39 | action_id => $message->client_id || sprintf("auto.%x",time()), | ||
| 40 | udai => $pass->content(), | ||
| 41 | ), | ||
| 42 | ); | ||
| 43 | } | ||
| 44 | |||
| 45 | if ( $op eq "query" ) { | ||
| 46 | my $msg = "This server does support pending transfers"; | ||
| 47 | return $self->make_response(code => 2306, extra => $msg); | ||
| 48 | } | ||
| 49 | |||
| 50 | return $self->make_response(code => 2400); | ||
| 51 | } | ||
| 52 | |||
| 53 | method notify( SRS::EPP::SRSResponse @rs ) { | ||
| 54 | my $epp = $self->message; | ||
| 55 | |||
| 56 | for ( @rs ) { | ||
| 57 | my $message = $_->message; | ||
| 58 | my $response = $message->response; | ||
| 59 | |||
| 60 | if ( $response ) { | ||
| 61 | if ( $message->action() eq "Whois" ) { | ||
| 62 | if ( $response->status eq "Available" ) { | ||
| 63 | return $self->make_response(code => 2303); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | if ( $message->action() eq "DomainUpdate" ) { | ||
| 67 | if ( $response->isa("XML::SRS::Domain") ) { | ||
| 68 | return $self->make_response(code => 1000); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | return $self->make_response(code => 2400); | ||
| 75 | } | ||
| 76 | |||
| 77 | |||
| 78 | 1; | ||