Net::DRI::Protocol::EPP::Extensions::IT::Contact - .IT EPP Contact extension for Net::DRI


Net-DRI documentation Contained in the Net-DRI distribution.

Index


Code Index:

NAME

Top

Net::DRI::Protocol::EPP::Extensions::IT::Contact - .IT EPP Contact extension for Net::DRI

SUPPORT

Top

For now, support questions should be sent to:

<noc@towertech.it>

Please also see the SUPPORT file in the distribution.

AUTHOR

Top

Alessandro Zummo, <a.zummo@towertech.it>

COPYRIGHT

Top


Net-DRI documentation Contained in the Net-DRI distribution.

## Domain Registry Interface, .IT Contact EPP extension
##
## Copyright (C) 2009-2010 Tower Technologies. All rights reserved.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License v2.
#
# 
#

package Net::DRI::Protocol::EPP::Extensions::IT::Contact;

use strict;
use warnings;

our $VERSION=do { my @r=(q$Revision: 1.1 $=~/\d+/g); sprintf("%d".".%02d" x $#r, @r); };


sub register_commands
{
       my ($class, $version) = @_;

       my $ops = {
               'create' => [ \&create, undef ],
       };

       return { 'contact' => $ops };
}

sub build_command_extension
{
       my ($msg, $epp, $tag) = @_;

       return $msg->command_extension_register($tag,
               sprintf('xmlns:extcon="%s" xsi:schemaLocation="%s %s"', $msg->nsattrs('it_contact')));
}

sub fix_contact
{
       my ($epp, $c, $op) = @_;
       my $msg = $epp->message;

       my $eid = build_command_extension($msg, $epp, 'extcon:' . $op);

       my @ext;

       push @ext, [ 'extcon:consentForPublishing', $c->consent_for_publishing ]
               if defined $c->consent_for_publishing;

       # registrant data (do not alter the order, there's people
       # who likes to use <sequence> in xsds)
       my @registrant;

       push @registrant, [ 'extcon:nationalityCode', $c->nationality_code ]
               if defined $c->nationality_code;

       push @registrant, [ 'extcon:entityType', $c->entity_type ]
               if defined $c->entity_type;

       push @registrant, [ 'extcon:regCode', $c->reg_code ]
               if defined $c->reg_code;


       push @ext, [ 'extcon:registrant', @registrant ]
               if scalar @registrant;

       $msg->command_extension($eid, [ @ext ])
               if scalar @ext;
}

sub create
{
       my ($epp, $contact) = @_;

       return fix_contact($epp, $contact, 'create');
}

1;