line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::CPI::Role::Receiver; |
2
|
|
|
|
|
|
|
# ABSTRACT: The person receiving the money |
3
|
1
|
|
|
1
|
|
501
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
28
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
5
|
1
|
|
|
1
|
|
252
|
use Business::CPI::Util::Types qw/Money/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
419
|
use Types::Standard qw/Bool/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.922'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has _gateway => ( |
11
|
|
|
|
|
|
|
is => 'rw', |
12
|
|
|
|
|
|
|
required => 1, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has gateway_fee => ( |
16
|
|
|
|
|
|
|
is => 'rwp', |
17
|
|
|
|
|
|
|
required => 0, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has account => ( |
21
|
|
|
|
|
|
|
is => 'rw', |
22
|
|
|
|
|
|
|
required => 1, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has is_primary => ( |
26
|
|
|
|
|
|
|
is => 'rw', |
27
|
|
|
|
|
|
|
isa => Bool, |
28
|
|
|
|
|
|
|
default => sub { 0 }, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has pay_gateway_fee => ( |
32
|
|
|
|
|
|
|
is => 'rw', |
33
|
|
|
|
|
|
|
isa => Bool, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has fixed_amount => ( |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
isa => Money, |
39
|
|
|
|
|
|
|
coerce => Money->coercion, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has percent_amount => ( |
43
|
|
|
|
|
|
|
is => 'rw', |
44
|
|
|
|
|
|
|
coerce => sub { 0 + $_[0] } |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
around BUILDARGS => sub { |
48
|
|
|
|
|
|
|
my $orig = shift; |
49
|
|
|
|
|
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $args = $self->$orig(@_); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# let it die elsewhere |
54
|
|
|
|
|
|
|
return $args unless $args->{_gateway}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
if (my $id = delete $args->{gateway_id}) { |
57
|
|
|
|
|
|
|
$args->{account} = $args->{_gateway}->new_account({ gateway_id => $id }); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return $args; |
61
|
|
|
|
|
|
|
}; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |