| 1 | package SRS::EPP::Command::Info::Contact; | ||
| 2 | |||
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | extends 'SRS::EPP::Command::Info'; | ||
| 5 | 1 | ▶ | use MooseX::Method::Signatures; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Crypt::Password; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use SRS::EPP::Session; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 8 | use XML::EPP::Contact; | ||
| 9 | use Data::Dumper; | ||
| 10 | |||
| 11 | use XML::EPP::Contact::Info::Response; | ||
| 12 | use XML::EPP::Contact::PostalInfo; | ||
| 13 | use XML::EPP::Contact::Addr; | ||
| 14 | |||
| 15 | # for plugin system to connect | ||
| 16 | sub xmlns { | ||
| 17 | XML::EPP::Contact::Node::xmlns(); | ||
| 18 | } | ||
| 19 | |||
| 20 | method process( SRS::EPP::Session $session ) { | ||
| 21 | $self->session($session); | ||
| 22 | my $epp = $self->message; | ||
| 23 | my $payload = $epp->message->argument->payload; | ||
| 24 | |||
| 25 | # we're not supporting authInfo, so get out of here with an EPP response | ||
| 26 | if ( $payload->has_auth_info ) { | ||
| 27 | return $self->make_response(code => 2307); | ||
| 28 | } | ||
| 29 | |||
| 30 | return XML::SRS::Handle::Query->new( handle_id_filter => $payload->id ); | ||
| 31 | } | ||
| 32 | |||
| 33 | has 'code' => ( | ||
| 34 | is => "rw", | ||
| 35 | isa => "Int", | ||
| 36 | ); | ||
| 37 | |||
| 38 | method notify( SRS::EPP::SRSResponse @rs ) { | ||
| 39 | my $message = $rs[0]->message; | ||
| 40 | my $response = $message->response; | ||
| 41 | |||
| 42 | if ( $self->code ) { | ||
| 43 | return $self->make_response(code => $self->code); | ||
| 44 | } | ||
| 45 | |||
| 46 | unless ( $response ) { | ||
| 47 | # assume the contact doesn't exist | ||
| 48 | return $self->make_response(code => 2303); | ||
| 49 | } | ||
| 50 | |||
| 51 | # make the Info::Response object | ||
| 52 | my $r = XML::EPP::Contact::Info::Response->new( | ||
| 53 | id => $response->handle_id, | ||
| 54 | # roid => ?, | ||
| 55 | # status => [ $self->message->status ], | ||
| 56 | postal_info => [ XML::EPP::Contact::PostalInfo->new( | ||
| 57 | name => $response->name, | ||
| 58 | # org => , | ||
| 59 | addr => XML::EPP::Contact::Addr->new( | ||
| 60 | street => [ $response->address->address1, $response->address->address2], | ||
| 61 | city => $response->address->city, | ||
| 62 | sp => $response->address->region, # state or province | ||
| 63 | pc => $response->address->postcode, | ||
| 64 | cc => $response->address->cc, | ||
| 65 | ), | ||
| 66 | ) ], | ||
| 67 | voice => XML::EPP::Contact::E164->new( | ||
| 68 | content => "+" . $response->phone->cc . "." . $response->phone->ndc . $response->phone->subscriber, | ||
| 69 | ), | ||
| 70 | #fax => XML::EPP::Contact::E164->new( | ||
| 71 | # content => $response->phone->cc . $response->phone->ndc . $response->phone->subscriber, | ||
| 72 | #), | ||
| 73 | # fax => , | ||
| 74 | email => $response->email, | ||
| 75 | ); | ||
| 76 | |||
| 77 | return $self->make_response( | ||
| 78 | 'Info', | ||
| 79 | code => 1000, | ||
| 80 | payload => $r, | ||
| 81 | ); | ||
| 82 | } | ||
| 83 | |||
| 84 | 1; | ||