line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, Handling of contact data for EURid |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2005-2009,2012,2013 Patrick Mevzek . All rights reserved. |
4
|
|
|
|
|
|
|
## |
5
|
|
|
|
|
|
|
## This file is part of Net::DRI |
6
|
|
|
|
|
|
|
## |
7
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
8
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
9
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
10
|
|
|
|
|
|
|
## (at your option) any later version. |
11
|
|
|
|
|
|
|
## |
12
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
13
|
|
|
|
|
|
|
######################################################################################### |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Net::DRI::Data::Contact::EURid; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
2365
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use base qw/Net::DRI::Data::Contact/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use Net::DRI::DRD::EURid; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
23
|
1
|
|
|
1
|
|
2
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
24
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
429
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__PACKAGE__->register_attributes(qw(type vat lang)); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Net::DRI::Data::Contact::EURid - Handle EURid contact data for Net::DRI |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This subclass of Net::DRI::Data::Contact adds accessors and validation for |
37
|
|
|
|
|
|
|
EURid specific data. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The following accessors/mutators can be called in chain, as they all return the object itself. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 type() |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
type of contact : billing, tech, registrant or onsite (mandatory) |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 vat() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
vat number of contact |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SUPPORT |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
For now, support questions should be sent to: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SEE ALSO |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
http://www.dotandco.com/services/software/Net-DRI/ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Patrick Mevzek, Enetdri@dotandco.comE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 COPYRIGHT |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Copyright (c) 2005-2009,2012,2013 Patrick Mevzek . |
70
|
|
|
|
|
|
|
All rights reserved. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
73
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
74
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
75
|
|
|
|
|
|
|
(at your option) any later version. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#################################################################################################### |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub validate |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
0
|
0
|
|
my ($self,$change)=@_; |
86
|
0
|
|
0
|
|
|
|
$change||=0; |
87
|
0
|
|
|
|
|
|
my @errs; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
$self->SUPER::validate($change); ## will trigger an Exception if problem |
90
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
|
if (!$change) |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: voice/type/lang mandatory') unless ($self->voice() && $self->type() && $self->lang()); |
|
|
|
0
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
## Lower limits than in EPP (other checks already done in superclass) |
97
|
0
|
0
|
0
|
|
|
|
push @errs,'name' if ($self->name() && grep { length($_) > 50 } ($self->name())); |
|
0
|
|
|
|
|
|
|
98
|
0
|
0
|
0
|
|
|
|
push @errs,'org' if ($self->org() && grep { length($_) > 100 } ($self->org())); |
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
0
|
|
|
|
push @errs,'type' if ($self->type() && $self->type()!~m/^(?:billing|tech|registrant|onsite)$/); |
102
|
0
|
0
|
0
|
|
|
|
push @errs,'vat' if ($self->vat() && !Net::DRI::Util::xml_is_token($self->vat(),1,20)); |
103
|
0
|
0
|
0
|
|
|
|
push @errs,'lang' if ($self->lang() && !exists($Net::DRI::DRD::EURid::LANGA2_EU{lc($self->lang())})); |
104
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
## if eurid:type is billing or tech, contact:org is mandatory |
108
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Org is mandatory for billing or tech contacts') if ($self->type() && $self->type()=~m/^(?:type|billing)$/ && !$self->org()); |
|
|
|
0
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Fax is mandatory for billing contacts') if (defined($self->type()) && ($self->type() eq 'billing') && !$self->fax()); |
|
|
|
0
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
## For registrants, country must be in EU |
113
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('Registrant contact must be in EU') if ($self->type() && ($self->type() eq 'registrant') && !exists($Net::DRI::DRD::EURid::CCA2_EU{uc($self->cc())})); |
|
|
|
0
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return 1; ## everything ok. |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub init |
119
|
|
|
|
|
|
|
{ |
120
|
0
|
|
|
0
|
0
|
|
my ($self,$what,$ndr)=@_; |
121
|
0
|
0
|
|
|
|
|
if ($what eq 'create') |
122
|
|
|
|
|
|
|
{ |
123
|
0
|
|
|
|
|
|
my $a=$self->auth(); |
124
|
0
|
0
|
0
|
|
|
|
$self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw})); |
|
|
|
0
|
|
|
|
|
125
|
0
|
0
|
|
|
|
|
$self->srid('ABCD') unless defined $self->srid(); ## we can not choose the ID |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
|
|
|
return; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
#################################################################################################### |
131
|
|
|
|
|
|
|
1; |