line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::CPI::Role::Account::Address; |
2
|
|
|
|
|
|
|
# ABSTRACT: Business::CPI role for Addresses |
3
|
3
|
|
|
3
|
|
12384
|
use Moo::Role; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
20
|
|
4
|
3
|
|
|
3
|
|
938
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
15
|
|
5
|
3
|
|
|
3
|
|
590
|
use Business::CPI::Util::Types qw/Country/; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
40
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.922'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# TODO: |
10
|
|
|
|
|
|
|
# move this to Business::CPI core |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has line1 => ( is => 'lazy' ); |
13
|
|
|
|
|
|
|
has line2 => ( is => 'lazy' ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has street => ( is => 'rw' ); |
16
|
|
|
|
|
|
|
has number => ( is => 'rw' ); |
17
|
|
|
|
|
|
|
has district => ( is => 'rw' ); |
18
|
|
|
|
|
|
|
has complement => ( is => 'rw' ); |
19
|
|
|
|
|
|
|
has zip_code => ( is => 'rw' ); |
20
|
|
|
|
|
|
|
has city => ( is => 'rw' ); |
21
|
|
|
|
|
|
|
has state => ( is => 'rw' ); # TODO: compare against Brazilian UF's, if country eq br |
22
|
|
|
|
|
|
|
has country => ( |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => Country, |
25
|
|
|
|
|
|
|
coerce => Country->coercion, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _build_line1 { |
29
|
1
|
|
|
1
|
|
3872
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
50
|
|
|
7
|
my $street = $self->street || ''; |
32
|
1
|
|
50
|
|
|
3
|
my $number = $self->number || ''; |
33
|
1
|
|
50
|
|
|
7
|
my $compl = $self->complement || ''; |
34
|
|
|
|
|
|
|
|
35
|
1
|
50
|
|
|
|
4
|
return unless $street; |
36
|
|
|
|
|
|
|
|
37
|
1
|
50
|
33
|
|
|
3
|
return $street unless ($number || $compl); |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
3
|
return "$street, $number" unless $compl; |
40
|
1
|
50
|
|
|
|
3
|
return "$street - $compl" unless $number; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
7
|
return "$street, $number - $compl"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _build_line2 { |
46
|
1
|
|
|
1
|
|
409
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
10
|
return $self->district; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |