| 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 | 0 | ▶ | { | ||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 26 | 0 | my ($class,$version)=@_; | |||||||||||||
| 27 | 0 | return { 'balance' => { info => [ \&balance_info_build, \&balance_info_parse ], | |||||||||||||
| 28 | }, | ||||||||||||||
| 29 | }; | ||||||||||||||
| 30 | } | ||||||||||||||
| 31 | |||||||||||||||
| 32 | sub setup | ||||||||||||||
| 33 | 0 | ▶ | { | ||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 34 | 0 | my ($class,$po,$version)=@_; | |||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||
|
Subroutine
balance_info_build: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 43 | 0 | my ($epp)=@_; | |||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||
|
Subroutine
balance_info_parse: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||
| 52 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||
| 53 | 0 | my $mes=$po->message(); | |||||||||||||
| 54 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 55 | |||||||||||||||
| 56 | 0 | my $data=$mes->get_response('balance','infData'); | |||||||||||||
| 57 | 0 | ▶ | return unless defined $data; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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
| |||||||||||||||
| 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__ | ||||||||||||||