blib/lib/WWW/eNom/DomainRequest/Transfer.pm

filter: Statementstmt 89.0% 49 / 55 Branchbran 42.1% 16 / 38 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 72.9% 78 / 107 CC 21 SCAR 35.4
CC
21
Cov
71%
construct_request
90.0
BUILD
13.7
BEGIN
1.0
CRAP 34.3
« blib/lib/WWW/eNom/Role/Command/Domain/PrivateNameServer.pm ↑ Summary blib/lib/WWW/eNom/Role/Command/Domain/Availability.pm »
1 package WWW::eNom::DomainRequest::Transfer;
2  
3 49 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 49 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 49 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 49 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 49 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 49 ▶use WWW::eNom::Types qw( Bool Contact DomainName Str TransferVerificationMethod );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 49 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 49 our $VERSION = 'v2.6.0'; # VERSION
15 # ABSTRACT: Domain Transfer Request
16  
17 49 has 'name' => (
18 is => 'ro',
19 isa => DomainName,
20 required => 1,
21 );
22  
23 49 has 'verification_method' => (
24 is => 'ro',
25 isa => TransferVerificationMethod,
26 default => 'Autoverification',
27 );
28  
29 49 has 'is_private' => (
30 is => 'ro',
31 isa => Bool,
32 default => 0,
33 );
34  
35 49 has 'is_locked' => (
36 is => 'ro',
37 isa => Bool,
38 default => 1,
39 );
40  
41 49 has 'is_auto_renew' => (
42 is => 'ro',
43 isa => Bool,
44 default => 0,
45 );
46  
47 49 has 'epp_key' => (
48 is => 'ro',
49 isa => Str,
50 required => 1,
51 );
52  
53 49 has 'use_existing_contacts' => (
54 is => 'ro',
55 isa => Bool,
56 default => 0,
57 );
58  
59 49 has 'registrant_contact' => (
60 is => 'ro',
61 isa => Contact,
62 predicate => 'has_registrant_contact',
63 );
64  
65 49 has 'admin_contact' => (
66 is => 'ro',
67 isa => Contact,
68 predicate => 'has_admin_contact',
69 );
70  
71 49 has 'technical_contact' => (
72 is => 'ro',
73 isa => Contact,
74 predicate => 'has_technical_contact',
75 );
76  
77 49 has 'billing_contact' => (
78 is => 'ro',
79 isa => Contact,
80 predicate => 'has_billing_contact',
81 );
82  
83 49 with 'WWW::eNom::Role::ParseDomain';
84  
85 sub BUILD {
86 7 ▶ my $self = shift;
Subroutine BUILD: called CC=13 SCAR=26.1
87  
88 7 ▶ if( $self->use_existing_contacts ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->use_existing_contacts) { } 4 3 7
89 4 ▶ ( $self->verification_method ne 'Fax' && $self->has_registrant_contact )
Branch: 1 branch
BranchTrueFalseTotal
$self->verification_method ne "Fax" and $self->has_registrant_contact and croak("When using existing contacts the registrant contact must not be specified") 1 3 4
Condition100%3/3
$self->verification_method ne "Fax" and $self->has_registrant_contact
!ll&&!rl&&r
211
MC/DC100%2/2
$self->verification_method ne "Fax" and $self->has_registrant_contact
$self->verification_method ne "Fax" $self->has_registrant_contact
Truth table100%3/3
A and B
A= $self->verification_method ne "Fax"B= $self->has_registrant_contact
ABresult
0X0
100
111
90 and croak 'When using existing contacts the registrant contact must not be specified';
91 3 ▶ $self->has_admin_contact and croak 'When using existing contacts the admin contact must not be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_admin_contact and croak("When using existing contacts the admin contact must not be specified") 0 3 3
92 3 ▶ $self->has_technical_contact and croak 'When using existing contacts the technical contact must not be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_technical_contact and croak("When using existing contacts the technical contact must not be specified") 0 3 3
93 3 ▶ $self->has_billing_contact and croak 'When using existing contacts the billing contact must not be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_billing_contact and croak("When using existing contacts the billing contact must not be specified") 0 3 3
94 }
95 else {
96 ## no critic ( ValuesAndExpressions::ProhibitMixedBooleanOperators )
97 3 ▶ !$self->has_registrant_contact and croak 'If not using existing contacts the registrant contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_registrant_contact or croak("If not using existing contacts the registrant contact must be specified") 1 2 3
98 2 ▶ !$self->has_admin_contact and croak 'If not using existing contacts the admin contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_admin_contact or croak("If not using existing contacts the admin contact must be specified") 0 2 2
99 2 ▶ !$self->has_technical_contact and croak 'If not using existing contacts the technical contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_technical_contact or croak("If not using existing contacts the technical contact must be specified") 0 2 2
100 2 ▶ !$self->has_billing_contact and croak 'If not using existing contacts the billing contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_billing_contact or croak("If not using existing contacts the billing contact must be specified") 0 2 2
101 ## use critic
102 }
103  
104 5 ▶ if( $self->verification_method eq 'Fax' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verification_method eq "Fax") 3 2 5
105 ## no critic ( ValuesAndExpressions::ProhibitMixedBooleanOperators )
106 3 ▶ !$self->has_registrant_contact and croak 'If using Fax verification, a registrant contact must be specified';
Branch: 1 branch
BranchTrueFalseTotal
$self->has_registrant_contact or croak("If using Fax verification, a registrant contact must be specified") 1 2 3
107 ## use critic
108 }
109  
110 4 return $self;
111 }
112  
113 sub construct_request {
114 0 ▶ my $self = shift;
Subroutine construct_request: not called CC=9 SCAR=45.0
115  
116 return {
117 DomainCount => 1,
118 SLD1 => $self->sld,
119 TLD1 => $self->tld,
120 AuthInfo1 => $self->epp_key,
121 OrderType => $self->verification_method,
122 IncludeIDP => $self->is_private ? 1 : 0,
123 Lock => $self->is_locked ? 1 : 0,
124 Renew => $self->is_auto_renew ? 1 : 0,
125 UseContacts => $self->use_existing_contacts ? 1 : 0,
126 0 ▶ $self->has_registrant_contact ? %{ $self->registrant_contact->construct_creation_request('Registrant') } : ( ),
Branch: 1 branch
BranchTrueFalseTotal
$self->has_admin_contact ? : 0 0 0
127 0 ▶ $self->has_admin_contact ? %{ $self->admin_contact->construct_creation_request('Admin') } : ( ),
Branch: 1 branch
BranchTrueFalseTotal
$self->has_technical_contact ? : 0 0 0
128 0 ▶ $self->has_technical_contact ? %{ $self->technical_contact->construct_creation_request('Tech') } : ( ),
Branch: 1 branch
BranchTrueFalseTotal
$self->has_billing_contact ? : 0 0 0
129 0 ▶ $self->has_billing_contact ? %{ $self->billing_contact->construct_creation_request('AuxBilling') } : ( ),
Branch: 5 branches
BranchTrueFalseTotal
$self->is_private ? : 0 0 0
$self->is_locked ? : 0 0 0
$self->is_auto_renew ? : 0 0 0
$self->use_existing_contacts ? : 0 0 0
$self->has_registrant_contact ? : 0 0 0
130 };
131 }
132  
133 49 __PACKAGE__->meta->make_immutable;
134 49 1;
135  
136 __END__
137  
138 =pod
139  
140 =head1 NAME
141  
142 WWW::eNom::DomainRequest::Transfer - Domain Transfer Request
143  
144 =head1 SYNOPSIS
145  
146 use WWW::eNom;
147 use WWW::eNom::Contact;
148 use WWW::eNom::DomainRequest::Transfer;
149  
150 my $api = WWW::eNom->new( ... );
151 my $contact = WWW::eNom::Contact->new( ... );
152  
153 # Transfer a Domain to eNom
154 my $transfer_request = WWW::eNom::DomainRequest::Transfer->new(
155 name => 'drzigman.com',
156 verification_method => 'Autoverification', # Optional, defaults to Autoverification
157 is_private => 0, # Optional, defaults to false
158 is_locked => 1, # Optional, defaults to true
159 is_auto_renew => 0, # Optional, defaults to false
160 epp_key => '12345',
161 use_existing_contacts => 0, # Optional, defaults to false (which requires that contacts be specified)
162 registrant_contact => $contact, # See attribute definition for details about when required
163 admin_contact => $contact, # See attribute definition for details about when required
164 technical_contact => $contact, # See attribute definition for details about when required
165 billing_contact => $contact, # See attribute definition for details about when required
166 );
167  
168 # Example showing construct_request, contrived! Use transfer_domain in real life!
169 my $response = $api->submit({
170 method => 'TP_CreateOrder',
171 params => $transfer_request->construct_request
172 });
173  
174 =head1 WITH
175  
176 =over 4
177  
178 =item L<WWW::eNom::Role::ParseDomain>
179  
180 =back
181  
182 =head1 DESCRIPTION
183  
184 WWW::eNom::DomainRequest::Transfer is a representation of all the data needed in order to complete a domain transfer. It is used when requesting a domain transfer to L<eNom|https://www.enom.com>.
185  
186 =head1 ATTRIBUTES
187  
188 =head2 B<name>
189  
190 The FQDN to transfer
191  
192 =head2 verification_method
193  
194 The method of verification to use for approval of the domain transfer. The valid options are:
195  
196 =over 4
197  
198 =item Autoverification
199  
200 This is the default, it uses an email sent to the registrant to request transfer approval.
201  
202 =item Fax
203  
204 A manual process that involves sending a fax to the registrant for transfer approval.
205  
206 B<NOTE> If you use this verification_method you must provide at least a registrant_contact.
207  
208 =back
209  
210 =head2 is_locked
211  
212 Boolean that defaults to true. Indicates if the domain should be locked, preventing transfers.
213  
214 =head2 is_private
215  
216 Boolean that defaults to false. If true, the L<WPPS Service|https://www.enom.com/api/Value%20Added%20Topics/ID%20Protect.htm> (what eNom calls Privacy Protection) will automatically be purchased and enabled.
217  
218 =head2 is_auto_renew
219  
220 Boolean that defaults to false. If true, this domain will be automatically renewed by eNom before it expires.
221  
222 =head2 B<epp_key>
223  
224 The EPP Key (sometimes called Auth Code or another registrar specific name) that allows this domain to be transferred. This must be provided.
225  
226 B<NOTE> If the epp_key provided is incorrect, L<eNom|https://www.enom.com> will cancel the transfer order and you'll have to submit a new one.
227  
228 =head2 use_existing_contacts
229  
230 Boolean indicating if you wish to specify a new set of contacts or have eNom attempt to import the existing contacts as part of the transfer process. Defaults to false.
231  
232 B<NOTE> A false value means you must also provide all of the contacts ( registrant, admin, technical, and billing ).
233  
234 =head2 registrant_contact
235  
236 A L<WWW::eNom::Contact> for the Registrant Contact.
237  
238 This is required if the L<verification_method> is Fax, or if L<use_existing_contacts> is false.
239  
240 =head2 admin_contact
241  
242 A L<WWW::eNom::Contact> for the Admin Contact.
243  
244 This is required if L<use_existing_contacts> is false.
245  
246 =head2 technical_contact
247  
248 A L<WWW::eNom::Contact> for the Technical Contact.
249  
250 This is required if L<use_existing_contacts> is false.
251  
252 =head2 billing_contact
253  
254 A L<WWW::eNom::Contact> for the Billing Contact.
255  
256 This is required if L<use_existing_contacts> is false.
257  
258 NOTE> L<eNom|https://www.eNom.com> actually calls this the AuxBilling> contact since the primary billing contact is the reseller's information.
259  
260 =head1 METHODS
261  
262 =head2 construct_request
263  
264 my $transfer_request = WWW::eNom::DomainRequest::Transfer->new( ... );
265  
266 my $response = $api->submit({
267 method => 'TP_CreateOrder',
268 params => $transfer_request->construct_request
269 });
270  
271 Converts $self into a HashRef suitable for the L<TP_CreateOrder|https://www.enom.com/api/API%20Topics/API_TP_CreateOrder.htm> (transfer) of a Domain.
272  
273 =cut
« blib/lib/WWW/eNom/Role/Command/Domain/PrivateNameServer.pm ↑ Summary blib/lib/WWW/eNom/Role/Command/Domain/Availability.pm »