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

Commit e72b231

Browse files
authored
Merge pull request #694 from commercetools/php-mantainance3
2 parents 47e1b59 + 731bd79 commit e72b231

File tree

44 files changed

+1858
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1858
-2
lines changed

src/Core/Builder/Request/ProductRequestBuilder.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
namespace Commercetools\Core\Builder\Request;
44

55
use Commercetools\Core\Request\Products\ProductByIdGetRequest;
6+
use Commercetools\Core\Request\Products\ProductByIdHeadRequest;
67
use Commercetools\Core\Request\Products\ProductByKeyGetRequest;
8+
use Commercetools\Core\Request\Products\ProductByKeyHeadRequest;
79
use Commercetools\Core\Request\Products\ProductCreateRequest;
810
use Commercetools\Core\Model\Product\ProductDraft;
911
use Commercetools\Core\Request\Products\ProductDeleteByKeyRequest;
1012
use Commercetools\Core\Model\Product\Product;
1113
use Commercetools\Core\Request\Products\ProductDeleteRequest;
14+
use Commercetools\Core\Request\Products\ProductHeadRequest;
1215
use Commercetools\Core\Request\Products\ProductImageUploadRequest;
1316
use Psr\Http\Message\UploadedFileInterface;
1417
use Commercetools\Core\Request\Products\ProductQueryRequest;
@@ -29,6 +32,17 @@ public function getById($id)
2932
return $request;
3033
}
3134

35+
/**
36+
* @link https://docs.commercetools.com/api/projects/products#by-id
37+
* @param string $id
38+
* @return ProductByIdHeadRequest
39+
*/
40+
public function getByIdHead($id)
41+
{
42+
$request = ProductByIdHeadRequest::ofId($id);
43+
return $request;
44+
}
45+
3246
/**
3347
*
3448
* @param string $key
@@ -40,6 +54,17 @@ public function getByKey($key)
4054
return $request;
4155
}
4256

57+
/**
58+
* @link https://docs.commercetools.com/api/projects/products#by-key
59+
* @param string $key
60+
* @return ProductByKeyHeadRequest
61+
*/
62+
public function getByKeyHead($key)
63+
{
64+
$request = ProductByKeyHeadRequest::ofKey($key);
65+
return $request;
66+
}
67+
4368
/**
4469
* @link https://docs.commercetools.com/http-api-projects-products.html#create-a-product
4570
* @param ProductDraft $product
@@ -73,6 +98,17 @@ public function delete(Product $product)
7398
return $request;
7499
}
75100

101+
/**
102+
* @link https://docs.commercetools.com/api/projects/products#by-query-predicate
103+
*
104+
* @return ProductHeadRequest
105+
*/
106+
public function head()
107+
{
108+
$request = ProductHeadRequest::of();
109+
return $request;
110+
}
111+
76112
/**
77113
* @link https://docs.commercetools.com/http-api-projects-products.html#upload-a-product-image
78114
* @param string $id

src/Core/Builder/Update/CartsActionBuilder.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
use Commercetools\Core\Request\Carts\Command\CartSetLineItemDistributionChannelAction;
5151
use Commercetools\Core\Request\Carts\Command\CartSetLineItemPriceAction;
5252
use Commercetools\Core\Request\Carts\Command\CartSetLineItemShippingDetailsAction;
53+
use Commercetools\Core\Request\Carts\Command\CartSetLineItemSupplyChannelAction;
5354
use Commercetools\Core\Request\Carts\Command\CartSetLineItemTaxAmountAction;
5455
use Commercetools\Core\Request\Carts\Command\CartSetLineItemTaxRateAction;
5556
use Commercetools\Core\Request\Carts\Command\CartSetLineItemTotalPriceAction;
@@ -574,6 +575,17 @@ public function setLineItemShippingDetails($action = null)
574575
return $this;
575576
}
576577

578+
/**
579+
*
580+
* @param CartSetLineItemSupplyChannelAction|callable $action
581+
* @return $this
582+
*/
583+
public function setLineItemSupplyChannel($action = null)
584+
{
585+
$this->addAction($this->resolveAction(CartSetLineItemSupplyChannelAction::class, $action));
586+
return $this;
587+
}
588+
577589
/**
578590
* @link https://docs.commercetools.com/http-api-projects-carts.html#set-lineitem-taxamount
579591
* @param CartSetLineItemTaxAmountAction|callable $action

src/Core/Builder/Update/OrdersActionBuilder.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@
3939
use Commercetools\Core\Request\Orders\Command\OrderSetLineItemShippingDetailsAction;
4040
use Commercetools\Core\Request\Orders\Command\OrderSetLocaleAction;
4141
use Commercetools\Core\Request\Orders\Command\OrderSetOrderNumberAction;
42+
use Commercetools\Core\Request\Orders\Command\OrderSetParcelCustomFieldAction;
43+
use Commercetools\Core\Request\Orders\Command\OrderSetParcelCustomTypeAction;
4244
use Commercetools\Core\Request\Orders\Command\OrderSetParcelItemsAction;
4345
use Commercetools\Core\Request\Orders\Command\OrderSetParcelMeasurementsAction;
4446
use Commercetools\Core\Request\Orders\Command\OrderSetParcelTrackingDataAction;
4547
use Commercetools\Core\Request\Orders\Command\OrderSetReturnInfoAction;
48+
use Commercetools\Core\Request\Orders\Command\OrderSetReturnItemCustomFieldAction;
49+
use Commercetools\Core\Request\Orders\Command\OrderSetReturnItemCustomTypeAction;
4650
use Commercetools\Core\Request\Orders\Command\OrderSetReturnPaymentStateAction;
4751
use Commercetools\Core\Request\Orders\Command\OrderSetReturnShipmentStateAction;
4852
use Commercetools\Core\Request\Orders\Command\OrderSetShippingAddress;
@@ -444,6 +448,28 @@ public function setOrderNumber($action = null)
444448
return $this;
445449
}
446450

451+
/**
452+
*
453+
* @param OrderSetParcelCustomFieldAction|callable $action
454+
* @return $this
455+
*/
456+
public function setParcelCustomField($action = null)
457+
{
458+
$this->addAction($this->resolveAction(OrderSetParcelCustomFieldAction::class, $action));
459+
return $this;
460+
}
461+
462+
/**
463+
*
464+
* @param OrderSetParcelCustomTypeAction|callable $action
465+
* @return $this
466+
*/
467+
public function setParcelCustomType($action = null)
468+
{
469+
$this->addAction($this->resolveAction(OrderSetParcelCustomTypeAction::class, $action));
470+
return $this;
471+
}
472+
447473
/**
448474
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-parcel-items
449475
* @param OrderSetParcelItemsAction|callable $action
@@ -488,6 +514,28 @@ public function setReturnInfo($action = null)
488514
return $this;
489515
}
490516

517+
/**
518+
*
519+
* @param OrderSetReturnItemCustomFieldAction|callable $action
520+
* @return $this
521+
*/
522+
public function setReturnItemCustomField($action = null)
523+
{
524+
$this->addAction($this->resolveAction(OrderSetReturnItemCustomFieldAction::class, $action));
525+
return $this;
526+
}
527+
528+
/**
529+
*
530+
* @param OrderSetReturnItemCustomTypeAction|callable $action
531+
* @return $this
532+
*/
533+
public function setReturnItemCustomType($action = null)
534+
{
535+
$this->addAction($this->resolveAction(OrderSetReturnItemCustomTypeAction::class, $action));
536+
return $this;
537+
}
538+
491539
/**
492540
* @link https://docs.commercetools.com/http-api-projects-orders.html#set-returnpaymentstate
493541
* @param OrderSetReturnPaymentStateAction|callable $action

src/Core/Builder/Update/PaymentsActionBuilder.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
use Commercetools\Core\Request\Payments\Command\PaymentSetMethodInfoNameAction;
2626
use Commercetools\Core\Request\Payments\Command\PaymentSetStatusInterfaceCodeAction;
2727
use Commercetools\Core\Request\Payments\Command\PaymentSetStatusInterfaceTextAction;
28+
use Commercetools\Core\Request\Payments\Command\PaymentSetTransactionCustomFieldAction;
29+
use Commercetools\Core\Request\Payments\Command\PaymentSetTransactionCustomTypeAction;
2830
use Commercetools\Core\Request\Payments\Command\PaymentTransitionStateAction;
2931

3032
class PaymentsActionBuilder
@@ -262,6 +264,28 @@ public function setStatusInterfaceText($action = null)
262264
return $this;
263265
}
264266

267+
/**
268+
*
269+
* @param PaymentSetTransactionCustomFieldAction|callable $action
270+
* @return $this
271+
*/
272+
public function setTransactionCustomField($action = null)
273+
{
274+
$this->addAction($this->resolveAction(PaymentSetTransactionCustomFieldAction::class, $action));
275+
return $this;
276+
}
277+
278+
/**
279+
*
280+
* @param PaymentSetTransactionCustomTypeAction|callable $action
281+
* @return $this
282+
*/
283+
public function setTransactionCustomType($action = null)
284+
{
285+
$this->addAction($this->resolveAction(PaymentSetTransactionCustomTypeAction::class, $action));
286+
return $this;
287+
}
288+
265289
/**
266290
* @link https://docs.commercetools.com/http-api-projects-payments.html#transition-state
267291
* @param PaymentTransitionStateAction|callable $action

src/Core/Builder/Update/StagedOrderActionBuilder.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@
6363
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetLocaleAction;
6464
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetOrderNumberAction;
6565
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetOrderTotalTaxAction;
66+
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetParcelCustomFieldAction;
67+
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetParcelCustomTypeAction;
6668
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetParcelItemsAction;
6769
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetParcelMeasurementsAction;
6870
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetParcelTrackingDataAction;
6971
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetReturnInfoAction;
72+
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetReturnItemCustomFieldAction;
73+
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetReturnItemCustomTypeAction;
7074
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetReturnPaymentStateAction;
7175
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetReturnShipmentStateAction;
7276
use Commercetools\Core\Request\OrderEdits\StagedOrder\Command\StagedOrderSetShippingAddressAction;
@@ -739,6 +743,28 @@ public function setOrderTotalTax($action = null)
739743
return $this;
740744
}
741745

746+
/**
747+
*
748+
* @param StagedOrderSetParcelCustomFieldAction|callable $action
749+
* @return $this
750+
*/
751+
public function setParcelCustomField($action = null)
752+
{
753+
$this->addAction($this->resolveAction(StagedOrderSetParcelCustomFieldAction::class, $action));
754+
return $this;
755+
}
756+
757+
/**
758+
*
759+
* @param StagedOrderSetParcelCustomTypeAction|callable $action
760+
* @return $this
761+
*/
762+
public function setParcelCustomType($action = null)
763+
{
764+
$this->addAction($this->resolveAction(StagedOrderSetParcelCustomTypeAction::class, $action));
765+
return $this;
766+
}
767+
742768
/**
743769
*
744770
* @param StagedOrderSetParcelItemsAction|callable $action
@@ -783,6 +809,28 @@ public function setReturnInfo($action = null)
783809
return $this;
784810
}
785811

812+
/**
813+
*
814+
* @param StagedOrderSetReturnItemCustomFieldAction|callable $action
815+
* @return $this
816+
*/
817+
public function setReturnItemCustomField($action = null)
818+
{
819+
$this->addAction($this->resolveAction(StagedOrderSetReturnItemCustomFieldAction::class, $action));
820+
return $this;
821+
}
822+
823+
/**
824+
*
825+
* @param StagedOrderSetReturnItemCustomTypeAction|callable $action
826+
* @return $this
827+
*/
828+
public function setReturnItemCustomType($action = null)
829+
{
830+
$this->addAction($this->resolveAction(StagedOrderSetReturnItemCustomTypeAction::class, $action));
831+
return $this;
832+
}
833+
786834
/**
787835
*
788836
* @param StagedOrderSetReturnPaymentStateAction|callable $action

src/Core/Client/HttpMethod.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ class HttpMethod
1414
const GET = 'GET';
1515
const POST = 'POST';
1616
const DELETE = 'DELETE';
17+
const HEAD = 'HEAD';
1718
}

src/Core/Helper/Annotate/AnnotationGenerator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,12 @@ function ($link) {
829829
$methodParams[] = [self::PARAM_DOC_TYPE => 'string', self::PARAM_NAME => '$' . $param];
830830
$factoryCall = 'of' . ucfirst($param) . '($' . $param . ');';
831831
break;
832+
case preg_match('/^by([a-zA-Z]+)Head$/', $methodName, $matches) === 1:
833+
$param = lcfirst($matches[1]);
834+
$methodName = 'getBy' . ucfirst($param) . 'Head';
835+
$methodParams[] = [self::PARAM_DOC_TYPE => 'string', self::PARAM_NAME => '$' . $param];
836+
$factoryCall = 'of' . ucfirst($param) . '($' . $param . ');';
837+
break;
832838
default:
833839
$factoryCall = 'of();';
834840
}

src/Core/Model/Cart/LineItem.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
* @method LineItem setAddedAt(DateTime $addedAt = null)
6363
* @method DateTime getLastModifiedAt()
6464
* @method LineItem setLastModifiedAt(DateTime $lastModifiedAt = null)
65+
* @method string getProductKey()
66+
* @method LineItem setProductKey(string $productKey = null)
6567
*/
6668
class LineItem extends JsonObject
6769
{
@@ -77,6 +79,7 @@ public function fieldDefinitions()
7779
return [
7880
'id' => [static::TYPE => 'string'],
7981
'productId' => [static::TYPE => 'string'],
82+
'productKey' => [static::TYPE => 'string'],
8083
'name' => [static::TYPE => LocalizedString::class],
8184
'productSlug' => [static::TYPE => LocalizedString::class],
8285
'variant' => [static::TYPE => ProductVariant::class],
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Commercetools\Core\Model\Common;
4+
5+
/**
6+
* @package Commercetools\Core\Model\Common
7+
*
8+
* @method string getContainer()
9+
* @method ContainerAndKey setContainer(string $container = null)
10+
* @method string getKey()
11+
* @method ContainerAndKey setKey(string $key = null)
12+
*/
13+
class ContainerAndKey extends JsonObject
14+
{
15+
public function fieldDefinitions()
16+
{
17+
return [
18+
'container' => [self::TYPE => 'string'],
19+
'key' => [self::TYPE => 'string'],
20+
];
21+
}
22+
}

src/Core/Model/Message/InventoryEntryQuantitySetMessage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Commercetools\Core\Model\Message;
55

6+
use Commercetools\Core\Model\Channel\ChannelReference;
67
use Commercetools\Core\Model\Common\DateTimeDecorator;
78
use DateTime;
89
use Commercetools\Core\Model\Common\Reference;
@@ -38,6 +39,8 @@
3839
* @method InventoryEntryQuantitySetMessage setOldAvailableQuantity(int $oldAvailableQuantity = null)
3940
* @method int getNewAvailableQuantity()
4041
* @method InventoryEntryQuantitySetMessage setNewAvailableQuantity(int $newAvailableQuantity = null)
42+
* @method ChannelReference getSupplyChannel()
43+
* @method InventoryEntryQuantitySetMessage setSupplyChannel(ChannelReference $supplyChannel = null)
4144
*/
4245
class InventoryEntryQuantitySetMessage extends Message
4346
{
@@ -50,6 +53,7 @@ public function fieldDefinitions()
5053
$definitions['newQuantityOnStock'] = [static::TYPE => 'int'];
5154
$definitions['oldAvailableQuantity'] = [static::TYPE => 'int'];
5255
$definitions['newAvailableQuantity'] = [static::TYPE => 'int'];
56+
$definitions['supplyChannel'] = [static::TYPE => ChannelReference::class];
5357

5458
return $definitions;
5559
}

0 commit comments

Comments
 (0)