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