File Coverage

blib/lib/WWW/LogicBoxes/DomainRequest.pm
Criterion Covered Total %
statement 24 31 77.4
branch 0 6 0.0
condition n/a
subroutine 8 9 88.8
pod 0 1 0.0
total 32 47 68.0


line stmt bran cond sub pod time code
1             package WWW::LogicBoxes::DomainRequest;
2              
3 42     42   383665 use strict;
  42         120  
  42         1396  
4 42     42   237 use warnings;
  42         94  
  42         1161  
5              
6 42     42   679 use Moose;
  42         143720  
  42         290  
7 42     42   275965 use MooseX::StrictConstructor;
  42         25024  
  42         318  
8 42     42   135231 use namespace::autoclean;
  42         110  
  42         334  
9              
10 42     42   4239 use WWW::LogicBoxes::Types qw( Bool DomainName DomainNames Int InvoiceOption );
  42         103  
  42         363  
11              
12 42     42   424924 use Carp;
  42         108  
  42         3218  
13 42     42   4667 use Mozilla::PublicSuffix qw( public_suffix );
  42         97816  
  42         14165  
14              
15             our $VERSION = '1.10.1'; # VERSION
16             # ABSTRACT: Abstract Base Class for Domain Registration/Transfer Requests
17              
18             has name => (
19             is => 'ro',
20             isa => DomainName,
21             required => 1,
22             );
23              
24             has customer_id => (
25             is => 'ro',
26             isa => Int,
27             required => 1,
28             );
29              
30             has ns => (
31             is => 'ro',
32             isa => DomainNames,
33             required => 1,
34             );
35              
36             has registrant_contact_id => (
37             is => 'ro',
38             isa => Int,
39             required => 1,
40             );
41              
42             has admin_contact_id => (
43             is => 'ro',
44             isa => Int,
45             required => 1,
46             );
47              
48             has technical_contact_id => (
49             is => 'ro',
50             isa => Int,
51             required => 1,
52             );
53              
54             has billing_contact_id => (
55             is => 'ro',
56             isa => Int,
57             required => 0,
58             predicate => 'has_billing_contact_id',
59             );
60              
61             has is_private => (
62             is => 'ro',
63             isa => Bool,
64             default => 0,
65             );
66              
67             has invoice_option => (
68             is => 'ro',
69             isa => InvoiceOption,
70             default => 'NoInvoice',
71             );
72              
73             sub BUILD {
74 0     0 0   my $self = shift;
75              
76 0           my $tld = public_suffix( $self->name );
77              
78 0 0         if( $tld eq 'ca' ) {
    0          
79 0 0         if( $self->has_billing_contact_id ) {
80 0           croak 'CA domains do not have a billing contact';
81             }
82             }
83             elsif( !$self->has_billing_contact_id ) {
84 0           croak 'A billing_contact_id is required';
85             }
86              
87 0           return $self;
88             }
89              
90             __PACKAGE__->meta->make_immutable;
91              
92             1;
93              
94             __END__
95             =pod
96              
97             =head1 NAME
98              
99             WWW::LogicBoxes::DomainRequest - Abstract Base Case for Domain Registration and Transfer Requests
100              
101             =head1 DESCRIPTION
102              
103             WWW::LogicBoxes::DomainRequest is an abstract base class that is extended for usage in L<WWW::LogicBoxes::DomainRequest::Registration> and L<WWW::LogicBoxes::DomainRequest::Transfer>. It should not be instantiated directly.
104              
105             =head1 ATTRIBUTES
106              
107             =head2 B<name>
108              
109             The full domain name.
110              
111             =head2 B<customer_id>
112              
113             L<LogicBoxes Customer|WWW::LogicBoxes::Customer> id that is purchasing this domain.
114              
115             =head2 B<ns>
116              
117             Array Ref of domain names that should be used as the authoritive nameservers.
118              
119             =head2 B<registrant_contact_id>
120              
121             A L<Contact|WWW::LogicBoxes::Contact> id for the Registrant.
122              
123             =head2 B<admin_contact_id>
124              
125             A L<Contact|WWW::LogicBoxes::Contact> id for the Admin.
126              
127             =head2 B<technical_contact_id>
128              
129             A L<Contact|WWW::LogicBoxes::Contact> id for the Technical.
130              
131             =head2 B<billing_contact_id>
132              
133             A L<Contact|WWW::LogicBoxes::Contact> id for the Billing. Offers a predicate of has_billing_contact_id.
134              
135             Almost all TLDs require a billing contact, however for .ca domains it B<must not> be provided.
136              
137             =head2 is_private
138              
139             Boolean indicating if this domain uses WHOIS Privacy. Defaults to false.
140              
141             B<NOTE> Not all tlds support domain privacy. For example, .us and .ca do not permit domain privacy.
142              
143             =head2 invoice_option
144              
145             Indicates to L<LogicBoxes|http://www.logicboxes.com> how invoicing of the L<customer|WWW::LogicBoxes::Customer> for this domain should occur. It must be one of the following values:
146              
147             =over 4
148              
149             =item NoInvoice
150              
151             Do not generate an invoice, just process the order.
152              
153             =item PayInvoice
154              
155             Generate an invoice and check the L<customer's|WWW::LogicBoxes::Customer> account balance. If there are sufficent funds pay the invoice and process the order. Otherwise, hold the order in a pending status.
156              
157             =item KeepInvoice
158              
159             Generate an invoice for the L<customer|WWW::LogicBoxes::Customer> to pay at some later point but process the order right now.
160              
161             =back
162              
163             The default value is 'NoInvoice'.
164              
165             =cut