« DRI/Protocol/EPP/Extensions/ResellerObject.pm
↑ Summary
DRI/Protocol/EPP/Extensions/CAT/DefensiveRegistration.pm »
| 1 | ## Domain Registry Interface, Handling of contact data for .BE | ||||||||||||||||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2006,2008,2009,2013 Patrick Mevzek <netdri@dotandco.com>. 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::BE; | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use base qw/Net::DRI::Data::Contact/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | __PACKAGE__->register_attributes(qw(vat lang)); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | Net::DRI::Data::Contact::BE - Handle .BE contact data for Net::DRI | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | This subclass of Net::DRI::Data::Contact adds accessors and validation for | ||||||||||||||||||||||||||||||||||||||||||
| 35 | .BE specific data. | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | The following accessors/mutators can be called in chain, as they all return the object itself. | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | =head2 type() | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | type of contact : billing, tech, registrant, onsite or accmgr (mandatory) | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | registrant is called licensee by the registry : you can use both names when setting value, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | but you will get back only registrant when getting. | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =head2 vat() | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | vat number of contact | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | =head2 lang() | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | language of contact, either fr, nl or en | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | http://www.dotandco.com/services/software/Net-DRI/ | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | Copyright (c) 2006,2008,2009,2013 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 78 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||
| 79 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||||||||||||
| 80 | (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | sub validate | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my ($self,$change)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $change||=0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$change ||= 0
MC/DC0%0/1
$change ||= 0
$change
Truth table0%0/2
A
A= $change
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my @errs; | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $self->SUPER::validate($change); ## will trigger an Exception if problem | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if (!$change) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('Invalid contact information: voice/type mandatory') unless ($self->voice() && $self->type()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->voice and $self->type
MC/DC0%0/2
$self->voice and $self->type
$self->voice
$self->type
Truth table0%0/3
A and B
A= $self->voiceB= $self->type
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | ## Lower limits than in EPP (other checks already done in superclass) | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | push @errs,'name' if ($self->name() && grep { length($_) > 50 } ($self->name())); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->name and grep {length $_ > 50;} $self->name
MC/DC0%0/2
$self->name and grep {length $_ > 50;} $self->name
$self->name
grep {length $_ > 50;} $self->name
Truth table0%0/3
A and B
A= $self->nameB= grep {length $_ > 50;} $self->name
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | push @errs,'org' if ($self->org() && grep { length($_) > 100 } ($self->org())); ## docs says only that it will be truncated if more than 100 characters | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->org and grep {length $_ > 100;} $self->org
MC/DC0%0/2
$self->org and grep {length $_ > 100;} $self->org
$self->org
grep {length $_ > 100;} $self->org
Truth table0%0/3
A and B
A= $self->orgB= grep {length $_ > 100;} $self->org
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | push @errs,'type' if ($self->type() && $self->type()!~m/^(?:billing|tech|registrant|onsite|accmgr)$/); ## licensee is translated to registrant ! | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->type and not $self->type =~ /^(?:billing|tech|registrant|onsite|accmgr)$/
MC/DC0%0/2
$self->type and not $self->type =~ /^(?:billing|tech|registrant|onsite|accmgr)$/
$self->type
not $self->type =~ /^(?:billing|tech|registrant|onsite|accmgr)$/
Truth table0%0/3
A and not(B)
A= $self->typeB= not $self->type =~ /^(?:billing|tech|registrant|onsite|accmgr)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | push @errs,'vat' if ($self->vat() && !Net::DRI::Util::xml_is_token($self->vat(),1,20)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->vat and not Net::DRI::Util::xml_is_token($self->vat, 1, 20)
MC/DC0%0/2
$self->vat and not Net::DRI::Util::xml_is_token($self->vat, 1, 20)
$self->vat
not Net::DRI::Util::xml_is_token($self->vat, 1, 20)
Truth table0%0/3
A and not(B)
A= $self->vatB= not Net::DRI::Util::xml_is_token($self->vat, 1, 20)
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | push @errs,'lang' if ($self->lang() && $self->lang()!~m/^(?:fr|nl|en)$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->lang and not $self->lang =~ /^(?:fr|nl|en)$/
MC/DC0%0/2
$self->lang and not $self->lang =~ /^(?:fr|nl|en)$/
$self->lang
not $self->lang =~ /^(?:fr|nl|en)$/
Truth table0%0/3
A and not(B)
A= $self->langB= not $self->lang =~ /^(?:fr|nl|en)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | Net::DRI::Exception::usererr_insufficient_parameters('Org is mandatory for billing, tech or accmgr contacts') if ($self->type() && $self->type()=~m/^(?:type|billing|accmgr)$/ && !$self->org()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->type and $self->type =~ /^(?:type|billing|accmgr)$/ and not $self->org
$self->type and $self->type =~ /^(?:type|billing|accmgr)$/
MC/DC0%0/3
$self->type and $self->type =~ /^(?:type|billing|accmgr)$/ and not $self->org
$self->type
$self->type =~ /^(?:type|billing|accmgr)$/
not $self->org
Truth table0%0/4
A and B and not(C)
A= $self->typeB= $self->type =~ /^(?:type|billing|accmgr)$/C= not $self->org
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | return 1; ## everything ok. | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my ($self,$what,$ndr)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if ($what eq 'create') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $a=$self->auth(); | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$a and ref $a eq "HASH" and exists $a->{"pw"}
$a and ref $a eq "HASH"
MC/DC0%0/3
$a and ref $a eq "HASH" and exists $a->{"pw"}
$a
ref $a eq "HASH"
exists $a->{"pw"}
Truth table0%0/4
A and B and C
A= $aB= ref $a eq "HASH"C= exists $a->{"pw"}
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | $self->srid('ABCD') unless defined $self->srid(); ## we can not choose the ID | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | sub type | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my ($self,$what)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if (defined $what && $what) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $what and $what
MC/DC0%0/2
defined $what and $what
defined $what
$what
Truth table0%0/3
A and B
A= defined $whatB= $what
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | $what='registrant' if $what eq 'licensee'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->{type}=$what; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return $self->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||