line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::GoCardless::Subscription; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::GoCardless::Subscription |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A class for a gocardless subscription, extends L |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
19
|
|
|
19
|
|
144
|
use strict; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
600
|
|
14
|
19
|
|
|
19
|
|
101
|
use warnings; |
|
19
|
|
|
|
|
50
|
|
|
19
|
|
|
|
|
477
|
|
15
|
|
|
|
|
|
|
|
16
|
19
|
|
|
19
|
|
100
|
use Moo; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
126
|
|
17
|
|
|
|
|
|
|
extends 'Business::GoCardless::Resource'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
amount |
22
|
|
|
|
|
|
|
created_at |
23
|
|
|
|
|
|
|
currency |
24
|
|
|
|
|
|
|
day_of_month |
25
|
|
|
|
|
|
|
description |
26
|
|
|
|
|
|
|
expires_at |
27
|
|
|
|
|
|
|
end_date |
28
|
|
|
|
|
|
|
id |
29
|
|
|
|
|
|
|
interval_length |
30
|
|
|
|
|
|
|
interval_unit |
31
|
|
|
|
|
|
|
interval |
32
|
|
|
|
|
|
|
links |
33
|
|
|
|
|
|
|
merchant_id |
34
|
|
|
|
|
|
|
metadata |
35
|
|
|
|
|
|
|
month |
36
|
|
|
|
|
|
|
name |
37
|
|
|
|
|
|
|
next_interval_start |
38
|
|
|
|
|
|
|
payment_reference |
39
|
|
|
|
|
|
|
setup_fee |
40
|
|
|
|
|
|
|
start_at |
41
|
|
|
|
|
|
|
start_date |
42
|
|
|
|
|
|
|
status |
43
|
|
|
|
|
|
|
sub_resource_uris |
44
|
|
|
|
|
|
|
uri |
45
|
|
|
|
|
|
|
user_id |
46
|
|
|
|
|
|
|
upcoming_payments |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has [ qw/ |
51
|
|
|
|
|
|
|
amount |
52
|
|
|
|
|
|
|
created_at |
53
|
|
|
|
|
|
|
currency |
54
|
|
|
|
|
|
|
description |
55
|
|
|
|
|
|
|
day_of_month |
56
|
|
|
|
|
|
|
expires_at |
57
|
|
|
|
|
|
|
end_date |
58
|
|
|
|
|
|
|
id |
59
|
|
|
|
|
|
|
interval_length |
60
|
|
|
|
|
|
|
interval_unit |
61
|
|
|
|
|
|
|
interval |
62
|
|
|
|
|
|
|
links |
63
|
|
|
|
|
|
|
merchant_id |
64
|
|
|
|
|
|
|
metadata |
65
|
|
|
|
|
|
|
month |
66
|
|
|
|
|
|
|
name |
67
|
|
|
|
|
|
|
next_interval_start |
68
|
|
|
|
|
|
|
payment_reference |
69
|
|
|
|
|
|
|
setup_fee |
70
|
|
|
|
|
|
|
start_at |
71
|
|
|
|
|
|
|
start_date |
72
|
|
|
|
|
|
|
status |
73
|
|
|
|
|
|
|
sub_resource_uris |
74
|
|
|
|
|
|
|
uri |
75
|
|
|
|
|
|
|
user_id |
76
|
|
|
|
|
|
|
upcoming_payments |
77
|
|
|
|
|
|
|
/ ] => ( |
78
|
|
|
|
|
|
|
is => 'rw', |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 Operations on a subscription |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
cancel |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$Subscription->cancel |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Cancels a subscription. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub cancel { |
92
|
2
|
|
|
2
|
0
|
19492
|
my ( $self ) = @_; |
93
|
|
|
|
|
|
|
|
94
|
2
|
100
|
|
|
|
57
|
if ( $self->client->api_version > 1 ) { |
95
|
1
|
|
|
|
|
26
|
return $self->_operation( undef,'api_post',undef,'actions/cancel' ); |
96
|
|
|
|
|
|
|
} else { |
97
|
1
|
|
|
|
|
39
|
return $self->_operation( 'cancel','api_put' ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 Status checks on a subscription |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
inactive |
104
|
|
|
|
|
|
|
active |
105
|
|
|
|
|
|
|
cancelled |
106
|
|
|
|
|
|
|
expired |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
if ( $Subscription->active ) { |
109
|
|
|
|
|
|
|
... |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
1
|
|
|
1
|
0
|
1868
|
sub inactive { return shift->status eq 'inactive' } |
115
|
1
|
|
|
1
|
0
|
7
|
sub active { return shift->status eq 'active' } |
116
|
3
|
|
|
3
|
0
|
19015
|
sub cancelled { return shift->status eq 'cancelled' } |
117
|
1
|
|
|
1
|
0
|
7
|
sub expired { return shift->status eq 'expired' } |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Lee Johnson - C |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
124
|
|
|
|
|
|
|
the same terms as Perl itself. If you would like to contribute documentation, |
125
|
|
|
|
|
|
|
features, bug fixes, or anything else then please raise an issue / pull request: |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
https://github.com/Humanstate/business-gocardless |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# vim: ts=4:sw=4:et |