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