view release on metacpan or search on metacpan
lib/Net/DRI/Protocol/EPP/Core/Contact.pm view on Meta::CPAN
push @d,['contact:org',{type=>'int'}],['contact:org',{type=>'loc'}] if exists($d->{org});
push @d,['contact:addr',{type=>'int'}] if (exists($d->{addr_int}) && !exists($d->{addr}));
push @d,['contact:addr',{type=>'loc'}] if (exists($d->{addr_loc}) && !exists($d->{addr}));
push @d,['contact:addr',{type=>'int'}],['contact:addr',{type=>'loc'}] if exists($d->{addr});
push @d,['contact:voice'] if exists($d->{voice});
push @d,['contact:fax'] if exists($d->{fax});
push @d,['contact:email'] if exists($d->{email});
return ['contact:disclose',@d,{flag=>(keys(%v))[0]}];
}
sub build_cdata
{
my ($contact,$v)=@_;
my $hasloc=$contact->has_loc();
my $hasint=$contact->has_int();
if ($hasint && !$hasloc && (($v & 5) == $v))
{
$contact->int2loc();
$hasloc=1;
} elsif ($hasloc && !$hasint && (($v & 6) == $v))
{
lib/Net/DRI/Protocol/EPP/Core/Contact.pm view on Meta::CPAN
}
sub create
{
my ($epp,$contact)=@_;
my $mes=$epp->message();
my @d=build_command($mes,'create',$contact);
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$contact) unless Net::DRI::Util::isa_contact($contact);
$contact->validate(); ## will trigger an Exception if needed
push @d,build_cdata($contact,$epp->{contacti18n});
$mes->command_body(\@d);
}
sub create_parse
{
my ($po,$otype,$oaction,$oname,$rinfo)=@_;
my $mes=$po->message();
return unless $mes->is_success();
my $credata=$mes->get_response('contact','creData');
lib/Net/DRI/Protocol/EPP/Core/Contact.pm view on Meta::CPAN
my @d=build_command($mes,'update',$contact);
push @d,['contact:add',$sadd->build_xml('contact:status')] if Net::DRI::Util::isa_statuslist($sadd);
push @d,['contact:rem',$sdel->build_xml('contact:status')] if Net::DRI::Util::isa_statuslist($sdel);
my $newc=$todo->set('info');
if (defined $newc)
{
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc);
$newc->validate(1); ## will trigger an Exception if needed
my @c=build_cdata($newc,$epp->{contacti18n});
push @d,['contact:chg',@c] if @c;
}
$mes->command_body(\@d);
}
####################################################################################################
## RFC4933 §3.3 Offline Review of Requested Actions
sub pandata_parse
{
lib/Net/DRI/Protocol/EPP/Extensions/CZ/Contact.pm view on Meta::CPAN
push(@d, ['contact:name']) if (exists($d->{name}));
push(@d, ['contact:org']) if (exists($d->{org}));
push(@d, ['contact:addr']) if (exists($d->{addr}));
push(@d, ['contact:voice']) if (exists($d->{voice}));
push(@d, ['contact:fax']) if (exists($d->{fax}));
push(@d, ['contact:email']) if (exists($d->{email}));
return ['contact:disclose',@d,{flag=>(keys(%v))[0]}];
}
sub build_cdata
{
my ($contact, $v) = @_;
my (@post, @addr);
my @tmp;
my @d;
@tmp = $contact->name();
if (defined($tmp[0])) { push(@post, ['contact:name', $tmp[0]]); }
@tmp = $contact->org();
lib/Net/DRI/Protocol/EPP/Extensions/CZ/Contact.pm view on Meta::CPAN
sub create
{
my ($epp, $contact) = @_;
my $mes = $epp->message();
my @d = build_command($mes, 'create', $contact);
Net::DRI::Exception->die(1, 'protocol/EPP', 10, 'Invalid contact ' .
$contact) unless Net::DRI::Util::isa_contact($contact);
$contact->validate(); ## will trigger an Exception if needed
push(@d, build_cdata($contact, $epp->{contacti18n}));
$mes->command_body(\@d);
}
sub update
{
my ($epp, $contact, $todo) = @_;
my $mes = $epp->message();
Net::DRI::Exception::usererr_invalid_parameters($todo .
' must be a Net::DRI::Data::Changes object')
lib/Net/DRI/Protocol/EPP/Extensions/CZ/Contact.pm view on Meta::CPAN
push(@d, ['contact:rem', $sdel->build_xml('contact:status')])
if ($sdel);
my $newc = $todo->set('info');
if ($newc)
{
Net::DRI::Exception->die(1, 'protocol/EPP', 10,
'Invalid contact ' . $newc)
unless Net::DRI::Util::isa_contact($newc);
$newc->validate(1); ## will trigger an Exception if needed
my @c = build_cdata($newc, $epp->{contacti18n});
push(@d, ['contact:chg', @c]) if (@c);
}
$mes->command_body(\@d);
}
####################################################################################################
1;
lib/Net/DRI/Protocol/EPP/Extensions/Nominet/Account.pm view on Meta::CPAN
$o[1]->validate() unless $ischange;
my @t=build_addr($o[1],'billing');
push @a,($ischange && !@t)? ['account:addr',{type=>'billing'}] : @t;
}
@o=$cs->get('admin');
Net::DRI::Exception::usererr_insufficient_parameters('admin data is mandatory') unless ($ischange || Net::DRI::Util::isa_contact($o[0],'Net::DRI::Data::Contact::Nominet'));
foreach my $o (0..2)
{
last unless defined($o[$o]);
my @t=Net::DRI::Protocol::EPP::Extensions::Nominet::Contact::build_cdata($o[$o]);
my $contype=$ischange? (($o[$o]->srid())? 'update' : 'create') : $modtype;
push @a,['account:contact',{type=>'admin',order=>$o+1},($ischange && !@t)? () : ['contact:'.$contype,@t]];
}
@o=$cs->get('billing');
foreach my $o (0..2)
{
last unless defined($o[$o]);
my @t=Net::DRI::Protocol::EPP::Extensions::Nominet::Contact::build_cdata($o[$o]);
my $contype=$ischange? (($o[$o]->srid())? 'update' : 'create') : $modtype;
push @a,['account:contact',{type=>'billing',order=>$o+1},($ischange && !@t)? () : ['contact:'.$contype,@t]];
}
return @a;
}
sub update
{
my ($epp,$c,$todo)=@_;
my $mes=$epp->message();
lib/Net/DRI/Protocol/EPP/Extensions/Nominet/Contact.pm view on Meta::CPAN
{
$contact->mobile(Net::DRI::Protocol::EPP::Util::parse_tel($c));
}
}
$rinfo->{contact}->{$oname}->{self}=$contact;
}
# ############ Transform commands
sub build_cdata
{
my ($contact)=@_;
my @d;
push @d,['contact:name',$contact->name()] if (defined($contact->name()));
push @d,Net::DRI::Protocol::EPP::Util::build_tel('contact:phone',$contact->voice()) if defined $contact->voice();
push @d,Net::DRI::Protocol::EPP::Util::build_tel('contact:fax',$contact->fax()) if defined $contact->fax();
push @d,Net::DRI::Protocol::EPP::Util::build_tel('contact:mobile',$contact->mobile()) if defined $contact->mobile();
push @d,['contact:email',$contact->email()] if defined($contact->email());
return @d;
}
lib/Net/DRI/Protocol/EPP/Extensions/Nominet/Contact.pm view on Meta::CPAN
{
Net::DRI::Exception->die(0,'protocol/EPP',11,'Only info set available for contact in .UK');
}
my @d=build_command($mes,'update',$contact);
my $newc=$todo->set('info');
if ($newc)
{
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless (Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::Nominet'));
$newc->validate(1); ## will trigger an Exception if needed
my @c=build_cdata($newc);
if (@c)
{
push @d,@c;
} else
{
Net::DRI::Exception->die(0,'protocol/EPP',11,'Nothing to update !');
}
} else
{
Net::DRI::Exception->die(0,'protocol/EPP',11,'Nothing to update !');
lib/Net/DRI/Protocol/EPP/Extensions/Nominet/Notifications.pm view on Meta::CPAN
####################################################################################################
## http://www.nominet.org.uk/registrars/systems/epp/registrarchange/
## http://www.nominet.org.uk/registrars/systems/epp/handshakerequest/
sub registrar_change
{
my ($po,$otype,$oaction,$oname,$rinfo)=@_;
my $mes=$po->message();
return unless $mes->is_success();
my $rcdata=$mes->get_response('notifications','rcData');
return unless defined $rcdata;
my $msgid=$mes->msg_id();
my $ns=$mes->ns('notifications');
$rinfo->{message}->{$msgid}->{action}='registrar_change';
$rinfo->{message}->{$msgid}->{orig}=Net::DRI::Util::xml_child_content($rcdata,$ns,'orig');
$rinfo->{message}->{$msgid}->{registrar_to}=Net::DRI::Util::xml_child_content($rcdata,$ns,'registrar-tag');
if ($rcdata->getChildrenByTagNameNS($ns,'case-id')->size())
{
$rinfo->{message}->{$msgid}->{action}='handshake_request';
$rinfo->{message}->{$msgid}->{case_id}=Net::DRI::Util::xml_child_content($rcdata,$ns,'case-id');
}
my $list=$mes->get_response('domain','listData'); ## attribute no-domains is not used, as there should be as many simpleInfData as domain names
my @d=parse_listdata($mes,$list,$rinfo);
$rinfo->{message}->{$msgid}->{domains}=\@d;
my $ainfo=$mes->get_response('account','infData');
## TODO : parse account info, see Account::parse_infdata
}
lib/Net/DRI/Protocol/EPP/Extensions/Nominet/Notifications.pm view on Meta::CPAN
}
return @d;
}
## http://www.nominet.org.uk/registrars/systems/epp/registrantchange/
sub registrant_change
{
my ($po,$otype,$oaction,$oname,$rinfo)=@_;
my $mes=$po->message();
return unless $mes->is_success();
my $rcdata=$mes->get_response('notifications','trnData');
return unless defined $rcdata;
my $msgid=$mes->msg_id();
my $ns=$mes->ns('notifications');
$rinfo->{message}->{$msgid}->{action}='registrant_change';
$rinfo->{message}->{$msgid}->{account_from}=Net::DRI::Util::xml_child_content($rcdata,$ns,'old-account-id');
$rinfo->{message}->{$msgid}->{account_to}=Net::DRI::Util::xml_child_content($rcdata,$ns,'account-id');
## domainList or listData ??? The documentation is very unclear on details like that !
my $list=$mes->get_response('domain','domainList'); ## attribute no-domains is not used, as there should be as many simpleInfData as domain names
my @d=parse_listdata($mes,$list,$rinfo);
$rinfo->{message}->{$msgid}->{domains}=\@d;
my $ainfo=$mes->get_response('account','infData');
## TODO : parse account info, see Account::parse_infdata
}
## http://www.nominet.org.uk/registrars/systems/epp/accountdetails/
## TODO : we do not parse the changed="Y" attribute
## http://www.nominet.org.uk/registrars/systems/epp/domaincancelled/
sub domain_cancelled
{
my ($po,$otype,$oaction,$oname,$rinfo)=@_;
my $mes=$po->message();
return unless $mes->is_success();
my $cancdata=$mes->get_response('notifications','cancData');
return unless defined $cancdata;
my $ns=$mes->ns('notifications');
my $name=Net::DRI::Util::xml_child_content($cancdata,$ns,'domain-name');
$rinfo->{domain}->{$name}->{exist}=0;
$rinfo->{domain}->{$name}->{action}='cancelled';
$rinfo->{domain}->{$name}->{cancelled_orig}=Net::DRI::Util::xml_child_content($cancdata,$ns,'orig');
}
## http://www.nominet.org.uk/registrars/systems/epp/handshakerejected/
## seem totally bogus and conflicts with http://www.nominet.org.uk/registrars/systems/epp/domainsreleased/
## http://www.nominet.org.uk/registrars/systems/epp/poorqualitydata/
sub poor_quality
{
my ($po,$otype,$oaction,$oname,$rinfo)=@_;
my $mes=$po->message();
lib/Net/DRI/Protocol/RRI/Contact.pm view on Meta::CPAN
push @d,['contact:org',{type=>'int'}],['contact:org',{type=>'loc'}] if exists($d->{org});
push @d,['contact:addr',{type=>'int'}] if (exists($d->{addr_int}) && !exists($d->{addr}));
push @d,['contact:addr',{type=>'loc'}] if (exists($d->{addr_loc}) && !exists($d->{addr}));
push @d,['contact:addr',{type=>'int'}],['contact:addr',{type=>'loc'}] if exists($d->{addr});
push @d,['contact:voice'] if exists($d->{voice});
push @d,['contact:fax'] if exists($d->{fax});
push @d,['contact:email'] if exists($d->{email});
return ['contact:disclose',@d,{flag=>(keys(%v))[0]}];
}
sub build_cdata
{
my $contact=shift;
my @d;
my (@post,@addr);
_do_locint(\@post,$contact,'type','type');
_do_locint(\@post,$contact,'name','name');
_do_locint(\@post,$contact,'organisation','org');
_do_locint(\@addr,$contact,'address','street');
_do_locint(\@addr,$contact,'postalCode','pc');
lib/Net/DRI/Protocol/RRI/Contact.pm view on Meta::CPAN
}
sub create
{
my ($rri,$contact)=@_;
my $mes=$rri->message();
my @d=build_command($mes,'create',$contact);
Net::DRI::Exception->die(1,'protocol/RRI',10,'Invalid contact '.$contact) unless (Net::DRI::Util::isa_contact($contact));
$contact->validate(); ## will trigger an Exception if needed
push @d,build_cdata($contact);
$mes->command_body(\@d);
}
sub create_parse
{
my ($po,$otype,$oaction,$oname,$rinfo)=@_;
my $mes=$po->message();
return unless $mes->is_success();
my $credata=$mes->get_content('creData',$mes->ns('contact'));
lib/Net/DRI/Protocol/RRI/Contact.pm view on Meta::CPAN
}
my @d=build_command($mes,'update',$contact);
my $newc=$todo->set('info');
if ($newc)
{
Net::DRI::Exception->die(1,'protocol/RRI',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc);
$newc->type($contact->type());
$newc->validate(1); ## will trigger an Exception if needed
push @d,build_cdata($newc);
}
$mes->command_body(\@d);
}
####################################################################################################
1;