line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::API::Stripe::Product::PromotionCode; |
2
|
|
|
|
|
|
|
BEGIN |
3
|
|
|
|
|
|
|
{ |
4
|
2
|
|
|
2
|
|
886
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
6
|
2
|
|
|
2
|
|
9
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
7
|
2
|
|
|
2
|
|
158
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
121
|
|
8
|
2
|
|
|
2
|
|
41
|
our( $VERSION ) = 'v0.1.0'; |
9
|
|
|
|
|
|
|
}; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
12
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
669
|
|
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
1
|
|
sub id { return( shift->_set_get_scalar( 'id', @_ ) ); } |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
1
|
|
sub object { return( shift->_set_get_scalar( 'object', @_ ) ); } |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
1
|
|
sub active { return( shift->_set_get_boolean( 'active', @_ ) ); } |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
1
|
|
sub code { return( shift->_set_get_scalar( 'code', @_ ) ); } |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
1
|
|
sub coupon { return( shift->_set_get_object( 'coupon', 'Net::API::Stripe::Product::Coupon', @_ ) ); } |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
1
|
|
sub created { return( shift->_set_get_datetime( 'created', @_ ) ); } |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
1
|
|
sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); } |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
1
|
|
sub expires_at { return( shift->_set_get_datetime( 'expires_at', @_ ) ); } |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
|
sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); } |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
|
sub max_redemptions { return( shift->_set_get_number( 'max_redemptions', @_ ) ); } |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
|
sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); } |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub restrictions { return( shift->_set_get_class( 'restrictions', |
37
|
|
|
|
|
|
|
{ |
38
|
|
|
|
|
|
|
first_time_transaction => { type => "boolean" }, |
39
|
|
|
|
|
|
|
minimum_amount => { type => "number" }, |
40
|
|
|
|
|
|
|
minimum_amount_currency => { type => "scalar" }, |
41
|
|
|
|
|
|
|
}, @_ ) ); } |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
|
sub times_redeemed { return( shift->_set_get_number( 'times_redeemed', @_ ) ); } |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=encoding utf8 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Net::API::Stripe::Product::PromotionCode - The promotion code object |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SYNOPSIS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $promo = $stripe->promotion_code({ |
58
|
|
|
|
|
|
|
active => $stripe->true, |
59
|
|
|
|
|
|
|
code => 'TS0EQJHH', |
60
|
|
|
|
|
|
|
## Net::API::Stripe::Product::Coupon |
61
|
|
|
|
|
|
|
coupon => $coupon_object, |
62
|
|
|
|
|
|
|
created => 'now', |
63
|
|
|
|
|
|
|
## Net::API::Stripe::Customer |
64
|
|
|
|
|
|
|
customer => $customer_object, |
65
|
|
|
|
|
|
|
expires_at => '+3M', |
66
|
|
|
|
|
|
|
livemode => $stripe->false, |
67
|
|
|
|
|
|
|
max_redemptions => 10, |
68
|
|
|
|
|
|
|
metadata => { customer_id => 123, trans_id => 456 }, |
69
|
|
|
|
|
|
|
restrictions => |
70
|
|
|
|
|
|
|
{ |
71
|
|
|
|
|
|
|
first_time_transaction => $stripe->true, |
72
|
|
|
|
|
|
|
minimum_amount => 1000, |
73
|
|
|
|
|
|
|
minimum_amount_currency => 'jpy', |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
times_redeemed => 0, |
76
|
|
|
|
|
|
|
}); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
v0.1.0 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
A Promotion Code represents a customer-redeemable code for a coupon. It can be used to create multiple codes for a single coupon. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 METHODS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 id string |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Unique identifier for the object. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 object string |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
String representing the object's type. Objects of the same type share the same value. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 active boolean |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 code string |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 coupon hash |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Hash describing the coupon for this promotion code. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 created timestamp |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Time at which the object was created. Measured in seconds since the Unix epoch. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 customer expandable |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
The customer that this promotion code can be used by. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
When expanded this is an L<Net::API::Stripe::Customer> object. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 expires_at timestamp |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Date at which the promotion code can no longer be redeemed. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 livemode boolean |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 max_redemptions positive_integer |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Maximum number of times this promotion code can be redeemed. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 metadata hash |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Set of [key-value pairs](/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 restrictions hash |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Settings that restrict the redemption of the promotion code. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
It has the following properties: |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=over 4 |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item I<first_time_transaction> boolean |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item I<minimum_amount> positive_integer |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item I<minimum_amount_currency> string |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Three-letter [ISO code](https://stripe.com/docs/currencies) for minimum_amount |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 times_redeemed nonnegative_integer |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Number of times this promotion code has been used. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 API SAMPLE |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
{ |
163
|
|
|
|
|
|
|
"id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx", |
164
|
|
|
|
|
|
|
"object": "promotion_code", |
165
|
|
|
|
|
|
|
"active": true, |
166
|
|
|
|
|
|
|
"code": "TS0EQJHH", |
167
|
|
|
|
|
|
|
"coupon": { |
168
|
|
|
|
|
|
|
"id": "123", |
169
|
|
|
|
|
|
|
"object": "coupon", |
170
|
|
|
|
|
|
|
"amount_off": null, |
171
|
|
|
|
|
|
|
"created": 1507799684, |
172
|
|
|
|
|
|
|
"currency": null, |
173
|
|
|
|
|
|
|
"duration": "repeating", |
174
|
|
|
|
|
|
|
"duration_in_months": 3, |
175
|
|
|
|
|
|
|
"livemode": false, |
176
|
|
|
|
|
|
|
"max_redemptions": 14, |
177
|
|
|
|
|
|
|
"metadata": { |
178
|
|
|
|
|
|
|
"teste": "test" |
179
|
|
|
|
|
|
|
}, |
180
|
|
|
|
|
|
|
"name": null, |
181
|
|
|
|
|
|
|
"percent_off": 34.0, |
182
|
|
|
|
|
|
|
"redeem_by": null, |
183
|
|
|
|
|
|
|
"times_redeemed": 0, |
184
|
|
|
|
|
|
|
"valid": true |
185
|
|
|
|
|
|
|
}, |
186
|
|
|
|
|
|
|
"created": 1599060617, |
187
|
|
|
|
|
|
|
"customer": null, |
188
|
|
|
|
|
|
|
"expires_at": null, |
189
|
|
|
|
|
|
|
"livemode": false, |
190
|
|
|
|
|
|
|
"max_redemptions": null, |
191
|
|
|
|
|
|
|
"metadata": { |
192
|
|
|
|
|
|
|
}, |
193
|
|
|
|
|
|
|
"restrictions": { |
194
|
|
|
|
|
|
|
"first_time_transaction": false, |
195
|
|
|
|
|
|
|
"minimum_amount": null, |
196
|
|
|
|
|
|
|
"minimum_amount_currency": null |
197
|
|
|
|
|
|
|
}, |
198
|
|
|
|
|
|
|
"times_redeemed": 0 |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 HISTORY |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 v0.1.0 |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Initial version |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 AUTHOR |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head1 SEE ALSO |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Stripe API documentation: |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
L<https://stripe.com/docs/api#promotion_code_object> |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
222
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |