| 1 | ## Domain Registry Interface, nic.at domain transactions extension | ||||||||||||||||||||||||||||
| 2 | ## Contributed by Michael Braunoeder from NIC.AT <mib@nic.at> | ||||||||||||||||||||||||||||
| 3 | ## | ||||||||||||||||||||||||||||
| 4 | ## Copyright (c) 2006-2008,2013,2016,2018,2019 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 5 | ## | ||||||||||||||||||||||||||||
| 6 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 7 | ## | ||||||||||||||||||||||||||||
| 8 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 9 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 10 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 11 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 12 | ## | ||||||||||||||||||||||||||||
| 13 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 14 | #################################################################################################### | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | package Net::DRI::Protocol::EPP::Extensions::AT::Domain; | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use feature 'state'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | #################################################################################################### | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub register_commands { | ||||||||||||||||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | my ( $class, $version ) = @_; | |||||||||||||||||||||||||||
| 29 | 0 | state $rops = { domain => { nocommand => [ \&extonly, \&extonly_parse_result ], | |||||||||||||||||||||||||||
| 30 | delete => [ \&delete, undef ], | ||||||||||||||||||||||||||||
| 31 | transfer_request => [ \&transfer_request, \&extonly_parse_result ], | ||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||
| 33 | }; | ||||||||||||||||||||||||||||
| 34 | 0 | return $rops; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub setup | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 0 | my ($class,$po,$version)=@_; | |||||||||||||||||||||||||||
| 40 | 0 | state $ns = { 'at-ext-domain' => 'http://www.nic.at/xsd/at-ext-domain-1.0', | |||||||||||||||||||||||||||
| 41 | 'at-ext-epp' => 'http://www.nic.at/xsd/at-ext-epp-1.0', | ||||||||||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||||||||||
| 43 | 0 | $po->ns($ns); | |||||||||||||||||||||||||||
| 44 | 0 | return; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | #################################################################################################### | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub extonly { | ||||||||||||||||||||||||||
|
Subroutine
extonly: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | my ( $epp, $domain, $rd ) = @_; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | my $transaction; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | $transaction = $rd->{transactionname} if $rd->{transactionname}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | return unless ($transaction); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | my $mes = $epp->message(); | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/EPP',2,'Domain name needed') unless defined($domain) && $domain; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $domain and $domain
MC/DC0%0/2
defined $domain and $domain
defined $domain
$domain
Truth table0%0/3
A and B
A= defined $domainB= $domain
| |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid domain name: '.$domain) unless Net::DRI::Util::is_hostname($domain); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | ##$mes->command_body([['domain:name',$domain]]); ## Useless if pure extension | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | my $cltrid=$mes->cltrid(); | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ( $transaction eq 'withdraw' ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | my %domns; | |||||||||||||||||||||||||||
| 68 | 0 | $domns{'xmlns:domain'} = $mes->ns('at-ext-domain'); | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | my %zdhash; | |||||||||||||||||||||||||||
| 71 | 0 | ▶ | $zdhash{'value'} = $rd->{zd} ? $rd->{zd} : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | $mes->command_extension( | |||||||||||||||||||||||||||
| 74 | 'at-ext-epp', | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | ['command', | ||||||||||||||||||||||||||||
| 77 | ['withdraw', | ||||||||||||||||||||||||||||
| 78 | [ 'domain:withdraw', ['domain:name', $domain], \%domns , | ||||||||||||||||||||||||||||
| 79 | ['domain:zd', \%zdhash], \%domns ]], | ||||||||||||||||||||||||||||
| 80 | ['clTRID', $cltrid ] | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | ] | ||||||||||||||||||||||||||||
| 83 | ); | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | elsif ( $transaction eq 'transfer_execute' ) { | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 0 | my $token; | |||||||||||||||||||||||||||
| 91 | 0 | ▶ | $token = $rd->{token} if $rd->{token}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | return unless ( defined($token) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | my %domns; | |||||||||||||||||||||||||||
| 96 | 0 | $domns{'xmlns:domain'} = $mes->ns('domain'); | |||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | my %domns2; | |||||||||||||||||||||||||||
| 99 | 0 | $domns2{'xmlns:at-ext-domain'} = $mes->ns('at-ext-domain'); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | $mes->command_extension( | |||||||||||||||||||||||||||
| 104 | 'at-ext-epp', | ||||||||||||||||||||||||||||
| 105 | ['command', | ||||||||||||||||||||||||||||
| 106 | ['transfer', | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | { 'op' => 'execute' }, | ||||||||||||||||||||||||||||
| 109 | [ 'domain:transfer', \%domns, [ 'domain:name', $domain ] | ||||||||||||||||||||||||||||
| 110 | ] | ||||||||||||||||||||||||||||
| 111 | ], | ||||||||||||||||||||||||||||
| 112 | ['extension', | ||||||||||||||||||||||||||||
| 113 | ['at-ext-domain:transfer' , \%domns2, ['at-ext-domain:token',$token] | ||||||||||||||||||||||||||||
| 114 | ] | ||||||||||||||||||||||||||||
| 115 | ], | ||||||||||||||||||||||||||||
| 116 | ['clTRID', $cltrid] | ||||||||||||||||||||||||||||
| 117 | ] | ||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | 0 | return; | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub delete { ## no critic (Subroutines::ProhibitBuiltinHomonyms) | ||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | my ( $epp, $domain, $rd ) = @_; | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | my $scheduledate; | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | $scheduledate = $rd->{scheduledate} if $rd->{scheduledate}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | return unless defined $scheduledate; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | $epp->message()->command_extension( 'at-ext-domain', ['delete', [ 'ascheduledate', $scheduledate ] ] ); | |||||||||||||||||||||||||||
| 134 | 0 | return; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub transfer_request { | ||||||||||||||||||||||||||
|
Subroutine
transfer_request: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 138 | 0 | my ( $epp, $domain, $rd ) = @_; | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 0 | my $registrarinfo; | |||||||||||||||||||||||||||
| 141 | 0 | ▶ | $registrarinfo = $rd->{registrarinfo} if $rd->{registrarinfo}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | return unless ( defined($registrarinfo) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | my %entryname = { name => 'Registrarinfo' }; | |||||||||||||||||||||||||||
| 146 | 0 | $epp->message()->command_extension( 'at-ext-domain', ['clientdata', [ 'entry', \%entryname, $registrarinfo ]] ); | |||||||||||||||||||||||||||
| 147 | 0 | return; | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub extonly_parse_result { | ||||||||||||||||||||||||||
|
Subroutine
extonly_parse_result: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 151 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||||||||||||||||||||
| 152 | 0 | my $mes=$po->message(); | |||||||||||||||||||||||||||
| 153 | 0 | ▶ | return unless $mes->is_success(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | my $keydatedata=$mes->get_extension('at-ext-domain', 'keydate'); | |||||||||||||||||||||||||||
| 156 | 0 | ▶ | return unless defined $keydatedata; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | my $keydate = $keydatedata->textContent(); | |||||||||||||||||||||||||||
| 159 | 0 | ▶ | return unless defined $keydate; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | $rinfo->{domain}->{$oname}->{keydate}=$keydate; | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | return; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | #################################################################################################### | ||||||||||||||||||||||||||||
| 169 | 1 | 1; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | __END__ | ||||||||||||||||||||||||||||