| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, ASIA CED extension | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2007,2008 Tonnerre Lombard . All rights reserved. | 
| 4 |  |  |  |  |  |  | ##           (c) 2010,2013 Patrick Mevzek . All rights reserved. | 
| 5 |  |  |  |  |  |  | ## | 
| 6 |  |  |  |  |  |  | ## This file is part of Net::DRI | 
| 7 |  |  |  |  |  |  | ## | 
| 8 |  |  |  |  |  |  | ## Net::DRI is free software; you can redistribute it and/or modify | 
| 9 |  |  |  |  |  |  | ## it under the terms of the GNU General Public License as published by | 
| 10 |  |  |  |  |  |  | ## the Free Software Foundation; either version 2 of the License, or | 
| 11 |  |  |  |  |  |  | ## (at your option) any later version. | 
| 12 |  |  |  |  |  |  | ## | 
| 13 |  |  |  |  |  |  | ## See the LICENSE file that comes with this distribution for more details. | 
| 14 |  |  |  |  |  |  | #################################################################################################### | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | package Net::DRI::Protocol::EPP::Extensions::ASIA::CED; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 1 |  |  | 1 |  | 1287 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 19 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 837 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =pod | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =head1 NAME | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | Net::DRI::Protocol::EPP::Extensions::ASIA::CED - .ASIA EPP CED extensions for Net::DRI | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | Please see the README file for details. | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =head1 SUPPORT | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | For now, support questions should be sent to: | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | Enetdri@dotandco.comE | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | Please also see the SUPPORT file in the distribution. | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | Ehttp://www.dotandco.com/services/software/Net-DRI/E and | 
| 42 |  |  |  |  |  |  | Ehttp://oss.bdsprojects.net/projects/netdri/E | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head1 AUTHOR | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | Tonnerre Lombard Etonnerre.lombard@sygroup.chE | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | Copyright (c) 2007,2008 Tonnerre Lombard | 
| 51 |  |  |  |  |  |  | (c) 2010,2013 Patrick Mevzek | 
| 52 |  |  |  |  |  |  | All rights reserved. | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify | 
| 55 |  |  |  |  |  |  | it under the terms of the GNU General Public License as published by | 
| 56 |  |  |  |  |  |  | the Free Software Foundation; either version 2 of the License, or | 
| 57 |  |  |  |  |  |  | (at your option) any later version. | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | See the LICENSE file that comes with this distribution for more details. | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =cut | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | #################################################################################################### | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | sub register_commands | 
| 66 |  |  |  |  |  |  | { | 
| 67 | 0 |  |  | 0 | 0 |  | my ($class,$version)=@_; | 
| 68 | 0 |  |  |  |  |  | my %contacttmp=( | 
| 69 |  |  |  |  |  |  | create =>	[ \&user_create, undef ], | 
| 70 |  |  |  |  |  |  | update =>	[ \&user_update, undef ], | 
| 71 |  |  |  |  |  |  | info =>	[ undef, \&user_info ] | 
| 72 |  |  |  |  |  |  | ); | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 0 |  |  |  |  |  | return { 'contact' => \%contacttmp }; | 
| 75 |  |  |  |  |  |  | } | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | #################################################################################################### | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | # automatically put type/form in other fields if not in the list of allowed | 
| 80 |  |  |  |  |  |  | sub auto_cedother | 
| 81 |  |  |  |  |  |  | { | 
| 82 | 0 |  |  | 0 | 0 |  | my $contact = shift; | 
| 83 | 0 | 0 |  |  |  |  | return $contact unless $contact->cedinum(); | 
| 84 | 0 |  |  |  |  |  | my $etype = lc($contact->cedetype()); | 
| 85 | 0 | 0 |  |  |  |  | unless ($etype =~ m/^(naturalperson|corporation|cooperative|partnership|government|politicalparty|society|institution|other)$/) | 
| 86 |  |  |  |  |  |  | { | 
| 87 | 0 |  |  |  |  |  | $contact->cedothertype($contact->cedetype()); | 
| 88 | 0 |  |  |  |  |  | $contact->cedetype('other'); | 
| 89 |  |  |  |  |  |  | } | 
| 90 | 0 |  |  |  |  |  | my $iform = $contact->cediform(); | 
| 91 | 0 | 0 |  |  |  |  | unless ($iform =~ m/^(passport|certificate|legislation|societyregistry|politicalpartyregistry|other)$/) | 
| 92 |  |  |  |  |  |  | { | 
| 93 | 0 |  |  |  |  |  | $contact->cedoiform($contact->cediform()); | 
| 94 | 0 |  |  |  |  |  | $contact->cediform('other'); | 
| 95 |  |  |  |  |  |  | } | 
| 96 | 0 |  |  |  |  |  | return $contact; | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | sub user_create | 
| 100 |  |  |  |  |  |  | { | 
| 101 | 0 |  |  | 0 | 0 |  | my ($epp,$contact,$rd)=@_; | 
| 102 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 103 | 0 |  |  |  |  |  | my @ceddata; | 
| 104 |  |  |  |  |  |  |  | 
| 105 | 0 | 0 |  |  |  |  | return unless Net::DRI::Util::isa_contact($contact, 'Net::DRI::Data::Contact::ASIA'); | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 0 |  |  |  |  |  | $contact = auto_cedother($contact); | 
| 108 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:ccLocality', $contact->cedcc()])         if defined $contact->cedcc()        && length $contact->cedcc(); | 
| 109 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:localitySp', $contact->cedsp()])         if defined $contact->cedsp()        && length $contact->cedsp(); | 
| 110 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:localityCity', $contact->cedcity()])     if defined $contact->cedcity()      && length $contact->cedcity(); | 
| 111 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:legalEntityType', $contact->cedetype()]) if defined $contact->cedetype()     && length $contact->cedetype(); | 
| 112 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:identForm', $contact->cediform()])       if defined $contact->cediform()     && length $contact->cediform(); | 
| 113 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:identNumber', $contact->cedinum()])      if defined $contact->cedinum()      && length $contact->cedinum(); | 
| 114 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:otherLEType', $contact->cedothertype()]) if defined $contact->cedothertype() && length $contact->cedothertype(); | 
| 115 | 0 | 0 | 0 |  |  |  | push(@ceddata, ['asia:otherIdentForm', $contact->cedoiform()]) if defined $contact->cedoiform()    && length $contact->cedoiform(); | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 0 | 0 |  |  |  |  | return unless (@ceddata); | 
| 118 |  |  |  |  |  |  |  | 
| 119 | 0 |  |  |  |  |  | my $eid=$mes->command_extension_register('asia:create',sprintf('xmlns:asia="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('asia'))); | 
| 120 | 0 |  |  |  |  |  | $mes->command_extension($eid,['asia:cedData', @ceddata]); | 
| 121 | 0 |  |  |  |  |  | return; | 
| 122 |  |  |  |  |  |  | } | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | sub user_update | 
| 125 |  |  |  |  |  |  | { | 
| 126 | 0 |  |  | 0 | 0 |  | my ($epp,$contact,$todo)=@_; | 
| 127 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 128 | 0 |  |  |  |  |  | my $newc=$todo->set('info'); | 
| 129 | 0 |  |  |  |  |  | my @ceddata; | 
| 130 |  |  |  |  |  |  |  | 
| 131 | 0 |  |  |  |  |  | $contact = auto_cedother($contact); | 
| 132 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:ccLocality', $contact->cedcc()])         if defined $contact->cedcc(); | 
| 133 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:localitySp', $contact->cedsp()])         if defined $contact->cedsp(); | 
| 134 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:localityCity', $contact->cedcity()])     if defined $contact->cedcity(); | 
| 135 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:legalEntityType', $contact->cedetype()]) if defined $contact->cedetype(); | 
| 136 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:identForm', $contact->cediform()])       if defined $contact->cediform(); | 
| 137 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:identNumber', $contact->cedinum()])      if defined $contact->cedinum(); | 
| 138 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:otherLEType', $contact->cedothertype()]) if defined $contact->cedothertype(); | 
| 139 | 0 | 0 |  |  |  |  | push(@ceddata, ['asia:otherIdentForm', $contact->cedoiform()]) if defined $contact->cedoiform(); | 
| 140 |  |  |  |  |  |  |  | 
| 141 | 0 | 0 |  |  |  |  | return unless (@ceddata); | 
| 142 |  |  |  |  |  |  |  | 
| 143 | 0 |  |  |  |  |  | my $eid=$mes->command_extension_register('asia:update',sprintf('xmlns:asia="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('asia'))); | 
| 144 | 0 |  |  |  |  |  | $mes->command_extension($eid,['asia:chg', ['asia:cedData', @ceddata]]); | 
| 145 | 0 |  |  |  |  |  | return; | 
| 146 |  |  |  |  |  |  | } | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | sub user_info | 
| 149 |  |  |  |  |  |  | { | 
| 150 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 151 | 0 |  |  |  |  |  | my $mes=$po->message(); | 
| 152 | 0 |  |  |  |  |  | my $infdata=$mes->get_extension('asia','infData'); | 
| 153 | 0 |  |  |  |  |  | my $ceddata; | 
| 154 | 0 |  |  |  |  |  | my $contact = $rinfo->{$otype}->{$oname}->{self}; | 
| 155 | 0 |  |  |  |  |  | my $c; | 
| 156 |  |  |  |  |  |  |  | 
| 157 | 0 |  |  |  |  |  | my $ns=$mes->ns('asia'); | 
| 158 | 0 | 0 |  |  |  |  | $ceddata = $infdata->getElementsByTagNameNS($ns, 'cedData')->shift() if (defined($infdata)); | 
| 159 | 0 | 0 |  |  |  |  | return unless ($ceddata); | 
| 160 |  |  |  |  |  |  |  | 
| 161 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'ccLocality'); | 
| 162 | 0 | 0 |  |  |  |  | $contact->cedcc($c->shift()->getFirstChild()->getData()) if ($c); | 
| 163 |  |  |  |  |  |  |  | 
| 164 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'localitySp'); | 
| 165 | 0 | 0 |  |  |  |  | $contact->cedsp($c->shift()->getFirstChild()->getData()) if ($c); | 
| 166 |  |  |  |  |  |  |  | 
| 167 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'localityCity'); | 
| 168 | 0 | 0 |  |  |  |  | $contact->cedcity($c->shift()->getFirstChild()->getData()) if ($c); | 
| 169 |  |  |  |  |  |  |  | 
| 170 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'legalEntityType'); | 
| 171 | 0 | 0 |  |  |  |  | $contact->cedetype($c->shift()->getFirstChild()->getData()) if ($c); | 
| 172 |  |  |  |  |  |  |  | 
| 173 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'identForm'); | 
| 174 | 0 | 0 |  |  |  |  | $contact->cediform($c->shift()->getFirstChild()->getData()) if ($c); | 
| 175 |  |  |  |  |  |  |  | 
| 176 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'identNumber'); | 
| 177 | 0 | 0 |  |  |  |  | $contact->cedinum($c->shift()->getFirstChild()->getData()) if ($c); | 
| 178 |  |  |  |  |  |  |  | 
| 179 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'otherLEType'); | 
| 180 | 0 | 0 |  |  |  |  | $contact->cedothertype($c->shift()->getFirstChild()->getData()) if ($c); | 
| 181 |  |  |  |  |  |  |  | 
| 182 | 0 |  |  |  |  |  | $c = $ceddata->getElementsByTagNameNS($ns,'otherIdentForm'); | 
| 183 | 0 | 0 |  |  |  |  | $contact->cedoiform($c->shift()->getFirstChild()->getData()) if ($c); | 
| 184 |  |  |  |  |  |  |  | 
| 185 | 0 |  |  |  |  |  | return; | 
| 186 |  |  |  |  |  |  | } | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | #################################################################################################### | 
| 189 |  |  |  |  |  |  | 1; |