« DRI/Protocol/EPP/Extensions/ResellerInfo.pm
↑ Summary
DRI/Protocol/EPP/Extensions/NeuLevel/WhoisType.pm »
| 1 | ## Domain Registry Interface, VeriSign EPP Premium Domain Extension | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2010,2012,2013,2016,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::PremiumDomain; | ||||||||||||||||||||||||||||
| 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 | 1 | ▶ | use feature 'state'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | #################################################################################################### | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub register_commands | ||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | my ($class,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | state $cmds = { 'domain' => { 'check' => [ \&check, \&check_parse ], | |||||||||||||||||||||||||||
| 31 | 'update' => [ \&update, undef ], | ||||||||||||||||||||||||||||
| 32 | } }; | ||||||||||||||||||||||||||||
| 33 | 0 | return $cmds; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub capabilities_add { return ('domain_update','premium_short_name',['set']); } | ||||||||||||||||||||||||||
|
Subroutine
capabilities_add: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub setup | ||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my ($class,$po,$version)=@_; | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 0 | state $rns = { 'premiumdomain' => 'http://www.verisign.com/epp/premiumdomain-1.0' }; | |||||||||||||||||||||||||||
| 42 | 0 | $po->ns($rns); | |||||||||||||||||||||||||||
| 43 | 0 | return; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | #################################################################################################### | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub check | ||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my ($epp,$domain,$rd)=@_; | ||||||||||||||||||||||||||
|
Subroutine
check: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 0 | my $mes=$epp->message(); | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | my $pd; | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | if (Net::DRI::Util::has_key($rd,'premium_domain')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | { | ||||||||||||||||||||||||||||
| 56 | 0 | $pd=$rd->{premium_domain}; | |||||||||||||||||||||||||||
| 57 | } else | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 0 | my $def=$epp->default_parameters(); | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (Net::DRI::Util::has_key($def,'premium_domain')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||
| 62 | 0 | $pd=$def->{premium_domain}; | |||||||||||||||||||||||||||
| 63 | } else | ||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 0 | Net::DRI::Exception::usererr_insufficient_parameters('Premium domain flag must be provided'); | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('Premium domain flag must be true/false/1/0') unless Net::DRI::Util::xml_is_boolean($pd); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | my $eid=$mes->command_extension_register('premiumdomain', 'check'); | |||||||||||||||||||||||||||
| 71 | 0 | $mes->command_extension($eid,['premiumdomain:flag',$pd]); | |||||||||||||||||||||||||||
| 72 | 0 | return; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | sub check_parse | ||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
check_parse: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 79 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | my $chkdata=$mes->get_extension('premiumdomain','chkData'); | |||||||||||||||||||||||||||
| 82 | 0 | ▶ | return unless defined $chkdata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | foreach my $cd ($chkdata->getChildrenByTagNameNS($mes->ns('premiumdomain'),'cd')) | |||||||||||||||||||||||||||
| 85 | { | ||||||||||||||||||||||||||||
| 86 | 0 | my $domain; | |||||||||||||||||||||||||||
| 87 | 0 | foreach my $el (Net::DRI::Util::xml_list_children($cd)) | |||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||
| 89 | 0 | my ($n,$c)=@$el; | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ($n eq 'name') | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||
| 92 | 0 | $domain=lc($c->textContent()); | |||||||||||||||||||||||||||
| 93 | 0 | $rinfo->{domain}->{$domain}->{is_premium}=Net::DRI::Util::xml_parse_boolean($c->getAttribute('premium')); | |||||||||||||||||||||||||||
| 94 | } elsif ($n eq 'price') | ||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||
| 96 | 0 | $rinfo->{domain}->{$domain}->{price}={ amount => 0+$c->textContent(), unit => $c->getAttribute('unit') }; | |||||||||||||||||||||||||||
| 97 | } elsif ($n eq 'renewalPrice') | ||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||
| 99 | 0 | $rinfo->{domain}->{$domain}->{renewal_price}={ amount => 0+$c->textContent(), unit => $c->getAttribute('unit') }; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | 0 | return; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | sub update | ||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||
| 108 | 0 | ▶ | my ($po,$domain,$todo)=@_; | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | my $chg=$todo->set('premium_short_name'); | |||||||||||||||||||||||||||
| 111 | 0 | ▶ | return unless defined $chg && length $chg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $chg and length $chg
MC/DC0%0/2
defined $chg and length $chg
defined $chg
length $chg
Truth table0%0/3
A and B
A= defined $chgB= length $chg
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 114 | 0 | my $eid=$mes->command_extension_register('premiumdomain', 'reassign'); | |||||||||||||||||||||||||||
| 115 | 0 | $mes->command_extension($eid,['premiumdomain:shortName',$chg]); | |||||||||||||||||||||||||||
| 116 | 0 | return; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | ######################################################################################################### | ||||||||||||||||||||||||||||
| 120 | 1 | 1; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | __END__ | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =pod | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =head1 NAME | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | Net::DRI::Protocol::EPP::Extensions::VeriSign::PremiumDomain - VeriSign EPP Premium Domain Extension for Net::DRI | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | $dri=Net::DRI->new(); | ||||||||||||||||||||||||||||
| 133 | $dri->add_registry('VeriSign::NameStore',{client_id=>'XXXXXX'); | ||||||||||||||||||||||||||||
| 134 | $dri->add_profile('p1','epp',{... transport ...},{extensions => [ 'VeriSign::DomainPremium' ]}); | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | $dri->protocol->default_parameters()->{premium_domain}=1; | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | ... | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | $rc=$dri->domain_check('example.tv'); | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | ... | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | $rc=$dri->domain_update('premium.tv',$dri->local_object('changes')->set('premium_short_name','testregistrar')); | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | Please see the README file for details. | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | Copyright (c) 2010,2012,2013,2016,2018 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||
| 169 | All rights reserved. | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 172 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 173 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 174 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | =cut | ||||||||||||||||||||||||||||