« DRI/Protocol/AdamsNames/WS/Domain.pm
↑ Summary
DRI/Protocol/EPP/Extensions/ICANN/RegistrarExpirationDate.pm »
| 1 | ## Domain Registry Interface, SIDN EPP Contact commands | ||||||||||||||||||
| 2 | ## | ||||||||||||||||||
| 3 | ## Copyright (c) 2009,2010,2013,2016 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::Protocol::EPP::Extensions::SIDN::Contact; | ||||||||||||||||||
| 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 | 1 | ▶ | use feature 'state'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 23 | |||||||||||||||||||
| 24 | #################################################################################################### | ||||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | sub register_commands | ||||||||||||||||||
| 27 | { | ||||||||||||||||||
| 28 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 29 | |||||||||||||||||||
| 30 | 0 | state $contact = { | |||||||||||||||||
| 31 | info => [ undef, \&info_parse ], | ||||||||||||||||||
| 32 | create => [ \&create, undef ], | ||||||||||||||||||
| 33 | update => [ \&update ], | ||||||||||||||||||
| 34 | }; | ||||||||||||||||||
| 35 | 0 | state $commands = { 'contact' => $contact }; | |||||||||||||||||
| 36 | |||||||||||||||||||
| 37 | 0 | return $commands; | |||||||||||||||||
| 38 | } | ||||||||||||||||||
| 39 | |||||||||||||||||||
| 40 | #################################################################################################### | ||||||||||||||||||
| 41 | ########### Query commands | ||||||||||||||||||
| 42 | |||||||||||||||||||
| 43 | sub info_parse | ||||||||||||||||||
| 44 | { | ||||||||||||||||||
| 45 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||
|
Subroutine
info_parse: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||
| 46 | 0 | my $mes=$po->message(); | |||||||||||||||||
| 47 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | 0 | my $infdata=$mes->get_extension('sidn','ext'); | |||||||||||||||||
| 50 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 51 | |||||||||||||||||||
| 52 | 0 | my $ns=$mes->ns('sidn'); | |||||||||||||||||
| 53 | 0 | $infdata=Net::DRI::Util::xml_traverse($infdata,$ns,'infData','contact'); | |||||||||||||||||
| 54 | 0 | ▶ | return unless defined $infdata; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 55 | |||||||||||||||||||
| 56 | 0 | my $contact=$rinfo->{contact}->{$oname}->{self}; | |||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | |||||||||||||||||
| 59 | { | ||||||||||||||||||
| 60 | 0 | my ($name,$c)=@$el; | |||||||||||||||||
| 61 | 0 | ▶ | if ($name eq 'legalForm') | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 62 | { | ||||||||||||||||||
| 63 | 0 | $contact->legal_form($c->textContent()); | |||||||||||||||||
| 64 | } elsif ($name eq 'legalFormRegNo') | ||||||||||||||||||
| 65 | { | ||||||||||||||||||
| 66 | 0 | $contact->legal_id($c->textContent()); | |||||||||||||||||
| 67 | } elsif ($name eq 'limited') | ||||||||||||||||||
| 68 | { | ||||||||||||||||||
| 69 | 0 | $contact->limited(Net::DRI::Util::xml_parse_boolean($c->textContent())); | |||||||||||||||||
| 70 | } | ||||||||||||||||||
| 71 | } | ||||||||||||||||||
| 72 | 0 | return; | |||||||||||||||||
| 73 | } | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | ########### Transform commands | ||||||||||||||||||
| 76 | |||||||||||||||||||
| 77 | sub create | ||||||||||||||||||
| 78 | { | ||||||||||||||||||
| 79 | 0 | ▶ | my ($epp,$contact)=@_; | ||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||
| 80 | 0 | my $mes=$epp->message(); | |||||||||||||||||
| 81 | |||||||||||||||||||
| 82 | ## $contact->validate() has been called | ||||||||||||||||||
| 83 | 0 | my @n; | |||||||||||||||||
| 84 | 0 | push @n,['sidn:legalForm',$contact->legal_form()]; | |||||||||||||||||
| 85 | 0 | ▶ | push @n,['sidn:legalFormRegNo',$contact->legal_id()] if $contact->legal_id(); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 86 | |||||||||||||||||||
| 87 | 0 | my $eid=$mes->command_extension_register('sidn', 'ext'); | |||||||||||||||||
| 88 | 0 | $mes->command_extension($eid,['sidn:create',['sidn:contact',@n]]); | |||||||||||||||||
| 89 | 0 | return; | |||||||||||||||||
| 90 | } | ||||||||||||||||||
| 91 | |||||||||||||||||||
| 92 | sub update | ||||||||||||||||||
| 93 | { | ||||||||||||||||||
| 94 | 0 | ▶ | my ($epp,$contact,$todo)=@_; | ||||||||||||||||
|
Subroutine
update: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||
| 95 | |||||||||||||||||||
| 96 | 0 | my $newc=$todo->set('info'); | |||||||||||||||||
| 97 | 0 | ▶ | return unless defined $newc; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 98 | |||||||||||||||||||
| 99 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::SIDN'); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 100 | 0 | $newc->validate(1); ## will trigger an Exception if needed | |||||||||||||||||
| 101 | |||||||||||||||||||
| 102 | 0 | my @n; | |||||||||||||||||
| 103 | 0 | ▶ | push @n,['sidn:legalForm',$newc->legal_form()] if $newc->legal_form(); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 104 | 0 | ▶ | push @n,['sidn:legalFormRegNo',$newc->legal_id()] if $newc->legal_id(); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 105 | |||||||||||||||||||
| 106 | 0 | ▶ | return unless @n; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 107 | |||||||||||||||||||
| 108 | 0 | my $mes=$epp->message(); | |||||||||||||||||
| 109 | 0 | my $eid=$mes->command_extension_register('sidn', 'ext'); | |||||||||||||||||
| 110 | 0 | $mes->command_extension($eid,['sidn:update',['sidn:contact',@n]]); | |||||||||||||||||
| 111 | 0 | return; | |||||||||||||||||
| 112 | } | ||||||||||||||||||
| 113 | |||||||||||||||||||
| 114 | #################################################################################################### | ||||||||||||||||||
| 115 | 1 | 1; | |||||||||||||||||
| 116 | |||||||||||||||||||
| 117 | __END__ | ||||||||||||||||||
| 118 | |||||||||||||||||||
| 119 | =pod | ||||||||||||||||||
| 120 | |||||||||||||||||||
| 121 | =head1 NAME | ||||||||||||||||||
| 122 | |||||||||||||||||||
| 123 | Net::DRI::Protocol::EPP::Extensions::SIDN::Contact - SIDN EPP Contact commands for Net::DRI | ||||||||||||||||||
| 124 | |||||||||||||||||||
| 125 | =head1 DESCRIPTION | ||||||||||||||||||
| 126 | |||||||||||||||||||
| 127 | Please see the README file for details. | ||||||||||||||||||
| 128 | |||||||||||||||||||
| 129 | =head1 SUPPORT | ||||||||||||||||||
| 130 | |||||||||||||||||||
| 131 | For now, support questions should be sent to: | ||||||||||||||||||
| 132 | |||||||||||||||||||
| 133 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||
| 134 | |||||||||||||||||||
| 135 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||
| 136 | |||||||||||||||||||
| 137 | =head1 SEE ALSO | ||||||||||||||||||
| 138 | |||||||||||||||||||
| 139 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||
| 140 | |||||||||||||||||||
| 141 | =head1 AUTHOR | ||||||||||||||||||
| 142 | |||||||||||||||||||
| 143 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||
| 144 | |||||||||||||||||||
| 145 | =head1 COPYRIGHT | ||||||||||||||||||
| 146 | |||||||||||||||||||
| 147 | Copyright (c) 2009,2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||
| 148 | All rights reserved. | ||||||||||||||||||
| 149 | |||||||||||||||||||
| 150 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||
| 151 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||
| 152 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||
| 153 | (at your option) any later version. | ||||||||||||||||||
| 154 | |||||||||||||||||||
| 155 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||
| 156 | |||||||||||||||||||
| 157 | =cut | ||||||||||||||||||