File Coverage

blib/lib/SRS/EPP/Response/Check.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             package SRS::EPP::Response::Check;
3 1     1   1410 use Moose;
  0            
  0            
4             extends 'SRS::EPP::Response';
5             use Data::Dumper;
6              
7             has "+message" =>
8             lazy => 1,
9             default => \&make_response,
10             ;
11              
12             #subtype 'XML::EPP::CheckRS'
13             # => as 'XML::EPP::Plugin'
14             # => where { $_->root_element eq 'check' }
15             # ;
16              
17             has 'payload' =>
18             is => 'rw',
19             # isa => 'XML::EPP::CheckRS', # XML::EPP::Plugin
20             isa => 'XML::EPP::Plugin', # XML::EPP::Plugin
21             required => 1,
22             ;
23              
24             sub make_response {
25             my $self = shift;
26              
27             my $server_id = $self->server_id;
28             my $client_id = $self->client_id;
29              
30             my $tx_id;
31             if ( $server_id ) {
32             $tx_id = XML::EPP::TrID->new(
33             server_id => $server_id,
34             ($client_id ? (client_id => $client_id) : () ),
35             );
36             }
37              
38             my $msg = $self->extra;
39             my $result = XML::EPP::Result->new(
40             ($msg ? (msg => $msg) : ()),
41             # msg => '',
42             code => $self->code,
43             );
44              
45             my $xml_epp = XML::EPP->new(
46             message => XML::EPP::Response->new(
47             result => [$result],
48             response => XML::EPP::SubResponse->new(
49             payload => $self->payload,
50             ),
51             ($tx_id ? (tx_id => $tx_id) : () ),
52             ),
53             );
54             return $xml_epp;
55             }
56              
57             1;