| 1 | ## Domain Registry Interface, Registration Type Extension Mapping for EPP | ||||||||||
| 2 | ## | ||||||||||
| 3 | ## Copyright (c) 2016,2018-2019 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::CentralNic::RegType; | ||||||||||
| 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 | 0 | ▶ | { | ||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 28 | 0 | my ($class,$version)=@_; | |||||||||
| 29 | 0 | state $rcmds = { 'domain' => { | |||||||||
| 30 | 'check' => [ \&check, undef ], | ||||||||||
| 31 | 'check_multi' => [ \&check, undef ], | ||||||||||
| 32 | 'info' => [ undef, \&info_parse ], | ||||||||||
| 33 | 'create' => [ \&create, undef ], | ||||||||||
| 34 | 'update' => [ \&update, undef ], | ||||||||||
| 35 | }, | ||||||||||
| 36 | }; | ||||||||||
| 37 | 0 | return $rcmds; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | sub setup | ||||||||||
| 41 | 0 | ▶ | { | ||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 42 | 0 | my ($class,$po,$version)=@_; | |||||||||
| 43 | 0 | state $rns = { 'regType' => 'urn:ietf:params:xml:ns:regtype-0.2' }; | |||||||||
| 44 | 0 | $po->ns($rns); | |||||||||
| 45 | 0 | return; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub capabilities_add { return ('domain_update', 'registration_type', [qw/set/]); } | ||||||||
|
Subroutine
capabilities_add: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub implements { return 'https://gitlab.centralnic.com/centralnic/epp-registration-type-extension/blob/e210c27730c8926324e502efff4d0ad77190d7c2/draft-brown-regtype.txt'; } | ||||||||
|
Subroutine
implements: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 51 | |||||||||||
| 52 | #################################################################################################### | ||||||||||
| 53 | |||||||||||
| 54 | sub _regtype | ||||||||||
| 55 | 0 | ▶ | { | ||||||||
|
Subroutine
_regtype: not called CC=3 SCAR=24.8
| |||||||||||
| 56 | 0 | my ($rd) = @_; | |||||||||
| 57 | 0 | ▶ | return unless Net::DRI::Util::has_key($rd, 'registration_type'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 0 | ▶ | Net::DRI::Exception::usererr_invalid_parameters('registration_type must be an XML token with at least one character') unless Net::DRI::Util::xml_is_token($rd->{registration_type},1); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | return $rd->{registration_type}; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | sub _build | ||||||||||
| 63 | 0 | ▶ | { | ||||||||
|
Subroutine
_build: not called CC=2 SCAR=17.9
| |||||||||||
| 64 | 0 | my ($epp,$domain,$rd,$command)=@_; | |||||||||
| 65 | 0 | my $regtype = _regtype($rd); | |||||||||
| 66 | 0 | ▶ | $epp->message()->command_extension('regType', [$command, ['type', $regtype]]) if $regtype; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | |||||||||||
| 68 | 0 | return; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | sub check | ||||||||||
| 72 | 0 | ▶ | { | ||||||||
|
Subroutine
check: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 73 | 0 | my ($epp,$domain,$rd)=@_; | |||||||||
| 74 | 0 | return _build($epp,$domain,$rd,'check'); | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | sub info_parse | ||||||||||
| 78 | 0 | ▶ | { | ||||||||
|
Subroutine
info_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 79 | 0 | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | |||||||||
| 80 | 0 | my $mes=$po->message(); | |||||||||
| 81 | 0 | ▶ | return unless $mes->is_success(); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 82 | |||||||||||
| 83 | 0 | my $ns=$mes->ns('regType'); | |||||||||
| 84 | 0 | my $data=$mes->get_extension('regType', 'infData'); | |||||||||
| 85 | 0 | ▶ | return unless defined $data; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 86 | |||||||||||
| 87 | 0 | $rinfo->{domain}->{$oname}->{registration_type}=Net::DRI::Util::xml_child_content($data, $ns, 'type'); | |||||||||
| 88 | |||||||||||
| 89 | 0 | return; | |||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | sub create | ||||||||||
| 93 | 0 | ▶ | { | ||||||||
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 94 | 0 | my ($epp,$domain,$rd)=@_; | |||||||||
| 95 | 0 | return _build($epp,$domain,$rd,'create'); | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | sub update | ||||||||||
| 99 | 0 | ▶ | { | ||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 100 | 0 | my ($epp,$domain,$todo)=@_; | |||||||||
| 101 | |||||||||||
| 102 | 0 | my $regtype = _regtype({ registration_type => $todo->set('registration_type') }); | |||||||||
| 103 | 0 | ▶ | $epp->message()->command_extension('regType', ['update', ['chg', ['type', $regtype]]]) if $regtype; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 104 | |||||||||||
| 105 | 0 | return; | |||||||||
| 106 | } | ||||||||||
| 107 | |||||||||||
| 108 | #################################################################################################### | ||||||||||
| 109 | 1 | 1; | |||||||||
| 110 | |||||||||||
| 111 | __END__ | ||||||||||