File Coverage

blib/lib/Net/DRI/Protocol/EPP/Extensions/IT/Contact.pm
Criterion Covered Total %
statement 6 25 24.0
branch 0 12 0.0
condition n/a
subroutine 2 6 33.3
pod 0 4 0.0
total 8 47 17.0


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, .IT Contact EPP extension
2             ##
3             ## Copyright (C) 2009-2010,2013 Tower Technologies. All rights reserved.
4             ##
5             ## This program is free software; you can redistribute it and/or modify
6             ## it under the terms of the GNU General Public License v2.
7              
8             package Net::DRI::Protocol::EPP::Extensions::IT::Contact;
9              
10 1     1   972 use strict;
  1         1  
  1         28  
11 1     1   5 use warnings;
  1         2  
  1         247  
12              
13             =pod
14              
15             =head1 NAME
16              
17             Net::DRI::Protocol::EPP::Extensions::IT::Contact - .IT EPP Contact extension for Net::DRI
18              
19             =head1 SUPPORT
20              
21             For now, support questions should be sent to:
22              
23             Enoc@towertech.itE
24              
25             Please also see the SUPPORT file in the distribution.
26              
27             =head1 AUTHOR
28              
29             Alessandro Zummo, Ea.zummo@towertech.itE
30              
31             =head1 COPYRIGHT
32              
33             Copyright (C) 2009-2010,2013 Tower Technologies.
34             All rights reserved.
35              
36             This program is free software; you can redistribute it and/or modify
37             it under the terms of the GNU General Public License v2 as published by
38             the Free Software Foundation.
39              
40             See the LICENSE file that comes with this distribution for more details.
41              
42             =cut
43              
44              
45             sub register_commands
46             {
47 0     0 0   my ($class, $version) = @_;
48              
49 0           my $ops = {
50             'create' => [ \&create, undef ],
51             };
52              
53 0           return { 'contact' => $ops };
54             }
55              
56             sub build_command_extension
57             {
58 0     0 0   my ($msg, $epp, $tag) = @_;
59              
60 0           return $msg->command_extension_register($tag,
61             sprintf('xmlns:extcon="%s" xsi:schemaLocation="%s %s"', $msg->nsattrs('it_contact')));
62             }
63              
64             sub fix_contact
65             {
66 0     0 0   my ($epp, $c, $op) = @_;
67 0           my $msg = $epp->message;
68              
69 0           my $eid = build_command_extension($msg, $epp, 'extcon:' . $op);
70              
71 0           my @ext;
72              
73 0 0         push @ext, [ 'extcon:consentForPublishing', $c->consent_for_publishing ]
74             if defined $c->consent_for_publishing;
75              
76             # registrant data (do not alter the order, there's people
77             # who likes to use in xsds)
78 0           my @registrant;
79              
80 0 0         push @registrant, [ 'extcon:nationalityCode', $c->nationality_code ]
81             if defined $c->nationality_code;
82              
83 0 0         push @registrant, [ 'extcon:entityType', $c->entity_type ]
84             if defined $c->entity_type;
85              
86 0 0         push @registrant, [ 'extcon:regCode', $c->reg_code ]
87             if defined $c->reg_code;
88              
89              
90 0 0         push @ext, [ 'extcon:registrant', @registrant ]
91             if scalar @registrant;
92              
93 0 0         $msg->command_extension($eid, [ @ext ])
94             if scalar @ext;
95 0           return;
96             }
97              
98             sub create
99             {
100 0     0 0   my ($epp, $contact) = @_;
101              
102 0           return fix_contact($epp, $contact, 'create');
103             }
104              
105             1;