| 1 | package WWW::eNom::DomainRequest::Registration; | ||||||||||||||||||||||||||||||
| 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 DomainNames Int NexusCategory NexusPurpose ); | ||||||||||||||||||||||||||||
|
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.7.0'; # VERSION | |||||||||||||||||||||||||||||
| 15 | # ABSTRACT: Domain Registration Request | ||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||
| 17 | 49 | has 'name' => ( | |||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||||
| 19 | isa => DomainName, | ||||||||||||||||||||||||||||||
| 20 | required => 1, | ||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||
| 23 | 49 | has 'ns' => ( | |||||||||||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||||||||||||
| 25 | isa => DomainNames, | ||||||||||||||||||||||||||||||
| 26 | predicate => 'has_ns', | ||||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||
| 29 | 49 | has 'is_ns_fail_fatal' => ( | |||||||||||||||||||||||||||||
| 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_private' => ( | |||||||||||||||||||||||||||||
| 42 | is => 'ro', | ||||||||||||||||||||||||||||||
| 43 | isa => Bool, | ||||||||||||||||||||||||||||||
| 44 | default => 0, | ||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||
| 47 | 49 | has 'is_auto_renew' => ( | |||||||||||||||||||||||||||||
| 48 | is => 'ro', | ||||||||||||||||||||||||||||||
| 49 | isa => Bool, | ||||||||||||||||||||||||||||||
| 50 | default => 0, | ||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||
| 53 | 49 | has 'is_queueable' => ( | |||||||||||||||||||||||||||||
| 54 | is => 'ro', | ||||||||||||||||||||||||||||||
| 55 | isa => Bool, | ||||||||||||||||||||||||||||||
| 56 | default => 0, | ||||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||
| 59 | 49 | has 'years' => ( | |||||||||||||||||||||||||||||
| 60 | is => 'ro', | ||||||||||||||||||||||||||||||
| 61 | isa => Int, | ||||||||||||||||||||||||||||||
| 62 | required => 1, | ||||||||||||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||
| 65 | 49 | has 'registrant_contact' => ( | |||||||||||||||||||||||||||||
| 66 | is => 'ro', | ||||||||||||||||||||||||||||||
| 67 | isa => Contact, | ||||||||||||||||||||||||||||||
| 68 | required => 1, | ||||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||
| 71 | 49 | has 'admin_contact' => ( | |||||||||||||||||||||||||||||
| 72 | is => 'ro', | ||||||||||||||||||||||||||||||
| 73 | isa => Contact, | ||||||||||||||||||||||||||||||
| 74 | required => 1, | ||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||
| 77 | 49 | has 'technical_contact' => ( | |||||||||||||||||||||||||||||
| 78 | is => 'ro', | ||||||||||||||||||||||||||||||
| 79 | isa => Contact, | ||||||||||||||||||||||||||||||
| 80 | required => 1, | ||||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||
| 83 | 49 | has 'billing_contact' => ( | |||||||||||||||||||||||||||||
| 84 | is => 'ro', | ||||||||||||||||||||||||||||||
| 85 | isa => Contact, | ||||||||||||||||||||||||||||||
| 86 | required => 1, | ||||||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||
| 89 | 49 | has 'nexus_purpose' => ( | |||||||||||||||||||||||||||||
| 90 | is => 'ro', | ||||||||||||||||||||||||||||||
| 91 | isa => NexusPurpose, | ||||||||||||||||||||||||||||||
| 92 | predicate => 'has_nexus_purpose', | ||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||
| 95 | 49 | has 'nexus_category' => ( | |||||||||||||||||||||||||||||
| 96 | is => 'ro', | ||||||||||||||||||||||||||||||
| 97 | isa => NexusCategory, | ||||||||||||||||||||||||||||||
| 98 | predicate => 'has_nexus_category', | ||||||||||||||||||||||||||||||
| 99 | ); | ||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||
| 101 | 49 | with 'WWW::eNom::Role::ParseDomain'; | |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=7 SCAR=25.1
| |||||||||||||||||||||||||||||||
| 104 | 2 | my $self = shift; | |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||
| 106 | 2 | ▶ | if( $self->public_suffix eq 'us' ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 107 | 2 | ▶ | if( !$self->has_nexus_purpose || !$self->has_nexus_category ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->has_nexus_purpose and $self->has_nexus_category
MC/DC50%1/2
$self->has_nexus_purpose and $self->has_nexus_category
$self->has_nexus_purpose
$self->has_nexus_category
Truth table66%2/3
A and B
A= $self->has_nexus_purposeB= $self->has_nexus_category
| |||||||||||||||||||||||||||||||
| 108 | 1 | croak '.us domain registration require a nexus_purpose and a nexus_category'; | |||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||
| 111 | 1 | ▶ | if( $self->is_private ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 112 | 1 | croak 'Domain Privacy is not available for .us domains'; | |||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||
| 115 | else { | ||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if( $self->has_nexus_purpose || $self->has_nexus_category ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->has_nexus_purpose or $self->has_nexus_category
MC/DC0%0/2
$self->has_nexus_purpose or $self->has_nexus_category
$self->has_nexus_purpose
$self->has_nexus_category
Truth table0%0/3
A or B
A= $self->has_nexus_purposeB= $self->has_nexus_category
| |||||||||||||||||||||||||||||||
| 117 | 0 | croak 'nexus values should only be provided for .us domains'; | |||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||
| 121 | 0 | return; | |||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub construct_request { | ||||||||||||||||||||||||||||
|
Subroutine
construct_request: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||
| 125 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||
| 127 | return { | ||||||||||||||||||||||||||||||
| 128 | SLD => $self->sld, | ||||||||||||||||||||||||||||||
| 129 | TLD => $self->tld, | ||||||||||||||||||||||||||||||
| 130 | !$self->has_ns | ||||||||||||||||||||||||||||||
| 131 | ? ( UseDNS => 'default' ) | ||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | : ( map { 'NS' . ( $_ + 1 ) => $self->ns->[ $_ ] } 0 .. ( scalar (@{ $self->ns }) - 1) ), | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 133 | IgnoreNSFail => ( $self->is_ns_fail_fatal ? 'No' : 'Yes' ), | ||||||||||||||||||||||||||||||
| 134 | UnLockRegistrar => ( $self->is_locked ? 0 : 1 ), | ||||||||||||||||||||||||||||||
| 135 | RenewName => ( $self->is_auto_renew ? 1 : 0 ), | ||||||||||||||||||||||||||||||
| 136 | AllowQueueing => ( $self->is_queueable ? 1 : 0 ), | ||||||||||||||||||||||||||||||
| 137 | NumYears => $self->years, | ||||||||||||||||||||||||||||||
| 138 | $self->has_nexus_purpose ? ( us_purpose => $self->nexus_purpose ) : ( ), | ||||||||||||||||||||||||||||||
| 139 | $self->has_nexus_category ? ( us_nexus => $self->nexus_category ) : ( ), | ||||||||||||||||||||||||||||||
| 140 | 0 | %{ $self->registrant_contact->construct_creation_request('Registrant') }, | |||||||||||||||||||||||||||||
| 141 | 0 | %{ $self->admin_contact->construct_creation_request('Admin') }, | |||||||||||||||||||||||||||||
| 142 | 0 | %{ $self->technical_contact->construct_creation_request('Tech') }, | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | %{ $self->billing_contact->construct_creation_request('AuxBilling') }, | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 144 | }; | ||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||
| 147 | 49 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||
| 148 | 49 | 1; | |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||
| 150 | __END__ | ||||||||||||||||||||||||||||||