File Coverage

blib/lib/SRS/EPP/Command/Delete/Contact.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1              
2              
3             package SRS::EPP::Command::Delete::Contact;
4              
5 1     1   1887 use Moose;
  0            
  0            
6             extends 'SRS::EPP::Command::Delete';
7             use MooseX::Method::Signatures;
8             use Crypt::Password;
9             use SRS::EPP::Session;
10             use XML::EPP::Contact;
11              
12             # for plugin system to connect
13             sub xmlns {
14             XML::EPP::Contact::Node::xmlns();
15             }
16              
17             method process( SRS::EPP::Session $session ) {
18             $self->session($session);
19             my $epp = $self->message;
20             my $message = $epp->message;
21              
22             my $payload = $message->argument->payload;
23             my $action_id = $message->client_id || sprintf("auto.%x",time());
24              
25             return XML::SRS::Handle::Update->new(
26             handle_id => $payload->id,
27             action_id => $action_id,
28             delete => 1,
29             );
30             }
31              
32             method notify( SRS::EPP::SRSResponse @rs ) {
33             my $message = $rs[0]->message;
34             my $response = $message->response;
35              
36             if ( ! $response ) {
37             # That means everything worked
38             return $self->make_response(code => 1000);
39             }
40              
41             if ( $response->isa("XML::SRS::Error") ) {
42             if ( $response->ErrorId() eq "HANDLE_DOES_NOT_EXIST" ) {
43             return $self->make_response(code => 2303);
44             }
45             }
46             return $self->make_response(code => 2400);
47             }
48              
49             1;