line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::CPI::Role::Buyer; |
2
|
|
|
|
|
|
|
# ABSTRACT: Information about the client |
3
|
5
|
|
|
5
|
|
9529
|
use Moo::Role; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
44
|
|
4
|
5
|
|
|
5
|
|
1841
|
use Locale::Country (); |
|
5
|
|
|
|
|
23336
|
|
|
5
|
|
|
|
|
114
|
|
5
|
5
|
|
|
5
|
|
377
|
use Business::CPI::Util::Types qw/Country/; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
85
|
|
6
|
5
|
|
|
5
|
|
2463
|
use Types::Standard qw/Str/; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
50
|
|
7
|
5
|
|
|
5
|
|
4510
|
use Type::EmailAddress qw/EmailAddress/; |
|
5
|
|
|
|
|
10099
|
|
|
5
|
|
|
|
|
47
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.922'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has email => ( |
12
|
|
|
|
|
|
|
isa => EmailAddress, |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has name => ( |
17
|
|
|
|
|
|
|
isa => Str, |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has address_line1 => ( is => 'lazy' ); |
22
|
|
|
|
|
|
|
has address_line2 => ( is => 'lazy' ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has address_street => ( is => 'ro', required => 0 ); |
25
|
|
|
|
|
|
|
has address_number => ( is => 'ro', required => 0 ); |
26
|
|
|
|
|
|
|
has address_district => ( is => 'ro', required => 0 ); |
27
|
|
|
|
|
|
|
has address_complement => ( is => 'ro', required => 0 ); |
28
|
|
|
|
|
|
|
has address_zip_code => ( is => 'ro', required => 0 ); |
29
|
|
|
|
|
|
|
has address_city => ( is => 'ro', required => 0 ); |
30
|
|
|
|
|
|
|
has address_state => ( is => 'ro', required => 0 ); |
31
|
|
|
|
|
|
|
has address_country => ( |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
required => 0, |
34
|
|
|
|
|
|
|
isa => Country, |
35
|
|
|
|
|
|
|
coerce => Country->coercion, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _build_address_line1 { |
39
|
4
|
|
|
4
|
|
2492
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
4
|
|
100
|
|
|
39
|
my $street = $self->address_street || ''; |
42
|
4
|
|
100
|
|
|
27
|
my $number = $self->address_number || ''; |
43
|
|
|
|
|
|
|
|
44
|
4
|
100
|
|
|
|
16
|
return unless $street; |
45
|
|
|
|
|
|
|
|
46
|
3
|
50
|
|
|
|
11
|
return $street unless $number; |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
20
|
return "$street, $number"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _build_address_line2 { |
52
|
4
|
|
|
4
|
|
1370
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
100
|
|
|
35
|
my $distr = $self->address_district || ''; |
55
|
4
|
|
100
|
|
|
31
|
my $compl = $self->address_complement || ''; |
56
|
|
|
|
|
|
|
|
57
|
4
|
50
|
66
|
|
|
27
|
return $distr if ($distr && !$compl); |
58
|
4
|
50
|
66
|
|
|
19
|
return $compl if (!$distr && $compl); |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
26
|
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
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |