| 1 | package WWW::eNom::Role::Command::Contact; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 46 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 46 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 46 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 46 | ▶ | use MooseX::Params::Validate; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 46 | ▶ | use WWW::eNom::Types qw( Bool Contact DomainName HashRef Str ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 46 | ▶ | use WWW::eNom::Contact; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 46 | ▶ | use Data::Util qw( is_string ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 46 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 46 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 46 | ▶ | use Readonly; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 46 | Readonly my $ENOM_CONTACT_TYPE_MAPPING => { | |||||||||||||||||||||||||||
| 19 | Registrant => 'registrant_contact', | ||||||||||||||||||||||||||||
| 20 | Admin => 'admin_contact', | ||||||||||||||||||||||||||||
| 21 | Tech => 'technical_contact', | ||||||||||||||||||||||||||||
| 22 | AuxBilling => 'billing_contact', | ||||||||||||||||||||||||||||
| 23 | }; | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 46 | Readonly my $CONTACT_TYPE_ENOM_MAPPING => { reverse %{ $ENOM_CONTACT_TYPE_MAPPING } }; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 46 | requires 'submit'; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 46 | our $VERSION = 'v2.6.0'; # VERSION | |||||||||||||||||||||||||||
| 30 | # ABSTRACT: Contact Related Operations | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub get_contacts_by_domain_name { | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
get_contacts_by_domain_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 0 | my ( $domain_name ) = pos_validated_list( \@_, { isa => DomainName } ); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | return try { | ||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my $response = $self->submit({ | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||
| 38 | method => 'GetContacts', | ||||||||||||||||||||||||||||
| 39 | params => { | ||||||||||||||||||||||||||||
| 40 | Domain => $domain_name | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | }); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if( grep { $_ eq 'Domain name not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | my $billing_party_id = $response->{GetContacts}{Billing}{BillingPartyID}; | |||||||||||||||||||||||||||
| 53 | my $billing_party_contact = WWW::eNom::Contact->construct_from_response( | ||||||||||||||||||||||||||||
| 54 | $self->_extract_common_contact_format( | ||||||||||||||||||||||||||||
| 55 | contact_type => 'Billing', | ||||||||||||||||||||||||||||
| 56 | raw_contact_response => $response->{GetContacts}{Billing}, | ||||||||||||||||||||||||||||
| 57 | ) | ||||||||||||||||||||||||||||
| 58 | 0 | ); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | my $contacts; | |||||||||||||||||||||||||||
| 61 | 0 | for my $contact_type ( keys %{ $ENOM_CONTACT_TYPE_MAPPING } ) { | |||||||||||||||||||||||||||
| 62 | my $common_contact_response = $self->_extract_common_contact_format( | ||||||||||||||||||||||||||||
| 63 | contact_type => $contact_type, | ||||||||||||||||||||||||||||
| 64 | 0 | raw_contact_response => $response->{GetContacts}{$contact_type}, | |||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | # If no other contact has been provided then MY information (the reseller) | ||||||||||||||||||||||||||||
| 68 | # is used. Treat this as no info. | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if( $common_contact_response->{PartyID} eq $billing_party_id ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | next; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | $contacts->{ $ENOM_CONTACT_TYPE_MAPPING->{ $contact_type} } = | |||||||||||||||||||||||||||
| 74 | WWW::eNom::Contact->construct_from_response( $common_contact_response ); | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | # Check for anyone who used the reseller's contact info for a contact and replace | ||||||||||||||||||||||||||||
| 78 | # it with the registrant contact data. | ||||||||||||||||||||||||||||
| 79 | 0 | for my $contact_type ( values %{ $ENOM_CONTACT_TYPE_MAPPING } ) { | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | if( !exists $contacts->{ $contact_type } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | # Do I have any other contacts that I can use? | ||||||||||||||||||||||||||||
| 82 | 0 | for my $replacement_contact_type ( grep { $_ ne $contact_type } ( values %{ $ENOM_CONTACT_TYPE_MAPPING } ) ) { | |||||||||||||||||||||||||||
| 83 | 0 | ▶ | if( exists $contacts->{$replacement_contact_type} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | $contacts->{ $contact_type } = $contacts->{ $replacement_contact_type }; | |||||||||||||||||||||||||||
| 85 | 0 | last; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | # If I didn't find one, begrugingly use the billing one | ||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $contacts->{ $contact_type } //= $billing_party_contact; | ||||||||||||||||||||||||||
|
Condition0%0/3
$contacts->{$contact_type} //= $billing_party_contact
MC/DC0%0/2
$contacts->{$contact_type} //= $billing_party_contact
$contacts->{$contact_type}
$billing_party_contact
Truth table0%0/3
A //= B
A= $contacts->{$contact_type}B= $billing_party_contact
| |||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | $contacts->{is_pending_irtp} = $response->{GetContacts}{PendingVerification} eq 'True'; | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | return $contacts; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | catch { | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | croak $_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 0 | } | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | sub _extract_common_contact_format { | ||||||||||||||||||||||||||||
| 104 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_extract_common_contact_format: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 105 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 106 | \@_, | ||||||||||||||||||||||||||||
| 107 | contact_type => { isa => Str }, | ||||||||||||||||||||||||||||
| 108 | raw_contact_response => { isa => HashRef }, | ||||||||||||||||||||||||||||
| 109 | ); | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | my $common_contact_response; | |||||||||||||||||||||||||||
| 112 | 0 | for my $field ( keys %{ $args{raw_contact_response} } ) { | |||||||||||||||||||||||||||
| 113 | 0 | ▶ | if( $field !~ m/${\( $args{contact_type} )}/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | 0 | next; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | # If the value is not a string then consider it undefined | ||||||||||||||||||||||||||||
| 118 | $common_contact_response->{ substr( $field, length( $args{contact_type} ) ) } = | ||||||||||||||||||||||||||||
| 119 | 0 | ▶ | is_string( $args{raw_contact_response}->{ $field } ) ? $args{raw_contact_response}->{ $field } : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | # Try harder to create a valid contact for the Billing contact (the Reseller) | ||||||||||||||||||||||||||||
| 123 | # We do this since if we have no other (valid) contacts we can't build the domain, | ||||||||||||||||||||||||||||
| 124 | # better to have something rather than nothing | ||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if( $args{contact_type} eq 'Billing' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if( $common_contact_response->{OrganizationName} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | $common_contact_response->{JobTitle} //= 'Reseller'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$common_contact_response->{"JobTitle"} //= "Reseller"
MC/DC0%0/1
$common_contact_response->{"JobTitle"} //= "Reseller"
$common_contact_response->{"JobTitle"}
Truth table0%0/2
A
A= $common_contact_response->{"JobTitle"}
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $common_contact_response->{Fax} //= $common_contact_response->{Phone}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$common_contact_response->{"Fax"} //= $common_contact_response->{"Phone"}
MC/DC0%0/2
$common_contact_response->{"Fax"} //= $common_contact_response->{"Phone"}
$common_contact_response->{"Fax"}
$common_contact_response->{"Phone"}
Truth table0%0/3
A //= B
A= $common_contact_response->{"Fax"}B= $common_contact_response->{"Phone"}
| |||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | return $common_contact_response; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | sub update_contacts_for_domain_name { | ||||||||||||||||||||||||||||
| 136 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
update_contacts_for_domain_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 137 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 138 | \@_, | ||||||||||||||||||||||||||||
| 139 | domain_name => { isa => DomainName }, | ||||||||||||||||||||||||||||
| 140 | registrant_contact => { isa => Contact, optional => 1 }, | ||||||||||||||||||||||||||||
| 141 | admin_contact => { isa => Contact, optional => 1 }, | ||||||||||||||||||||||||||||
| 142 | technical_contact => { isa => Contact, optional => 1 }, | ||||||||||||||||||||||||||||
| 143 | billing_contact => { isa => Contact, optional => 1 }, | ||||||||||||||||||||||||||||
| 144 | is_transfer_locked => { isa => Bool, default => 1 }, | ||||||||||||||||||||||||||||
| 145 | ); | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | try { | ||||||||||||||||||||||||||||
| 148 | # The not for is_transfer_locked is because eNom treats this as opt out | ||||||||||||||||||||||||||||
| 149 | # while I'm treating the input as just if it should lock or not | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | # Replace all contacts at once | ||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if( ( scalar grep { exists $args{$_} && defined $args{$_} } values %{ $ENOM_CONTACT_TYPE_MAPPING } ) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 153 | 0 | == ( scalar values %{ $ENOM_CONTACT_TYPE_MAPPING } ) ) { | |||||||||||||||||||||||||||
| 154 | $self->_update_contacts({ | ||||||||||||||||||||||||||||
| 155 | payload => { | ||||||||||||||||||||||||||||
| 156 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 157 | IRTPOptOut => ( !$args{is_transfer_locked} ? 'true' : 'false' ), | ||||||||||||||||||||||||||||
| 158 | 0 | %{ $args{registrant_contact}->construct_creation_request('Registrant') }, | |||||||||||||||||||||||||||
| 159 | 0 | %{ $args{admin_contact}->construct_creation_request('Admin') }, | |||||||||||||||||||||||||||
| 160 | 0 | %{ $args{technical_contact}->construct_creation_request('Tech') }, | |||||||||||||||||||||||||||
| 161 | 0 | ▶ | %{ $args{billing_contact}->construct_creation_request('AuxBilling') }, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | }); | ||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | # Replace contacts one at a time | ||||||||||||||||||||||||||||
| 166 | else { | ||||||||||||||||||||||||||||
| 167 | 0 | for my $contact_type ( values %{ $ENOM_CONTACT_TYPE_MAPPING } ) { | |||||||||||||||||||||||||||
| 168 | 0 | ▶ | if( !exists $args{ $contact_type } || !defined $args{ $contact_type } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $args{$contact_type} and defined $args{$contact_type}
MC/DC0%0/2
exists $args{$contact_type} and defined $args{$contact_type}
exists $args{$contact_type}
defined $args{$contact_type}
Truth table0%0/3
A and B
A= exists $args{$contact_type}B= defined $args{$contact_type}
| |||||||||||||||||||||||||||||
| 169 | 0 | next; | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | $self->_update_contacts({ | ||||||||||||||||||||||||||||
| 173 | payload => { | ||||||||||||||||||||||||||||
| 174 | Domain => $args{domain_name}, | ||||||||||||||||||||||||||||
| 175 | IRTPOptOut => ( !$args{is_transfer_locked} ? 'True' : 'False' ), | ||||||||||||||||||||||||||||
| 176 | ContactType => uc $CONTACT_TYPE_ENOM_MAPPING->{ $contact_type }, | ||||||||||||||||||||||||||||
| 177 | 0 | ▶ | %{ $args{ $contact_type }->construct_creation_request( $CONTACT_TYPE_ENOM_MAPPING->{ $contact_type } ) }, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | }); | ||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | catch { | ||||||||||||||||||||||||||||
| 184 | 0 | ▶ | croak $_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 185 | 0 | }; | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | return $self->get_contacts_by_domain_name( $args{domain_name} ); | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | sub _update_contacts { | ||||||||||||||||||||||||||||
| 191 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_update_contacts: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 192 | 0 | my ( %args ) = validated_hash( | |||||||||||||||||||||||||||
| 193 | \@_, | ||||||||||||||||||||||||||||
| 194 | payload => { isa => HashRef }, | ||||||||||||||||||||||||||||
| 195 | ); | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | my $response = $self->submit({ | ||||||||||||||||||||||||||||
| 198 | method => 'Contacts', | ||||||||||||||||||||||||||||
| 199 | params => $args{payload}, | ||||||||||||||||||||||||||||
| 200 | 0 | }); | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 0 | ▶ | if( $response->{ErrCount} > 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if( grep { $_ eq 'Domain name ID not found' } @{ $response->{errors} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | croak 'Domain not found in your account'; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 0 | croak 'Unknown error'; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | return $response; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 46 | 1; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | __END__ | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | =head1 NAME | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | WWW::eNom::Role::Command::Contact - Contact Related Operations | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | use WWW::eNom; | ||||||||||||||||||||||||||||
| 224 | use WWW::eNom::Contact; | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | my $api = WWW::eNom->new( ... ); | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | # Get Contacts for a Domain | ||||||||||||||||||||||||||||
| 229 | my $contacts = $api->get_contacts_by_domain_name( 'drzigman.com' ); | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | for my $contact_type (qw( registrant_contact admin_contact technical_contact billing_contact )) { | ||||||||||||||||||||||||||||
| 232 | print "Email Address of $contact_type is: " . $contacts->{$contact_type}->email . "\n"; | ||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | # Update Contacts | ||||||||||||||||||||||||||||
| 236 | my $new_registrant_contact = WWW::eNom::Contact->new( ... ); | ||||||||||||||||||||||||||||
| 237 | my $new_admin_contact = WWW::eNom::Contact->new( ... ); | ||||||||||||||||||||||||||||
| 238 | my $new_technical_contact = WWW::eNom::Contact->new( ... ); | ||||||||||||||||||||||||||||
| 239 | my $new_billing_contact = WWW::eNom::Contact->new( ... ); | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | my $updated_contacts = $api->update_contacts_for_domain_name( | ||||||||||||||||||||||||||||
| 242 | domain_name => 'drzigman.com', | ||||||||||||||||||||||||||||
| 243 | is_transfer_locked => 1, # Optional, Defaults to truthy | ||||||||||||||||||||||||||||
| 244 | registrant_contact => $new_registrant_contact, # Optional | ||||||||||||||||||||||||||||
| 245 | admin_contact => $new_admin_contact, # Optional | ||||||||||||||||||||||||||||
| 246 | technical_contact => $new_technical_contact, # Optional | ||||||||||||||||||||||||||||
| 247 | billing_contact => $new_billing_contact, # Optional | ||||||||||||||||||||||||||||
| 248 | ); | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =head1 REQUIRES | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | =over 4 | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =item submit | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | =back | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | Implements contact related operations with L<eNom|https://www.enom.com>'s API. | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | =head1 METHODS | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | =head2 get_contacts_by_domain_name | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | my $contacts = $api->get_contacts_by_domain_name( 'drzigman.com' ); | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | for my $contact_type (qw( registrant_contact admin_contact technical_contact billing_contact )) { | ||||||||||||||||||||||||||||
| 269 | print "Email Address of $contact_type is: " . $contacts->{$contact_type}->email . "\n"; | ||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | Abstraction of the L<GetContacts|https://www.enom.com/api/API%20topics/api_GetContacts.htm> eNom API Call. Given a FQDN, returns a HashRef of contacts for that domain. The keys for the returned HashRef are: | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =over 4 | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =item registrant_contact | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | =item admin_contact | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =item technical_contact | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =item billing_contact | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =back | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | Each of these keys point to a value which is an instance of L<WWW::eNom::Contact>. | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =head2 update_contacts_for_domain_name | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | my $updated_contacts = $api->update_contacts_for_domain_name( | ||||||||||||||||||||||||||||
| 291 | domain_name => 'drzigman.com', | ||||||||||||||||||||||||||||
| 292 | is_transfer_locked => 1, # Optional, Defaults to truthy | ||||||||||||||||||||||||||||
| 293 | registrant_contact => $new_registrant_contact, # Optional | ||||||||||||||||||||||||||||
| 294 | admin_contact => $new_admin_contact, # Optional | ||||||||||||||||||||||||||||
| 295 | technical_contact => $new_technical_contact, # Optional | ||||||||||||||||||||||||||||
| 296 | billing_contact => $new_billing_contact, # Optional | ||||||||||||||||||||||||||||
| 297 | ); | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | Abstraction of the L<Contacts|https://www.enom.com/api/API%20topics/api_Contacts.htm> eNom API Call. Given a FQDN and new contacts to use, updates the specified contacts to match those provided. Returned is a HashRef of Contacts (see L<get_contacts_by_domain_name> for response format). | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | AN interesting thing about this method is that you only need specify the contacts you wish to update. If you wish to update registrant, admin, technical, and billing great! Go for it and include all of them in one call. If you wish to update only a subset of the contacts (1, 2 or 3 of them) you should pass only the contacts to be updated. | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | Moreover, when making changes to the registrant_contact, per the 2016-12-01 L<ICANN Inter Registrar Transfer Policy|https://www.icann.org/resources/pages/transfer-policy-2016-06-01-en>, a 60 day transfer lock is imposed on the domain unless the requester explicitly states that they B<DO NOT> wish to have this transfer lock imposed. By default the domain will be locked, however, if you pass a falsey value for is_transfer_locked that lock will not be applied. | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =cut | ||||||||||||||||||||||||||||