line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Order.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/orders/object |
11
|
|
|
|
|
|
|
package Net::API::Stripe::Order; |
12
|
|
|
|
|
|
|
BEGIN |
13
|
|
|
|
|
|
|
{ |
14
|
2
|
|
|
2
|
|
21685247
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
64
|
|
15
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
68
|
|
16
|
2
|
|
|
2
|
|
12
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
12
|
|
17
|
2
|
|
|
2
|
|
142
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
118
|
|
18
|
2
|
|
|
2
|
|
44
|
our( $VERSION ) = 'v0.100.0'; |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
43
|
|
22
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
1124
|
|
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
1
|
|
sub id { return( shift->_set_get_scalar( 'id', @_ ) ); } |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
1
|
|
sub object { return( shift->_set_get_scalar( 'object', @_ ) ); } |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
1
|
|
sub amount { return( shift->_set_get_number( 'amount', @_ ) ); } |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
|
sub amount_returned { return( shift->_set_get_number( 'amount_returned', @_ ) ); } |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
|
sub application { return( shift->_set_get_scalar_or_object( 'application', 'Net::API::Stripe::Connect::Account', @_ ) ); } |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
|
sub application_fee { return( shift->_set_get_number( 'application_fee', @_ ) ); } |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub charge { return( shift->_set_get_scalar_or_object( 'charge', 'Net::API::Stripe::Charge', @_ ) ); } |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
1
|
|
sub created { return( shift->_set_get_datetime( 'created', @_ ) ); } |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
|
sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); } |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
|
sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); } |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub email { return( shift->_set_get_scalar( 'email', @_ ) ); } |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
1
|
|
sub external_coupon_code { return( shift->_set_get_scalar( 'external_coupon_code', @_ ) ); } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
## Array of Net::API::Stripe::Order::Item |
49
|
0
|
|
|
0
|
1
|
|
sub items { return( shift->_set_get_object_array( 'items', 'Net::API::Stripe::Order::Item', @_ ) ); } |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
|
sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); } |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
1
|
|
sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); } |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
sub returns { return( shift->_set_get_object( 'returns', 'Net::API::Stripe::Order::Returns', @_ ) ); } |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub selected_shipping_method { return( shift->_set_get_scalar( 'selected_shipping_method', @_ ) ); } |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
0
|
1
|
|
sub shipping { return( shift->_set_get_object( 'shipping', 'Net::API::Stripe::Shipping', @_ ) ); } |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
1
|
|
sub shipping_methods { return( shift->_set_get_object_array( 'shipping_methods', 'Net::API::Stripe::Order::ShippingMethod', @_ ) ); } |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
1
|
|
sub status { return( shift->_set_get_scalar( 'status', @_ ) ); } |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
1
|
|
sub status_transitions { return( shift->_set_get_object( 'status_transitions', 'Net::API::Stripe::Order::StatusTransitions', @_ ) ); } |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
0
|
1
|
|
sub updated { return( shift->_set_get_datetime( 'updated', @_ ) ); } |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
1
|
|
sub upstream_id { return( shift->_set_get_scalar( 'upstream_id', @_ ) ); } |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=encoding utf8 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 NAME |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Net::API::Stripe::Order - A Stripe Order Object |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SYNOPSIS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $order = $stripe->order({ |
84
|
|
|
|
|
|
|
amount => 2000, |
85
|
|
|
|
|
|
|
amount_returned => undef, |
86
|
|
|
|
|
|
|
application => $connect_account_object, |
87
|
|
|
|
|
|
|
application_fee => 20, |
88
|
|
|
|
|
|
|
charge => $charge_object, |
89
|
|
|
|
|
|
|
currency => 'jpy', |
90
|
|
|
|
|
|
|
customer => $customer_object, |
91
|
|
|
|
|
|
|
email => 'john.doe@example.com', |
92
|
|
|
|
|
|
|
metadata => { transaction_id => 123, customer_id => 456 }, |
93
|
|
|
|
|
|
|
returns => [], |
94
|
|
|
|
|
|
|
status => 'paid', |
95
|
|
|
|
|
|
|
status_transitions => $status_transitions_object, |
96
|
|
|
|
|
|
|
}); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 VERSION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
v0.100.0 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 DESCRIPTION |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Order objects are created to handle end customers' purchases of previously defined products (L<https://stripe.com/docs/api/orders#products>). You can create, retrieve, and pay individual orders, as well as list all orders. Orders are identified by a unique, random ID. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 new( %ARG ) |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Order> object. |
113
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 METHODS |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 id string |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Unique identifier for the object. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 object string, value is "order" |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
String representing the object’s type. Objects of the same type share the same value. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 amount integer |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 amount_returned integer |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
The total amount that was returned to the customer. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 application string |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
ID of the Connect Application that created the order. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
If this was somehow expanded, this would be a L<Net::API::Stripe::Connect::Account> object. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 application_fee integer |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
A fee in cents that will be applied to the order and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees documentation. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 charge string (expandable) |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
The ID of the payment used to pay for the order. Present if the order status is paid, fulfilled, or refunded. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
When expanded, this is a L<Net::API::Stripe::Charge> object. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 created timestamp |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Time at which the object was created. Measured in seconds since the Unix epoch. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 currency currency |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Three-letter ISO currency code, in lowercase. Must be a supported currency. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 customer string (expandable) |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
The customer used for the order. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
When expanded, this is a L<Net::API::Stripe::Customer> object. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 email string |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The email address of the customer placing the order. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 external_coupon_code string |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
External coupon code to load for this order. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 items array of hashes |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
List of items constituting the order. An order can have up to 25 items. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This is an array of L<Net::API::Stripe::Order::Item> objects. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 livemode boolean |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Has the value true if the object exists in live mode or the value false if the object exists in test mode. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 metadata hash |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 returns list |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This is an array of L<Net::API::Stripe::Order::Returns> objects. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 selected_shipping_method string |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
The shipping method that is currently selected for this order, if any. If present, it is equal to one of the ids of shipping methods in the shipping_methods array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 shipping hash |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
The shipping address for the order. Present if the order is for goods to be shipped. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Shipping> object. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 shipping_methods array of hashes |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This is an array of L<Net::API::Stripe::Order::ShippingMethod> objects. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 status string |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Current order status. One of created, paid, canceled, fulfilled, or returned. More details in the Orders Guide. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 status_transitions hash |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
The timestamps at which the order status was updated. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Order::StatusTransitions> object. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head2 updated timestamp |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Time at which the object was last updated. Measured in seconds since the Unix epoch. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head2 upstream_id string |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
The user’s order ID if it is different from the Stripe order ID. |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 API SAMPLE |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
{ |
226
|
|
|
|
|
|
|
"id": "or_fake123456789", |
227
|
|
|
|
|
|
|
"object": "order", |
228
|
|
|
|
|
|
|
"amount": 1500, |
229
|
|
|
|
|
|
|
"amount_returned": null, |
230
|
|
|
|
|
|
|
"application": null, |
231
|
|
|
|
|
|
|
"application_fee": null, |
232
|
|
|
|
|
|
|
"charge": null, |
233
|
|
|
|
|
|
|
"created": 1571480453, |
234
|
|
|
|
|
|
|
"currency": "jpy", |
235
|
|
|
|
|
|
|
"customer": null, |
236
|
|
|
|
|
|
|
"email": null, |
237
|
|
|
|
|
|
|
"items": [ |
238
|
|
|
|
|
|
|
{ |
239
|
|
|
|
|
|
|
"object": "order_item", |
240
|
|
|
|
|
|
|
"amount": 1500, |
241
|
|
|
|
|
|
|
"currency": "jpy", |
242
|
|
|
|
|
|
|
"description": "T-shirt", |
243
|
|
|
|
|
|
|
"parent": "sk_fake123456789", |
244
|
|
|
|
|
|
|
"quantity": null, |
245
|
|
|
|
|
|
|
"type": "sku" |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
], |
248
|
|
|
|
|
|
|
"livemode": false, |
249
|
|
|
|
|
|
|
"metadata": {}, |
250
|
|
|
|
|
|
|
"returns": { |
251
|
|
|
|
|
|
|
"object": "list", |
252
|
|
|
|
|
|
|
"data": [], |
253
|
|
|
|
|
|
|
"has_more": false, |
254
|
|
|
|
|
|
|
"url": "/v1/order_returns?order=or_fake123456789" |
255
|
|
|
|
|
|
|
}, |
256
|
|
|
|
|
|
|
"selected_shipping_method": null, |
257
|
|
|
|
|
|
|
"shipping": { |
258
|
|
|
|
|
|
|
"address": { |
259
|
|
|
|
|
|
|
"city": "Anytown", |
260
|
|
|
|
|
|
|
"country": "US", |
261
|
|
|
|
|
|
|
"line1": "1234 Main street", |
262
|
|
|
|
|
|
|
"line2": null, |
263
|
|
|
|
|
|
|
"postal_code": "123456", |
264
|
|
|
|
|
|
|
"state": null |
265
|
|
|
|
|
|
|
}, |
266
|
|
|
|
|
|
|
"carrier": null, |
267
|
|
|
|
|
|
|
"name": "Jenny Rosen", |
268
|
|
|
|
|
|
|
"phone": null, |
269
|
|
|
|
|
|
|
"tracking_number": null |
270
|
|
|
|
|
|
|
}, |
271
|
|
|
|
|
|
|
"shipping_methods": null, |
272
|
|
|
|
|
|
|
"status": "created", |
273
|
|
|
|
|
|
|
"status_transitions": { |
274
|
|
|
|
|
|
|
"canceled": null, |
275
|
|
|
|
|
|
|
"fulfiled": null, |
276
|
|
|
|
|
|
|
"paid": null, |
277
|
|
|
|
|
|
|
"returned": null |
278
|
|
|
|
|
|
|
}, |
279
|
|
|
|
|
|
|
"updated": 1571480453 |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head1 HISTORY |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head2 v0.1 |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
Initial version |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head1 AUTHOR |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head1 SEE ALSO |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Stripe API documentation: |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/orders>, L<https://stripe.com/docs/orders> |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
303
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |