line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::GoCardless::Mandate; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::GoCardless::Mandate |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A class for a gocardless mandate, extends L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
19
|
|
|
19
|
|
134
|
use strict; |
|
19
|
|
|
|
|
53
|
|
|
19
|
|
|
|
|
580
|
|
14
|
19
|
|
|
19
|
|
336
|
use warnings; |
|
19
|
|
|
|
|
291
|
|
|
19
|
|
|
|
|
528
|
|
15
|
|
|
|
|
|
|
|
16
|
19
|
|
|
19
|
|
118
|
use Moo; |
|
19
|
|
|
|
|
63
|
|
|
19
|
|
|
|
|
110
|
|
17
|
|
|
|
|
|
|
extends 'Business::GoCardless::Resource'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
created_at |
22
|
|
|
|
|
|
|
consent_parameters |
23
|
|
|
|
|
|
|
id |
24
|
|
|
|
|
|
|
links |
25
|
|
|
|
|
|
|
metadata |
26
|
|
|
|
|
|
|
next_possible_charge_date |
27
|
|
|
|
|
|
|
payments_require_approval |
28
|
|
|
|
|
|
|
reference |
29
|
|
|
|
|
|
|
scheme |
30
|
|
|
|
|
|
|
status |
31
|
|
|
|
|
|
|
verified_at |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has [ qw/ |
36
|
|
|
|
|
|
|
created_at |
37
|
|
|
|
|
|
|
consent_parameters |
38
|
|
|
|
|
|
|
id |
39
|
|
|
|
|
|
|
links |
40
|
|
|
|
|
|
|
metadata |
41
|
|
|
|
|
|
|
next_possible_charge_date |
42
|
|
|
|
|
|
|
payments_require_approval |
43
|
|
|
|
|
|
|
reference |
44
|
|
|
|
|
|
|
scheme |
45
|
|
|
|
|
|
|
status |
46
|
|
|
|
|
|
|
verified_at |
47
|
|
|
|
|
|
|
/ ] => ( |
48
|
|
|
|
|
|
|
is => 'rw', |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 Operations on a mandate |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 cancel |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$Mandate->cancel; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 update |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$Mandate->update( %params ); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
note that you can only update the metadata on a mandate, so you must pass the params |
63
|
|
|
|
|
|
|
hash as something that looks like: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
%params = ( metadata => { ... } ); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
1
|
0
|
sub cancel { shift->_operation( undef,'api_post',undef,'actions/cancel' ); } |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub update { |
72
|
0
|
|
|
0
|
1
|
0
|
my ( $self,%params ) = @_; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
0
|
return $self->client->api_put( |
75
|
|
|
|
|
|
|
sprintf( $self->endpoint,$self->id ), |
76
|
|
|
|
|
|
|
{ mandates => { %params } }, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 Status checks on a mandate |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
pending_customer_approval |
83
|
|
|
|
|
|
|
pending_submission |
84
|
|
|
|
|
|
|
submitted |
85
|
|
|
|
|
|
|
active |
86
|
|
|
|
|
|
|
failed |
87
|
|
|
|
|
|
|
cancelled |
88
|
|
|
|
|
|
|
expired |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
if ( $Mandate->failed ) { |
91
|
|
|
|
|
|
|
... |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
1
|
0
|
1979
|
sub pending_customer_approval { return shift->status eq 'pending_customer_approval' } |
97
|
1
|
|
|
1
|
0
|
7
|
sub pending_submission { return shift->status eq 'pending_submission' } |
98
|
1
|
|
|
1
|
0
|
8
|
sub submitted { return shift->status eq 'submitted' } |
99
|
1
|
|
|
1
|
0
|
9
|
sub active { return shift->status eq 'active' } |
100
|
1
|
|
|
1
|
0
|
10
|
sub failed { return shift->status eq 'failed' } |
101
|
1
|
|
|
1
|
0
|
11
|
sub cancelled { return shift->status eq 'cancelled' } |
102
|
1
|
|
|
1
|
0
|
9
|
sub expired { return shift->status eq 'expired' } |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Lee Johnson - C |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as Perl itself. If you would like to contribute documentation, |
110
|
|
|
|
|
|
|
features, bug fixes, or anything else then please raise an issue / pull request: |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
https://github.com/Humanstate/business-gocardless |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# vim: ts=4:sw=4:et |