DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm

filter: Statementstmt 29.4% 10 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 24.5% 13 / 53 CC 6 SCAR 30.8
CC
6
Cov
24%
balance_info_parse
42.0
register_commands
2.0
setup
2.0
CRAP 21.8
« DRI/Protocol/EPP/Extensions/PL/Contact.pm ↑ Summary DRI/Data/Contact/SE.pm »
1 ## Domain Registry Interface, VeriSign Balance object mapping EPP extension
2 ##
3 ## Copyright (c) 2013,2018 Patrick Mevzek <netdri@dotandco.com>. 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::Balance;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 ####################################################################################################
23  
24 sub register_commands
25 {
26 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 return { 'balance' => { info => [ \&balance_info_build, \&balance_info_parse ],
28 },
29 };
30 }
31  
32 sub setup
33 {
34 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
35 0 $po->ns({ 'balance' => 'http://www.verisign.com/epp/balance-1.0' });
36 0 return;
37 }
38  
39 ####################################################################################################
40  
41 sub balance_info_build
42 {
43 0 ▶ my ($epp)=@_;
Subroutine balance_info_build: not called CC=1 SCAR=6.9
Pod undocumented
44 0 my $mes=$epp->message();
45  
46 0 $mes->command(['info','balance:info', $mes->nsattrs('balance')]);
47 0 return;
48 }
49  
50 sub balance_info_parse
51 {
52 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine balance_info_parse: not called CC=6 SCAR=37.4
Pod undocumented
53 0 my $mes=$po->message();
54 0 ▶ return unless $mes->is_success();
Branch: 1 branch
BranchTrueFalseTotal
unless $mes->is_success 0 0 0
55  
56 0 my $data=$mes->get_response('balance','infData');
57 0 ▶ return unless defined $data;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
58  
59 0 my %w=(action => 'balance_info');
60 0 foreach my $el (Net::DRI::Util::xml_list_children($data))
61 {
62 0 my ($name,$c)=@$el;
63 0 ▶ if ($name=~m/^(?:creditLimit|balance|availableCredit)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($name =~ /^(?:creditLimit|balance|availableCredit)$/) { } 0 0 0
elsif ($name eq 'creditThreshold') { } 0 0 0
64 {
65 0 $w{Net::DRI::Util::remcam($name)}=0+$c->textContent();
66 } elsif ($name eq 'creditThreshold')
67 {
68 0 my ($ct)=Net::DRI::Util::xml_list_children($c);
69 0 $w{'credit_threshold'}=0+$ct->[1]->textContent();
70 0 $w{'credit_threshold_type'}=uc $ct->[0]; ## to be compatible with lowBalance poll
71 }
72 }
73  
74 0 $rinfo->{session}->{balance}=\%w;
75 0 return;
76 }
77  
78 ####################################################################################################
79 1 1;
80  
81 __END__
82  
83 =pod
84  
85 =head1 NAME
86  
87 Net::DRI::Protocol::EPP::Extensions::VeriSign::Balance - VeriSign Balance object mapping EPP Extension for Net::DRI
88  
89 =head1 DESCRIPTION
90  
91 Please see the README file for details.
92  
93 =head1 SUPPORT
94  
95 For now, support questions should be sent to:
96  
97 E<lt>netdri@dotandco.comE<gt>
98  
99 Please also see the SUPPORT file in the distribution.
100  
101 =head1 SEE ALSO
102  
103 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
104  
105 =head1 AUTHOR
106  
107 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
108  
109 =head1 COPYRIGHT
110  
111 Copyright (c) 2013,2018 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
112 All rights reserved.
113  
114 This program is free software; you can redistribute it and/or modify
115 it under the terms of the GNU General Public License as published by
116 the Free Software Foundation; either version 2 of the License, or
117 (at your option) any later version.
118  
119 See the LICENSE file that comes with this distribution for more details.
120  
121 =cut
« DRI/Protocol/EPP/Extensions/PL/Contact.pm ↑ Summary DRI/Data/Contact/SE.pm »