GoCardless/OutboundPayment.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 57.1% 8 / 14 MC/DCmcdc 14.2% 1 / 7 Subroutinesub 100% 13 / 13 Podpod 30.0% 3 / 10 totaltotal 71.2% 47 / 66 CC 8 SCAR 5.8
CC
8
Cov
83%
pending_approval
2.1
scheduled
2.1
executing
2.1
CRAP 1.8
« GoCardless/Webhook.pm ↑ Summary GoCardless/MandateImport.pm »
1 package Business::GoCardless::OutboundPayment;
2  
3 =head1 NAME
4  
5 Business::GoCardless::OutboundPayment
6  
7 =head1 DESCRIPTION
8  
9 A class for a gocardless outbound payment, 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 amount
22 created_at
23 currency
24 description
25 execution_date
26 id
27 is_withdrawal
28 links
29 metadata
30 reference
31 scheme
32 status
33 verifications
34  
35 =cut
36  
37 7 has [ qw/
38 amount
39 created_at
40 currency
41 description
42 execution_date
43 id
44 is_withdrawal
45 links
46 metadata
47 reference
48 scheme
49 status
50 verifications
51 / ] => (
52 is => 'rw',
53 );
54  
55 =head1 Operations on an outbound payment
56  
57 =head2 update
58  
59 Update the outbound payment's metadata:
60  
61 $OutboundPayment->update( metadata => { ... } );
62  
63 =head2 approve
64  
65 Approve the outbound payment:
66  
67 $OutboundPayment->approve;
68  
69 =head2 cancel
70  
71 Cancel the outbound payment (only possible before it is C<executing>):
72  
73 $OutboundPayment->cancel;
74  
75 =cut
76  
77 2 ▶sub update { shift->_update( @_ ); }
Subroutine update: called CC=1 SCAR=0.0
Pod documented
78 2 ▶sub approve { shift->_action( 'approve',@_ ); }
Subroutine approve: called CC=1 SCAR=0.0
Pod documented
79 2 ▶sub cancel { shift->_action( 'cancel',@_ ); }
Subroutine cancel: called CC=1 SCAR=0.0
Pod documented
80  
81 =head1 Status checks on an outbound payment
82  
83 verifying
84 pending_approval
85 scheduled
86 executing
87 executed
88 cancelled
89 failed
90  
91 if ( $OutboundPayment->verifying ) {
92 ...
93 }
94  
95 =cut
96  
97 8 ▶sub verifying { return ( shift->status // '' ) eq 'verifying' }
Subroutine verifying: 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
98 7 ▶sub pending_approval { return ( shift->status // '' ) eq 'pending_approval' }
Subroutine pending_approval: 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
99 7 ▶sub scheduled { return ( shift->status // '' ) eq 'scheduled' }
Subroutine scheduled: 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
100 7 ▶sub executing { return ( shift->status // '' ) eq 'executing' }
Subroutine executing: 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
101 7 ▶sub executed { return ( shift->status // '' ) eq 'executed' }
Subroutine executed: 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
102 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
103 7 ▶sub failed { return ( shift->status // '' ) eq 'failed' }
Subroutine failed: 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
104  
105 =head1 AUTHOR
106  
107 Lee Johnson - C<lee@payprop.com>
108  
109 This library is free software; you can redistribute it and/or modify it under
110 the same terms as Perl itself. If you would like to contribute documentation,
111 features, bug fixes, or anything else then please raise an issue / pull request:
112  
113 https://github.com/payprop/business-gocardless
114  
115 =cut
116  
117 7 1;
118  
119 # vim: ts=4:sw=4:et
« GoCardless/Webhook.pm ↑ Summary GoCardless/MandateImport.pm »