| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, .PL EPP Report extension commands | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2012,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::PL::Report; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 |  |  | 1 |  | 992 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 18 | 1 |  |  | 1 |  | 3 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 20 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 1 |  |  | 1 |  | 4 | use Net::DRI::Util; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 16 |  | 
| 21 | 1 |  |  | 1 |  | 4 | use Net::DRI::Exception; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 2333 |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | #################################################################################################### | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | sub register_commands | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 0 |  |  | 0 | 0 |  | my ($class,$version)=@_; | 
| 28 | 0 |  |  |  |  |  | return { 'report' => { create => [ \&create, \&create_parse ] } }; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | sub setup | 
| 32 |  |  |  |  |  |  | { | 
| 33 | 0 |  |  | 0 | 0 |  | my ($class,$po,$version)=@_; | 
| 34 | 0 |  |  |  |  |  | $po->ns({ 'extreport' => [ 'urn:ietf:params:xml:ns:extreport-1.0','extreport-1.0.xsd' ] }); | 
| 35 | 0 |  |  |  |  |  | return; | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | #################################################################################################### | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | sub create | 
| 41 |  |  |  |  |  |  | { | 
| 42 | 0 |  |  | 0 | 0 |  | my ($epp,$id,$rp)=@_; | 
| 43 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 | 0 | 0 |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('An ID must be provided to track this report results') unless defined $id && length $id; | 
| 46 | 0 | 0 |  |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('An hash ref must be provided with at least a type key') unless Net::DRI::Util::has_key($rp,'type'); | 
| 47 | 0 | 0 |  |  |  |  | Net::DRI::Exception::usererr_invalid_parameters('Type value must be domain,contact,host,future,payment or funds') unless $rp->{type}=~m/^(?:domain|contact|host|future|payment|funds)$/; | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 0 |  |  |  |  |  | my @n; | 
| 50 | 0 | 0 |  |  |  |  | if ($rp->{type} eq 'domain') | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | { | 
| 52 | 0 |  |  |  |  |  | push @n,['extreport:domain',_create_domain($rp)]; | 
| 53 |  |  |  |  |  |  | } elsif ($rp->{type} eq 'contact') | 
| 54 |  |  |  |  |  |  | { | 
| 55 | 0 |  |  |  |  |  | push @n,['extreport:contact',_create_contact($rp)]; | 
| 56 |  |  |  |  |  |  | } elsif ($rp->{type} eq 'host') | 
| 57 |  |  |  |  |  |  | { | 
| 58 | 0 |  |  |  |  |  | push @n,['extreport:host',_create_host($rp)]; | 
| 59 |  |  |  |  |  |  | } elsif ($rp->{type} eq 'future') | 
| 60 |  |  |  |  |  |  | { | 
| 61 | 0 |  |  |  |  |  | push @n,['extreport:future',_create_future($rp)]; | 
| 62 |  |  |  |  |  |  | } elsif ($rp->{type} eq 'payment') | 
| 63 |  |  |  |  |  |  | { | 
| 64 | 0 |  |  |  |  |  | push @n,['extreport:prepaid',['extreport:payment',_create_payment($rp)]]; | 
| 65 |  |  |  |  |  |  | } elsif ($rp->{type} eq 'funds') | 
| 66 |  |  |  |  |  |  | { | 
| 67 | 0 |  |  |  |  |  | push @n,['extreport:prepaid',['extreport:paymentFunds',_create_payment($rp)]]; | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 0 | 0 | 0 |  |  |  | push @n,['extreport:offset',$rp->{offset}] if Net::DRI::Util::has_key($rp,'offset') && $rp->{offset}=~m/^\d+$/; | 
| 71 | 0 | 0 | 0 |  |  |  | push @n,['extreport:limit',$rp->{limit}]   if Net::DRI::Util::has_key($rp,'limit')  && $rp->{limit}=~m/^\d+$/; | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 0 |  |  |  |  |  | my $eid=$mes->command_extension_register('extreport','report'); | 
| 74 | 0 |  |  |  |  |  | $mes->command_extension($eid,\@n); | 
| 75 | 0 |  |  |  |  |  | return; | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | sub _create_domain | 
| 79 |  |  |  |  |  |  | { | 
| 80 | 0 |  |  | 0 |  |  | my ($rp)=@_; | 
| 81 | 0 |  |  |  |  |  | my @n; | 
| 82 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'state')) | 
| 83 |  |  |  |  |  |  | { | 
| 84 | 0 |  |  |  |  |  | my $state=$rp->{state}; | 
| 85 | 0 | 0 |  |  |  |  | Net::DRI::Exception::usererr_invalid_parameters('Domain state must be from list of registry states') unless $state=~m/^(?:STATE_)?(?:REGISTERED|EXPIRED|BLOCKED|RESERVED|BOOK_BLOCKED|DELETE_BLOCKED|TASTED|TASTED_BLOCKED)$/i; | 
| 86 | 0 |  |  |  |  |  | $state=uc $state; | 
| 87 | 0 | 0 |  |  |  |  | $state='STATE_'.$state unless $state=~m/^STATE_/; | 
| 88 | 0 |  |  |  |  |  | push @n,['extreport:state',$state]; | 
| 89 |  |  |  |  |  |  | } | 
| 90 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'exDate')) | 
| 91 |  |  |  |  |  |  | { | 
| 92 | 0 |  |  |  |  |  | my $date=$rp->{exDate}; | 
| 93 | 0 | 0 |  |  |  |  | $date=Net::DRI::Util::dto2zstring($date) if Net::DRI::Util::is_class($date,'DateTime'); | 
| 94 | 0 | 0 |  |  |  |  | Net::DRI::Exception::usererr_invalid_parameters('exDate must be in ISO8601 format') unless $date=~m/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/; | 
| 95 | 0 | 0 |  |  |  |  | $date.='Z' unless $date=~m/Z$/; | 
| 96 | 0 |  |  |  |  |  | push @n,['extreport:exDate',$date]; | 
| 97 |  |  |  |  |  |  | } | 
| 98 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'status')) | 
| 99 |  |  |  |  |  |  | { | 
| 100 | 0 | 0 |  |  |  |  | Net::DRI::Exception::usererr_invalid_parameters('status must be a StatusList object') unless Net::DRI::Util::is_class($rp->{status},'Net::DRI::Data::StatusList'); | 
| 101 | 0 |  |  |  |  |  | my %s; | 
| 102 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'status_in')) | 
| 103 |  |  |  |  |  |  | { | 
| 104 | 0 | 0 |  |  |  |  | $s{statusesIn}=$rp->{status_in} ? 'true' : 'false'; | 
| 105 |  |  |  |  |  |  | } | 
| 106 | 0 |  |  |  |  |  | push @n,['extreport:statuses',\%s,map { ['extreport:status',$_] } $rp->{status}->list_status()]; | 
|  | 0 |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | } | 
| 108 | 0 |  |  |  |  |  | return @n; | 
| 109 |  |  |  |  |  |  | } | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | sub _create_contact | 
| 112 |  |  |  |  |  |  | { | 
| 113 | 0 |  |  | 0 |  |  | my ($rp)=@_; | 
| 114 | 0 |  |  |  |  |  | my @n; | 
| 115 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'id')) | 
| 116 |  |  |  |  |  |  | { | 
| 117 | 0 | 0 |  |  |  |  | push @n,['extreport:conId',Net::DRI::Util::is_class($rp->{id},'Net::DRI::Data::Contact')? $rp->{id}->srid() : $rp->{id} ]; | 
| 118 |  |  |  |  |  |  | } | 
| 119 | 0 |  |  |  |  |  | return @n; | 
| 120 |  |  |  |  |  |  | } | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | sub _create_host | 
| 123 |  |  |  |  |  |  | { | 
| 124 | 0 |  |  | 0 |  |  | my ($rp)=@_; | 
| 125 | 0 |  |  |  |  |  | my @n; | 
| 126 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'name')) | 
| 127 |  |  |  |  |  |  | { | 
| 128 | 0 | 0 |  |  |  |  | push @n,['extreport:name',Net::DRI::Util::is_class($rp->{name},'Net::DRI::Data::Hosts')? $rp->{name}->get_names(1) : $rp->{name} ]; | 
| 129 |  |  |  |  |  |  | } | 
| 130 | 0 |  |  |  |  |  | return @n; | 
| 131 |  |  |  |  |  |  | } | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | sub _create_future | 
| 134 |  |  |  |  |  |  | { | 
| 135 | 0 |  |  | 0 |  |  | my ($rp)=@_; | 
| 136 | 0 |  |  |  |  |  | my @n; | 
| 137 |  |  |  |  |  |  |  | 
| 138 | 0 | 0 |  |  |  |  | if (Net::DRI::Util::has_key($rp,'exDate')) | 
| 139 |  |  |  |  |  |  | { | 
| 140 | 0 |  |  |  |  |  | my $date=$rp->{exDate}; | 
| 141 | 0 | 0 |  |  |  |  | $date=Net::DRI::Util::dto2zstring($date) if Net::DRI::Util::is_class($date,'DateTime'); | 
| 142 | 0 | 0 |  |  |  |  | Net::DRI::Exception::usererr_invalid_parameters('exDate must be in ISO8601 format') unless $date=~m/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/; | 
| 143 | 0 | 0 |  |  |  |  | $date.='Z' unless $date=~m/Z$/; | 
| 144 | 0 |  |  |  |  |  | push @n,['extreport:exDate',$date]; | 
| 145 |  |  |  |  |  |  | } | 
| 146 |  |  |  |  |  |  |  | 
| 147 | 0 |  |  |  |  |  | return @n; | 
| 148 |  |  |  |  |  |  | } | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | sub _create_payment | 
| 151 |  |  |  |  |  |  | { | 
| 152 | 0 |  |  | 0 |  |  | my ($rp)=@_; | 
| 153 | 0 |  |  |  |  |  | my @n; | 
| 154 |  |  |  |  |  |  |  | 
| 155 | 0 | 0 | 0 |  |  |  | Net::DRI::Exception::usererr_insufficient_parameters('account_type value is mandatory for payment reports') unless Net::DRI::Util::has_key($rp,'account_type') && length $rp->{account_type}; | 
| 156 | 0 |  |  |  |  |  | push @n,['extreport:accountType',$rp->{account_type}]; | 
| 157 |  |  |  |  |  |  |  | 
| 158 | 0 |  |  |  |  |  | return @n; | 
| 159 |  |  |  |  |  |  | } | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | sub create_parse | 
| 162 |  |  |  |  |  |  | { | 
| 163 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 164 | 0 |  |  |  |  |  | my $mes=$po->message(); | 
| 165 | 0 | 0 |  |  |  |  | return unless $mes->is_success(); | 
| 166 |  |  |  |  |  |  |  | 
| 167 | 0 |  |  |  |  |  | my $data=$mes->get_extension('extreport','reportData'); | 
| 168 | 0 | 0 |  |  |  |  | return unless defined $data; | 
| 169 |  |  |  |  |  |  |  | 
| 170 | 0 |  |  |  |  |  | my $ns=$mes->ns('extreport'); | 
| 171 | 0 |  |  |  |  |  | my @nodes=Net::DRI::Util::xml_list_children($data); | 
| 172 | 0 |  |  |  |  |  | my ($name,$c)=@{shift @nodes}; | 
|  | 0 |  |  |  |  |  |  | 
| 173 |  |  |  |  |  |  |  | 
| 174 | 0 | 0 |  |  |  |  | if ($name eq 'domDataRsp') | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | { | 
| 176 | 0 |  |  |  |  |  | _parse_domain($po,$otype,$oaction,$oname,$rinfo,$c); | 
| 177 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{type}='domain'; | 
| 178 |  |  |  |  |  |  | } elsif ($name eq 'conDataRsp') | 
| 179 |  |  |  |  |  |  | { | 
| 180 | 0 |  |  |  |  |  | _parse_contact($po,$otype,$oaction,$oname,$rinfo,$c); | 
| 181 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{type}='contact'; | 
| 182 |  |  |  |  |  |  | } elsif ($name eq 'hosDataRsp') | 
| 183 |  |  |  |  |  |  | { | 
| 184 | 0 |  |  |  |  |  | _parse_host($po,$otype,$oaction,$oname,$rinfo,$c); | 
| 185 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{type}='host'; | 
| 186 |  |  |  |  |  |  | } elsif ($name eq 'futDataRsp') | 
| 187 |  |  |  |  |  |  | { | 
| 188 | 0 |  |  |  |  |  | _parse_future($po,$otype,$oaction,$oname,$rinfo,$c); | 
| 189 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{type}='future'; | 
| 190 |  |  |  |  |  |  | } elsif ($name eq 'paymentDataRsp') | 
| 191 |  |  |  |  |  |  | { | 
| 192 | 0 |  |  |  |  |  | _parse_payment($po,$otype,$oaction,$oname,$rinfo,$c); | 
| 193 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{type}='payment'; | 
| 194 |  |  |  |  |  |  | } elsif ($name eq 'paymentFundsDataRsp') | 
| 195 |  |  |  |  |  |  | { | 
| 196 | 0 |  |  |  |  |  | _parse_funds($po,$otype,$oaction,$oname,$rinfo,$c); | 
| 197 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{type}='funds'; | 
| 198 |  |  |  |  |  |  | } | 
| 199 |  |  |  |  |  |  |  | 
| 200 | 0 |  |  |  |  |  | foreach my $el (@nodes) | 
| 201 |  |  |  |  |  |  | { | 
| 202 | 0 |  |  |  |  |  | my ($name,$node)=@$el; | 
| 203 | 0 | 0 |  |  |  |  | if ($name=~m/^(?:offset|limit|size)$/) | 
| 204 |  |  |  |  |  |  | { | 
| 205 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{$name}=$node->textContent(); | 
| 206 |  |  |  |  |  |  | } | 
| 207 |  |  |  |  |  |  | } | 
| 208 | 0 |  |  |  |  |  | return; | 
| 209 |  |  |  |  |  |  | } | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | sub _parse_domain | 
| 212 |  |  |  |  |  |  | { | 
| 213 | 0 |  |  | 0 |  |  | my ($po,$otype,$oaction,$oname,$rinfo,$c)=@_; | 
| 214 |  |  |  |  |  |  |  | 
| 215 | 0 |  |  |  |  |  | my @r; | 
| 216 | 0 |  |  |  |  |  | foreach my $el (map { $_->[1] } grep { $_->[0] eq 'domData' } Net::DRI::Util::xml_list_children($c)) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | { | 
| 218 | 0 |  |  |  |  |  | my %r; | 
| 219 | 0 |  |  |  |  |  | foreach my $subel (Net::DRI::Util::xml_list_children($el)) | 
| 220 |  |  |  |  |  |  | { | 
| 221 | 0 |  |  |  |  |  | my ($name,$node)=@$subel; | 
| 222 | 0 | 0 |  |  |  |  | if ($name=~m/^(?:name|roid)$/) | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | { | 
| 224 | 0 |  |  |  |  |  | $r{$name}=$node->textContent(); | 
| 225 |  |  |  |  |  |  | } elsif ($name eq 'exDate') | 
| 226 |  |  |  |  |  |  | { | 
| 227 | 0 |  |  |  |  |  | $r{$name}=$po->parse_iso8601($node->textContent()); | 
| 228 |  |  |  |  |  |  | } elsif ($name eq 'statuses') | 
| 229 |  |  |  |  |  |  | { | 
| 230 | 0 |  |  |  |  |  | my @s=map { $_->[1]->textContent() } grep { $_->[0] eq 'status' } Net::DRI::Util::xml_list_children($node); | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 231 | 0 |  |  |  |  |  | $r{status}=$po->create_local_object('status')->add(@s); | 
| 232 |  |  |  |  |  |  | } | 
| 233 |  |  |  |  |  |  | } | 
| 234 | 0 |  |  |  |  |  | push @r,\%r; | 
| 235 |  |  |  |  |  |  | } | 
| 236 |  |  |  |  |  |  |  | 
| 237 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{results}=\@r; | 
| 238 | 0 |  |  |  |  |  | return; | 
| 239 |  |  |  |  |  |  | } | 
| 240 |  |  |  |  |  |  |  | 
| 241 |  |  |  |  |  |  | sub _parse_contact | 
| 242 |  |  |  |  |  |  | { | 
| 243 | 0 |  |  | 0 |  |  | my ($po,$otype,$oaction,$oname,$rinfo,$c)=@_; | 
| 244 |  |  |  |  |  |  |  | 
| 245 | 0 |  |  |  |  |  | my @r; | 
| 246 | 0 |  |  |  |  |  | foreach my $el (map { $_->[1] } grep { $_->[0] eq 'conData' } Net::DRI::Util::xml_list_children($c)) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 247 |  |  |  |  |  |  | { | 
| 248 | 0 |  |  |  |  |  | my $c=$po->create_local_object('contact'); | 
| 249 | 0 |  |  |  |  |  | foreach my $subel (Net::DRI::Util::xml_list_children($el)) | 
| 250 |  |  |  |  |  |  | { | 
| 251 | 0 |  |  |  |  |  | my ($name,$node)=@$subel; | 
| 252 | 0 | 0 |  |  |  |  | if ($name eq 'conId') | 
|  |  | 0 |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | { | 
| 254 | 0 |  |  |  |  |  | $c->srid($node->textContent()); | 
| 255 |  |  |  |  |  |  | } elsif ($name eq 'roid') | 
| 256 |  |  |  |  |  |  | { | 
| 257 | 0 |  |  |  |  |  | $c->roid($node->textContent()); | 
| 258 |  |  |  |  |  |  | } | 
| 259 |  |  |  |  |  |  | } | 
| 260 | 0 |  |  |  |  |  | push @r,$c; | 
| 261 |  |  |  |  |  |  | } | 
| 262 |  |  |  |  |  |  |  | 
| 263 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{results}=\@r; | 
| 264 | 0 |  |  |  |  |  | return; | 
| 265 |  |  |  |  |  |  | } | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | sub _parse_host | 
| 268 |  |  |  |  |  |  | { | 
| 269 | 0 |  |  | 0 |  |  | my ($po,$otype,$oaction,$oname,$rinfo,$c)=@_; | 
| 270 |  |  |  |  |  |  |  | 
| 271 | 0 |  |  |  |  |  | my $h=$po->create_local_object('hosts'); | 
| 272 | 0 |  |  |  |  |  | foreach my $el (map { $_->[1] } grep { $_->[0] eq 'hosData' } Net::DRI::Util::xml_list_children($c)) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 273 |  |  |  |  |  |  | { | 
| 274 | 0 |  |  |  |  |  | my ($hostname,$hostroid); | 
| 275 | 0 |  |  |  |  |  | foreach my $subel (Net::DRI::Util::xml_list_children($el)) | 
| 276 |  |  |  |  |  |  | { | 
| 277 | 0 |  |  |  |  |  | my ($name,$node)=@$subel; | 
| 278 | 0 | 0 |  |  |  |  | if ($name eq 'name') | 
|  |  | 0 |  |  |  |  |  | 
| 279 |  |  |  |  |  |  | { | 
| 280 | 0 |  |  |  |  |  | $hostname=$node->textContent(); | 
| 281 |  |  |  |  |  |  | } elsif ($name eq 'roid') | 
| 282 |  |  |  |  |  |  | { | 
| 283 | 0 |  |  |  |  |  | $hostroid=$node->textContent(); | 
| 284 |  |  |  |  |  |  | } | 
| 285 |  |  |  |  |  |  | } | 
| 286 | 0 |  |  |  |  |  | $h->add($hostname,undef,undef,{roid => $hostroid}); | 
| 287 |  |  |  |  |  |  | } | 
| 288 |  |  |  |  |  |  |  | 
| 289 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{results}=$h; | 
| 290 | 0 |  |  |  |  |  | return; | 
| 291 |  |  |  |  |  |  | } | 
| 292 |  |  |  |  |  |  |  | 
| 293 |  |  |  |  |  |  | sub _parse_future | 
| 294 |  |  |  |  |  |  | { | 
| 295 | 0 |  |  | 0 |  |  | my ($po,$otype,$oaction,$oname,$rinfo,$c)=@_; | 
| 296 |  |  |  |  |  |  |  | 
| 297 | 0 |  |  |  |  |  | my @r; | 
| 298 | 0 |  |  |  |  |  | foreach my $el (map { $_->[1] } grep { $_->[0] eq 'futData' } Net::DRI::Util::xml_list_children($c)) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 299 |  |  |  |  |  |  | { | 
| 300 | 0 |  |  |  |  |  | my %r; | 
| 301 | 0 |  |  |  |  |  | foreach my $subel (Net::DRI::Util::xml_list_children($el)) | 
| 302 |  |  |  |  |  |  | { | 
| 303 | 0 |  |  |  |  |  | my ($name,$node)=@$subel; | 
| 304 | 0 | 0 |  |  |  |  | if ($name=~m/^(?:name|roid)$/) | 
|  |  | 0 |  |  |  |  |  | 
| 305 |  |  |  |  |  |  | { | 
| 306 | 0 |  |  |  |  |  | $r{$name}=$node->textContent(); | 
| 307 |  |  |  |  |  |  | } elsif ($name eq 'exDate') | 
| 308 |  |  |  |  |  |  | { | 
| 309 | 0 |  |  |  |  |  | $r{$name}=$po->parse_iso8601($node->textContent()); | 
| 310 |  |  |  |  |  |  | } | 
| 311 |  |  |  |  |  |  | } | 
| 312 | 0 |  |  |  |  |  | push @r,\%r; | 
| 313 |  |  |  |  |  |  | } | 
| 314 |  |  |  |  |  |  |  | 
| 315 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{results}=\@r; | 
| 316 | 0 |  |  |  |  |  | return; | 
| 317 |  |  |  |  |  |  | } | 
| 318 |  |  |  |  |  |  |  | 
| 319 |  |  |  |  |  |  | sub _parse_payment | 
| 320 |  |  |  |  |  |  | { | 
| 321 | 0 |  |  | 0 |  |  | my ($po,$otype,$oaction,$oname,$rinfo,$c)=@_; | 
| 322 |  |  |  |  |  |  |  | 
| 323 | 0 |  |  |  |  |  | my @r; | 
| 324 | 0 |  |  |  |  |  | foreach my $el (map { $_->[1] } grep { $_->[0] eq 'paymentData' } Net::DRI::Util::xml_list_children($c)) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 325 |  |  |  |  |  |  | { | 
| 326 | 0 |  |  |  |  |  | my %r; | 
| 327 | 0 |  |  |  |  |  | foreach my $subel (Net::DRI::Util::xml_list_children($el)) | 
| 328 |  |  |  |  |  |  | { | 
| 329 | 0 |  |  |  |  |  | my ($name,$node)=@$subel; | 
| 330 | 0 | 0 |  |  |  |  | if ($name eq 'roid') | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 331 |  |  |  |  |  |  | { | 
| 332 | 0 |  |  |  |  |  | $r{$name}=$node->textContent(); | 
| 333 |  |  |  |  |  |  | } elsif ($name eq 'crDate') | 
| 334 |  |  |  |  |  |  | { | 
| 335 | 0 |  |  |  |  |  | $r{$name}=$po->parse_iso8601($node->textContent()); | 
| 336 |  |  |  |  |  |  | } elsif ($name=~m/^(?:grossValue|vatPercent|vatValue|initialFunds|currentFunds)$/) | 
| 337 |  |  |  |  |  |  | { | 
| 338 | 0 |  |  |  |  |  | $r{Net::DRI::Util::remcam($name)}=0+$node->textContent(); | 
| 339 |  |  |  |  |  |  | } | 
| 340 |  |  |  |  |  |  | } | 
| 341 | 0 |  |  |  |  |  | push @r,\%r; | 
| 342 |  |  |  |  |  |  | } | 
| 343 |  |  |  |  |  |  |  | 
| 344 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{results}=\@r; | 
| 345 | 0 |  |  |  |  |  | return; | 
| 346 |  |  |  |  |  |  | } | 
| 347 |  |  |  |  |  |  |  | 
| 348 |  |  |  |  |  |  | sub _parse_funds | 
| 349 |  |  |  |  |  |  | { | 
| 350 | 0 |  |  | 0 |  |  | my ($po,$otype,$oaction,$oname,$rinfo,$c)=@_; | 
| 351 |  |  |  |  |  |  |  | 
| 352 | 0 |  |  |  |  |  | my %r; | 
| 353 | 0 |  |  |  |  |  | my ($el)=(map { $_->[1] } grep { $_->[0] eq 'paymentFundsData' } Net::DRI::Util::xml_list_children($c)); ## only one of them | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 354 | 0 |  |  |  |  |  | foreach my $subel (Net::DRI::Util::xml_list_children($el)) | 
| 355 |  |  |  |  |  |  | { | 
| 356 | 0 |  |  |  |  |  | my ($name,$node)=@$subel; | 
| 357 | 0 | 0 |  |  |  |  | if ($name eq 'currentBalance') | 
| 358 |  |  |  |  |  |  | { | 
| 359 | 0 |  |  |  |  |  | $r{Net::DRI::Util::remcam($name)}=0+$node->textContent(); | 
| 360 |  |  |  |  |  |  | } | 
| 361 |  |  |  |  |  |  | } | 
| 362 |  |  |  |  |  |  |  | 
| 363 | 0 |  |  |  |  |  | $rinfo->{report}->{$oname}->{results}=\%r; | 
| 364 | 0 |  |  |  |  |  | return; | 
| 365 |  |  |  |  |  |  | } | 
| 366 |  |  |  |  |  |  |  | 
| 367 |  |  |  |  |  |  | #################################################################################################### | 
| 368 |  |  |  |  |  |  | 1; | 
| 369 |  |  |  |  |  |  |  | 
| 370 |  |  |  |  |  |  | __END__ |