CPI/Role/Receiver.pm

filter: Statementstmt 100% 31 / 31 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 97.6% 41 / 42 CC 3 SCAR 5.1
CC
3
Cov
97%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« CPI.pm ↑ Summary CPI/Util/Types.pm »
1 package Business::CPI::Role::Receiver;
2 # ABSTRACT: The person receiving the money
3 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Business::CPI::Util::Types qw/Money/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Types::Standard qw/Bool/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.924'; # VERSION
9  
10 1 has _gateway => (
11 is => 'rw',
12 required => 1,
13 );
14  
15 1 has gateway_fee => (
16 is => 'rwp',
17 required => 0,
18 );
19  
20 1 has account => (
21 is => 'rw',
22 required => 1,
23 );
24  
25 has is_primary => (
26 is => 'rw',
27 isa => Bool,
28 2 ▶ default => sub { 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
29 1 );
30  
31 1 has pay_gateway_fee => (
32 is => 'rw',
33 isa => Bool,
34 );
35  
36 1 has fixed_amount => (
37 is => 'rw',
38 isa => Money,
39 coerce => Money->coercion,
40 );
41  
42 has percent_amount => (
43 is => 'rw',
44 2 ▶ coerce => sub { 0 + $_[0] }
Subroutine __ANON__: called CC=1 SCAR=0.0
45 1 );
46  
47 2 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
48 2 my $orig = shift;
49 2 my $self = shift;
50  
51 2 my $args = $self->$orig(@_);
52  
53 # let it die elsewhere
54 2 ▶ return $args unless $args->{_gateway};
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{"_gateway"} 0 2 2
55  
56 2 ▶ if (my $id = delete $args->{gateway_id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $id = delete $args->{"gateway_id"}) 1 1 2
57 1 $args->{account} = $args->{_gateway}->new_account({ gateway_id => $id });
58 }
59  
60 2 return $args;
61 1 };
62  
63 1 1;
64  
65 __END__
« CPI.pm ↑ Summary CPI/Util/Types.pm »