line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SRS::EPP::Command::Create::Contact; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$SRS::EPP::Command::Create::Contact::VERSION = '0.22'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3077
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'SRS::EPP::Command::Create'; |
9
|
|
|
|
|
|
|
with 'SRS::EPP::Common::Contact'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6816
|
use SRS::EPP::Session; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use XML::EPP::Contact; |
13
|
|
|
|
|
|
|
use XML::SRS::TimeStamp; |
14
|
|
|
|
|
|
|
use MooseX::Params::Validate; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# for plugin system to connect |
17
|
|
|
|
|
|
|
sub xmlns { |
18
|
|
|
|
|
|
|
return XML::EPP::Contact::Node::xmlns(); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub process { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my ( $session ) = pos_validated_list( |
25
|
|
|
|
|
|
|
\@_, |
26
|
|
|
|
|
|
|
{ isa => 'SRS::EPP::Session' }, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$self->session($session); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $epp = $self->message; |
32
|
|
|
|
|
|
|
my $message = $epp->message; |
33
|
|
|
|
|
|
|
my $payload = $message->argument->payload; |
34
|
|
|
|
|
|
|
my $error; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $epp_postal_info = $payload->postal_info() |
37
|
|
|
|
|
|
|
or return $self->make_error( |
38
|
|
|
|
|
|
|
code => 2306, |
39
|
|
|
|
|
|
|
message => "Postal information must be provided", |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
if ($error = $self->validate_contact_postal($epp_postal_info)) { |
43
|
|
|
|
|
|
|
return $error; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $postal_info = $epp_postal_info->[0]; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $address = $self->translate_address($postal_info->addr) |
49
|
|
|
|
|
|
|
or goto error_out; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $voice = $payload->voice |
52
|
|
|
|
|
|
|
or return $self->make_error( |
53
|
|
|
|
|
|
|
code => 2306, |
54
|
|
|
|
|
|
|
message => "Voice phone number must be provided", |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
if ($error = $self->validate_contact_voice($voice)) { |
58
|
|
|
|
|
|
|
return $error; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $txn = { |
62
|
|
|
|
|
|
|
handle_id => $payload->id(), |
63
|
|
|
|
|
|
|
name => $postal_info->name(), |
64
|
|
|
|
|
|
|
phone => $payload->voice()->content(), |
65
|
|
|
|
|
|
|
address => $address, |
66
|
|
|
|
|
|
|
email => $payload->email(), |
67
|
|
|
|
|
|
|
action_id => $self->client_id || $self->server_id, |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
if ( $payload->fax() && $payload->fax()->content() ) { |
71
|
|
|
|
|
|
|
$txn->{fax} = $payload->fax()->content(); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $srsTxn = XML::SRS::Handle::Create->new(%$txn) |
75
|
|
|
|
|
|
|
or goto error_out; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
$self->log_info( "$self: prepared HandleCreate, ActionId = " .$txn->{action_id} ); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return $srsTxn; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
error_out: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Catch all (possibly not necessary) |
84
|
|
|
|
|
|
|
return $self->make_response(code => 2400); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub notify { |
88
|
|
|
|
|
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my ( $rs ) = pos_validated_list( |
91
|
|
|
|
|
|
|
\@_, |
92
|
|
|
|
|
|
|
{ isa => 'ArrayRef[SRS::EPP::SRSResponse]' }, |
93
|
|
|
|
|
|
|
); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my $message = $rs->[0]->message; |
96
|
|
|
|
|
|
|
my $response = $message->response; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$self->log_info( |
99
|
|
|
|
|
|
|
"$self: Handle ".$response->handle_id |
100
|
|
|
|
|
|
|
." created OK" |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $r = XML::EPP::Contact::Create::Response->new( |
104
|
|
|
|
|
|
|
id => $response->handle_id, |
105
|
|
|
|
|
|
|
created => $message->server_time->timestamptz, |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
return $self->make_response( |
109
|
|
|
|
|
|
|
code => 1000, |
110
|
|
|
|
|
|
|
payload => $r, |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |