1## Domain Registry Interface, "Verisign Naming and Directory Services" Registry Driver for .COM .NET .CC .TV .BZ .JOBS
2##
3## Copyright (c) 2005,2006,2007,2008,2009 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#
16####################################################################################################
17
18package Net::DRI::DRD::VNDS;
19
20use strict;
21use warnings;
22
23use base qw/Net::DRI::DRD/;
24
25use DateTime::Duration;
26use DateTime;
27
28our $VERSION=do { my @r=(q$Revision: 1.19 $=~/\d+/g); sprintf("%d".".%02d" x $#r, @r); };
29
30=pod
31
32=head1 NAME
33
34Net::DRI::DRD::VNDS - Verisign .COM/.NET/.CC/.TV/.BZ/.JOBS Registry driver for Net::DRI
35
36=head1 DESCRIPTION
37
38Please see the README file for details.
39
40=head1 SUPPORT
41
42For now, support questions should be sent to:
43
44E<lt>netdri@dotandco.comE<gt>
45
46Please also see the SUPPORT file in the distribution.
47
48=head1 SEE ALSO
49
50E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
51
52=head1 AUTHOR
53
54Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
55
56=head1 COPYRIGHT
57
58Copyright (c) 2005,2006,2007,2008,2009 Patrick Mevzek <netdri@dotandco.com>.
59All rights reserved.
60
61This program is free software; you can redistribute it and/or modify
62it under the terms of the GNU General Public License as published by
63the Free Software Foundation; either version 2 of the License, or
64(at your option) any later version.
65
66See the LICENSE file that comes with this distribution for more details.
67
68=cut
69
70####################################################################################################
71
72sub periods      { return map { DateTime::Duration->new(years => $_) } (1..10); }
73sub name         { return 'VNDS'; }
74sub tlds         { return ('com','net','cc','tv','bz','jobs'); } ## If this changes, VeriSign/NameStore will need to be updated also
75sub object_types { return ('domain','ns'); }
76sub profile_types { return qw/epp whois/; }
77
78sub transport_protocol_default
79{
80 my ($self,$type)=@_;
81
82 return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::VeriSign',{})                  if $type eq 'epp';
83 return ('Net::DRI::Transport::Socket',{remote_host=>'whois.verisign-grs.com'},'Net::DRI::Protocol::Whois',{}) if $type eq 'whois';
84 return;
85}
86
87####################################################################################################
88
89sub verify_name_domain
90{
91 my ($self,$ndr,$domain,$op)=@_;
92 return $self->_verify_name_rules($domain,$op,{check_name => 1,
93                                               my_tld => 1,
94                                               icann_reserved => 1,
95                                              });
96}
97
98## We can not start a transfer, if domain name has already been transfered less than 15 days ago.
99sub verify_duration_transfer
100{
101 my ($self,$ndr,$duration,$domain,$op)=@_;
102 ($duration,$domain,$op)=($ndr,$duration,$domain) unless (defined($ndr) && $ndr && (ref($ndr) eq 'Net::DRI::Registry'));
103
104 return 0 unless ($op eq 'start'); ## we are not interested by other cases, they are always OK
105 my $rc=$self->domain_info($ndr,$domain,{hosts=>'none'});
106 return 1 unless ($rc->is_success());
107 my $trdate=$ndr->get_info('trDate');
108 return 0 unless ($trdate && $trdate->isa('DateTime'));
109
110 my $now=DateTime->now(time_zone => $trdate->time_zone()->name());
111 my $cmp=DateTime->compare($now,$trdate+DateTime::Duration->new(days => 15));
112 return ($cmp == 1)? 0 : 1; ## we must have : now > transferdate + 15days
113 ## we return 0 if OK, anything else if not
114}
115
116####################################################################################################
1171;
118