GoCardless/InstalmentSchedule.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 68.7% 11 / 16 MC/DCmcdc 37.5% 3 / 8 Subroutinesub 100% 13 / 13 Podpod 20.0% 2 / 10 totaltotal 73.9% 51 / 69 CC 9 SCAR 6.1
CC
9
Cov
87%
creation_failed
2.1
completed
2.1
cancelled
2.1
CRAP 1.8
« GoCardless/OutboundPaymentImport.pm ↑ Summary GoCardless/Payment.pm »
1 package Business::GoCardless::InstalmentSchedule;
2  
3 =head1 NAME
4  
5 Business::GoCardless::InstalmentSchedule
6  
7 =head1 DESCRIPTION
8  
9 A class for a gocardless instalment schedule, extends L<Business::GoCardless::Resource>
10  
11 =cut
12  
13 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 7 extends 'Business::GoCardless::Resource';
18  
19 =head1 ATTRIBUTES
20  
21 created_at
22 currency
23 id
24 links
25 metadata
26 name
27 payment_errors
28 status
29 total_amount
30  
31 =cut
32  
33 7 has [ qw/
34 created_at
35 currency
36 id
37 links
38 metadata
39 name
40 payment_errors
41 status
42 total_amount
43 / ] => (
44 is => 'rw',
45 );
46  
47 =head1 Operations on an instalment schedule
48  
49 =head2 update
50  
51 Update the instalment schedule's metadata:
52  
53 $Schedule->update( metadata => { ... } );
54  
55 =head2 cancel
56  
57 Cancel the instalment schedule, cancelling any payments not yet submitted:
58  
59 $Schedule->cancel;
60  
61 =cut
62  
63 2 ▶sub update { shift->_update( @_ ); }
Subroutine update: called CC=1 SCAR=0.0
Pod documented
64 2 ▶sub cancel { shift->_action( 'cancel',@_ ); }
Subroutine cancel: called CC=1 SCAR=0.0
Pod documented
65  
66 =head1 Status checks on an instalment schedule
67  
68 pending
69 active
70 creation_failed
71 completed
72 cancelled
73 errored
74  
75 if ( $InstalmentSchedule->pending ) {
76 ...
77 }
78  
79 =cut
80  
81 7 ▶sub pending { return ( shift->status // '' ) eq 'pending' }
Subroutine pending: called CC=2 SCAR=6.9
Pod undocumented
Condition100%2/2
(shift())->status // ""
l!l
61
MC/DC100%1/1
(shift())->status // ""
(shift())->status
Truth table100%2/2
A
A= (shift())->status
Aresult
11
00
82 8 ▶sub active { return ( shift->status // '' ) eq 'active' }
Subroutine active: called CC=2 SCAR=6.9
Pod undocumented
Condition100%2/2
(shift())->status // ""
l!l
71
MC/DC100%1/1
(shift())->status // ""
(shift())->status
Truth table100%2/2
A
A= (shift())->status
Aresult
11
00
83 6 ▶sub creation_failed { return ( shift->status // '' ) eq 'creation_failed' }
Subroutine creation_failed: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
(shift())->status // ""
l!l
60
MC/DC0%0/1
(shift())->status // ""
(shift())->status
Truth table50%1/2
A
A= (shift())->status
Aresult
11
00
84 6 ▶sub completed { return ( shift->status // '' ) eq 'completed' }
Subroutine completed: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
(shift())->status // ""
l!l
60
MC/DC0%0/1
(shift())->status // ""
(shift())->status
Truth table50%1/2
A
A= (shift())->status
Aresult
11
00
85 7 ▶sub cancelled { return ( shift->status // '' ) eq 'cancelled' }
Subroutine cancelled: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
(shift())->status // ""
l!l
70
MC/DC0%0/1
(shift())->status // ""
(shift())->status
Truth table50%1/2
A
A= (shift())->status
Aresult
11
00
86 6 ▶sub errored { return ( shift->status // '' ) eq 'errored' }
Subroutine errored: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
(shift())->status // ""
l!l
60
MC/DC0%0/1
(shift())->status // ""
(shift())->status
Truth table50%1/2
A
A= (shift())->status
Aresult
11
00
87  
88 =head1 Links
89  
90 Shortcut methods to get the IDs of the linked resources
91  
92 mandate_id
93 customer_id
94  
95 =cut
96  
97 2 ▶sub mandate_id { return ( shift->links // {} )->{mandate} }
Subroutine mandate_id: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
(shift())->links // {}
l!l
20
MC/DC0%0/1
(shift())->links // {}
(shift())->links
Truth table50%1/2
A
A= (shift())->links
Aresult
11
00
98 3 ▶sub customer_id { return ( shift->links // {} )->{customer} }
Subroutine customer_id: called CC=2 SCAR=6.9
Pod undocumented
Condition100%2/2
(shift())->links // {}
l!l
21
MC/DC100%1/1
(shift())->links // {}
(shift())->links
Truth table100%2/2
A
A= (shift())->links
Aresult
11
00
99  
100 =head1 AUTHOR
101  
102 Lee Johnson - C<lee@payprop.com>
103  
104 This library is free software; you can redistribute it and/or modify it under
105 the same terms as Perl itself. If you would like to contribute documentation,
106 features, bug fixes, or anything else then please raise an issue / pull request:
107  
108 https://github.com/payprop/business-gocardless
109  
110 =cut
111  
112 7 1;
113  
114 # vim: ts=4:sw=4:et
« GoCardless/OutboundPaymentImport.pm ↑ Summary GoCardless/Payment.pm »