|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of michaelbutler/phposh. |
|
5
|
|
|
* Source: https://github.com/michaelbutler/phposh |
|
6
|
|
|
* |
|
7
|
|
|
* (c) Michael Butler <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* This source file is subject to the MIT license that is bundled |
|
10
|
|
|
* with this source code in the file named LICENSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace PHPosh\Provider\Poshmark; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Represents an Order of Item(s). |
|
17
|
|
|
*/ |
|
18
|
|
|
class Order |
|
19
|
|
|
{ |
|
20
|
|
|
/** @var string Right after purchase, still needs to ship */ |
|
21
|
|
|
public const STATUS_SOLD = 'Sold'; |
|
22
|
|
|
|
|
23
|
|
|
/** @var string Printed label but not picked up yet */ |
|
24
|
|
|
public const STATUS_PENDING_SCAN = 'Pending Shipment Scan'; |
|
25
|
|
|
|
|
26
|
|
|
/** @var string Shipped and scanned */ |
|
27
|
|
|
public const STATUS_SHIPPED = 'Shipped'; |
|
28
|
|
|
|
|
29
|
|
|
/** @var string Delivered and confirmed by buyer */ |
|
30
|
|
|
public const STATUS_DELIVERED = 'Delivered'; |
|
31
|
|
|
|
|
32
|
|
|
/** @var string Poshmark Identifier */ |
|
33
|
|
|
private $id; |
|
34
|
|
|
|
|
35
|
|
|
/** @var string Order title */ |
|
36
|
|
|
private $title; |
|
37
|
|
|
|
|
38
|
|
|
/** @var Price Order total */ |
|
39
|
|
|
private $orderTotal; |
|
40
|
|
|
|
|
41
|
|
|
/** @var Price Money made (after fees, etc.) */ |
|
42
|
|
|
private $earnings; |
|
43
|
|
|
|
|
44
|
|
|
/** @var Price */ |
|
45
|
|
|
private $poshmarkFee; |
|
46
|
|
|
|
|
47
|
|
|
/** @var Price */ |
|
48
|
|
|
private $taxes; |
|
49
|
|
|
|
|
50
|
|
|
/** @var \DateTime Date ordered */ |
|
51
|
|
|
private $orderDate; |
|
52
|
|
|
|
|
53
|
|
|
/** @var string Size purchased (single-item order only) */ |
|
54
|
|
|
private $size; |
|
55
|
|
|
|
|
56
|
|
|
/** @var string Url to order details */ |
|
57
|
|
|
private $url; |
|
58
|
|
|
|
|
59
|
|
|
/** @var string Url to item picture (the first item) */ |
|
60
|
|
|
private $imageUrl; |
|
61
|
|
|
|
|
62
|
|
|
/** @var string Username of buyer */ |
|
63
|
|
|
private $buyerUsername; |
|
64
|
|
|
|
|
65
|
|
|
/** @var string Address of buyer (currently not supported, as Poshmark doesn't make this easy to access) */ |
|
66
|
|
|
private $buyerAddress; |
|
67
|
|
|
|
|
68
|
|
|
/** @var string Order status */ |
|
69
|
|
|
private $orderStatus; |
|
70
|
|
|
|
|
71
|
|
|
/** @var Item[] Order items */ |
|
72
|
|
|
private $items; |
|
73
|
|
|
|
|
74
|
|
|
/** @var int Number of items in order */ |
|
75
|
|
|
private $itemCount; |
|
76
|
|
|
|
|
77
|
|
|
/** @var string Url to the shipping label PDF download */ |
|
78
|
|
|
private $shippingLabelPdf; |
|
79
|
|
|
|
|
80
|
1 |
|
public function getId(): string |
|
81
|
|
|
{ |
|
82
|
1 |
|
return $this->id; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
1 |
|
public function setId(string $id): Order |
|
86
|
|
|
{ |
|
87
|
1 |
|
$this->id = $id; |
|
88
|
|
|
|
|
89
|
1 |
|
return $this; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
1 |
|
public function getTitle(): string |
|
93
|
|
|
{ |
|
94
|
1 |
|
return $this->title; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
1 |
|
public function setTitle(string $title): Order |
|
98
|
|
|
{ |
|
99
|
1 |
|
$this->title = $title; |
|
100
|
|
|
|
|
101
|
1 |
|
return $this; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
1 |
|
public function getOrderTotal(): Price |
|
105
|
|
|
{ |
|
106
|
1 |
|
return $this->orderTotal; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
1 |
|
public function setOrderTotal(Price $orderTotal): Order |
|
110
|
|
|
{ |
|
111
|
1 |
|
$this->orderTotal = $orderTotal; |
|
112
|
|
|
|
|
113
|
1 |
|
return $this; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
1 |
|
public function getSize(): string |
|
117
|
|
|
{ |
|
118
|
1 |
|
return $this->size; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
1 |
|
public function setSize(string $size): Order |
|
122
|
|
|
{ |
|
123
|
1 |
|
$this->size = $size; |
|
124
|
|
|
|
|
125
|
1 |
|
return $this; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
1 |
|
public function getUrl(): string |
|
129
|
|
|
{ |
|
130
|
1 |
|
return $this->url; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
1 |
|
public function setUrl(string $url): Order |
|
134
|
|
|
{ |
|
135
|
1 |
|
$this->url = $url; |
|
136
|
|
|
|
|
137
|
1 |
|
return $this; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
1 |
|
public function getImageUrl(): string |
|
141
|
|
|
{ |
|
142
|
1 |
|
return $this->imageUrl; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
1 |
|
public function setImageUrl(string $imageUrl): Order |
|
146
|
|
|
{ |
|
147
|
1 |
|
$this->imageUrl = $imageUrl; |
|
148
|
|
|
|
|
149
|
1 |
|
return $this; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
1 |
|
public function getBuyerUsername(): string |
|
153
|
|
|
{ |
|
154
|
1 |
|
return $this->buyerUsername; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
1 |
|
public function setBuyerUsername(string $buyerUsername): Order |
|
158
|
|
|
{ |
|
159
|
1 |
|
$this->buyerUsername = $buyerUsername; |
|
160
|
|
|
|
|
161
|
1 |
|
return $this; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
1 |
|
public function getBuyerAddress(): string |
|
165
|
|
|
{ |
|
166
|
1 |
|
return $this->buyerAddress; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
1 |
|
public function setBuyerAddress(string $buyerAddress): Order |
|
170
|
|
|
{ |
|
171
|
1 |
|
$this->buyerAddress = $buyerAddress; |
|
172
|
|
|
|
|
173
|
1 |
|
return $this; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
1 |
|
public function getOrderStatus(): string |
|
177
|
|
|
{ |
|
178
|
1 |
|
return $this->orderStatus; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
1 |
|
public function setOrderStatus(string $orderStatus): Order |
|
182
|
|
|
{ |
|
183
|
1 |
|
$this->orderStatus = $orderStatus; |
|
184
|
|
|
|
|
185
|
1 |
|
return $this; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
1 |
|
public function getOrderDate(): \DateTime |
|
189
|
|
|
{ |
|
190
|
1 |
|
return $this->orderDate; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
1 |
|
public function setOrderDate(\DateTime $orderDate): Order |
|
194
|
|
|
{ |
|
195
|
1 |
|
$this->orderDate = $orderDate; |
|
196
|
|
|
|
|
197
|
1 |
|
return $this; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
1 |
|
public function getEarnings(): Price |
|
201
|
|
|
{ |
|
202
|
1 |
|
return $this->earnings; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
1 |
|
public function setEarnings(Price $earnings): Order |
|
206
|
|
|
{ |
|
207
|
1 |
|
$this->earnings = $earnings; |
|
208
|
|
|
|
|
209
|
1 |
|
return $this; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* @return Item[] |
|
214
|
|
|
*/ |
|
215
|
1 |
|
public function getItems(): array |
|
216
|
|
|
{ |
|
217
|
1 |
|
return $this->items; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @param Item[] $items |
|
222
|
|
|
*/ |
|
223
|
1 |
|
public function setItems(array $items): Order |
|
224
|
|
|
{ |
|
225
|
1 |
|
$this->items = $items; |
|
226
|
|
|
|
|
227
|
1 |
|
return $this; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
1 |
|
public function getItemCount(): int |
|
231
|
|
|
{ |
|
232
|
1 |
|
return $this->itemCount; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
1 |
|
public function setItemCount(int $itemCount): Order |
|
236
|
|
|
{ |
|
237
|
1 |
|
$this->itemCount = $itemCount; |
|
238
|
|
|
|
|
239
|
1 |
|
return $this; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
1 |
|
public function getPoshmarkFee(): Price |
|
243
|
|
|
{ |
|
244
|
1 |
|
return $this->poshmarkFee; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
1 |
|
public function setPoshmarkFee(Price $poshmarkFee): Order |
|
248
|
|
|
{ |
|
249
|
1 |
|
$this->poshmarkFee = $poshmarkFee; |
|
250
|
|
|
|
|
251
|
1 |
|
return $this; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
1 |
|
public function getTaxes(): Price |
|
255
|
|
|
{ |
|
256
|
1 |
|
return $this->taxes; |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
1 |
|
public function setTaxes(Price $taxes): Order |
|
260
|
|
|
{ |
|
261
|
1 |
|
$this->taxes = $taxes; |
|
262
|
|
|
|
|
263
|
1 |
|
return $this; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
1 |
|
public function getShippingLabelPdf(): string |
|
267
|
|
|
{ |
|
268
|
1 |
|
return $this->shippingLabelPdf; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
1 |
|
public function setShippingLabelPdf(string $shippingLabelPdf): Order |
|
272
|
|
|
{ |
|
273
|
1 |
|
$this->shippingLabelPdf = $shippingLabelPdf; |
|
274
|
|
|
|
|
275
|
1 |
|
return $this; |
|
276
|
|
|
} |
|
277
|
|
|
} |
|
278
|
|
|
|