|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Commercetools\Core\Builder\Update; |
|
4
|
|
|
|
|
5
|
|
|
use Commercetools\Core\Error\InvalidArgumentException; |
|
6
|
|
|
use Commercetools\Core\Request\AbstractAction; |
|
7
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderAddDeliveryAction; |
|
8
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderAddItemShippingAddressAction; |
|
9
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderAddParcelToDeliveryAction; |
|
10
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderAddPaymentAction; |
|
11
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderAddReturnInfoAction; |
|
12
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderChangeOrderStateAction; |
|
13
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderChangePaymentStateAction; |
|
14
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderChangeShipmentStateAction; |
|
15
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderImportCustomLineItemStateAction; |
|
16
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderImportLineItemStateAction; |
|
17
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderRemoveDeliveryAction; |
|
18
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderRemoveItemShippingAddressAction; |
|
19
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderRemoveParcelFromDeliveryAction; |
|
20
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderRemovePaymentAction; |
|
21
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetBillingAddress; |
|
22
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetBillingAddressCustomFieldAction; |
|
23
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetBillingAddressCustomTypeAction; |
|
24
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomFieldAction; |
|
25
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomLineItemCustomFieldAction; |
|
26
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomLineItemCustomTypeAction; |
|
27
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomLineItemShippingDetailsAction; |
|
28
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomTypeAction; |
|
29
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomerEmail; |
|
30
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetCustomerIdAction; |
|
31
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetDeliveryAddressAction; |
|
32
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetDeliveryAddressCustomFieldAction; |
|
33
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetDeliveryAddressCustomTypeAction; |
|
34
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetDeliveryItemsAction; |
|
35
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetItemShippingAddressCustomFieldAction; |
|
36
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetItemShippingAddressCustomTypeAction; |
|
37
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemCustomFieldAction; |
|
38
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemCustomTypeAction; |
|
39
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemShippingDetailsAction; |
|
40
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetLocaleAction; |
|
41
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetOrderNumberAction; |
|
42
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetParcelCustomFieldAction; |
|
43
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetParcelCustomTypeAction; |
|
44
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetParcelItemsAction; |
|
45
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetParcelMeasurementsAction; |
|
46
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetParcelTrackingDataAction; |
|
47
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetReturnInfoAction; |
|
48
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetReturnItemCustomFieldAction; |
|
49
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetReturnItemCustomTypeAction; |
|
50
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetReturnPaymentStateAction; |
|
51
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetReturnShipmentStateAction; |
|
52
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetShippingAddress; |
|
53
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetShippingAddressCustomFieldAction; |
|
54
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetShippingAddressCustomTypeAction; |
|
55
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderSetStoreAction; |
|
56
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderTransitionCustomLineItemStateAction; |
|
57
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderTransitionLineItemStateAction; |
|
58
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderTransitionStateAction; |
|
59
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderUpdateItemShippingAddressAction; |
|
60
|
|
|
use Commercetools\Core\Request\Orders\Command\OrderUpdateSyncInfoAction; |
|
61
|
|
|
|
|
62
|
|
|
class OrdersActionBuilder |
|
63
|
|
|
{ |
|
64
|
|
|
private $actions = []; |
|
65
|
|
|
|
|
66
|
1 |
|
/** |
|
67
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#add-delivery |
|
68
|
1 |
|
* @param OrderAddDeliveryAction|callable $action |
|
69
|
1 |
|
* @return $this |
|
70
|
|
|
*/ |
|
71
|
|
|
public function addDelivery($action = null) |
|
72
|
|
|
{ |
|
73
|
|
|
$this->addAction($this->resolveAction(OrderAddDeliveryAction::class, $action)); |
|
74
|
|
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
1 |
|
/** |
|
78
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#add-itemshippingaddress |
|
79
|
1 |
|
* @param OrderAddItemShippingAddressAction|callable $action |
|
80
|
1 |
|
* @return $this |
|
81
|
|
|
*/ |
|
82
|
|
|
public function addItemShippingAddress($action = null) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->addAction($this->resolveAction(OrderAddItemShippingAddressAction::class, $action)); |
|
85
|
|
|
return $this; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
1 |
|
/** |
|
89
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#add-parcel |
|
90
|
1 |
|
* @param OrderAddParcelToDeliveryAction|callable $action |
|
91
|
1 |
|
* @return $this |
|
92
|
|
|
*/ |
|
93
|
|
|
public function addParcelToDelivery($action = null) |
|
94
|
|
|
{ |
|
95
|
|
|
$this->addAction($this->resolveAction(OrderAddParcelToDeliveryAction::class, $action)); |
|
96
|
|
|
return $this; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
1 |
|
/** |
|
100
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#add-payment |
|
101
|
1 |
|
* @param OrderAddPaymentAction|callable $action |
|
102
|
1 |
|
* @return $this |
|
103
|
|
|
*/ |
|
104
|
|
|
public function addPayment($action = null) |
|
105
|
|
|
{ |
|
106
|
|
|
$this->addAction($this->resolveAction(OrderAddPaymentAction::class, $action)); |
|
107
|
|
|
return $this; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
1 |
|
/** |
|
111
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#addreturninfo |
|
112
|
1 |
|
* @param OrderAddReturnInfoAction|callable $action |
|
113
|
1 |
|
* @return $this |
|
114
|
|
|
*/ |
|
115
|
|
|
public function addReturnInfo($action = null) |
|
116
|
|
|
{ |
|
117
|
|
|
$this->addAction($this->resolveAction(OrderAddReturnInfoAction::class, $action)); |
|
118
|
|
|
return $this; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
1 |
|
/** |
|
122
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#change-orderstate |
|
123
|
1 |
|
* @param OrderChangeOrderStateAction|callable $action |
|
124
|
1 |
|
* @return $this |
|
125
|
|
|
*/ |
|
126
|
|
|
public function changeOrderState($action = null) |
|
127
|
|
|
{ |
|
128
|
|
|
$this->addAction($this->resolveAction(OrderChangeOrderStateAction::class, $action)); |
|
129
|
|
|
return $this; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
1 |
|
/** |
|
133
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#change-paymentstate |
|
134
|
1 |
|
* @param OrderChangePaymentStateAction|callable $action |
|
135
|
1 |
|
* @return $this |
|
136
|
|
|
*/ |
|
137
|
|
|
public function changePaymentState($action = null) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->addAction($this->resolveAction(OrderChangePaymentStateAction::class, $action)); |
|
140
|
|
|
return $this; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
1 |
|
/** |
|
144
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#change-shipmentstate |
|
145
|
1 |
|
* @param OrderChangeShipmentStateAction|callable $action |
|
146
|
1 |
|
* @return $this |
|
147
|
|
|
*/ |
|
148
|
|
|
public function changeShipmentState($action = null) |
|
149
|
|
|
{ |
|
150
|
|
|
$this->addAction($this->resolveAction(OrderChangeShipmentStateAction::class, $action)); |
|
151
|
|
|
return $this; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
1 |
|
/** |
|
155
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#import-state-for-customlineitems |
|
156
|
1 |
|
* @param OrderImportCustomLineItemStateAction|callable $action |
|
157
|
1 |
|
* @return $this |
|
158
|
|
|
*/ |
|
159
|
|
|
public function importCustomLineItemState($action = null) |
|
160
|
|
|
{ |
|
161
|
|
|
$this->addAction($this->resolveAction(OrderImportCustomLineItemStateAction::class, $action)); |
|
162
|
|
|
return $this; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
1 |
|
/** |
|
166
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#import-state-for-lineitems |
|
167
|
1 |
|
* @param OrderImportLineItemStateAction|callable $action |
|
168
|
1 |
|
* @return $this |
|
169
|
|
|
*/ |
|
170
|
|
|
public function importLineItemState($action = null) |
|
171
|
|
|
{ |
|
172
|
|
|
$this->addAction($this->resolveAction(OrderImportLineItemStateAction::class, $action)); |
|
173
|
|
|
return $this; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
1 |
|
/** |
|
177
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#remove-delivery |
|
178
|
1 |
|
* @param OrderRemoveDeliveryAction|callable $action |
|
179
|
1 |
|
* @return $this |
|
180
|
|
|
*/ |
|
181
|
|
|
public function removeDelivery($action = null) |
|
182
|
|
|
{ |
|
183
|
|
|
$this->addAction($this->resolveAction(OrderRemoveDeliveryAction::class, $action)); |
|
184
|
|
|
return $this; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
1 |
|
/** |
|
188
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#remove-itemshippingaddress |
|
189
|
1 |
|
* @param OrderRemoveItemShippingAddressAction|callable $action |
|
190
|
1 |
|
* @return $this |
|
191
|
|
|
*/ |
|
192
|
|
|
public function removeItemShippingAddress($action = null) |
|
193
|
|
|
{ |
|
194
|
|
|
$this->addAction($this->resolveAction(OrderRemoveItemShippingAddressAction::class, $action)); |
|
195
|
|
|
return $this; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
1 |
|
/** |
|
199
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#remove-parcel-from-delivery |
|
200
|
1 |
|
* @param OrderRemoveParcelFromDeliveryAction|callable $action |
|
201
|
1 |
|
* @return $this |
|
202
|
|
|
*/ |
|
203
|
|
|
public function removeParcelFromDelivery($action = null) |
|
204
|
|
|
{ |
|
205
|
|
|
$this->addAction($this->resolveAction(OrderRemoveParcelFromDeliveryAction::class, $action)); |
|
206
|
|
|
return $this; |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
1 |
|
/** |
|
210
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#remove-payment |
|
211
|
1 |
|
* @param OrderRemovePaymentAction|callable $action |
|
212
|
1 |
|
* @return $this |
|
213
|
|
|
*/ |
|
214
|
|
|
public function removePayment($action = null) |
|
215
|
|
|
{ |
|
216
|
|
|
$this->addAction($this->resolveAction(OrderRemovePaymentAction::class, $action)); |
|
217
|
|
|
return $this; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
1 |
|
/** |
|
221
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-billing-address |
|
222
|
1 |
|
* @param OrderSetBillingAddress|callable $action |
|
223
|
1 |
|
* @return $this |
|
224
|
|
|
*/ |
|
225
|
|
|
public function setBillingAddress($action = null) |
|
226
|
|
|
{ |
|
227
|
|
|
$this->addAction($this->resolveAction(OrderSetBillingAddress::class, $action)); |
|
228
|
|
|
return $this; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
1 |
|
/** |
|
232
|
|
|
* |
|
233
|
1 |
|
* @param OrderSetBillingAddressCustomFieldAction|callable $action |
|
234
|
1 |
|
* @return $this |
|
235
|
|
|
*/ |
|
236
|
|
|
public function setBillingAddressCustomField($action = null) |
|
237
|
|
|
{ |
|
238
|
|
|
$this->addAction($this->resolveAction(OrderSetBillingAddressCustomFieldAction::class, $action)); |
|
239
|
|
|
return $this; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
1 |
|
/** |
|
243
|
|
|
* |
|
244
|
1 |
|
* @param OrderSetBillingAddressCustomTypeAction|callable $action |
|
245
|
1 |
|
* @return $this |
|
246
|
|
|
*/ |
|
247
|
|
|
public function setBillingAddressCustomType($action = null) |
|
248
|
|
|
{ |
|
249
|
|
|
$this->addAction($this->resolveAction(OrderSetBillingAddressCustomTypeAction::class, $action)); |
|
250
|
|
|
return $this; |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
1 |
|
/** |
|
254
|
|
|
* |
|
255
|
1 |
|
* @param OrderSetCustomFieldAction|callable $action |
|
256
|
1 |
|
* @return $this |
|
257
|
|
|
*/ |
|
258
|
|
|
public function setCustomField($action = null) |
|
259
|
|
|
{ |
|
260
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomFieldAction::class, $action)); |
|
261
|
|
|
return $this; |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
1 |
|
/** |
|
265
|
|
|
* |
|
266
|
1 |
|
* @param OrderSetCustomLineItemCustomFieldAction|callable $action |
|
267
|
1 |
|
* @return $this |
|
268
|
|
|
*/ |
|
269
|
|
|
public function setCustomLineItemCustomField($action = null) |
|
270
|
|
|
{ |
|
271
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomLineItemCustomFieldAction::class, $action)); |
|
272
|
|
|
return $this; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
1 |
|
/** |
|
276
|
|
|
* |
|
277
|
1 |
|
* @param OrderSetCustomLineItemCustomTypeAction|callable $action |
|
278
|
1 |
|
* @return $this |
|
279
|
|
|
*/ |
|
280
|
|
|
public function setCustomLineItemCustomType($action = null) |
|
281
|
|
|
{ |
|
282
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomLineItemCustomTypeAction::class, $action)); |
|
283
|
|
|
return $this; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
1 |
|
/** |
|
287
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-customlineitemshippingdetails |
|
288
|
1 |
|
* @param OrderSetCustomLineItemShippingDetailsAction|callable $action |
|
289
|
1 |
|
* @return $this |
|
290
|
|
|
*/ |
|
291
|
|
|
public function setCustomLineItemShippingDetails($action = null) |
|
292
|
|
|
{ |
|
293
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomLineItemShippingDetailsAction::class, $action)); |
|
294
|
|
|
return $this; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
1 |
|
/** |
|
298
|
|
|
* |
|
299
|
1 |
|
* @param OrderSetCustomTypeAction|callable $action |
|
300
|
1 |
|
* @return $this |
|
301
|
|
|
*/ |
|
302
|
|
|
public function setCustomType($action = null) |
|
303
|
|
|
{ |
|
304
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomTypeAction::class, $action)); |
|
305
|
|
|
return $this; |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
1 |
|
/** |
|
309
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-customer-email |
|
310
|
1 |
|
* @param OrderSetCustomerEmail|callable $action |
|
311
|
1 |
|
* @return $this |
|
312
|
|
|
*/ |
|
313
|
|
|
public function setCustomerEmail($action = null) |
|
314
|
|
|
{ |
|
315
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomerEmail::class, $action)); |
|
316
|
|
|
return $this; |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
1 |
|
/** |
|
320
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-customer-id |
|
321
|
1 |
|
* @param OrderSetCustomerIdAction|callable $action |
|
322
|
1 |
|
* @return $this |
|
323
|
|
|
*/ |
|
324
|
|
|
public function setCustomerId($action = null) |
|
325
|
|
|
{ |
|
326
|
|
|
$this->addAction($this->resolveAction(OrderSetCustomerIdAction::class, $action)); |
|
327
|
|
|
return $this; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
1 |
|
/** |
|
331
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-delivery-address |
|
332
|
1 |
|
* @param OrderSetDeliveryAddressAction|callable $action |
|
333
|
1 |
|
* @return $this |
|
334
|
|
|
*/ |
|
335
|
|
|
public function setDeliveryAddress($action = null) |
|
336
|
|
|
{ |
|
337
|
|
|
$this->addAction($this->resolveAction(OrderSetDeliveryAddressAction::class, $action)); |
|
338
|
|
|
return $this; |
|
339
|
|
|
} |
|
340
|
|
|
|
|
341
|
1 |
|
/** |
|
342
|
|
|
* |
|
343
|
1 |
|
* @param OrderSetDeliveryAddressCustomFieldAction|callable $action |
|
344
|
1 |
|
* @return $this |
|
345
|
|
|
*/ |
|
346
|
|
|
public function setDeliveryAddressCustomField($action = null) |
|
347
|
|
|
{ |
|
348
|
|
|
$this->addAction($this->resolveAction(OrderSetDeliveryAddressCustomFieldAction::class, $action)); |
|
349
|
|
|
return $this; |
|
350
|
|
|
} |
|
351
|
|
|
|
|
352
|
1 |
|
/** |
|
353
|
|
|
* |
|
354
|
1 |
|
* @param OrderSetDeliveryAddressCustomTypeAction|callable $action |
|
355
|
1 |
|
* @return $this |
|
356
|
|
|
*/ |
|
357
|
|
|
public function setDeliveryAddressCustomType($action = null) |
|
358
|
|
|
{ |
|
359
|
|
|
$this->addAction($this->resolveAction(OrderSetDeliveryAddressCustomTypeAction::class, $action)); |
|
360
|
|
|
return $this; |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
1 |
|
/** |
|
364
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-delivery-items |
|
365
|
1 |
|
* @param OrderSetDeliveryItemsAction|callable $action |
|
366
|
1 |
|
* @return $this |
|
367
|
|
|
*/ |
|
368
|
|
|
public function setDeliveryItems($action = null) |
|
369
|
|
|
{ |
|
370
|
|
|
$this->addAction($this->resolveAction(OrderSetDeliveryItemsAction::class, $action)); |
|
371
|
|
|
return $this; |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
1 |
|
/** |
|
375
|
|
|
* |
|
376
|
1 |
|
* @param OrderSetItemShippingAddressCustomFieldAction|callable $action |
|
377
|
1 |
|
* @return $this |
|
378
|
|
|
*/ |
|
379
|
|
|
public function setItemShippingAddressCustomField($action = null) |
|
380
|
|
|
{ |
|
381
|
|
|
$this->addAction($this->resolveAction(OrderSetItemShippingAddressCustomFieldAction::class, $action)); |
|
382
|
|
|
return $this; |
|
383
|
|
|
} |
|
384
|
|
|
|
|
385
|
1 |
|
/** |
|
386
|
|
|
* |
|
387
|
1 |
|
* @param OrderSetItemShippingAddressCustomTypeAction|callable $action |
|
388
|
1 |
|
* @return $this |
|
389
|
|
|
*/ |
|
390
|
|
|
public function setItemShippingAddressCustomType($action = null) |
|
391
|
|
|
{ |
|
392
|
|
|
$this->addAction($this->resolveAction(OrderSetItemShippingAddressCustomTypeAction::class, $action)); |
|
393
|
|
|
return $this; |
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
1 |
|
/** |
|
397
|
|
|
* |
|
398
|
1 |
|
* @param OrderSetLineItemCustomFieldAction|callable $action |
|
399
|
1 |
|
* @return $this |
|
400
|
|
|
*/ |
|
401
|
|
|
public function setLineItemCustomField($action = null) |
|
402
|
|
|
{ |
|
403
|
|
|
$this->addAction($this->resolveAction(OrderSetLineItemCustomFieldAction::class, $action)); |
|
404
|
|
|
return $this; |
|
405
|
|
|
} |
|
406
|
|
|
|
|
407
|
1 |
|
/** |
|
408
|
|
|
* |
|
409
|
1 |
|
* @param OrderSetLineItemCustomTypeAction|callable $action |
|
410
|
1 |
|
* @return $this |
|
411
|
|
|
*/ |
|
412
|
|
|
public function setLineItemCustomType($action = null) |
|
413
|
|
|
{ |
|
414
|
|
|
$this->addAction($this->resolveAction(OrderSetLineItemCustomTypeAction::class, $action)); |
|
415
|
|
|
return $this; |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
1 |
|
/** |
|
419
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-lineitemshippingdetails |
|
420
|
1 |
|
* @param OrderSetLineItemShippingDetailsAction|callable $action |
|
421
|
1 |
|
* @return $this |
|
422
|
|
|
*/ |
|
423
|
|
|
public function setLineItemShippingDetails($action = null) |
|
424
|
|
|
{ |
|
425
|
|
|
$this->addAction($this->resolveAction(OrderSetLineItemShippingDetailsAction::class, $action)); |
|
426
|
|
|
return $this; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
1 |
|
/** |
|
430
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-locale |
|
431
|
1 |
|
* @param OrderSetLocaleAction|callable $action |
|
432
|
1 |
|
* @return $this |
|
433
|
|
|
*/ |
|
434
|
|
|
public function setLocale($action = null) |
|
435
|
|
|
{ |
|
436
|
|
|
$this->addAction($this->resolveAction(OrderSetLocaleAction::class, $action)); |
|
437
|
|
|
return $this; |
|
438
|
|
|
} |
|
439
|
|
|
|
|
440
|
1 |
|
/** |
|
441
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-order-number |
|
442
|
1 |
|
* @param OrderSetOrderNumberAction|callable $action |
|
443
|
1 |
|
* @return $this |
|
444
|
|
|
*/ |
|
445
|
|
|
public function setOrderNumber($action = null) |
|
446
|
|
|
{ |
|
447
|
|
|
$this->addAction($this->resolveAction(OrderSetOrderNumberAction::class, $action)); |
|
448
|
|
|
return $this; |
|
449
|
|
|
} |
|
450
|
|
|
|
|
451
|
1 |
|
/** |
|
452
|
|
|
* |
|
453
|
1 |
|
* @param OrderSetParcelCustomFieldAction|callable $action |
|
454
|
1 |
|
* @return $this |
|
455
|
|
|
*/ |
|
456
|
|
|
public function setParcelCustomField($action = null) |
|
457
|
|
|
{ |
|
458
|
|
|
$this->addAction($this->resolveAction(OrderSetParcelCustomFieldAction::class, $action)); |
|
459
|
|
|
return $this; |
|
460
|
|
|
} |
|
461
|
|
|
|
|
462
|
1 |
|
/** |
|
463
|
|
|
* |
|
464
|
1 |
|
* @param OrderSetParcelCustomTypeAction|callable $action |
|
465
|
1 |
|
* @return $this |
|
466
|
|
|
*/ |
|
467
|
|
|
public function setParcelCustomType($action = null) |
|
468
|
|
|
{ |
|
469
|
|
|
$this->addAction($this->resolveAction(OrderSetParcelCustomTypeAction::class, $action)); |
|
470
|
|
|
return $this; |
|
471
|
|
|
} |
|
472
|
|
|
|
|
473
|
1 |
|
/** |
|
474
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-parcel-items |
|
475
|
1 |
|
* @param OrderSetParcelItemsAction|callable $action |
|
476
|
1 |
|
* @return $this |
|
477
|
|
|
*/ |
|
478
|
|
|
public function setParcelItems($action = null) |
|
479
|
|
|
{ |
|
480
|
|
|
$this->addAction($this->resolveAction(OrderSetParcelItemsAction::class, $action)); |
|
481
|
|
|
return $this; |
|
482
|
|
|
} |
|
483
|
|
|
|
|
484
|
1 |
|
/** |
|
485
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-parcel-measurements |
|
486
|
1 |
|
* @param OrderSetParcelMeasurementsAction|callable $action |
|
487
|
1 |
|
* @return $this |
|
488
|
|
|
*/ |
|
489
|
|
|
public function setParcelMeasurements($action = null) |
|
490
|
|
|
{ |
|
491
|
|
|
$this->addAction($this->resolveAction(OrderSetParcelMeasurementsAction::class, $action)); |
|
492
|
|
|
return $this; |
|
493
|
|
|
} |
|
494
|
|
|
|
|
495
|
1 |
|
/** |
|
496
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-parcel-tracking-data |
|
497
|
1 |
|
* @param OrderSetParcelTrackingDataAction|callable $action |
|
498
|
1 |
|
* @return $this |
|
499
|
|
|
*/ |
|
500
|
|
|
public function setParcelTrackingData($action = null) |
|
501
|
|
|
{ |
|
502
|
|
|
$this->addAction($this->resolveAction(OrderSetParcelTrackingDataAction::class, $action)); |
|
503
|
|
|
return $this; |
|
504
|
|
|
} |
|
505
|
|
|
|
|
506
|
1 |
|
/** |
|
507
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-delivery-items |
|
508
|
1 |
|
* @param OrderSetReturnInfoAction|callable $action |
|
509
|
1 |
|
* @return $this |
|
510
|
|
|
*/ |
|
511
|
|
|
public function setReturnInfo($action = null) |
|
512
|
|
|
{ |
|
513
|
|
|
$this->addAction($this->resolveAction(OrderSetReturnInfoAction::class, $action)); |
|
514
|
|
|
return $this; |
|
515
|
|
|
} |
|
516
|
|
|
|
|
517
|
1 |
|
/** |
|
518
|
|
|
* |
|
519
|
1 |
|
* @param OrderSetReturnItemCustomFieldAction|callable $action |
|
520
|
1 |
|
* @return $this |
|
521
|
|
|
*/ |
|
522
|
|
|
public function setReturnItemCustomField($action = null) |
|
523
|
|
|
{ |
|
524
|
|
|
$this->addAction($this->resolveAction(OrderSetReturnItemCustomFieldAction::class, $action)); |
|
525
|
|
|
return $this; |
|
526
|
|
|
} |
|
527
|
|
|
|
|
528
|
1 |
|
/** |
|
529
|
|
|
* |
|
530
|
1 |
|
* @param OrderSetReturnItemCustomTypeAction|callable $action |
|
531
|
1 |
|
* @return $this |
|
532
|
|
|
*/ |
|
533
|
|
|
public function setReturnItemCustomType($action = null) |
|
534
|
|
|
{ |
|
535
|
|
|
$this->addAction($this->resolveAction(OrderSetReturnItemCustomTypeAction::class, $action)); |
|
536
|
|
|
return $this; |
|
537
|
|
|
} |
|
538
|
|
|
|
|
539
|
1 |
|
/** |
|
540
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-returnpaymentstate |
|
541
|
1 |
|
* @param OrderSetReturnPaymentStateAction|callable $action |
|
542
|
1 |
|
* @return $this |
|
543
|
|
|
*/ |
|
544
|
|
|
public function setReturnPaymentState($action = null) |
|
545
|
|
|
{ |
|
546
|
|
|
$this->addAction($this->resolveAction(OrderSetReturnPaymentStateAction::class, $action)); |
|
547
|
|
|
return $this; |
|
548
|
|
|
} |
|
549
|
|
|
|
|
550
|
1 |
|
/** |
|
551
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-returnshipmentstate |
|
552
|
1 |
|
* @param OrderSetReturnShipmentStateAction|callable $action |
|
553
|
1 |
|
* @return $this |
|
554
|
|
|
*/ |
|
555
|
|
|
public function setReturnShipmentState($action = null) |
|
556
|
|
|
{ |
|
557
|
|
|
$this->addAction($this->resolveAction(OrderSetReturnShipmentStateAction::class, $action)); |
|
558
|
|
|
return $this; |
|
559
|
|
|
} |
|
560
|
|
|
|
|
561
|
1 |
|
/** |
|
562
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-shipping-address |
|
563
|
1 |
|
* @param OrderSetShippingAddress|callable $action |
|
564
|
1 |
|
* @return $this |
|
565
|
|
|
*/ |
|
566
|
|
|
public function setShippingAddress($action = null) |
|
567
|
|
|
{ |
|
568
|
|
|
$this->addAction($this->resolveAction(OrderSetShippingAddress::class, $action)); |
|
569
|
|
|
return $this; |
|
570
|
|
|
} |
|
571
|
|
|
|
|
572
|
1 |
|
/** |
|
573
|
|
|
* |
|
574
|
1 |
|
* @param OrderSetShippingAddressCustomFieldAction|callable $action |
|
575
|
1 |
|
* @return $this |
|
576
|
|
|
*/ |
|
577
|
|
|
public function setShippingAddressCustomField($action = null) |
|
578
|
|
|
{ |
|
579
|
|
|
$this->addAction($this->resolveAction(OrderSetShippingAddressCustomFieldAction::class, $action)); |
|
580
|
|
|
return $this; |
|
581
|
|
|
} |
|
582
|
|
|
|
|
583
|
1 |
|
/** |
|
584
|
|
|
* |
|
585
|
1 |
|
* @param OrderSetShippingAddressCustomTypeAction|callable $action |
|
586
|
1 |
|
* @return $this |
|
587
|
|
|
*/ |
|
588
|
|
|
public function setShippingAddressCustomType($action = null) |
|
589
|
|
|
{ |
|
590
|
|
|
$this->addAction($this->resolveAction(OrderSetShippingAddressCustomTypeAction::class, $action)); |
|
591
|
|
|
return $this; |
|
592
|
|
|
} |
|
593
|
|
|
|
|
594
|
1 |
|
/** |
|
595
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-store-beta |
|
596
|
1 |
|
* @param OrderSetStoreAction|callable $action |
|
597
|
1 |
|
* @return $this |
|
598
|
|
|
*/ |
|
599
|
|
|
public function setStore($action = null) |
|
600
|
|
|
{ |
|
601
|
|
|
$this->addAction($this->resolveAction(OrderSetStoreAction::class, $action)); |
|
602
|
|
|
return $this; |
|
603
|
|
|
} |
|
604
|
|
|
|
|
605
|
|
|
/** |
|
606
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#change-the-state-of-customlineitem-according-to-allowed-transitions |
|
607
|
|
|
* @param OrderTransitionCustomLineItemStateAction|callable $action |
|
608
|
|
|
* @return $this |
|
609
|
|
|
*/ |
|
610
|
|
|
public function transitionCustomLineItemState($action = null) |
|
611
|
|
|
{ |
|
612
|
|
|
$this->addAction($this->resolveAction(OrderTransitionCustomLineItemStateAction::class, $action)); |
|
613
|
|
|
return $this; |
|
614
|
49 |
|
} |
|
615
|
|
|
|
|
616
|
49 |
|
/** |
|
617
|
49 |
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#change-the-state-of-lineitem-according-to-allowed-transitions |
|
618
|
49 |
|
* @param OrderTransitionLineItemStateAction|callable $action |
|
619
|
49 |
|
* @return $this |
|
620
|
|
|
*/ |
|
621
|
49 |
|
public function transitionLineItemState($action = null) |
|
622
|
49 |
|
{ |
|
623
|
|
|
$this->addAction($this->resolveAction(OrderTransitionLineItemStateAction::class, $action)); |
|
624
|
|
|
return $this; |
|
625
|
|
|
} |
|
626
|
|
|
|
|
627
|
|
|
/** |
|
628
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#transition-state |
|
629
|
|
|
* @param OrderTransitionStateAction|callable $action |
|
630
|
|
|
* @return $this |
|
631
|
|
|
*/ |
|
632
|
|
|
public function transitionState($action = null) |
|
633
|
|
|
{ |
|
634
|
49 |
|
$this->addAction($this->resolveAction(OrderTransitionStateAction::class, $action)); |
|
635
|
|
|
return $this; |
|
636
|
49 |
|
} |
|
637
|
|
|
|
|
638
|
|
|
/** |
|
639
|
49 |
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#update-itemshippingaddress |
|
640
|
|
|
* @param OrderUpdateItemShippingAddressAction|callable $action |
|
641
|
|
|
* @return $this |
|
642
|
|
|
*/ |
|
643
|
|
|
public function updateItemShippingAddress($action = null) |
|
644
|
|
|
{ |
|
645
|
|
|
$this->addAction($this->resolveAction(OrderUpdateItemShippingAddressAction::class, $action)); |
|
646
|
49 |
|
return $this; |
|
647
|
|
|
} |
|
648
|
49 |
|
|
|
649
|
49 |
|
/** |
|
650
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#update-syncinfo |
|
651
|
|
|
* @param OrderUpdateSyncInfoAction|callable $action |
|
652
|
|
|
* @return $this |
|
653
|
|
|
*/ |
|
654
|
|
|
public function updateSyncInfo($action = null) |
|
655
|
49 |
|
{ |
|
656
|
|
|
$this->addAction($this->resolveAction(OrderUpdateSyncInfoAction::class, $action)); |
|
657
|
49 |
|
return $this; |
|
658
|
|
|
} |
|
659
|
|
|
|
|
660
|
|
|
/** |
|
661
|
|
|
* @return OrdersActionBuilder |
|
662
|
|
|
*/ |
|
663
|
|
|
public static function of() |
|
664
|
|
|
{ |
|
665
|
|
|
return new self(); |
|
666
|
|
|
} |
|
667
|
|
|
|
|
668
|
|
|
/** |
|
669
|
|
|
* @param $class |
|
670
|
|
|
* @param $action |
|
671
|
|
|
* @return AbstractAction |
|
672
|
|
|
* @throws InvalidArgumentException |
|
673
|
|
|
*/ |
|
674
|
|
|
private function resolveAction($class, $action = null) |
|
675
|
|
|
{ |
|
676
|
|
|
if (is_null($action) || is_callable($action)) { |
|
677
|
|
|
$callback = $action; |
|
678
|
|
|
$emptyAction = $class::of(); |
|
679
|
|
|
$action = $this->callback($emptyAction, $callback); |
|
680
|
|
|
} |
|
681
|
|
|
if ($action instanceof $class) { |
|
682
|
|
|
return $action; |
|
683
|
|
|
} |
|
684
|
|
|
throw new InvalidArgumentException( |
|
685
|
|
|
sprintf('Expected method to be called with or callable to return %s', $class) |
|
686
|
|
|
); |
|
687
|
|
|
} |
|
688
|
|
|
|
|
689
|
|
|
/** |
|
690
|
|
|
* @param $action |
|
691
|
|
|
* @param callable $callback |
|
692
|
|
|
* @return AbstractAction |
|
693
|
|
|
*/ |
|
694
|
|
|
private function callback($action, callable $callback = null) |
|
695
|
|
|
{ |
|
696
|
|
|
if (!is_null($callback)) { |
|
697
|
|
|
$action = $callback($action); |
|
698
|
|
|
} |
|
699
|
|
|
return $action; |
|
700
|
|
|
} |
|
701
|
|
|
|
|
702
|
|
|
/** |
|
703
|
|
|
* @param AbstractAction $action |
|
704
|
|
|
* @return $this; |
|
705
|
|
|
*/ |
|
706
|
|
|
public function addAction(AbstractAction $action) |
|
707
|
|
|
{ |
|
708
|
|
|
$this->actions[] = $action; |
|
709
|
|
|
return $this; |
|
710
|
|
|
} |
|
711
|
|
|
|
|
712
|
|
|
/** |
|
713
|
|
|
* @return array |
|
714
|
|
|
*/ |
|
715
|
|
|
public function getActions() |
|
716
|
|
|
{ |
|
717
|
|
|
return $this->actions; |
|
718
|
|
|
} |
|
719
|
|
|
|
|
720
|
|
|
|
|
721
|
|
|
/** |
|
722
|
|
|
* @param array $actions |
|
723
|
|
|
* @return $this |
|
724
|
|
|
*/ |
|
725
|
|
|
public function setActions(array $actions) |
|
726
|
|
|
{ |
|
727
|
|
|
$this->actions = $actions; |
|
728
|
|
|
return $this; |
|
729
|
|
|
} |
|
730
|
|
|
} |
|
731
|
|
|
|