blib/lib/WWW/eNom/DomainTransfer.pm

filter: Statementstmt 92.3% 36 / 39 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod n/a totaltotal 78.1% 43 / 55 CC 5 SCAR 25.7
CC
5
Cov
77%
construct_from_response
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 13.1
« blib/lib/WWW/eNom/Role/Command/Domain/Registration.pm ↑ Summary blib/lib/WWW/eNom/Domain.pm »
1 package WWW::eNom::DomainTransfer;
2  
3 48 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 48 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 48 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 48 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 48 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 48 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 48 ▶use WWW::eNom::Types qw( Bool Contact DomainName HashRef PositiveInt Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 48 our $VERSION = 'v2.6.0'; # VERSION
14 # ABSTRACT: Representation of In Progress Domain Transfer
15  
16 48 has 'order_id' => (
17 is => 'ro',
18 isa => PositiveInt,
19 required => 1,
20 );
21  
22 48 has 'name' => (
23 is => 'ro',
24 isa => DomainName,
25 required => 1,
26 );
27  
28 48 has 'status' => (
29 is => 'ro',
30 isa => Str,
31 required => 1,
32 );
33  
34 48 has 'status_id' => (
35 is => 'ro',
36 isa => PositiveInt,
37 required => 1,
38 );
39  
40 48 has 'is_locked' => (
41 is => 'ro',
42 isa => Bool,
43 required => 1,
44 );
45  
46 48 has 'is_auto_renew' => (
47 is => 'ro',
48 isa => Bool,
49 required => 1,
50 );
51  
52 48 has 'use_existing_contacts' => (
53 is => 'ro',
54 isa => Bool,
55 required => 1,
56 );
57  
58 48 has 'registrant_contact' => (
59 is => 'ro',
60 isa => Contact,
61 predicate => 'has_registrant_contact',
62 );
63  
64 48 has 'admin_contact' => (
65 is => 'ro',
66 isa => Contact,
67 predicate => 'has_admin_contact',
68 );
69  
70 48 has 'technical_contact' => (
71 is => 'ro',
72 isa => Contact,
73 predicate => 'has_technical_contact',
74 );
75  
76 48 has 'billing_contact' => (
77 is => 'ro',
78 isa => Contact,
79 predicate => 'has_billing_contact',
80 );
81  
82 48 with 'WWW::eNom::Role::ParseDomain';
83  
84 sub construct_from_response {
85 0 ▶ my $self = shift;
Subroutine construct_from_response: not called CC=5 SCAR=34.0
86 0 my ( %args ) = validated_hash(
87 \@_,
88 transfer_detail => { isa => HashRef },
89 );
90  
91 return $self->new(
92 order_id => $args{transfer_detail}{transferorderdetailid},
93 name => sprintf('%s.%s', $args{transfer_detail}{sld}, $args{transfer_detail}{tld} ),
94 status => $args{transfer_detail}{statusdesc},
95 status_id => $args{transfer_detail}{statusid},
96 is_locked => ( $args{transfer_detail}{lock} eq 'True' ),
97 is_auto_renew => ( $args{transfer_detail}{renew} eq 'True' ),
98 use_existing_contacts => ( $args{transfer_detail}{usecontacts} == 1 ),
99 $args{transfer_detail}{contacts}{Registrant} ne 'None'
100 ? ( registrant_contact => WWW::eNom::Contact->construct_from_response( $args{transfer_detail}{contacts}{Registrant} ) )
101 : ( ),
102 $args{transfer_detail}{contacts}{Admin} ne 'None'
103 ? ( admin_contact => WWW::eNom::Contact->construct_from_response( $args{transfer_detail}{contacts}{Admin} ) )
104 : ( ),
105 $args{transfer_detail}{contacts}{Tech} ne 'None'
106 ? ( technical_contact => WWW::eNom::Contact->construct_from_response( $args{transfer_detail}{contacts}{Tech} ) )
107 : ( ),
108 $args{transfer_detail}{contacts}{AuxBilling} ne 'None'
109 0 ▶ ? ( billing_contact => WWW::eNom::Contact->construct_from_response( $args{transfer_detail}{contacts}{AuxBilling} ) )
Branch: 4 branches
BranchTrueFalseTotal
$args{'transfer_detail'}{'contacts'}{'Registrant'} ne 'None' ? : 0 0 0
$args{'transfer_detail'}{'contacts'}{'Admin'} ne 'None' ? : 0 0 0
$args{'transfer_detail'}{'contacts'}{'Tech'} ne 'None' ? : 0 0 0
$args{'transfer_detail'}{'contacts'}{'AuxBilling'} ne 'None' ? : 0 0 0
110 : ( ),
111 );
112 }
113  
114 48 __PACKAGE__->meta->make_immutable;
115 48 1;
116  
117 __END__
118  
119 =pod
120  
121 =head1 NAME
122  
123 WWW::eNom::DomainTransfer - Representation of In Progress Domain Transfer
124  
125 =head1 SYNOPSIS
126  
127 use WWW::eNom;
128 use WWW::eNom::Contact;
129 use WWW::eNom::DomainTransfer;
130  
131 my $api = WWW::eNom->new( ... );
132 my $contact = WWW::eNom::Contact->new( ... );
133  
134 # You shouldn't be calling new on this, you probably want to call $api->get_transfer_by_order_id instead
135 my $domain_transfer = WWW::eNom::DomainTransfer->new(
136 order_id => 12345,
137 name => 'drzigman.com',
138 status => 'Awaiting auto verification of transfer request',
139 status_id => 9
140 is_locked => 1,
141 is_auto_renew => 1,
142 use_existing_contacts => 0,
143  
144 # These contacts may or may not be populated depending on the transfer options
145 # and the stage of the transfer.
146 registrant_contact => $contact,
147 admin_contact => $contact,
148 technical_contact => $contact,
149 billing_contact => $contact,
150 );
151  
152 # Construct from eNom TP_GetOrderDetail Response
153 my $response = $self->submit({
154 method => 'TP_GetOrderDetail',
155 params => {
156 TransferOrderDetailID => 12345
157 }
158 });
159  
160 my $transfer = WWW::eNom::DomainTransfer->construct_from_response(
161 transfer_detail => $response->{transferorderdetail}
162 );
163  
164 =head1 WITH
165  
166 =over 4
167  
168 =item L<WWW::eNom::Role::ParseDomain>
169  
170 =back
171  
172 =head1 DESCRIPTION
173  
174 Represents L<eNom|https://www.enom.com> domain transfer that is in progress.
175  
176 =head1 ATTRIBUTES
177  
178 =head2 B<order_id>
179  
180 The order id for this specific domain transfer attempt with L<eNom|https://www.enom.com>.
181  
182 eNom is a bit odd with how it handles order_id. The purchase of a transfer will have a parent_order_id (for the entire order) as well as an order id for this specific domain transfer attempt (what this module calls the order_id). If a domain transfer attempt fails for any reason (such as a bad EPP Key) then when you resubmit the domain transfer a new order_id will be created to describe the new domain transfer attempt.
183  
184 =head2 B<name>
185  
186 The FQDN to transfer
187  
188 =head2 B<status>
189  
190 A Str in English that describes the current status of this domain transfer. Please see L<https://www.enom.com/api/API%20Topics/api_TP_GetDetailsByDomain.htm#notes> for a full list of possible statuses.
191  
192 =head2 B<status_id>
193  
194 PositiveInt indicating the status_id assoicated with the status. Please see L<https://www.enom.com/api/API%20Topics/api_TP_GetDetailsByDomain.htm#notes> for a full list of possible statuses.
195  
196 =head2 B<is_locked>
197  
198 Indicates if the domain will be locked, preventing transfers.
199  
200 =head2 B<is_auto_renew>
201  
202 Boolean that indicates if the domain will auto renew. If true, this domain will be automatically renewed by eNom before it expires.
203  
204 =head2 B<use_existing_contacts>
205  
206 Boolean indicating if eNom will attempt to import the existing whois contacts.
207  
208 =head2 registrant_contact
209  
210 A L<WWW::eNom::Contact> for the Registrant Contact, predicate of has_registrant_contact.
211  
212 This will not be populated if L<use_existing_contacts> is true unless the L<WWW::eNom::DomainRequest::Transfer/verification_method> used when the transfer was originally requested was Fax.
213  
214 B<NOTE> based on the stage of the transfer, L<eNom|https://www.enom.com> may or may not have contact information for this domain transfer. Just because nothing was returned does not mean there is not any data, it just might not be available.
215  
216 =head2 admin_contact
217  
218 A L<WWW::eNom::Contact> for the Admin Contact, predicate of has_admin_contact.
219  
220 B<NOTE> based on the stage of the transfer, L<eNom|https://www.enom.com> may or may not have contact information for this domain transfer. Just because nothing was returned does not mean there is not any data, it just might not be available.
221  
222 =head2 technical_contact
223  
224 A L<WWW::eNom::Contact> for the Technical Contact, predicate of has_technical_contact.
225  
226 B<NOTE> based on the stage of the transfer, L<eNom|https://www.enom.com> may or may not have contact information for this domain transfer. Just because nothing was returned does not mean there is not any data, it just might not be available.
227  
228 =head2 billing_contact
229  
230 A L<WWW::eNom::Contact> for the Billing Contact, predicate of has_billing_contact.
231  
232 NOTE> L<eNom|https://www.eNom.com> actually calls this the AuxBilling> contact since the primary billing contact is the reseller's information.
233  
234 <NOTE> based on the stage of the transfer, L<eNom|https://www.enom.com> may or may not have contact information for this domain transfer. Just because nothing was returned does not mean there is not any data, it just might not be available.
235  
236 =head1 METHODS
237  
238 =head2 construct_from_response
239  
240 my $response = $self->submit({
241 method => 'TP_GetOrderDetail',
242 params => {
243 TransferOrderDetailID => 12345
244 }
245 });
246  
247 my $transfer = WWW::eNom::DomainTransfer->construct_from_response(
248 transfer_detail => $response->{transferorderdetail}
249 );
250  
251 Creates an instance of $self from eNom's response to L<TP_GetOrderDetail|https://www.enom.com/api/API%20topics/api_TP_GetOrderDetail.htm>.
« blib/lib/WWW/eNom/Role/Command/Domain/Registration.pm ↑ Summary blib/lib/WWW/eNom/Domain.pm »