Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit d98c259

Browse files
committed
feat(Order): support multiple shipping addresses
1 parent 09a80b6 commit d98c259

File tree

7 files changed

+344
-4
lines changed

7 files changed

+344
-4
lines changed

src/Core/Builder/Update/OrdersActionBuilder.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Commercetools\Core\Error\InvalidArgumentException;
66
use Commercetools\Core\Request\AbstractAction;
77
use Commercetools\Core\Request\Orders\Command\OrderAddDeliveryAction;
8+
use Commercetools\Core\Request\Orders\Command\OrderAddItemShippingAddressAction;
89
use Commercetools\Core\Request\Orders\Command\OrderAddParcelToDeliveryAction;
910
use Commercetools\Core\Request\Orders\Command\OrderAddPaymentAction;
1011
use Commercetools\Core\Request\Orders\Command\OrderAddReturnInfoAction;
@@ -14,18 +15,21 @@
1415
use Commercetools\Core\Request\Orders\Command\OrderImportCustomLineItemStateAction;
1516
use Commercetools\Core\Request\Orders\Command\OrderImportLineItemStateAction;
1617
use Commercetools\Core\Request\Orders\Command\OrderRemoveDeliveryAction;
18+
use Commercetools\Core\Request\Orders\Command\OrderRemoveItemShippingAddressAction;
1719
use Commercetools\Core\Request\Orders\Command\OrderRemoveParcelFromDeliveryAction;
1820
use Commercetools\Core\Request\Orders\Command\OrderRemovePaymentAction;
1921
use Commercetools\Core\Request\Orders\Command\OrderSetBillingAddress;
2022
use Commercetools\Core\Request\Orders\Command\OrderSetCustomFieldAction;
2123
use Commercetools\Core\Request\Orders\Command\OrderSetCustomLineItemCustomFieldAction;
2224
use Commercetools\Core\Request\Orders\Command\OrderSetCustomLineItemCustomTypeAction;
25+
use Commercetools\Core\Request\Orders\Command\OrderSetCustomLineItemShippingDetailsAction;
2326
use Commercetools\Core\Request\Orders\Command\OrderSetCustomTypeAction;
2427
use Commercetools\Core\Request\Orders\Command\OrderSetCustomerEmail;
2528
use Commercetools\Core\Request\Orders\Command\OrderSetDeliveryAddressAction;
2629
use Commercetools\Core\Request\Orders\Command\OrderSetDeliveryItemsAction;
2730
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemCustomFieldAction;
2831
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemCustomTypeAction;
32+
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemShippingDetailsAction;
2933
use Commercetools\Core\Request\Orders\Command\OrderSetLocaleAction;
3034
use Commercetools\Core\Request\Orders\Command\OrderSetOrderNumberAction;
3135
use Commercetools\Core\Request\Orders\Command\OrderSetParcelItemsAction;
@@ -37,6 +41,7 @@
3741
use Commercetools\Core\Request\Orders\Command\OrderTransitionCustomLineItemStateAction;
3842
use Commercetools\Core\Request\Orders\Command\OrderTransitionLineItemStateAction;
3943
use Commercetools\Core\Request\Orders\Command\OrderTransitionStateAction;
44+
use Commercetools\Core\Request\Orders\Command\OrderUpdateItemShippingAddressAction;
4045
use Commercetools\Core\Request\Orders\Command\OrderUpdateSyncInfoAction;
4146

4247
class OrdersActionBuilder
@@ -54,6 +59,17 @@ public function addDelivery($action = null)
5459
return $this;
5560
}
5661

62+
/**
63+
*
64+
* @param OrderAddItemShippingAddressAction|callable $action
65+
* @return $this
66+
*/
67+
public function addItemShippingAddress($action = null)
68+
{
69+
$this->addAction($this->resolveAction(OrderAddItemShippingAddressAction::class, $action));
70+
return $this;
71+
}
72+
5773
/**
5874
* @link https://docs.commercetools.com/http-api-projects-orders.html#add-parcel
5975
* @param OrderAddParcelToDeliveryAction|callable $action
@@ -153,6 +169,17 @@ public function removeDelivery($action = null)
153169
return $this;
154170
}
155171

172+
/**
173+
*
174+
* @param OrderRemoveItemShippingAddressAction|callable $action
175+
* @return $this
176+
*/
177+
public function removeItemShippingAddress($action = null)
178+
{
179+
$this->addAction($this->resolveAction(OrderRemoveItemShippingAddressAction::class, $action));
180+
return $this;
181+
}
182+
156183
/**
157184
* @link https://docs.commercetools.com/http-api-projects-orders.html#remove-parcel-from-delivery
158185
* @param OrderRemoveParcelFromDeliveryAction|callable $action
@@ -219,6 +246,17 @@ public function setCustomLineItemCustomType($action = null)
219246
return $this;
220247
}
221248

249+
/**
250+
*
251+
* @param OrderSetCustomLineItemShippingDetailsAction|callable $action
252+
* @return $this
253+
*/
254+
public function setCustomLineItemShippingDetails($action = null)
255+
{
256+
$this->addAction($this->resolveAction(OrderSetCustomLineItemShippingDetailsAction::class, $action));
257+
return $this;
258+
}
259+
222260
/**
223261
*
224262
* @param OrderSetCustomTypeAction|callable $action
@@ -285,6 +323,17 @@ public function setLineItemCustomType($action = null)
285323
return $this;
286324
}
287325

326+
/**
327+
*
328+
* @param OrderSetLineItemShippingDetailsAction|callable $action
329+
* @return $this
330+
*/
331+
public function setLineItemShippingDetails($action = null)
332+
{
333+
$this->addAction($this->resolveAction(OrderSetLineItemShippingDetailsAction::class, $action));
334+
return $this;
335+
}
336+
288337
/**
289338
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-locale
290339
* @param OrderSetLocaleAction|callable $action
@@ -406,6 +455,17 @@ public function transitionState($action = null)
406455
return $this;
407456
}
408457

458+
/**
459+
*
460+
* @param OrderUpdateItemShippingAddressAction|callable $action
461+
* @return $this
462+
*/
463+
public function updateItemShippingAddress($action = null)
464+
{
465+
$this->addAction($this->resolveAction(OrderUpdateItemShippingAddressAction::class, $action));
466+
return $this;
467+
}
468+
409469
/**
410470
* @link https://docs.commercetools.com/http-api-projects-orders.html#update-syncinfo
411471
* @param OrderUpdateSyncInfoAction|callable $action
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
*
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Request\Carts\Command\CartAddItemShippingAddressAction;
9+
use Commercetools\Core\Model\Common\Address;
10+
11+
/**
12+
* @package Commercetools\Core\Request\Orders\Command
13+
*
14+
* @method string getAction()
15+
* @method OrderAddItemShippingAddressAction setAction(string $action = null)
16+
* @method Address getAddress()
17+
* @method OrderAddItemShippingAddressAction setAddress(Address $address = null)
18+
*/
19+
class OrderAddItemShippingAddressAction extends CartAddItemShippingAddressAction
20+
{
21+
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
*
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Request\Carts\Command\CartRemoveItemShippingAddressAction;
9+
10+
/**
11+
* @package Commercetools\Core\Request\Orders\Command
12+
*
13+
* @method string getAction()
14+
* @method OrderRemoveItemShippingAddressAction setAction(string $action = null)
15+
* @method string getAddressKey()
16+
* @method OrderRemoveItemShippingAddressAction setAddressKey(string $addressKey = null)
17+
*/
18+
class OrderRemoveItemShippingAddressAction extends CartRemoveItemShippingAddressAction
19+
{
20+
21+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
*
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Request\Carts\Command\CartSetCustomLineItemShippingDetailsAction;
9+
use Commercetools\Core\Model\Cart\ItemShippingDetailsDraft;
10+
11+
/**
12+
* @package Commercetools\Core\Request\Orders\Command
13+
*
14+
* @method string getAction()
15+
* @method OrderSetCustomLineItemShippingDetailsAction setAction(string $action = null)
16+
* @method string getCustomLineItemId()
17+
* @method OrderSetCustomLineItemShippingDetailsAction setCustomLineItemId(string $customLineItemId = null)
18+
* @method ItemShippingDetailsDraft getShippingDetails()
19+
* @codingStandardsIgnoreStart
20+
* @method OrderSetCustomLineItemShippingDetailsAction setShippingDetails(ItemShippingDetailsDraft $shippingDetails = null)
21+
* @codingStandardsIgnoreEnd
22+
*/
23+
class OrderSetCustomLineItemShippingDetailsAction extends CartSetCustomLineItemShippingDetailsAction
24+
{
25+
26+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
*
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Request\Carts\Command\CartSetLineItemShippingDetailsAction;
9+
use Commercetools\Core\Model\Cart\ItemShippingDetailsDraft;
10+
11+
/**
12+
* @package Commercetools\Core\Request\Orders\Command
13+
*
14+
* @method string getAction()
15+
* @method OrderSetLineItemShippingDetailsAction setAction(string $action = null)
16+
* @method string getLineItemId()
17+
* @method OrderSetLineItemShippingDetailsAction setLineItemId(string $lineItemId = null)
18+
* @method ItemShippingDetailsDraft getShippingDetails()
19+
* @method OrderSetLineItemShippingDetailsAction setShippingDetails(ItemShippingDetailsDraft $shippingDetails = null)
20+
*/
21+
class OrderSetLineItemShippingDetailsAction extends CartSetLineItemShippingDetailsAction
22+
{
23+
24+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
*
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Request\Carts\Command\CartUpdateItemShippingAddressAction;
9+
use Commercetools\Core\Model\Common\Address;
10+
11+
/**
12+
* @package Commercetools\Core\Request\Orders\Command
13+
*
14+
* @method string getAction()
15+
* @method OrderUpdateItemShippingAddressAction setAction(string $action = null)
16+
* @method Address getAddress()
17+
* @method OrderUpdateItemShippingAddressAction setAddress(Address $address = null)
18+
*/
19+
class OrderUpdateItemShippingAddressAction extends CartUpdateItemShippingAddressAction
20+
{
21+
22+
}

0 commit comments

Comments
 (0)