| 1 | package Business::CPI::Role::Buyer; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Information about the client | ||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use Locale::Country (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use Business::CPI::Util::Types qw/Country/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use Types::Standard qw/Str/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Type::EmailAddress qw/EmailAddress/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 5 | our $VERSION = '0.924'; # VERSION | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 5 | has email => ( | |||||||||||||||||||||||||||
| 12 | isa => EmailAddress, | ||||||||||||||||||||||||||||
| 13 | is => 'ro', | ||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 5 | has name => ( | |||||||||||||||||||||||||||
| 17 | isa => Str, | ||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 5 | has address_line1 => ( is => 'lazy' ); | |||||||||||||||||||||||||||
| 22 | 5 | has address_line2 => ( is => 'lazy' ); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 5 | has address_street => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 25 | 5 | has address_number => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 26 | 5 | has address_district => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 27 | 5 | has address_complement => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 28 | 5 | has address_zip_code => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 29 | 5 | has address_city => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 30 | 5 | has address_state => ( is => 'ro', required => 0 ); | |||||||||||||||||||||||||||
| 31 | 5 | has address_country => ( | |||||||||||||||||||||||||||
| 32 | is => 'ro', | ||||||||||||||||||||||||||||
| 33 | required => 0, | ||||||||||||||||||||||||||||
| 34 | isa => Country, | ||||||||||||||||||||||||||||
| 35 | coerce => Country->coercion, | ||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 4 | ▶ | sub _build_address_line1 { | ||||||||||||||||||||||||||
|
Subroutine
_build_address_line1: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 39 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 4 | ▶ | my $street = $self->address_street || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->address_street || ''
MC/DC100%1/1
$self->address_street || ''
$self->address_street
Truth table100%2/2
A
A= $self->address_street
| |||||||||||||||||||||||||||||
| 42 | 4 | ▶ | my $number = $self->address_number || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->address_number || ''
MC/DC100%1/1
$self->address_number || ''
$self->address_number
Truth table100%2/2
A
A= $self->address_number
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 4 | ▶ | return unless $street; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 3 | ▶ | return $street unless $number; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | return "$street, $number"; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 4 | ▶ | sub _build_address_line2 { | ||||||||||||||||||||||||||
|
Subroutine
_build_address_line2: called CC=7 SCAR=20.0
| |||||||||||||||||||||||||||||
| 52 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 4 | ▶ | my $distr = $self->address_district || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->address_district || ''
MC/DC100%1/1
$self->address_district || ''
$self->address_district
Truth table100%2/2
A
A= $self->address_district
| |||||||||||||||||||||||||||||
| 55 | 4 | ▶ | my $compl = $self->address_complement || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->address_complement || ''
MC/DC100%1/1
$self->address_complement || ''
$self->address_complement
Truth table100%2/2
A
A= $self->address_complement
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 4 | ▶ | return $distr if ($distr && !$compl); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$distr and not $compl
MC/DC0%0/2
$distr and not $compl
$distr
not $compl
Truth table66%2/3
A and not(B)
A= $distrB= not $compl
| |||||||||||||||||||||||||||||
| 58 | 4 | ▶ | return $compl if (!$distr && $compl); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $distr and $compl
MC/DC0%0/2
not $distr and $compl
not $distr
$compl
Truth table66%2/3
not(A) and B
A= not $distrB= $compl
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 4 | return "$distr - $compl"; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | # TODO | ||||||||||||||||||||||||||||
| 64 | # add all the other attrs. | ||||||||||||||||||||||||||||
| 65 | # | ||||||||||||||||||||||||||||
| 66 | # try and find the common ones between PagSeguro / PayPal / etc, and keep them | ||||||||||||||||||||||||||||
| 67 | # here. Specific attrs can stay in Business::CPI::${gateway}::Buyer | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 5 | 1; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | __END__ | ||||||||||||||||||||||||||||