| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, ASIA domain extension | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2010,2013 Patrick Mevzek . 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::ASIA::Domain; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 |  |  | 1 |  | 967 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 35 |  | 
| 18 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 1 |  |  | 1 |  | 4 | use Net::DRI::Util; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 16 |  | 
| 21 | 1 |  |  | 1 |  | 5 | use Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 874 |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | #################################################################################################### | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | sub register_commands | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 0 |  |  | 0 | 0 |  | my ($class,$version)=@_; | 
| 28 | 0 |  |  |  |  |  | my %tmp=( | 
| 29 |  |  |  |  |  |  | create =>	[ \&create, \&create_parse ], | 
| 30 |  |  |  |  |  |  | update => 	[ \&update, undef ], | 
| 31 |  |  |  |  |  |  | info =>	[ undef, \&info_parse ], | 
| 32 |  |  |  |  |  |  | ); | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 0 |  |  |  |  |  | return { 'domain' => \%tmp }; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | #################################################################################################### | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub create | 
| 40 |  |  |  |  |  |  | { | 
| 41 | 0 |  |  | 0 | 0 |  | my ($epp,$domain,$rd)=@_; | 
| 42 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 43 |  |  |  |  |  |  |  | 
| 44 | 0 |  |  |  |  |  | my @d; | 
| 45 | 0 |  |  |  |  |  | push @d,Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl::create('asia',$rd); | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_contact($rd)) | 
| 48 |  |  |  |  |  |  | { | 
| 49 | 0 |  |  |  |  |  | my $cs=$rd->{contact}; | 
| 50 | 0 |  |  |  |  |  | foreach my $type (grep { ! /^(?:registrant|admin|tech|billing|regAgent)$/ } $cs->types()) | 
|  | 0 |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | { | 
| 52 | 0 |  |  |  |  |  | push @d,map { ['asia:contact',{type => $type},$_->srid()] } ($cs->get($type)); | 
|  | 0 |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 0 | 0 |  |  |  |  | return unless @d; | 
| 57 | 0 |  |  |  |  |  | my $eid=$mes->command_extension_register('asia:create',sprintf('xmlns:asia="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('asia'))); | 
| 58 | 0 |  |  |  |  |  | $mes->command_extension($eid,\@d); | 
| 59 | 0 |  |  |  |  |  | return; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | sub create_parse | 
| 63 |  |  |  |  |  |  | { | 
| 64 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 65 | 0 |  |  |  |  |  | my $mes=$po->message(); | 
| 66 | 0 |  |  |  |  |  | my $infdata=$mes->get_extension('asia','creData'); | 
| 67 |  |  |  |  |  |  |  | 
| 68 | 0 | 0 |  |  |  |  | return unless defined $infdata; | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 0 |  |  |  |  |  | my $c=Net::DRI::Util::xml_child_content($infdata,$mes->ns('asia'),'domainRoid'); | 
| 71 | 0 | 0 |  |  |  |  | $rinfo->{$otype}->{$oname}->{roid}=$c if defined $c; | 
| 72 | 0 |  |  |  |  |  | return; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | ## TODO: from liberty-rtk-addon-0.5.1 it seems domainRoid can be in info and update commands, in the asia extension ? | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | sub update | 
| 78 |  |  |  |  |  |  | { | 
| 79 | 0 |  |  | 0 | 0 |  | my ($epp,$domain,$todo) = @_; | 
| 80 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 0 |  |  |  |  |  | my @d; | 
| 83 | 0 |  |  |  |  |  | push @d,Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl::update('asia',$todo); | 
| 84 |  |  |  |  |  |  |  | 
| 85 | 0 |  |  |  |  |  | my $cs=$todo->set('contact'); | 
| 86 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::isa_contactset($cs)) | 
| 87 |  |  |  |  |  |  | { | 
| 88 | 0 |  |  |  |  |  | foreach my $type (grep { ! /^(?:registrant|admin|tech|billing)$/ } $cs->types()) | 
|  | 0 |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | { | 
| 90 | 0 |  |  |  |  |  | push @d,map { ['asia:contact',{type => $type},$_->srid()] } ($cs->get($type)); | 
|  | 0 |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | } | 
| 92 |  |  |  |  |  |  | } | 
| 93 |  |  |  |  |  |  |  | 
| 94 | 0 | 0 |  |  |  |  | return unless @d; | 
| 95 | 0 |  |  |  |  |  | my $eid=$mes->command_extension_register('asia:update',sprintf('xmlns:asia="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('asia'))); | 
| 96 | 0 |  |  |  |  |  | $mes->command_extension($eid,['asia:chg',@d]); | 
| 97 | 0 |  |  |  |  |  | return; | 
| 98 |  |  |  |  |  |  | } | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | sub info_parse | 
| 101 |  |  |  |  |  |  | { | 
| 102 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 103 | 0 |  |  |  |  |  | my $mes=$po->message(); | 
| 104 | 0 |  |  |  |  |  | my $infdata=$mes->get_extension('asia','infData'); | 
| 105 |  |  |  |  |  |  |  | 
| 106 | 0 | 0 |  |  |  |  | return unless defined $infdata; | 
| 107 |  |  |  |  |  |  |  | 
| 108 | 0 |  |  |  |  |  | my $c=Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl::info_parse($mes->ns('asia'),$infdata); | 
| 109 | 0 | 0 |  |  |  |  | $rinfo->{$otype}->{$oname}->{maintainer_url}=$c if defined $c; | 
| 110 |  |  |  |  |  |  |  | 
| 111 | 0 |  |  |  |  |  | my $cs=$rinfo->{$otype}->{$oname}->{contact}; | 
| 112 | 0 |  |  |  |  |  | foreach my $ct ($infdata->getElementsByTagNameNS($mes->ns('asia'),'contact')) | 
| 113 |  |  |  |  |  |  | { | 
| 114 | 0 |  |  |  |  |  | $cs->add($po->create_local_object('contact')->srid($ct->textContent()),$ct->getAttribute('type')); | 
| 115 |  |  |  |  |  |  | } | 
| 116 | 0 |  |  |  |  |  | return; | 
| 117 |  |  |  |  |  |  | } | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | #################################################################################################### | 
| 120 |  |  |  |  |  |  | 1; | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | __END__ |