line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Billing/Discount.pm |
3
|
|
|
|
|
|
|
## Version v0.100.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2019 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2019/11/02 |
7
|
|
|
|
|
|
|
## Modified 2020/05/15 |
8
|
|
|
|
|
|
|
## |
9
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
## https://stripe.com/docs/api/discounts |
11
|
|
|
|
|
|
|
package Net::API::Stripe::Billing::Discount; |
12
|
|
|
|
|
|
|
BEGIN |
13
|
|
|
|
|
|
|
{ |
14
|
2
|
|
|
2
|
|
21284994
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
63
|
|
15
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
61
|
|
16
|
2
|
|
|
2
|
|
10
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
11
|
|
17
|
2
|
|
|
2
|
|
148
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
126
|
|
18
|
2
|
|
|
2
|
|
40
|
our( $VERSION ) = 'v0.100.0'; |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
37
|
|
22
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
479
|
|
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
1
|
|
sub object { return( shift->_set_get_scalar( 'object', @_ ) ); } |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
1
|
|
sub id { return( shift->_set_get_scalar( 'id', @_ ) ); } |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
1
|
|
sub checkout_session { return( shift->_set_get_scalar( 'checkout_session', @_ ) ); } |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
|
sub coupon { return( shift->_set_get_object( 'coupon', 'Net::API::Stripe::Billing::Coupon', @_ ) ); } |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
|
sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); } |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
|
sub end { return( shift->_set_get_datetime( 'end', @_ ) ); } |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub invoice { return( shift->_set_get_scalar( 'invoice', @_ ) ); } |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
1
|
|
sub invoice_item { return( shift->_set_get_scalar( 'invoice_item', @_ ) ); } |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
|
sub promotion_code { return( shift->_set_get_scalar_or_object( 'promotion_code', 'Net::API::Stripe::Billing::PromotionCode', @_ ) ); } |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
|
sub start { return( shift->_set_get_datetime( 'start', @_ ) ); } |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub subscription { return( shift->_set_get_scalar( 'subscription', @_ ) ); } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding utf8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Net::API::Stripe::Billing::Discount - A Stripe Discount |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SYNOPSIS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $discount = $stripe->discount({ |
59
|
|
|
|
|
|
|
coupon => $stripe->coupon({ |
60
|
|
|
|
|
|
|
id => 'SUMMER10POFF', |
61
|
|
|
|
|
|
|
currency => 'usd', |
62
|
|
|
|
|
|
|
duration_in_months => 2, |
63
|
|
|
|
|
|
|
max_redemptions => 12, |
64
|
|
|
|
|
|
|
name => 'Summer 10% reduction', |
65
|
|
|
|
|
|
|
percent_off => 10, |
66
|
|
|
|
|
|
|
valid => 1 |
67
|
|
|
|
|
|
|
}), |
68
|
|
|
|
|
|
|
customer => $customer_object, |
69
|
|
|
|
|
|
|
# undef() for once or forever |
70
|
|
|
|
|
|
|
end => '2020-12-31', |
71
|
|
|
|
|
|
|
start => '2020-06-01', |
72
|
|
|
|
|
|
|
subscription => 'sub_fake1234567', |
73
|
|
|
|
|
|
|
}); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 VERSION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
v0.100.0 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 DESCRIPTION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
A discount represents the actual application of a coupon to a particular customer. It contains information about when the discount began and when it will end. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 new( %ARG ) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Billing::Discount> object. |
88
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 object string, value is "discount" |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
String representing the object’s type. Objects of the same type share the same value. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 id string |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The ID of the discount object. Discounts cannot be fetched by ID. Use C<expand[]=discounts> in API calls to expand discount IDs in an array. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 checkout_session string |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 coupon hash, coupon object |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Hash describing the coupon applied to create this discount. This is a L<Net::API::Stripe::Billing::Coupon> object. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 customer string (expandable) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is the Stripe customer id, or when expanded, this is the L<Net::API::Stripe::Customer> object. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 end timestamp |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 invoice string |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 invoice_item string |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The invoice item C<id> (or invoice line item C<id> for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 promotion_code expandable |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The promotion code applied to create this discount. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
When expanded this is an L<Net::API::Stripe::Billing::PromotionCode> object. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 start timestamp |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Date that the coupon was applied. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 subscription string |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The subscription that this coupon is applied to, if it is applied to a particular subscription. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 API SAMPLE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
{ |
141
|
|
|
|
|
|
|
"object": "discount", |
142
|
|
|
|
|
|
|
"coupon": { |
143
|
|
|
|
|
|
|
"id": "25_5OFF", |
144
|
|
|
|
|
|
|
"object": "coupon", |
145
|
|
|
|
|
|
|
"amount_off": null, |
146
|
|
|
|
|
|
|
"created": 1571397911, |
147
|
|
|
|
|
|
|
"currency": null, |
148
|
|
|
|
|
|
|
"duration": "repeating", |
149
|
|
|
|
|
|
|
"duration_in_months": 3, |
150
|
|
|
|
|
|
|
"livemode": false, |
151
|
|
|
|
|
|
|
"max_redemptions": null, |
152
|
|
|
|
|
|
|
"metadata": {}, |
153
|
|
|
|
|
|
|
"name": "25.5% off", |
154
|
|
|
|
|
|
|
"percent_off": 25.5, |
155
|
|
|
|
|
|
|
"redeem_by": null, |
156
|
|
|
|
|
|
|
"times_redeemed": 0, |
157
|
|
|
|
|
|
|
"valid": true |
158
|
|
|
|
|
|
|
}, |
159
|
|
|
|
|
|
|
"customer": "cus_fake124567890", |
160
|
|
|
|
|
|
|
"end": 1579346711, |
161
|
|
|
|
|
|
|
"start": 1571397911, |
162
|
|
|
|
|
|
|
"subscription": null |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 HISTORY |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 v0.1 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Initial version |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 AUTHOR |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 SEE ALSO |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Stripe API documentation: |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
L<https://stripe.com/docs/api>, L<https://stripe.com/docs/billing/subscriptions/discounts> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
186
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |