| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, .AU Domain EPP extension commands | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2007,2008,2013 Distribute.IT Pty Ltd, www.distributeit.com.au, Rony Meyer . 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::AU::Domain; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 |  |  | 1 |  | 1026 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 41 |  | 
| 18 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 1 |  |  | 1 |  | 4 | use Net::DRI::Exception; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 590 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =pod | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | =head1 NAME | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | Net::DRI::Protocol::EPP::Extensions::AU::Domain - .AU EPP Domain extension commands for Net::DRI | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | Please see the README file for details. | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | =head1 SUPPORT | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | For now, support questions should be sent to: | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | Enetdri@dotandco.comE | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | Please also see the SUPPORT file in the distribution. | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | Ehttp://www.dotandco.com/services/software/Net-DRI/E | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head1 AUTHOR | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | Rony Meyer, Eperl@spot-light.chE | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | Copyright (c) 2007,2008,2013 Distribute.IT Pty Ltd, Ehttp://www.distributeit.com.auE, Rony Meyer . | 
| 51 |  |  |  |  |  |  | All rights reserved. | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify | 
| 54 |  |  |  |  |  |  | it under the terms of the GNU General Public License as published by | 
| 55 |  |  |  |  |  |  | the Free Software Foundation; either version 2 of the License, or | 
| 56 |  |  |  |  |  |  | (at your option) any later version. | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | See the LICENSE file that comes with this distribution for more details. | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | =cut | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | #################################################################################################### | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | sub register_commands | 
| 65 |  |  |  |  |  |  | { | 
| 66 | 0 |  |  | 0 | 0 |  | my ($class,$version)=@_; | 
| 67 | 0 |  |  |  |  |  | my %tmp=( | 
| 68 |  |  |  |  |  |  | create => [ \&create, undef ], | 
| 69 |  |  |  |  |  |  | info   => [ undef, \&info_parse ], | 
| 70 |  |  |  |  |  |  | ); | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 0 |  |  |  |  |  | return { 'domain' => \%tmp }; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | #################################################################################################### | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | sub build_command_extension | 
| 78 |  |  |  |  |  |  | { | 
| 79 | 0 |  |  | 0 | 0 |  | my ($mes,$epp,$tag)=@_; | 
| 80 | 0 |  |  |  |  |  | return $mes->command_extension_register($tag,sprintf('xmlns:auext="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('auext'))); | 
| 81 |  |  |  |  |  |  | } | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | sub create | 
| 84 |  |  |  |  |  |  | { | 
| 85 | 0 |  |  | 0 | 0 |  | my ($epp,$domain,$rd)=@_; | 
| 86 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 0 | 0 | 0 |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute is mandatory, as ref hash') | 
| 89 |  |  |  |  |  |  | unless (exists($rd->{eligibility}) && (ref($rd->{eligibility}) eq 'HASH')); | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 0 | 0 | 0 |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key registrantName') | 
| 92 |  |  |  |  |  |  | unless (exists($rd->{eligibility}->{registrantName}) && $rd->{eligibility}->{registrantName}); | 
| 93 | 0 | 0 | 0 |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key policyReason') | 
| 94 |  |  |  |  |  |  | unless (exists($rd->{eligibility}->{policyReason}) && $rd->{eligibility}->{policyReason}); | 
| 95 | 0 | 0 | 0 |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('eligibility attribute missing key eligibilityType') | 
| 96 |  |  |  |  |  |  | unless (exists($rd->{eligibility}->{eligibilityType}) && $rd->{eligibility}->{eligibilityType}); | 
| 97 |  |  |  |  |  |  |  | 
| 98 | 0 |  |  |  |  |  | my @n; | 
| 99 | 0 |  |  |  |  |  | push @n,['auext:registrantName',$rd->{eligibility}->{registrantName}]; | 
| 100 | 0 | 0 | 0 |  |  |  | if (exists $rd->{eligibility}->{registrantID} && $rd->{eligibility}->{registrantID} && | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
| 101 |  |  |  |  |  |  | exists $rd->{eligibility}->{registrantIDType} && $rd->{eligibility}->{registrantIDType}) { | 
| 102 | 0 |  |  |  |  |  | push @n,['auext:registrantID',$rd->{eligibility}->{registrantID},{'type'=> $rd->{eligibility}->{registrantIDType}}]; | 
| 103 |  |  |  |  |  |  | } | 
| 104 | 0 |  |  |  |  |  | push @n,['auext:eligibilityType',$rd->{eligibility}->{eligibilityType}]; | 
| 105 | 0 | 0 | 0 |  |  |  | push @n,['auext:eligibilityName',$rd->{eligibility}->{eligibilityName}] if exists $rd->{eligibility}->{eligibilityName} && $rd->{eligibility}->{eligibilityName}; | 
| 106 | 0 | 0 | 0 |  |  |  | if (exists $rd->{eligibility}->{eligibilityID} && $rd->{eligibility}->{eligibilityID} && | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
| 107 |  |  |  |  |  |  | exists $rd->{eligibility}->{eligibilityIDType} && $rd->{eligibility}->{eligibilityIDType}) { | 
| 108 | 0 |  |  |  |  |  | push @n,['auext:eligibilityID',$rd->{eligibility}->{eligibilityID},{'type'=> $rd->{eligibility}->{eligibilityIDType}}]; | 
| 109 |  |  |  |  |  |  | } | 
| 110 | 0 |  |  |  |  |  | push @n,['auext:policyReason',$rd->{eligibility}->{policyReason}]; | 
| 111 |  |  |  |  |  |  |  | 
| 112 | 0 |  |  |  |  |  | my $eid=build_command_extension($mes,$epp,'auext:extensionAU'); | 
| 113 |  |  |  |  |  |  |  | 
| 114 | 0 |  |  |  |  |  | my @nn; | 
| 115 | 0 |  |  |  |  |  | push @nn, ['auext:create',@n]; | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 0 |  |  |  |  |  | $mes->command_extension($eid,\@nn); | 
| 118 | 0 |  |  |  |  |  | return; | 
| 119 |  |  |  |  |  |  | } | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | sub info_parse | 
| 123 |  |  |  |  |  |  | { | 
| 124 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 125 | 0 |  |  |  |  |  | my $mes=$po->message(); | 
| 126 | 0 | 0 |  |  |  |  | return unless $mes->is_success(); | 
| 127 |  |  |  |  |  |  |  | 
| 128 | 0 |  |  |  |  |  | my $infdata=$mes->get_extension('auextnew','infData'); | 
| 129 | 0 | 0 |  |  |  |  | return unless $infdata; | 
| 130 |  |  |  |  |  |  |  | 
| 131 | 0 |  |  |  |  |  | my %ens; | 
| 132 | 0 |  |  |  |  |  | my $c=$infdata->getFirstChild(); | 
| 133 | 0 |  |  |  |  |  | while($c) | 
| 134 |  |  |  |  |  |  | { | 
| 135 | 0 | 0 |  |  |  |  | next unless ($c->nodeType() == 1); ## only for element nodes | 
| 136 | 0 |  | 0 |  |  |  | my $name=$c->localname() || $c->nodeName(); | 
| 137 | 0 | 0 |  |  |  |  | next unless $name; | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | # if ($name eq 'info') | 
| 140 | 0 | 0 |  |  |  |  | if ($name eq 'auProperties') | 
| 141 |  |  |  |  |  |  | { | 
| 142 | 0 |  |  |  |  |  | my $cc=$c->getFirstChild(); | 
| 143 | 0 |  |  |  |  |  | while($cc) | 
| 144 |  |  |  |  |  |  | { | 
| 145 | 0 | 0 |  |  |  |  | next unless ($cc->nodeType() == 1); ## only for element nodes | 
| 146 | 0 |  | 0 |  |  |  | my $name2=$cc->localname() || $cc->nodeName(); | 
| 147 | 0 | 0 |  |  |  |  | next unless $name2; | 
| 148 |  |  |  |  |  |  |  | 
| 149 | 0 | 0 |  |  |  |  | if ($name2 eq 'registrantName') | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | { | 
| 151 | 0 |  |  |  |  |  | $ens{registrantName}=$cc->getFirstChild()->getData(); | 
| 152 |  |  |  |  |  |  | } elsif ($name2 eq 'registrantID') | 
| 153 |  |  |  |  |  |  | { | 
| 154 | 0 |  |  |  |  |  | $ens{registrantID}=$cc->getFirstChild()->getData(); | 
| 155 | 0 |  |  |  |  |  | $ens{registrantIDType}=$cc->getAttribute('type'); #registrantID | 
| 156 |  |  |  |  |  |  | } elsif ($name2 eq 'eligibilityType') | 
| 157 |  |  |  |  |  |  | { | 
| 158 | 0 |  |  |  |  |  | $ens{eligibilityType}=$cc->getFirstChild()->getData(); | 
| 159 |  |  |  |  |  |  | } elsif ($name2 eq 'eligibilityName') | 
| 160 |  |  |  |  |  |  | { | 
| 161 | 0 |  |  |  |  |  | $ens{eligibilityName}=$cc->getFirstChild()->getData(); | 
| 162 |  |  |  |  |  |  | } elsif ($name2 eq 'eligibilityID') | 
| 163 |  |  |  |  |  |  | { | 
| 164 | 0 |  |  |  |  |  | $ens{eligibilityID}=$cc->getFirstChild()->getData(); | 
| 165 | 0 |  |  |  |  |  | $ens{eligibilityIDType}=$cc->getAttribute('type'); #eligibilityID | 
| 166 |  |  |  |  |  |  | } elsif ($name2 eq 'policyReason') | 
| 167 |  |  |  |  |  |  | { | 
| 168 | 0 |  |  |  |  |  | $ens{policyReason}=$cc->getFirstChild()->getData(); | 
| 169 |  |  |  |  |  |  | } | 
| 170 | 0 |  |  |  |  |  | } continue { $cc=$cc->getNextSibling(); } | 
| 171 |  |  |  |  |  |  | } | 
| 172 | 0 |  |  |  |  |  | } continue { $c=$c->getNextSibling(); } | 
| 173 |  |  |  |  |  |  |  | 
| 174 | 0 |  |  |  |  |  | $rinfo->{domain}->{$oname}->{eligibility}=\%ens; | 
| 175 | 0 |  |  |  |  |  | return; | 
| 176 |  |  |  |  |  |  | } | 
| 177 |  |  |  |  |  |  | #################################################################################################### | 
| 178 |  |  |  |  |  |  | 1; |