File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/VeriSign/PollLowBalance.pm
Criterion Covered Total %
statement 9 30 30.0
branch 0 12 0.0
condition 0 3 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 52 23.0


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, EPP Low Balance (EPP-LowBalance-Mapping.pdf)
2             ##
3             ## Copyright (c) 2006-2008,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::VeriSign::PollLowBalance;
16              
17 1     1   925 use strict;
  1         2  
  1         27  
18 1     1   4 use warnings;
  1         2  
  1         22  
19              
20 1     1   4 use Net::DRI::Util;
  1         2  
  1         297  
21              
22             =pod
23              
24             =head1 NAME
25              
26             Net::DRI::Protocol::EPP::Extensions::VeriSign::PollLowBalance - EPP Low Balance Mapping (EPP-LowBalance-Mapping.pdf) 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             Patrick Mevzek, Enetdri@dotandco.comE
47              
48             =head1 COPYRIGHT
49              
50             Copyright (c) 2006-2008,2013 Patrick Mevzek .
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             lowbalance => [ undef, \&parse ],
69             );
70              
71 0           return { 'message' => \%tmp };
72             }
73              
74             ####################################################################################################
75              
76             sub parse
77             {
78 0     0 0   my ($po,$otype,$oaction,$oname,$rinfo)=@_;
79 0           my $mes=$po->message();
80 0 0         return unless $mes->is_success();
81              
82 0           my $infdata=$mes->get_response('http://www.verisign.com/epp/lowbalance-poll-1.0','pollData');
83 0 0         return unless $infdata;
84              
85 0           my %w=(action => 'lowbalance_notification');
86 0           my $c=$infdata->getFirstChild();
87 0           while ($c)
88             {
89 0 0         next unless ($c->nodeType() == 1); ## only for element nodes
90 0   0       my $name=$c->localname() || $c->nodeName();
91 0 0         next unless $name;
92              
93 0 0         if ($name=~m/^(registrarName|creditLimit|availableCredit)$/)
    0          
94             {
95 0           $w{Net::DRI::Util::remcam($name)}=$c->getFirstChild()->getData();
96             } elsif ($name eq 'creditThreshold')
97             {
98 0           $w{Net::DRI::Util::remcam($name)}=$c->getFirstChild()->getData();
99 0           $w{'credit_threshold_type'}=$c->getAttribute('type');
100             }
101 0           } continue { $c=$c->getNextSibling(); }
102              
103 0           $rinfo->{session}->{lowbalance}=\%w;
104 0           return;
105             }
106              
107             ####################################################################################################
108             1;