diff --git a/lib/commercetools-api-tests/gen.properties b/lib/commercetools-api-tests/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-api-tests/gen.properties
+++ b/lib/commercetools-api-tests/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-api/gen.properties b/lib/commercetools-api/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-api/gen.properties
+++ b/lib/commercetools-api/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php
new file mode 100644
index 00000000000..1e839b741f6
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailAction.php
@@ -0,0 +1,27 @@
+
+ */
+final class MyCartSetCustomerEmailActionBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $email;
+
+ /**
+ * @return null|string
+ */
+ public function getEmail()
+ {
+ return $this->email;
+ }
+
+ /**
+ * @param ?string $email
+ * @return $this
+ */
+ public function withEmail(?string $email)
+ {
+ $this->email = $email;
+
+ return $this;
+ }
+
+
+ public function build(): MyCartSetCustomerEmailAction
+ {
+ return new MyCartSetCustomerEmailActionModel(
+ $this->email
+ );
+ }
+
+ public static function of(): MyCartSetCustomerEmailActionBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php
new file mode 100644
index 00000000000..a2cb8f79f65
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionCollection.php
@@ -0,0 +1,55 @@
+
+ * @method MyCartSetCustomerEmailAction current()
+ * @method MyCartSetCustomerEmailAction at($offset)
+ */
+class MyCartSetCustomerEmailActionCollection extends MyCartUpdateActionCollection
+{
+ /**
+ * @psalm-assert MyCartSetCustomerEmailAction $value
+ * @psalm-param MyCartSetCustomerEmailAction|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return MyCartSetCustomerEmailActionCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof MyCartSetCustomerEmailAction) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?MyCartSetCustomerEmailAction
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?MyCartSetCustomerEmailAction {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var MyCartSetCustomerEmailAction $data */
+ $data = MyCartSetCustomerEmailActionModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php
new file mode 100644
index 00000000000..78d1561dd6c
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Me/MyCartSetCustomerEmailActionModel.php
@@ -0,0 +1,86 @@
+email = $email;
+ $this->action = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getAction()
+ {
+ if (is_null($this->action)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_ACTION);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->action = (string) $data;
+ }
+
+ return $this->action;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getEmail()
+ {
+ if (is_null($this->email)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_EMAIL);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->email = (string) $data;
+ }
+
+ return $this->email;
+ }
+
+
+ /**
+ * @param ?string $email
+ */
+ public function setEmail(?string $email): void
+ {
+ $this->email = $email;
+ }
+}
diff --git a/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php b/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php
index e90de392151..85c31f3ab39 100644
--- a/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php
+++ b/lib/commercetools-api/src/Models/Me/MyCartUpdateActionModel.php
@@ -46,6 +46,7 @@ final class MyCartUpdateActionModel extends JsonObjectModel implements MyCartUpd
'setCountry' => MyCartSetCountryActionModel::class,
'setCustomField' => MyCartSetCustomFieldActionModel::class,
'setCustomType' => MyCartSetCustomTypeActionModel::class,
+ 'setCustomerEmail' => MyCartSetCustomerEmailActionModel::class,
'setDeleteDaysAfterLastModification' => MyCartSetDeleteDaysAfterLastModificationActionModel::class,
'setLineItemCustomField' => MyCartSetLineItemCustomFieldActionModel::class,
'setLineItemCustomType' => MyCartSetLineItemCustomTypeActionModel::class,
diff --git a/lib/commercetools-base/gen.properties b/lib/commercetools-base/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-base/gen.properties
+++ b/lib/commercetools-base/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-history-tests/gen.properties b/lib/commercetools-history-tests/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-history-tests/gen.properties
+++ b/lib/commercetools-history-tests/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-history/gen.properties b/lib/commercetools-history/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-history/gen.properties
+++ b/lib/commercetools-history/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-import-tests/gen.properties b/lib/commercetools-import-tests/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-import-tests/gen.properties
+++ b/lib/commercetools-import-tests/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdTest.php b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdTest.php
new file mode 100644
index 00000000000..46ae82d5cb2
--- /dev/null
+++ b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdTest.php
@@ -0,0 +1,185 @@
+assertSame(strtolower($method), strtolower($request->getMethod()));
+ $this->assertSame($relativeUri, (string) $request->getUri());
+ if (!is_null($body)) {
+ $this->assertJsonStringEqualsJsonString($body, (string) $request->getBody());
+ } else {
+ $this->assertSame("", (string) $request->getBody());
+ }
+ }
+
+
+
+ /**
+ * @dataProvider getRequestBuilderResponses()
+ */
+ public function testMapFromResponse(callable $builderFunction, $statusCode)
+ {
+ $builder = new ImportRequestBuilder();
+ $request = $builderFunction($builder);
+ $this->assertInstanceOf(ApiRequest::class, $request);
+
+ $response = new Response($statusCode, [], "{}");
+ $this->assertInstanceOf(JsonObject::class, $request->mapFromResponse($response));
+ }
+
+ /**
+ * @dataProvider getRequestBuilders()
+ */
+ public function testExecuteClientException(callable $builderFunction)
+ {
+ $client = $this->createMock(ClientInterface::class);
+
+ $builder = new ImportRequestBuilder($client);
+ $request = $builderFunction($builder);
+ $client->method("send")->willThrowException(new ClientException("Oops!", $request, new Response(400)));
+
+ $this->expectException(ApiClientException::class);
+ $request->execute();
+ }
+
+ /**
+ * @dataProvider getRequestBuilders()
+ */
+ public function testExecuteServerException(callable $builderFunction)
+ {
+ $client = $this->createMock(ClientInterface::class);
+
+ $builder = new ImportRequestBuilder($client);
+ $request = $builderFunction($builder);
+ $client->method("send")->willThrowException(new ServerException("Oops!", $request, new Response(500)));
+
+ $this->expectException(ApiServerException::class);
+ $request->execute();
+ }
+
+ public function getRequests()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("test_importSinkKey")
+ ->importOperations()
+ ->withIdValue("test_id")
+ ->get();
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations/test_id',
+ ]
+ ];
+ }
+
+ public function getResources()
+ {
+ return [
+ ];
+ }
+
+ public function getRequestBuilders()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->withIdValue("id")
+ ->get();
+ }
+ ]
+ ];
+ }
+
+ public function getRequestBuilderResponses()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet_200' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->withIdValue("id")
+ ->get();
+ },
+ 200
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet_404' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->withIdValue("id")
+ ->get();
+ },
+ 404
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet_503' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->withIdValue("id")
+ ->get();
+ },
+ 503
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet_599' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->withIdValue("id")
+ ->get();
+ },
+ 599
+ ]
+ ];
+ }
+}
diff --git a/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsTest.php b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsTest.php
new file mode 100644
index 00000000000..a582a82c2ea
--- /dev/null
+++ b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsTest.php
@@ -0,0 +1,245 @@
+assertSame(strtolower($method), strtolower($request->getMethod()));
+ $this->assertSame($relativeUri, (string) $request->getUri());
+ if (!is_null($body)) {
+ $this->assertJsonStringEqualsJsonString($body, (string) $request->getBody());
+ } else {
+ $this->assertSame("", (string) $request->getBody());
+ }
+ }
+
+ /**
+ * @dataProvider getResources()
+ */
+ public function testResources(callable $builderFunction, string $class, array $expectedArgs)
+ {
+ $builder = new ImportRequestBuilder();
+ $resource = $builderFunction($builder);
+ $this->assertInstanceOf($class, $resource);
+ $this->assertEquals($expectedArgs, $resource->getArgs());
+ }
+
+ /**
+ * @dataProvider getRequestBuilderResponses()
+ */
+ public function testMapFromResponse(callable $builderFunction, $statusCode)
+ {
+ $builder = new ImportRequestBuilder();
+ $request = $builderFunction($builder);
+ $this->assertInstanceOf(ApiRequest::class, $request);
+
+ $response = new Response($statusCode, [], "{}");
+ $this->assertInstanceOf(JsonObject::class, $request->mapFromResponse($response));
+ }
+
+ /**
+ * @dataProvider getRequestBuilders()
+ */
+ public function testExecuteClientException(callable $builderFunction)
+ {
+ $client = $this->createMock(ClientInterface::class);
+
+ $builder = new ImportRequestBuilder($client);
+ $request = $builderFunction($builder);
+ $client->method("send")->willThrowException(new ClientException("Oops!", $request, new Response(400)));
+
+ $this->expectException(ApiClientException::class);
+ $request->execute();
+ }
+
+ /**
+ * @dataProvider getRequestBuilders()
+ */
+ public function testExecuteServerException(callable $builderFunction)
+ {
+ $client = $this->createMock(ClientInterface::class);
+
+ $builder = new ImportRequestBuilder($client);
+ $request = $builderFunction($builder);
+ $client->method("send")->willThrowException(new ServerException("Oops!", $request, new Response(500)));
+
+ $this->expectException(ApiServerException::class);
+ $request->execute();
+ }
+
+ public function getRequests()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_withLimit' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue('test_projectKey')
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue('test_importSinkKey')
+ ->importOperations()
+ ->get()
+ ->withLimit('limit');
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations?limit=limit',
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_withOffset' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue('test_projectKey')
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue('test_importSinkKey')
+ ->importOperations()
+ ->get()
+ ->withOffset('offset');
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations?offset=offset',
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_withSort' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue('test_projectKey')
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue('test_importSinkKey')
+ ->importOperations()
+ ->get()
+ ->withSort('sort');
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations?sort=sort',
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_withResourceKey' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue('test_projectKey')
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue('test_importSinkKey')
+ ->importOperations()
+ ->get()
+ ->withResourceKey('resourceKey');
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations?resourceKey=resourceKey',
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_withState' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue('test_projectKey')
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue('test_importSinkKey')
+ ->importOperations()
+ ->get()
+ ->withState('state');
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations?state=state',
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("test_importSinkKey")
+ ->importOperations()
+ ->get();
+ },
+ 'get',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey/import-operations',
+ ]
+ ];
+ }
+
+ public function getResources()
+ {
+ return [
+ 'ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById' => [
+ function (ImportRequestBuilder $builder): ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("test_importSinkKey")
+ ->importOperations()
+ ->withIdValue("test_id");
+ },
+ ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById::class,
+ ['projectKey' => 'test_projectKey', 'importSinkKey' => 'test_importSinkKey', 'id' => 'test_id'],
+ '/{projectKey}/order-patches/importSinkKey={importSinkKey}/import-operations/{id}'
+ ]
+ ];
+ }
+
+ public function getRequestBuilders()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->get();
+ }
+ ]
+ ];
+ }
+
+ public function getRequestBuilderResponses()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_200' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->get();
+ },
+ 200
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet_599' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->get();
+ },
+ 599
+ ]
+ ];
+ }
+}
diff --git a/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyTest.php b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyTest.php
new file mode 100644
index 00000000000..89a9cfc3f69
--- /dev/null
+++ b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyTest.php
@@ -0,0 +1,175 @@
+assertSame(strtolower($method), strtolower($request->getMethod()));
+ $this->assertSame($relativeUri, (string) $request->getUri());
+ if (!is_null($body)) {
+ $this->assertJsonStringEqualsJsonString($body, (string) $request->getBody());
+ } else {
+ $this->assertSame("", (string) $request->getBody());
+ }
+ }
+
+ /**
+ * @dataProvider getResources()
+ */
+ public function testResources(callable $builderFunction, string $class, array $expectedArgs)
+ {
+ $builder = new ImportRequestBuilder();
+ $resource = $builderFunction($builder);
+ $this->assertInstanceOf($class, $resource);
+ $this->assertEquals($expectedArgs, $resource->getArgs());
+ }
+
+ /**
+ * @dataProvider getRequestBuilderResponses()
+ */
+ public function testMapFromResponse(callable $builderFunction, $statusCode)
+ {
+ $builder = new ImportRequestBuilder();
+ $request = $builderFunction($builder);
+ $this->assertInstanceOf(ApiRequest::class, $request);
+
+ $response = new Response($statusCode, [], "{}");
+ $this->assertInstanceOf(JsonObject::class, $request->mapFromResponse($response));
+ }
+
+ /**
+ * @dataProvider getRequestBuilders()
+ */
+ public function testExecuteClientException(callable $builderFunction)
+ {
+ $client = $this->createMock(ClientInterface::class);
+
+ $builder = new ImportRequestBuilder($client);
+ $request = $builderFunction($builder);
+ $client->method("send")->willThrowException(new ClientException("Oops!", $request, new Response(400)));
+
+ $this->expectException(ApiClientException::class);
+ $request->execute();
+ }
+
+ /**
+ * @dataProvider getRequestBuilders()
+ */
+ public function testExecuteServerException(callable $builderFunction)
+ {
+ $client = $this->createMock(ClientInterface::class);
+
+ $builder = new ImportRequestBuilder($client);
+ $request = $builderFunction($builder);
+ $client->method("send")->willThrowException(new ServerException("Oops!", $request, new Response(500)));
+
+ $this->expectException(ApiServerException::class);
+ $request->execute();
+ }
+
+ public function getRequests()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("test_importSinkKey")
+ ->post(null);
+ },
+ 'post',
+ 'test_projectKey/order-patches/importSinkKey=test_importSinkKey',
+ ]
+ ];
+ }
+
+ public function getResources()
+ {
+ return [
+ 'ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations' => [
+ function (ImportRequestBuilder $builder): ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("test_importSinkKey")
+ ->importOperations();
+ },
+ ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations::class,
+ ['projectKey' => 'test_projectKey', 'importSinkKey' => 'test_importSinkKey'],
+ '/{projectKey}/order-patches/importSinkKey={importSinkKey}/import-operations'
+ ]
+ ];
+ }
+
+ public function getRequestBuilders()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->post(null);
+ }
+ ]
+ ];
+ }
+
+ public function getRequestBuilderResponses()
+ {
+ return [
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost_201' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->post(null);
+ },
+ 201
+ ],
+ 'ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost_599' => [
+ function (ImportRequestBuilder $builder): RequestInterface {
+ return $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->post(null);
+ },
+ 599
+ ]
+ ];
+ }
+}
diff --git a/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesTest.php b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesTest.php
new file mode 100644
index 00000000000..275e79404e2
--- /dev/null
+++ b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyOrderPatchesTest.php
@@ -0,0 +1,80 @@
+assertInstanceOf($class, $resource);
+ $this->assertEquals($expectedArgs, $resource->getArgs());
+ }
+
+
+
+
+
+
+
+ public function getRequests()
+ {
+ return [
+ ];
+ }
+
+ public function getResources()
+ {
+ return [
+ 'ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey' => [
+ function (ImportRequestBuilder $builder): ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("test_importSinkKey");
+ },
+ ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey::class,
+ ['projectKey' => 'test_projectKey', 'importSinkKey' => 'test_importSinkKey'],
+ '/{projectKey}/order-patches/importSinkKey={importSinkKey}'
+ ]
+ ];
+ }
+
+ public function getRequestBuilders()
+ {
+ return [
+ ];
+ }
+
+ public function getRequestBuilderResponses()
+ {
+ return [
+ ];
+ }
+}
diff --git a/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyTest.php b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyTest.php
index faeba8837de..4332f2bd224 100644
--- a/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyTest.php
+++ b/lib/commercetools-import-tests/test/unit/Client/Resource/ResourceByProjectKeyTest.php
@@ -18,6 +18,7 @@
use Commercetools\Import\Client\Resource\ResourceByProjectKeyImportSinks;
use Commercetools\Import\Client\Resource\ResourceByProjectKeyImportSummaries;
use Commercetools\Import\Client\Resource\ResourceByProjectKeyInventories;
+use Commercetools\Import\Client\Resource\ResourceByProjectKeyOrderPatches;
use Commercetools\Import\Client\Resource\ResourceByProjectKeyOrders;
use Commercetools\Import\Client\Resource\ResourceByProjectKeyPrices;
use Commercetools\Import\Client\Resource\ResourceByProjectKeyProductDrafts;
@@ -163,6 +164,16 @@ function (ImportRequestBuilder $builder): ResourceByProjectKeyOrders {
['projectKey' => 'test_projectKey'],
'/{projectKey}/orders'
],
+ 'ResourceByProjectKeyOrderPatches' => [
+ function (ImportRequestBuilder $builder): ResourceByProjectKeyOrderPatches {
+ return $builder
+ ->withProjectKeyValue("test_projectKey")
+ ->orderPatches();
+ },
+ ResourceByProjectKeyOrderPatches::class,
+ ['projectKey' => 'test_projectKey'],
+ '/{projectKey}/order-patches'
+ ],
'ResourceByProjectKeyCustomers' => [
function (ImportRequestBuilder $builder): ResourceByProjectKeyCustomers {
return $builder
diff --git a/lib/commercetools-import/docs/RequestBuilder.md b/lib/commercetools-import/docs/RequestBuilder.md
index 179c41d7f34..536d5cbf1dc 100644
--- a/lib/commercetools-import/docs/RequestBuilder.md
+++ b/lib/commercetools-import/docs/RequestBuilder.md
@@ -246,6 +246,55 @@ $request = $builder
->withIdValue("id")
->get();
```
+## `withProjectKeyValue("projectKey")->orderPatches()->importSinkKeyWithImportSinkKeyValue("importSinkKey")->post(null)`
+
+Creates a new import request for order patches
+
+### Example
+```php
+use Commercetools\Import\Client\ImportRequestBuilder;
+
+$builder = new ImportRequestBuilder();
+$request = $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->post(null);
+```
+## `withProjectKeyValue("projectKey")->orderPatches()->importSinkKeyWithImportSinkKeyValue("importSinkKey")->importOperations()->get()`
+
+Retrieves all order-patches import operations of an import sink key.
+
+### Example
+```php
+use Commercetools\Import\Client\ImportRequestBuilder;
+
+$builder = new ImportRequestBuilder();
+$request = $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->get();
+```
+## `withProjectKeyValue("projectKey")->orderPatches()->importSinkKeyWithImportSinkKeyValue("importSinkKey")->importOperations()->withIdValue("id")->get()`
+
+Retrieves the import operation with the given id.
+
+
+### Example
+```php
+use Commercetools\Import\Client\ImportRequestBuilder;
+
+$builder = new ImportRequestBuilder();
+$request = $builder
+ ->withProjectKeyValue("projectKey")
+ ->orderPatches()
+ ->importSinkKeyWithImportSinkKeyValue("importSinkKey")
+ ->importOperations()
+ ->withIdValue("id")
+ ->get();
+```
## `withProjectKeyValue("projectKey")->orders()->importSinkKeyWithImportSinkKeyValue("importSinkKey")->post(null)`
Creates import request for creating new orders or updating existing ones.
diff --git a/lib/commercetools-import/gen.properties b/lib/commercetools-import/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-import/gen.properties
+++ b/lib/commercetools-import/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet.php b/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet.php
new file mode 100644
index 00000000000..fc967180ef3
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet.php
@@ -0,0 +1,124 @@
+ $headers
+ */
+ public function __construct(string $projectKey, string $importSinkKey, string $id, $body = null, array $headers = [], ClientInterface $client = null)
+ {
+ $uri = str_replace(['{projectKey}', '{importSinkKey}', '{id}'], [$projectKey, $importSinkKey, $id], '{projectKey}/order-patches/importSinkKey={importSinkKey}/import-operations/{id}');
+ parent::__construct($client, 'GET', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ * @return ErrorResponse|ImportOperation|JsonObject|T|null
+ */
+ public function mapFromResponse(?ResponseInterface $response, string $resultType = null)
+ {
+ if (is_null($response)) {
+ return null;
+ }
+ if (is_null($resultType)) {
+ switch ($response->getStatusCode()) {
+ case '200':
+ $resultType = ImportOperationModel::class;
+
+ break;
+ case '404':
+ $resultType = ErrorResponseModel::class;
+
+ break;
+ case '503':
+ $resultType = ErrorResponseModel::class;
+
+ break;
+ default:
+ $resultType = JsonObjectModel::class;
+
+ break;
+ }
+ }
+
+ return $resultType::of($this->responseData($response));
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ *
+ * @return null|ErrorResponse|ImportOperation|JsonObject
+ */
+ public function execute(array $options = [], string $resultType = null)
+ {
+ try {
+ $response = $this->send($options);
+ } catch (ServerException $e) {
+ $response = $e->getResponse();
+ $e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ throw $e;
+ } catch (ClientException $e) {
+ $response = $e->getResponse();
+ $e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ throw $e;
+ }
+
+ return $this->mapFromResponse($response, $resultType);
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ *
+ * @return PromiseInterface
+ */
+ public function executeAsync(array $options = [], string $resultType = null)
+ {
+ return $this->sendAsync($options)->then(
+ function (ResponseInterface $response) use ($resultType) {
+ return $this->mapFromResponse($response, $resultType);
+ },
+ function (RequestException $e) use ($resultType) {
+ $response = $e->getResponse();
+ if ($e instanceof ServerException) {
+ $e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ }
+ if ($e instanceof ClientException) {
+ $e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ }
+ throw $e;
+ }
+ );
+ }
+}
diff --git a/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet.php b/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet.php
new file mode 100644
index 00000000000..5da7d7d7bbf
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet.php
@@ -0,0 +1,159 @@
+ $headers
+ */
+ public function __construct(string $projectKey, string $importSinkKey, $body = null, array $headers = [], ClientInterface $client = null)
+ {
+ $uri = str_replace(['{projectKey}', '{importSinkKey}'], [$projectKey, $importSinkKey], '{projectKey}/order-patches/importSinkKey={importSinkKey}/import-operations');
+ parent::__construct($client, 'GET', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ * @return ImportOperationPagedResponse|JsonObject|T|null
+ */
+ public function mapFromResponse(?ResponseInterface $response, string $resultType = null)
+ {
+ if (is_null($response)) {
+ return null;
+ }
+ if (is_null($resultType)) {
+ switch ($response->getStatusCode()) {
+ case '200':
+ $resultType = ImportOperationPagedResponseModel::class;
+
+ break;
+ default:
+ $resultType = JsonObjectModel::class;
+
+ break;
+ }
+ }
+
+ return $resultType::of($this->responseData($response));
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ *
+ * @return null|ImportOperationPagedResponse|JsonObject
+ */
+ public function execute(array $options = [], string $resultType = null)
+ {
+ try {
+ $response = $this->send($options);
+ } catch (ServerException $e) {
+ $response = $e->getResponse();
+ $e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ throw $e;
+ } catch (ClientException $e) {
+ $response = $e->getResponse();
+ $e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ throw $e;
+ }
+
+ return $this->mapFromResponse($response, $resultType);
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ *
+ * @return PromiseInterface
+ */
+ public function executeAsync(array $options = [], string $resultType = null)
+ {
+ return $this->sendAsync($options)->then(
+ function (ResponseInterface $response) use ($resultType) {
+ return $this->mapFromResponse($response, $resultType);
+ },
+ function (RequestException $e) use ($resultType) {
+ $response = $e->getResponse();
+ if ($e instanceof ServerException) {
+ $e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ }
+ if ($e instanceof ClientException) {
+ $e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ }
+ throw $e;
+ }
+ );
+ }
+
+ /**
+ *
+ * @psalm-param scalar|scalar[] $limit
+ */
+ public function withLimit($limit): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet
+ {
+ return $this->withQueryParam('limit', $limit);
+ }
+
+ /**
+ *
+ * @psalm-param scalar|scalar[] $offset
+ */
+ public function withOffset($offset): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet
+ {
+ return $this->withQueryParam('offset', $offset);
+ }
+
+ /**
+ *
+ * @psalm-param scalar|scalar[] $sort
+ */
+ public function withSort($sort): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet
+ {
+ return $this->withQueryParam('sort', $sort);
+ }
+
+ /**
+ *
+ * @psalm-param scalar|scalar[] $resourceKey
+ */
+ public function withResourceKey($resourceKey): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet
+ {
+ return $this->withQueryParam('resourceKey', $resourceKey);
+ }
+
+ /**
+ *
+ * @psalm-param scalar|scalar[] $state
+ */
+ public function withState($state): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet
+ {
+ return $this->withQueryParam('state', $state);
+ }
+}
diff --git a/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost.php b/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost.php
new file mode 100644
index 00000000000..1f5940d7b96
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost.php
@@ -0,0 +1,114 @@
+ $headers
+ */
+ public function __construct(string $projectKey, string $importSinkKey, $body = null, array $headers = [], ClientInterface $client = null)
+ {
+ $uri = str_replace(['{projectKey}', '{importSinkKey}'], [$projectKey, $importSinkKey], '{projectKey}/order-patches/importSinkKey={importSinkKey}');
+ parent::__construct($client, 'POST', $uri, $headers, is_object($body) || is_array($body) ? json_encode($body) : $body);
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ * @return ImportResponse|JsonObject|T|null
+ */
+ public function mapFromResponse(?ResponseInterface $response, string $resultType = null)
+ {
+ if (is_null($response)) {
+ return null;
+ }
+ if (is_null($resultType)) {
+ switch ($response->getStatusCode()) {
+ case '201':
+ $resultType = ImportResponseModel::class;
+
+ break;
+ default:
+ $resultType = JsonObjectModel::class;
+
+ break;
+ }
+ }
+
+ return $resultType::of($this->responseData($response));
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ *
+ * @return null|ImportResponse|JsonObject
+ */
+ public function execute(array $options = [], string $resultType = null)
+ {
+ try {
+ $response = $this->send($options);
+ } catch (ServerException $e) {
+ $response = $e->getResponse();
+ $e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ throw $e;
+ } catch (ClientException $e) {
+ $response = $e->getResponse();
+ $e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ throw $e;
+ }
+
+ return $this->mapFromResponse($response, $resultType);
+ }
+
+ /**
+ * @template T of JsonObject
+ * @psalm-param ?class-string $resultType
+ *
+ * @return PromiseInterface
+ */
+ public function executeAsync(array $options = [], string $resultType = null)
+ {
+ return $this->sendAsync($options)->then(
+ function (ResponseInterface $response) use ($resultType) {
+ return $this->mapFromResponse($response, $resultType);
+ },
+ function (RequestException $e) use ($resultType) {
+ $response = $e->getResponse();
+ if ($e instanceof ServerException) {
+ $e = ExceptionFactory::createServerException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ }
+ if ($e instanceof ClientException) {
+ $e = ExceptionFactory::createClientException($e, $this, $response, $this->mapFromResponse($response, $resultType));
+ }
+ throw $e;
+ }
+ );
+ }
+}
diff --git a/lib/commercetools-import/src/Client/Resource/ResourceByProjectKey.php b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKey.php
index 4429fac568d..2dd8c0fcb02 100644
--- a/lib/commercetools-import/src/Client/Resource/ResourceByProjectKey.php
+++ b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKey.php
@@ -85,6 +85,12 @@ public function orders(): ResourceByProjectKeyOrders
return new ResourceByProjectKeyOrders($args, $this->getClient());
}
+ public function orderPatches(): ResourceByProjectKeyOrderPatches
+ {
+ $args = $this->getArgs();
+
+ return new ResourceByProjectKeyOrderPatches($args, $this->getClient());
+ }
public function customers(): ResourceByProjectKeyCustomers
{
$args = $this->getArgs();
diff --git a/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatches.php b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatches.php
new file mode 100644
index 00000000000..0408e46e970
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatches.php
@@ -0,0 +1,37 @@
+ $args
+ */
+ public function __construct(array $args = [], ClientInterface $client = null)
+ {
+ parent::__construct('/{projectKey}/order-patches', $args, $client);
+ }
+
+ public function importSinkKeyWithImportSinkKeyValue(string $importSinkKey = null): ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey
+ {
+ $args = $this->getArgs();
+ if (!is_null($importSinkKey)) {
+ $args['importSinkKey'] = $importSinkKey;
+ }
+
+ return new ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey($args, $this->getClient());
+ }
+}
diff --git a/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey.php b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey.php
new file mode 100644
index 00000000000..e053171dfe3
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKey.php
@@ -0,0 +1,46 @@
+ $args
+ */
+ public function __construct(array $args = [], ClientInterface $client = null)
+ {
+ parent::__construct('/{projectKey}/order-patches/importSinkKey={importSinkKey}', $args, $client);
+ }
+
+ public function importOperations(): ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations
+ {
+ $args = $this->getArgs();
+
+ return new ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations($args, $this->getClient());
+ }
+
+ /**
+ * @psalm-param ?OrderPatchImportRequest $body
+ * @psalm-param array $headers
+ */
+ public function post(?OrderPatchImportRequest $body = null, array $headers = []): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost
+ {
+ $args = $this->getArgs();
+
+ return new ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyPost($args['projectKey'], $args['importSinkKey'], $body, $headers, $this->getClient());
+ }
+}
diff --git a/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations.php b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations.php
new file mode 100644
index 00000000000..aa963b5273d
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperations.php
@@ -0,0 +1,48 @@
+ $args
+ */
+ public function __construct(array $args = [], ClientInterface $client = null)
+ {
+ parent::__construct('/{projectKey}/order-patches/importSinkKey={importSinkKey}/import-operations', $args, $client);
+ }
+
+ public function withIdValue(string $id = null): ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById
+ {
+ $args = $this->getArgs();
+ if (!is_null($id)) {
+ $args['id'] = $id;
+ }
+
+ return new ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById($args, $this->getClient());
+ }
+
+ /**
+ * @psalm-param ?object|array|string $body
+ * @psalm-param array $headers
+ */
+ public function get($body = null, array $headers = []): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet
+ {
+ $args = $this->getArgs();
+
+ return new ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsGet($args['projectKey'], $args['importSinkKey'], $body, $headers, $this->getClient());
+ }
+}
diff --git a/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById.php b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById.php
new file mode 100644
index 00000000000..58c77c7b528
--- /dev/null
+++ b/lib/commercetools-import/src/Client/Resource/ResourceByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsById.php
@@ -0,0 +1,38 @@
+ $args
+ */
+ public function __construct(array $args = [], ClientInterface $client = null)
+ {
+ parent::__construct('/{projectKey}/order-patches/importSinkKey={importSinkKey}/import-operations/{id}', $args, $client);
+ }
+
+ /**
+ * @psalm-param ?object|array|string $body
+ * @psalm-param array $headers
+ */
+ public function get($body = null, array $headers = []): ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet
+ {
+ $args = $this->getArgs();
+
+ return new ByProjectKeyOrderPatchesImportSinkKeyByImportSinkKeyImportOperationsByIdGet($args['projectKey'], $args['importSinkKey'], $args['id'], $body, $headers, $this->getClient());
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/CartKeyReference.php b/lib/commercetools-import/src/Models/Common/CartKeyReference.php
new file mode 100644
index 00000000000..cf968a2a3a8
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/CartKeyReference.php
@@ -0,0 +1,16 @@
+
+ */
+final class CartKeyReferenceBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $key;
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ /**
+ * @param ?string $key
+ * @return $this
+ */
+ public function withKey(?string $key)
+ {
+ $this->key = $key;
+
+ return $this;
+ }
+
+
+ public function build(): CartKeyReference
+ {
+ return new CartKeyReferenceModel(
+ $this->key
+ );
+ }
+
+ public static function of(): CartKeyReferenceBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/CartKeyReferenceCollection.php b/lib/commercetools-import/src/Models/Common/CartKeyReferenceCollection.php
new file mode 100644
index 00000000000..ba7c46081fe
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/CartKeyReferenceCollection.php
@@ -0,0 +1,55 @@
+
+ * @method CartKeyReference current()
+ * @method CartKeyReference at($offset)
+ */
+class CartKeyReferenceCollection extends KeyReferenceCollection
+{
+ /**
+ * @psalm-assert CartKeyReference $value
+ * @psalm-param CartKeyReference|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return CartKeyReferenceCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof CartKeyReference) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?CartKeyReference
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?CartKeyReference {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var CartKeyReference $data */
+ $data = CartKeyReferenceModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/CartKeyReferenceModel.php b/lib/commercetools-import/src/Models/Common/CartKeyReferenceModel.php
new file mode 100644
index 00000000000..7837490e0b6
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/CartKeyReferenceModel.php
@@ -0,0 +1,88 @@
+key = $key;
+ $this->typeId = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ if (is_null($this->key)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_KEY);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->key = (string) $data;
+ }
+
+ return $this->key;
+ }
+
+ /**
+ * The type of the referenced resource.
+ *
+ * @return null|string
+ */
+ public function getTypeId()
+ {
+ if (is_null($this->typeId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->typeId = (string) $data;
+ }
+
+ return $this->typeId;
+ }
+
+
+ /**
+ * @param ?string $key
+ */
+ public function setKey(?string $key): void
+ {
+ $this->key = $key;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReference.php b/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReference.php
new file mode 100644
index 00000000000..61958cb3e06
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReference.php
@@ -0,0 +1,16 @@
+
+ */
+final class DiscountCodeKeyReferenceBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $key;
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ /**
+ * @param ?string $key
+ * @return $this
+ */
+ public function withKey(?string $key)
+ {
+ $this->key = $key;
+
+ return $this;
+ }
+
+
+ public function build(): DiscountCodeKeyReference
+ {
+ return new DiscountCodeKeyReferenceModel(
+ $this->key
+ );
+ }
+
+ public static function of(): DiscountCodeKeyReferenceBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReferenceCollection.php b/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReferenceCollection.php
new file mode 100644
index 00000000000..3197e90ca67
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReferenceCollection.php
@@ -0,0 +1,55 @@
+
+ * @method DiscountCodeKeyReference current()
+ * @method DiscountCodeKeyReference at($offset)
+ */
+class DiscountCodeKeyReferenceCollection extends KeyReferenceCollection
+{
+ /**
+ * @psalm-assert DiscountCodeKeyReference $value
+ * @psalm-param DiscountCodeKeyReference|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return DiscountCodeKeyReferenceCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof DiscountCodeKeyReference) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?DiscountCodeKeyReference
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?DiscountCodeKeyReference {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var DiscountCodeKeyReference $data */
+ $data = DiscountCodeKeyReferenceModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReferenceModel.php b/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReferenceModel.php
new file mode 100644
index 00000000000..0fae1697cc1
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/DiscountCodeKeyReferenceModel.php
@@ -0,0 +1,88 @@
+key = $key;
+ $this->typeId = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ if (is_null($this->key)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_KEY);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->key = (string) $data;
+ }
+
+ return $this->key;
+ }
+
+ /**
+ * The type of the referenced resource.
+ *
+ * @return null|string
+ */
+ public function getTypeId()
+ {
+ if (is_null($this->typeId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->typeId = (string) $data;
+ }
+
+ return $this->typeId;
+ }
+
+
+ /**
+ * @param ?string $key
+ */
+ public function setKey(?string $key): void
+ {
+ $this->key = $key;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/KeyReferenceModel.php b/lib/commercetools-import/src/Models/Common/KeyReferenceModel.php
index ddeb3f46ded..4678d5d3fe0 100644
--- a/lib/commercetools-import/src/Models/Common/KeyReferenceModel.php
+++ b/lib/commercetools-import/src/Models/Common/KeyReferenceModel.php
@@ -35,11 +35,15 @@ final class KeyReferenceModel extends JsonObjectModel implements KeyReference
*
*/
private static $discriminatorClasses = [
+ 'cart' => CartKeyReferenceModel::class,
'cart-discount' => CartDiscountKeyReferenceModel::class,
'category' => CategoryKeyReferenceModel::class,
'channel' => ChannelKeyReferenceModel::class,
'customer' => CustomerKeyReferenceModel::class,
'customer-group' => CustomerGroupKeyReferenceModel::class,
+ 'discount-code' => DiscountCodeKeyReferenceModel::class,
+ 'order' => OrderKeyReferenceModel::class,
+ 'payment' => PaymentKeyReferenceModel::class,
'price' => PriceKeyReferenceModel::class,
'product' => ProductKeyReferenceModel::class,
'product-discount' => ProductDiscountKeyReferenceModel::class,
diff --git a/lib/commercetools-import/src/Models/Common/OrderKeyReference.php b/lib/commercetools-import/src/Models/Common/OrderKeyReference.php
new file mode 100644
index 00000000000..fdf5bb58290
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/OrderKeyReference.php
@@ -0,0 +1,16 @@
+
+ */
+final class OrderKeyReferenceBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $key;
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ /**
+ * @param ?string $key
+ * @return $this
+ */
+ public function withKey(?string $key)
+ {
+ $this->key = $key;
+
+ return $this;
+ }
+
+
+ public function build(): OrderKeyReference
+ {
+ return new OrderKeyReferenceModel(
+ $this->key
+ );
+ }
+
+ public static function of(): OrderKeyReferenceBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/OrderKeyReferenceCollection.php b/lib/commercetools-import/src/Models/Common/OrderKeyReferenceCollection.php
new file mode 100644
index 00000000000..60b7e1d165c
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/OrderKeyReferenceCollection.php
@@ -0,0 +1,55 @@
+
+ * @method OrderKeyReference current()
+ * @method OrderKeyReference at($offset)
+ */
+class OrderKeyReferenceCollection extends KeyReferenceCollection
+{
+ /**
+ * @psalm-assert OrderKeyReference $value
+ * @psalm-param OrderKeyReference|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return OrderKeyReferenceCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof OrderKeyReference) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?OrderKeyReference
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?OrderKeyReference {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var OrderKeyReference $data */
+ $data = OrderKeyReferenceModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/OrderKeyReferenceModel.php b/lib/commercetools-import/src/Models/Common/OrderKeyReferenceModel.php
new file mode 100644
index 00000000000..511cdc273a2
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/OrderKeyReferenceModel.php
@@ -0,0 +1,88 @@
+key = $key;
+ $this->typeId = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ if (is_null($this->key)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_KEY);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->key = (string) $data;
+ }
+
+ return $this->key;
+ }
+
+ /**
+ * The type of the referenced resource.
+ *
+ * @return null|string
+ */
+ public function getTypeId()
+ {
+ if (is_null($this->typeId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->typeId = (string) $data;
+ }
+
+ return $this->typeId;
+ }
+
+
+ /**
+ * @param ?string $key
+ */
+ public function setKey(?string $key): void
+ {
+ $this->key = $key;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/PaymentKeyReference.php b/lib/commercetools-import/src/Models/Common/PaymentKeyReference.php
new file mode 100644
index 00000000000..bd18d465b92
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/PaymentKeyReference.php
@@ -0,0 +1,16 @@
+
+ */
+final class PaymentKeyReferenceBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $key;
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ /**
+ * @param ?string $key
+ * @return $this
+ */
+ public function withKey(?string $key)
+ {
+ $this->key = $key;
+
+ return $this;
+ }
+
+
+ public function build(): PaymentKeyReference
+ {
+ return new PaymentKeyReferenceModel(
+ $this->key
+ );
+ }
+
+ public static function of(): PaymentKeyReferenceBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/PaymentKeyReferenceCollection.php b/lib/commercetools-import/src/Models/Common/PaymentKeyReferenceCollection.php
new file mode 100644
index 00000000000..a8f2f1c9812
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/PaymentKeyReferenceCollection.php
@@ -0,0 +1,55 @@
+
+ * @method PaymentKeyReference current()
+ * @method PaymentKeyReference at($offset)
+ */
+class PaymentKeyReferenceCollection extends KeyReferenceCollection
+{
+ /**
+ * @psalm-assert PaymentKeyReference $value
+ * @psalm-param PaymentKeyReference|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return PaymentKeyReferenceCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof PaymentKeyReference) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?PaymentKeyReference
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?PaymentKeyReference {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var PaymentKeyReference $data */
+ $data = PaymentKeyReferenceModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Common/PaymentKeyReferenceModel.php b/lib/commercetools-import/src/Models/Common/PaymentKeyReferenceModel.php
new file mode 100644
index 00000000000..80e1955571e
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Common/PaymentKeyReferenceModel.php
@@ -0,0 +1,88 @@
+key = $key;
+ $this->typeId = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ if (is_null($this->key)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_KEY);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->key = (string) $data;
+ }
+
+ return $this->key;
+ }
+
+ /**
+ * The type of the referenced resource.
+ *
+ * @return null|string
+ */
+ public function getTypeId()
+ {
+ if (is_null($this->typeId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->typeId = (string) $data;
+ }
+
+ return $this->typeId;
+ }
+
+
+ /**
+ * @param ?string $key
+ */
+ public function setKey(?string $key): void
+ {
+ $this->key = $key;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Importrequests/ImportRequestModel.php b/lib/commercetools-import/src/Models/Importrequests/ImportRequestModel.php
index 5f629696e5d..0ea016b3e31 100644
--- a/lib/commercetools-import/src/Models/Importrequests/ImportRequestModel.php
+++ b/lib/commercetools-import/src/Models/Importrequests/ImportRequestModel.php
@@ -34,6 +34,7 @@ final class ImportRequestModel extends JsonObjectModel implements ImportRequest
'customer' => CustomerImportRequestModel::class,
'inventory' => InventoryImportRequestModel::class,
'order' => OrderImportRequestModel::class,
+ 'order-patch' => OrderPatchImportRequestModel::class,
'price' => PriceImportRequestModel::class,
'product' => ProductImportRequestModel::class,
'product-draft' => ProductDraftImportRequestModel::class,
diff --git a/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequest.php b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequest.php
new file mode 100644
index 00000000000..26495226aa7
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequest.php
@@ -0,0 +1,30 @@
+The order patches of this request
+ *
+ * @return null|OrderPatchImportCollection
+ */
+ public function getPatches();
+
+ /**
+ * @param ?OrderPatchImportCollection $patches
+ */
+ public function setPatches(?OrderPatchImportCollection $patches): void;
+}
diff --git a/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestBuilder.php b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestBuilder.php
new file mode 100644
index 00000000000..909d0d8fd53
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestBuilder.php
@@ -0,0 +1,62 @@
+
+ */
+final class OrderPatchImportRequestBuilder implements Builder
+{
+ /**
+ * @var ?OrderPatchImportCollection
+ */
+ private $patches;
+
+ /**
+ * The order patches of this request
+ *
+ * @return null|OrderPatchImportCollection
+ */
+ public function getPatches()
+ {
+ return $this->patches;
+ }
+
+ /**
+ * @param ?OrderPatchImportCollection $patches
+ * @return $this
+ */
+ public function withPatches(?OrderPatchImportCollection $patches)
+ {
+ $this->patches = $patches;
+
+ return $this;
+ }
+
+
+ public function build(): OrderPatchImportRequest
+ {
+ return new OrderPatchImportRequestModel(
+ $this->patches
+ );
+ }
+
+ public static function of(): OrderPatchImportRequestBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestCollection.php b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestCollection.php
new file mode 100644
index 00000000000..583585e391d
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestCollection.php
@@ -0,0 +1,55 @@
+
+ * @method OrderPatchImportRequest current()
+ * @method OrderPatchImportRequest at($offset)
+ */
+class OrderPatchImportRequestCollection extends ImportRequestCollection
+{
+ /**
+ * @psalm-assert OrderPatchImportRequest $value
+ * @psalm-param OrderPatchImportRequest|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return OrderPatchImportRequestCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof OrderPatchImportRequest) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?OrderPatchImportRequest
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?OrderPatchImportRequest {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var OrderPatchImportRequest $data */
+ $data = OrderPatchImportRequestModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestModel.php b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestModel.php
new file mode 100644
index 00000000000..a1206af4b78
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Importrequests/OrderPatchImportRequestModel.php
@@ -0,0 +1,91 @@
+patches = $patches;
+ $this->type = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * The type of the import resource.
+ *
+ * @return null|string
+ */
+ public function getType()
+ {
+ if (is_null($this->type)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->type = (string) $data;
+ }
+
+ return $this->type;
+ }
+
+ /**
+ * The order patches of this request
+ *
+ * @return null|OrderPatchImportCollection
+ */
+ public function getPatches()
+ {
+ if (is_null($this->patches)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_PATCHES);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->patches = OrderPatchImportCollection::fromArray($data);
+ }
+
+ return $this->patches;
+ }
+
+
+ /**
+ * @param ?OrderPatchImportCollection $patches
+ */
+ public function setPatches(?OrderPatchImportCollection $patches): void
+ {
+ $this->patches = $patches;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponse.php b/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponse.php
index 15a662191b5..769fc4098f1 100644
--- a/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponse.php
+++ b/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponse.php
@@ -16,6 +16,7 @@ interface ImportSinkPagedResponse extends JsonObject
public const FIELD_LIMIT = 'limit';
public const FIELD_OFFSET = 'offset';
public const FIELD_COUNT = 'count';
+ public const FIELD_TOTAL = 'total';
public const FIELD_RESULTS = 'results';
/**
@@ -39,6 +40,13 @@ public function getOffset();
*/
public function getCount();
+ /**
+ * The total number of results matching the query.
+ *
+ * @return null|int
+ */
+ public function getTotal();
+
/**
* The results for this paged response.
*
@@ -61,6 +69,11 @@ public function setOffset(?int $offset): void;
*/
public function setCount(?int $count): void;
+ /**
+ * @param ?int $total
+ */
+ public function setTotal(?int $total): void;
+
/**
* @param ?ImportSinkCollection $results
*/
diff --git a/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseBuilder.php b/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseBuilder.php
index 121f75e1fb9..46d61cc6d2b 100644
--- a/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseBuilder.php
+++ b/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseBuilder.php
@@ -35,6 +35,11 @@ final class ImportSinkPagedResponseBuilder implements Builder
*/
private $count;
+ /**
+ * @var ?int
+ */
+ private $total;
+
/**
* @var ?ImportSinkCollection
*/
@@ -70,6 +75,16 @@ public function getCount()
return $this->count;
}
+ /**
+ * The total number of results matching the query.
+ *
+ * @return null|int
+ */
+ public function getTotal()
+ {
+ return $this->total;
+ }
+
/**
* The results for this paged response.
*
@@ -113,6 +128,17 @@ public function withCount(?int $count)
return $this;
}
+ /**
+ * @param ?int $total
+ * @return $this
+ */
+ public function withTotal(?int $total)
+ {
+ $this->total = $total;
+
+ return $this;
+ }
+
/**
* @param ?ImportSinkCollection $results
* @return $this
@@ -131,6 +157,7 @@ public function build(): ImportSinkPagedResponse
$this->limit,
$this->offset,
$this->count,
+ $this->total,
$this->results
);
}
diff --git a/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseModel.php b/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseModel.php
index c26a27bdbe1..852db79c748 100644
--- a/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseModel.php
+++ b/lib/commercetools-import/src/Models/Importsinks/ImportSinkPagedResponseModel.php
@@ -34,6 +34,11 @@ final class ImportSinkPagedResponseModel extends JsonObjectModel implements Impo
*/
protected $count;
+ /**
+ * @var ?int
+ */
+ protected $total;
+
/**
* @var ?ImportSinkCollection
*/
@@ -47,11 +52,13 @@ public function __construct(
?int $limit = null,
?int $offset = null,
?int $count = null,
+ ?int $total = null,
?ImportSinkCollection $results = null
) {
$this->limit = $limit;
$this->offset = $offset;
$this->count = $count;
+ $this->total = $total;
$this->results = $results;
}
@@ -112,6 +119,25 @@ public function getCount()
return $this->count;
}
+ /**
+ * The total number of results matching the query.
+ *
+ * @return null|int
+ */
+ public function getTotal()
+ {
+ if (is_null($this->total)) {
+ /** @psalm-var ?int $data */
+ $data = $this->raw(self::FIELD_TOTAL);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->total = (int) $data;
+ }
+
+ return $this->total;
+ }
+
/**
* The results for this paged response.
*
@@ -156,6 +182,14 @@ public function setCount(?int $count): void
$this->count = $count;
}
+ /**
+ * @param ?int $total
+ */
+ public function setTotal(?int $total): void
+ {
+ $this->total = $total;
+ }
+
/**
* @param ?ImportSinkCollection $results
*/
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraft.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraft.php
new file mode 100644
index 00000000000..c94968768ae
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraft.php
@@ -0,0 +1,39 @@
+
+ */
+final class DeliveryAddressDraftBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $deliveryId;
+
+ /**
+ * @var null|Address|AddressBuilder
+ */
+ private $address;
+
+ /**
+ * @return null|string
+ */
+ public function getDeliveryId()
+ {
+ return $this->deliveryId;
+ }
+
+ /**
+ * @return null|Address
+ */
+ public function getAddress()
+ {
+ return $this->address instanceof AddressBuilder ? $this->address->build() : $this->address;
+ }
+
+ /**
+ * @param ?string $deliveryId
+ * @return $this
+ */
+ public function withDeliveryId(?string $deliveryId)
+ {
+ $this->deliveryId = $deliveryId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?Address $address
+ * @return $this
+ */
+ public function withAddress(?Address $address)
+ {
+ $this->address = $address;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withAddress() instead
+ * @return $this
+ */
+ public function withAddressBuilder(?AddressBuilder $address)
+ {
+ $this->address = $address;
+
+ return $this;
+ }
+
+ public function build(): DeliveryAddressDraft
+ {
+ return new DeliveryAddressDraftModel(
+ $this->deliveryId,
+ $this->address instanceof AddressBuilder ? $this->address->build() : $this->address
+ );
+ }
+
+ public static function of(): DeliveryAddressDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraftCollection.php
new file mode 100644
index 00000000000..73814a31c6a
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method DeliveryAddressDraft current()
+ * @method DeliveryAddressDraft at($offset)
+ */
+class DeliveryAddressDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert DeliveryAddressDraft $value
+ * @psalm-param DeliveryAddressDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return DeliveryAddressDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof DeliveryAddressDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?DeliveryAddressDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?DeliveryAddressDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var DeliveryAddressDraft $data */
+ $data = DeliveryAddressDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraftModel.php
new file mode 100644
index 00000000000..a0bdbea9b29
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryAddressDraftModel.php
@@ -0,0 +1,97 @@
+deliveryId = $deliveryId;
+ $this->address = $address;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getDeliveryId()
+ {
+ if (is_null($this->deliveryId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_DELIVERY_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->deliveryId = (string) $data;
+ }
+
+ return $this->deliveryId;
+ }
+
+ /**
+ * @return null|Address
+ */
+ public function getAddress()
+ {
+ if (is_null($this->address)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_ADDRESS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->address = AddressModel::of($data);
+ }
+
+ return $this->address;
+ }
+
+
+ /**
+ * @param ?string $deliveryId
+ */
+ public function setDeliveryId(?string $deliveryId): void
+ {
+ $this->deliveryId = $deliveryId;
+ }
+
+ /**
+ * @param ?Address $address
+ */
+ public function setAddress(?Address $address): void
+ {
+ $this->address = $address;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraft.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraft.php
new file mode 100644
index 00000000000..8aa9bcd1b84
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraft.php
@@ -0,0 +1,51 @@
+
+ */
+final class DeliveryDraftBuilder implements Builder
+{
+ /**
+ * @var ?DeliveryItemCollection
+ */
+ private $items;
+
+ /**
+ * @var null|Address|AddressBuilder
+ */
+ private $address;
+
+ /**
+ * @var ?DeliveryParcelDraftCollection
+ */
+ private $parcels;
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ /**
+ * @return null|Address
+ */
+ public function getAddress()
+ {
+ return $this->address instanceof AddressBuilder ? $this->address->build() : $this->address;
+ }
+
+ /**
+ * @return null|DeliveryParcelDraftCollection
+ */
+ public function getParcels()
+ {
+ return $this->parcels;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ * @return $this
+ */
+ public function withItems(?DeliveryItemCollection $items)
+ {
+ $this->items = $items;
+
+ return $this;
+ }
+
+ /**
+ * @param ?Address $address
+ * @return $this
+ */
+ public function withAddress(?Address $address)
+ {
+ $this->address = $address;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryParcelDraftCollection $parcels
+ * @return $this
+ */
+ public function withParcels(?DeliveryParcelDraftCollection $parcels)
+ {
+ $this->parcels = $parcels;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withAddress() instead
+ * @return $this
+ */
+ public function withAddressBuilder(?AddressBuilder $address)
+ {
+ $this->address = $address;
+
+ return $this;
+ }
+
+ public function build(): DeliveryDraft
+ {
+ return new DeliveryDraftModel(
+ $this->items,
+ $this->address instanceof AddressBuilder ? $this->address->build() : $this->address,
+ $this->parcels
+ );
+ }
+
+ public static function of(): DeliveryDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraftCollection.php
new file mode 100644
index 00000000000..00c961b5157
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method DeliveryDraft current()
+ * @method DeliveryDraft at($offset)
+ */
+class DeliveryDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert DeliveryDraft $value
+ * @psalm-param DeliveryDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return DeliveryDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof DeliveryDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?DeliveryDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?DeliveryDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var DeliveryDraft $data */
+ $data = DeliveryDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraftModel.php
new file mode 100644
index 00000000000..fb0a257dd1c
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryDraftModel.php
@@ -0,0 +1,130 @@
+items = $items;
+ $this->address = $address;
+ $this->parcels = $parcels;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ if (is_null($this->items)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_ITEMS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->items = DeliveryItemCollection::fromArray($data);
+ }
+
+ return $this->items;
+ }
+
+ /**
+ * @return null|Address
+ */
+ public function getAddress()
+ {
+ if (is_null($this->address)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_ADDRESS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->address = AddressModel::of($data);
+ }
+
+ return $this->address;
+ }
+
+ /**
+ * @return null|DeliveryParcelDraftCollection
+ */
+ public function getParcels()
+ {
+ if (is_null($this->parcels)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_PARCELS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->parcels = DeliveryParcelDraftCollection::fromArray($data);
+ }
+
+ return $this->parcels;
+ }
+
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ */
+ public function setItems(?DeliveryItemCollection $items): void
+ {
+ $this->items = $items;
+ }
+
+ /**
+ * @param ?Address $address
+ */
+ public function setAddress(?Address $address): void
+ {
+ $this->address = $address;
+ }
+
+ /**
+ * @param ?DeliveryParcelDraftCollection $parcels
+ */
+ public function setParcels(?DeliveryParcelDraftCollection $parcels): void
+ {
+ $this->parcels = $parcels;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcel.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcel.php
new file mode 100644
index 00000000000..750ef562f17
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcel.php
@@ -0,0 +1,63 @@
+
+ */
+final class DeliveryParcelBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $deliveryId;
+
+ /**
+ * @var null|ParcelMeasurements|ParcelMeasurementsBuilder
+ */
+ private $measurements;
+
+ /**
+ * @var null|TrackingData|TrackingDataBuilder
+ */
+ private $trackingData;
+
+ /**
+ * @var ?DeliveryItemCollection
+ */
+ private $items;
+
+ /**
+ * @return null|string
+ */
+ public function getDeliveryId()
+ {
+ return $this->deliveryId;
+ }
+
+ /**
+ * @return null|ParcelMeasurements
+ */
+ public function getMeasurements()
+ {
+ return $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements;
+ }
+
+ /**
+ * @return null|TrackingData
+ */
+ public function getTrackingData()
+ {
+ return $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ /**
+ * @param ?string $deliveryId
+ * @return $this
+ */
+ public function withDeliveryId(?string $deliveryId)
+ {
+ $this->deliveryId = $deliveryId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?ParcelMeasurements $measurements
+ * @return $this
+ */
+ public function withMeasurements(?ParcelMeasurements $measurements)
+ {
+ $this->measurements = $measurements;
+
+ return $this;
+ }
+
+ /**
+ * @param ?TrackingData $trackingData
+ * @return $this
+ */
+ public function withTrackingData(?TrackingData $trackingData)
+ {
+ $this->trackingData = $trackingData;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ * @return $this
+ */
+ public function withItems(?DeliveryItemCollection $items)
+ {
+ $this->items = $items;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withMeasurements() instead
+ * @return $this
+ */
+ public function withMeasurementsBuilder(?ParcelMeasurementsBuilder $measurements)
+ {
+ $this->measurements = $measurements;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withTrackingData() instead
+ * @return $this
+ */
+ public function withTrackingDataBuilder(?TrackingDataBuilder $trackingData)
+ {
+ $this->trackingData = $trackingData;
+
+ return $this;
+ }
+
+ public function build(): DeliveryParcel
+ {
+ return new DeliveryParcelModel(
+ $this->deliveryId,
+ $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements,
+ $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData,
+ $this->items
+ );
+ }
+
+ public static function of(): DeliveryParcelBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelCollection.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelCollection.php
new file mode 100644
index 00000000000..017acb1fc31
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelCollection.php
@@ -0,0 +1,55 @@
+
+ * @method DeliveryParcel current()
+ * @method DeliveryParcel at($offset)
+ */
+class DeliveryParcelCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert DeliveryParcel $value
+ * @psalm-param DeliveryParcel|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return DeliveryParcelCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof DeliveryParcel) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?DeliveryParcel
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?DeliveryParcel {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var DeliveryParcel $data */
+ $data = DeliveryParcelModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraft.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraft.php
new file mode 100644
index 00000000000..731326fce06
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraft.php
@@ -0,0 +1,52 @@
+
+ */
+final class DeliveryParcelDraftBuilder implements Builder
+{
+ /**
+ * @var null|ParcelMeasurements|ParcelMeasurementsBuilder
+ */
+ private $measurements;
+
+ /**
+ * @var null|TrackingData|TrackingDataBuilder
+ */
+ private $trackingData;
+
+ /**
+ * @var ?DeliveryItemCollection
+ */
+ private $items;
+
+ /**
+ * @return null|ParcelMeasurements
+ */
+ public function getMeasurements()
+ {
+ return $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements;
+ }
+
+ /**
+ * @return null|TrackingData
+ */
+ public function getTrackingData()
+ {
+ return $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ /**
+ * @param ?ParcelMeasurements $measurements
+ * @return $this
+ */
+ public function withMeasurements(?ParcelMeasurements $measurements)
+ {
+ $this->measurements = $measurements;
+
+ return $this;
+ }
+
+ /**
+ * @param ?TrackingData $trackingData
+ * @return $this
+ */
+ public function withTrackingData(?TrackingData $trackingData)
+ {
+ $this->trackingData = $trackingData;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ * @return $this
+ */
+ public function withItems(?DeliveryItemCollection $items)
+ {
+ $this->items = $items;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withMeasurements() instead
+ * @return $this
+ */
+ public function withMeasurementsBuilder(?ParcelMeasurementsBuilder $measurements)
+ {
+ $this->measurements = $measurements;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withTrackingData() instead
+ * @return $this
+ */
+ public function withTrackingDataBuilder(?TrackingDataBuilder $trackingData)
+ {
+ $this->trackingData = $trackingData;
+
+ return $this;
+ }
+
+ public function build(): DeliveryParcelDraft
+ {
+ return new DeliveryParcelDraftModel(
+ $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements,
+ $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData,
+ $this->items
+ );
+ }
+
+ public static function of(): DeliveryParcelDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraftCollection.php
new file mode 100644
index 00000000000..0742c6f68d4
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method DeliveryParcelDraft current()
+ * @method DeliveryParcelDraft at($offset)
+ */
+class DeliveryParcelDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert DeliveryParcelDraft $value
+ * @psalm-param DeliveryParcelDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return DeliveryParcelDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof DeliveryParcelDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?DeliveryParcelDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?DeliveryParcelDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var DeliveryParcelDraft $data */
+ $data = DeliveryParcelDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraftModel.php
new file mode 100644
index 00000000000..401884a784f
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelDraftModel.php
@@ -0,0 +1,133 @@
+measurements = $measurements;
+ $this->trackingData = $trackingData;
+ $this->items = $items;
+ }
+
+ /**
+ * @return null|ParcelMeasurements
+ */
+ public function getMeasurements()
+ {
+ if (is_null($this->measurements)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_MEASUREMENTS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->measurements = ParcelMeasurementsModel::of($data);
+ }
+
+ return $this->measurements;
+ }
+
+ /**
+ * @return null|TrackingData
+ */
+ public function getTrackingData()
+ {
+ if (is_null($this->trackingData)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_TRACKING_DATA);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->trackingData = TrackingDataModel::of($data);
+ }
+
+ return $this->trackingData;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ if (is_null($this->items)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_ITEMS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->items = DeliveryItemCollection::fromArray($data);
+ }
+
+ return $this->items;
+ }
+
+
+ /**
+ * @param ?ParcelMeasurements $measurements
+ */
+ public function setMeasurements(?ParcelMeasurements $measurements): void
+ {
+ $this->measurements = $measurements;
+ }
+
+ /**
+ * @param ?TrackingData $trackingData
+ */
+ public function setTrackingData(?TrackingData $trackingData): void
+ {
+ $this->trackingData = $trackingData;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ */
+ public function setItems(?DeliveryItemCollection $items): void
+ {
+ $this->items = $items;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelModel.php b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelModel.php
new file mode 100644
index 00000000000..276318035eb
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/DeliveryParcelModel.php
@@ -0,0 +1,165 @@
+deliveryId = $deliveryId;
+ $this->measurements = $measurements;
+ $this->trackingData = $trackingData;
+ $this->items = $items;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getDeliveryId()
+ {
+ if (is_null($this->deliveryId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_DELIVERY_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->deliveryId = (string) $data;
+ }
+
+ return $this->deliveryId;
+ }
+
+ /**
+ * @return null|ParcelMeasurements
+ */
+ public function getMeasurements()
+ {
+ if (is_null($this->measurements)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_MEASUREMENTS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->measurements = ParcelMeasurementsModel::of($data);
+ }
+
+ return $this->measurements;
+ }
+
+ /**
+ * @return null|TrackingData
+ */
+ public function getTrackingData()
+ {
+ if (is_null($this->trackingData)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_TRACKING_DATA);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->trackingData = TrackingDataModel::of($data);
+ }
+
+ return $this->trackingData;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ if (is_null($this->items)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_ITEMS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->items = DeliveryItemCollection::fromArray($data);
+ }
+
+ return $this->items;
+ }
+
+
+ /**
+ * @param ?string $deliveryId
+ */
+ public function setDeliveryId(?string $deliveryId): void
+ {
+ $this->deliveryId = $deliveryId;
+ }
+
+ /**
+ * @param ?ParcelMeasurements $measurements
+ */
+ public function setMeasurements(?ParcelMeasurements $measurements): void
+ {
+ $this->measurements = $measurements;
+ }
+
+ /**
+ * @param ?TrackingData $trackingData
+ */
+ public function setTrackingData(?TrackingData $trackingData): void
+ {
+ $this->trackingData = $trackingData;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ */
+ public function setItems(?DeliveryItemCollection $items): void
+ {
+ $this->items = $items;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderField.php b/lib/commercetools-import/src/Models/OrderPatches/OrderField.php
new file mode 100644
index 00000000000..72558d945fc
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderField.php
@@ -0,0 +1,133 @@
+Maps to Order.returnInfo
+ *
+ * @return null|ReturnInfo
+ */
+ public function getAddReturnInfo();
+
+ /**
+ * Maps to Order.delivery
+ *
+ * @return null|DeliveryParcel
+ */
+ public function getAddParcelToDelivery();
+
+ /**
+ * Maps to Order.delivery
+ *
+ * @return null|DeliveryDraftCollection
+ */
+ public function getAddDeliveries();
+
+ /**
+ * Maps to Order.removeDelivery
+ *
+ * @return null|RemoveDeliveryDraft
+ */
+ public function getRemoveDelivery();
+
+ /**
+ * Maps to Order.removeParcelFromDelivery
+ *
+ * @return null|RemoveParcelFromDeliveryDraft
+ */
+ public function getRemoveParcelFromDelivery();
+
+ /**
+ * Maps to Order.addressDraft
+ *
+ * @return null|DeliveryAddressDraft
+ */
+ public function getSetDeliveryAddress();
+
+ /**
+ * Maps to Order.parcelMeasurements
+ *
+ * @return null|ParcelMeasurementDraft
+ */
+ public function getSetParcelMeasurements();
+
+ /**
+ * Maps to Order.parcelTrackingData
+ *
+ * @return null|ParcelTrackingData
+ */
+ public function getSetParcelTrackingData();
+
+ /**
+ * Maps to Order.parcelItems
+ *
+ * @return null|ParcelItemsCollection
+ */
+ public function getSetParcelItems();
+
+ /**
+ * @param ?ReturnInfo $addReturnInfo
+ */
+ public function setAddReturnInfo(?ReturnInfo $addReturnInfo): void;
+
+ /**
+ * @param ?DeliveryParcel $addParcelToDelivery
+ */
+ public function setAddParcelToDelivery(?DeliveryParcel $addParcelToDelivery): void;
+
+ /**
+ * @param ?DeliveryDraftCollection $addDeliveries
+ */
+ public function setAddDeliveries(?DeliveryDraftCollection $addDeliveries): void;
+
+ /**
+ * @param ?RemoveDeliveryDraft $removeDelivery
+ */
+ public function setRemoveDelivery(?RemoveDeliveryDraft $removeDelivery): void;
+
+ /**
+ * @param ?RemoveParcelFromDeliveryDraft $removeParcelFromDelivery
+ */
+ public function setRemoveParcelFromDelivery(?RemoveParcelFromDeliveryDraft $removeParcelFromDelivery): void;
+
+ /**
+ * @param ?DeliveryAddressDraft $setDeliveryAddress
+ */
+ public function setSetDeliveryAddress(?DeliveryAddressDraft $setDeliveryAddress): void;
+
+ /**
+ * @param ?ParcelMeasurementDraft $setParcelMeasurements
+ */
+ public function setSetParcelMeasurements(?ParcelMeasurementDraft $setParcelMeasurements): void;
+
+ /**
+ * @param ?ParcelTrackingData $setParcelTrackingData
+ */
+ public function setSetParcelTrackingData(?ParcelTrackingData $setParcelTrackingData): void;
+
+ /**
+ * @param ?ParcelItemsCollection $setParcelItems
+ */
+ public function setSetParcelItems(?ParcelItemsCollection $setParcelItems): void;
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderFieldBuilder.php b/lib/commercetools-import/src/Models/OrderPatches/OrderFieldBuilder.php
new file mode 100644
index 00000000000..c79b43138aa
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderFieldBuilder.php
@@ -0,0 +1,353 @@
+
+ */
+final class OrderFieldBuilder implements Builder
+{
+ /**
+ * @var null|ReturnInfo|ReturnInfoBuilder
+ */
+ private $addReturnInfo;
+
+ /**
+ * @var null|DeliveryParcel|DeliveryParcelBuilder
+ */
+ private $addParcelToDelivery;
+
+ /**
+ * @var ?DeliveryDraftCollection
+ */
+ private $addDeliveries;
+
+ /**
+ * @var null|RemoveDeliveryDraft|RemoveDeliveryDraftBuilder
+ */
+ private $removeDelivery;
+
+ /**
+ * @var null|RemoveParcelFromDeliveryDraft|RemoveParcelFromDeliveryDraftBuilder
+ */
+ private $removeParcelFromDelivery;
+
+ /**
+ * @var null|DeliveryAddressDraft|DeliveryAddressDraftBuilder
+ */
+ private $setDeliveryAddress;
+
+ /**
+ * @var null|ParcelMeasurementDraft|ParcelMeasurementDraftBuilder
+ */
+ private $setParcelMeasurements;
+
+ /**
+ * @var null|ParcelTrackingData|ParcelTrackingDataBuilder
+ */
+ private $setParcelTrackingData;
+
+ /**
+ * @var ?ParcelItemsCollection
+ */
+ private $setParcelItems;
+
+ /**
+ * Maps to Order.returnInfo
+ *
+ * @return null|ReturnInfo
+ */
+ public function getAddReturnInfo()
+ {
+ return $this->addReturnInfo instanceof ReturnInfoBuilder ? $this->addReturnInfo->build() : $this->addReturnInfo;
+ }
+
+ /**
+ * Maps to Order.delivery
+ *
+ * @return null|DeliveryParcel
+ */
+ public function getAddParcelToDelivery()
+ {
+ return $this->addParcelToDelivery instanceof DeliveryParcelBuilder ? $this->addParcelToDelivery->build() : $this->addParcelToDelivery;
+ }
+
+ /**
+ * Maps to Order.delivery
+ *
+ * @return null|DeliveryDraftCollection
+ */
+ public function getAddDeliveries()
+ {
+ return $this->addDeliveries;
+ }
+
+ /**
+ * Maps to Order.removeDelivery
+ *
+ * @return null|RemoveDeliveryDraft
+ */
+ public function getRemoveDelivery()
+ {
+ return $this->removeDelivery instanceof RemoveDeliveryDraftBuilder ? $this->removeDelivery->build() : $this->removeDelivery;
+ }
+
+ /**
+ * Maps to Order.removeParcelFromDelivery
+ *
+ * @return null|RemoveParcelFromDeliveryDraft
+ */
+ public function getRemoveParcelFromDelivery()
+ {
+ return $this->removeParcelFromDelivery instanceof RemoveParcelFromDeliveryDraftBuilder ? $this->removeParcelFromDelivery->build() : $this->removeParcelFromDelivery;
+ }
+
+ /**
+ * Maps to Order.addressDraft
+ *
+ * @return null|DeliveryAddressDraft
+ */
+ public function getSetDeliveryAddress()
+ {
+ return $this->setDeliveryAddress instanceof DeliveryAddressDraftBuilder ? $this->setDeliveryAddress->build() : $this->setDeliveryAddress;
+ }
+
+ /**
+ * Maps to Order.parcelMeasurements
+ *
+ * @return null|ParcelMeasurementDraft
+ */
+ public function getSetParcelMeasurements()
+ {
+ return $this->setParcelMeasurements instanceof ParcelMeasurementDraftBuilder ? $this->setParcelMeasurements->build() : $this->setParcelMeasurements;
+ }
+
+ /**
+ * Maps to Order.parcelTrackingData
+ *
+ * @return null|ParcelTrackingData
+ */
+ public function getSetParcelTrackingData()
+ {
+ return $this->setParcelTrackingData instanceof ParcelTrackingDataBuilder ? $this->setParcelTrackingData->build() : $this->setParcelTrackingData;
+ }
+
+ /**
+ * Maps to Order.parcelItems
+ *
+ * @return null|ParcelItemsCollection
+ */
+ public function getSetParcelItems()
+ {
+ return $this->setParcelItems;
+ }
+
+ /**
+ * @param ?ReturnInfo $addReturnInfo
+ * @return $this
+ */
+ public function withAddReturnInfo(?ReturnInfo $addReturnInfo)
+ {
+ $this->addReturnInfo = $addReturnInfo;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryParcel $addParcelToDelivery
+ * @return $this
+ */
+ public function withAddParcelToDelivery(?DeliveryParcel $addParcelToDelivery)
+ {
+ $this->addParcelToDelivery = $addParcelToDelivery;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryDraftCollection $addDeliveries
+ * @return $this
+ */
+ public function withAddDeliveries(?DeliveryDraftCollection $addDeliveries)
+ {
+ $this->addDeliveries = $addDeliveries;
+
+ return $this;
+ }
+
+ /**
+ * @param ?RemoveDeliveryDraft $removeDelivery
+ * @return $this
+ */
+ public function withRemoveDelivery(?RemoveDeliveryDraft $removeDelivery)
+ {
+ $this->removeDelivery = $removeDelivery;
+
+ return $this;
+ }
+
+ /**
+ * @param ?RemoveParcelFromDeliveryDraft $removeParcelFromDelivery
+ * @return $this
+ */
+ public function withRemoveParcelFromDelivery(?RemoveParcelFromDeliveryDraft $removeParcelFromDelivery)
+ {
+ $this->removeParcelFromDelivery = $removeParcelFromDelivery;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryAddressDraft $setDeliveryAddress
+ * @return $this
+ */
+ public function withSetDeliveryAddress(?DeliveryAddressDraft $setDeliveryAddress)
+ {
+ $this->setDeliveryAddress = $setDeliveryAddress;
+
+ return $this;
+ }
+
+ /**
+ * @param ?ParcelMeasurementDraft $setParcelMeasurements
+ * @return $this
+ */
+ public function withSetParcelMeasurements(?ParcelMeasurementDraft $setParcelMeasurements)
+ {
+ $this->setParcelMeasurements = $setParcelMeasurements;
+
+ return $this;
+ }
+
+ /**
+ * @param ?ParcelTrackingData $setParcelTrackingData
+ * @return $this
+ */
+ public function withSetParcelTrackingData(?ParcelTrackingData $setParcelTrackingData)
+ {
+ $this->setParcelTrackingData = $setParcelTrackingData;
+
+ return $this;
+ }
+
+ /**
+ * @param ?ParcelItemsCollection $setParcelItems
+ * @return $this
+ */
+ public function withSetParcelItems(?ParcelItemsCollection $setParcelItems)
+ {
+ $this->setParcelItems = $setParcelItems;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withAddReturnInfo() instead
+ * @return $this
+ */
+ public function withAddReturnInfoBuilder(?ReturnInfoBuilder $addReturnInfo)
+ {
+ $this->addReturnInfo = $addReturnInfo;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withAddParcelToDelivery() instead
+ * @return $this
+ */
+ public function withAddParcelToDeliveryBuilder(?DeliveryParcelBuilder $addParcelToDelivery)
+ {
+ $this->addParcelToDelivery = $addParcelToDelivery;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withRemoveDelivery() instead
+ * @return $this
+ */
+ public function withRemoveDeliveryBuilder(?RemoveDeliveryDraftBuilder $removeDelivery)
+ {
+ $this->removeDelivery = $removeDelivery;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withRemoveParcelFromDelivery() instead
+ * @return $this
+ */
+ public function withRemoveParcelFromDeliveryBuilder(?RemoveParcelFromDeliveryDraftBuilder $removeParcelFromDelivery)
+ {
+ $this->removeParcelFromDelivery = $removeParcelFromDelivery;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withSetDeliveryAddress() instead
+ * @return $this
+ */
+ public function withSetDeliveryAddressBuilder(?DeliveryAddressDraftBuilder $setDeliveryAddress)
+ {
+ $this->setDeliveryAddress = $setDeliveryAddress;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withSetParcelMeasurements() instead
+ * @return $this
+ */
+ public function withSetParcelMeasurementsBuilder(?ParcelMeasurementDraftBuilder $setParcelMeasurements)
+ {
+ $this->setParcelMeasurements = $setParcelMeasurements;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withSetParcelTrackingData() instead
+ * @return $this
+ */
+ public function withSetParcelTrackingDataBuilder(?ParcelTrackingDataBuilder $setParcelTrackingData)
+ {
+ $this->setParcelTrackingData = $setParcelTrackingData;
+
+ return $this;
+ }
+
+ public function build(): OrderField
+ {
+ return new OrderFieldModel(
+ $this->addReturnInfo instanceof ReturnInfoBuilder ? $this->addReturnInfo->build() : $this->addReturnInfo,
+ $this->addParcelToDelivery instanceof DeliveryParcelBuilder ? $this->addParcelToDelivery->build() : $this->addParcelToDelivery,
+ $this->addDeliveries,
+ $this->removeDelivery instanceof RemoveDeliveryDraftBuilder ? $this->removeDelivery->build() : $this->removeDelivery,
+ $this->removeParcelFromDelivery instanceof RemoveParcelFromDeliveryDraftBuilder ? $this->removeParcelFromDelivery->build() : $this->removeParcelFromDelivery,
+ $this->setDeliveryAddress instanceof DeliveryAddressDraftBuilder ? $this->setDeliveryAddress->build() : $this->setDeliveryAddress,
+ $this->setParcelMeasurements instanceof ParcelMeasurementDraftBuilder ? $this->setParcelMeasurements->build() : $this->setParcelMeasurements,
+ $this->setParcelTrackingData instanceof ParcelTrackingDataBuilder ? $this->setParcelTrackingData->build() : $this->setParcelTrackingData,
+ $this->setParcelItems
+ );
+ }
+
+ public static function of(): OrderFieldBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderFieldCollection.php b/lib/commercetools-import/src/Models/OrderPatches/OrderFieldCollection.php
new file mode 100644
index 00000000000..32c7aef46de
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderFieldCollection.php
@@ -0,0 +1,55 @@
+
+ * @method OrderField current()
+ * @method OrderField at($offset)
+ */
+class OrderFieldCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert OrderField $value
+ * @psalm-param OrderField|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return OrderFieldCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof OrderField) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?OrderField
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?OrderField {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var OrderField $data */
+ $data = OrderFieldModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderFieldModel.php b/lib/commercetools-import/src/Models/OrderPatches/OrderFieldModel.php
new file mode 100644
index 00000000000..ff2232dcfcb
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderFieldModel.php
@@ -0,0 +1,343 @@
+addReturnInfo = $addReturnInfo;
+ $this->addParcelToDelivery = $addParcelToDelivery;
+ $this->addDeliveries = $addDeliveries;
+ $this->removeDelivery = $removeDelivery;
+ $this->removeParcelFromDelivery = $removeParcelFromDelivery;
+ $this->setDeliveryAddress = $setDeliveryAddress;
+ $this->setParcelMeasurements = $setParcelMeasurements;
+ $this->setParcelTrackingData = $setParcelTrackingData;
+ $this->setParcelItems = $setParcelItems;
+ }
+
+ /**
+ * Maps to Order.returnInfo
+ *
+ * @return null|ReturnInfo
+ */
+ public function getAddReturnInfo()
+ {
+ if (is_null($this->addReturnInfo)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_ADD_RETURN_INFO);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->addReturnInfo = ReturnInfoModel::of($data);
+ }
+
+ return $this->addReturnInfo;
+ }
+
+ /**
+ * Maps to Order.delivery
+ *
+ * @return null|DeliveryParcel
+ */
+ public function getAddParcelToDelivery()
+ {
+ if (is_null($this->addParcelToDelivery)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_ADD_PARCEL_TO_DELIVERY);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->addParcelToDelivery = DeliveryParcelModel::of($data);
+ }
+
+ return $this->addParcelToDelivery;
+ }
+
+ /**
+ * Maps to Order.delivery
+ *
+ * @return null|DeliveryDraftCollection
+ */
+ public function getAddDeliveries()
+ {
+ if (is_null($this->addDeliveries)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_ADD_DELIVERIES);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->addDeliveries = DeliveryDraftCollection::fromArray($data);
+ }
+
+ return $this->addDeliveries;
+ }
+
+ /**
+ * Maps to Order.removeDelivery
+ *
+ * @return null|RemoveDeliveryDraft
+ */
+ public function getRemoveDelivery()
+ {
+ if (is_null($this->removeDelivery)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_REMOVE_DELIVERY);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->removeDelivery = RemoveDeliveryDraftModel::of($data);
+ }
+
+ return $this->removeDelivery;
+ }
+
+ /**
+ * Maps to Order.removeParcelFromDelivery
+ *
+ * @return null|RemoveParcelFromDeliveryDraft
+ */
+ public function getRemoveParcelFromDelivery()
+ {
+ if (is_null($this->removeParcelFromDelivery)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_REMOVE_PARCEL_FROM_DELIVERY);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->removeParcelFromDelivery = RemoveParcelFromDeliveryDraftModel::of($data);
+ }
+
+ return $this->removeParcelFromDelivery;
+ }
+
+ /**
+ * Maps to Order.addressDraft
+ *
+ * @return null|DeliveryAddressDraft
+ */
+ public function getSetDeliveryAddress()
+ {
+ if (is_null($this->setDeliveryAddress)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_SET_DELIVERY_ADDRESS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->setDeliveryAddress = DeliveryAddressDraftModel::of($data);
+ }
+
+ return $this->setDeliveryAddress;
+ }
+
+ /**
+ * Maps to Order.parcelMeasurements
+ *
+ * @return null|ParcelMeasurementDraft
+ */
+ public function getSetParcelMeasurements()
+ {
+ if (is_null($this->setParcelMeasurements)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_SET_PARCEL_MEASUREMENTS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->setParcelMeasurements = ParcelMeasurementDraftModel::of($data);
+ }
+
+ return $this->setParcelMeasurements;
+ }
+
+ /**
+ * Maps to Order.parcelTrackingData
+ *
+ * @return null|ParcelTrackingData
+ */
+ public function getSetParcelTrackingData()
+ {
+ if (is_null($this->setParcelTrackingData)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_SET_PARCEL_TRACKING_DATA);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->setParcelTrackingData = ParcelTrackingDataModel::of($data);
+ }
+
+ return $this->setParcelTrackingData;
+ }
+
+ /**
+ * Maps to Order.parcelItems
+ *
+ * @return null|ParcelItemsCollection
+ */
+ public function getSetParcelItems()
+ {
+ if (is_null($this->setParcelItems)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_SET_PARCEL_ITEMS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->setParcelItems = ParcelItemsCollection::fromArray($data);
+ }
+
+ return $this->setParcelItems;
+ }
+
+
+ /**
+ * @param ?ReturnInfo $addReturnInfo
+ */
+ public function setAddReturnInfo(?ReturnInfo $addReturnInfo): void
+ {
+ $this->addReturnInfo = $addReturnInfo;
+ }
+
+ /**
+ * @param ?DeliveryParcel $addParcelToDelivery
+ */
+ public function setAddParcelToDelivery(?DeliveryParcel $addParcelToDelivery): void
+ {
+ $this->addParcelToDelivery = $addParcelToDelivery;
+ }
+
+ /**
+ * @param ?DeliveryDraftCollection $addDeliveries
+ */
+ public function setAddDeliveries(?DeliveryDraftCollection $addDeliveries): void
+ {
+ $this->addDeliveries = $addDeliveries;
+ }
+
+ /**
+ * @param ?RemoveDeliveryDraft $removeDelivery
+ */
+ public function setRemoveDelivery(?RemoveDeliveryDraft $removeDelivery): void
+ {
+ $this->removeDelivery = $removeDelivery;
+ }
+
+ /**
+ * @param ?RemoveParcelFromDeliveryDraft $removeParcelFromDelivery
+ */
+ public function setRemoveParcelFromDelivery(?RemoveParcelFromDeliveryDraft $removeParcelFromDelivery): void
+ {
+ $this->removeParcelFromDelivery = $removeParcelFromDelivery;
+ }
+
+ /**
+ * @param ?DeliveryAddressDraft $setDeliveryAddress
+ */
+ public function setSetDeliveryAddress(?DeliveryAddressDraft $setDeliveryAddress): void
+ {
+ $this->setDeliveryAddress = $setDeliveryAddress;
+ }
+
+ /**
+ * @param ?ParcelMeasurementDraft $setParcelMeasurements
+ */
+ public function setSetParcelMeasurements(?ParcelMeasurementDraft $setParcelMeasurements): void
+ {
+ $this->setParcelMeasurements = $setParcelMeasurements;
+ }
+
+ /**
+ * @param ?ParcelTrackingData $setParcelTrackingData
+ */
+ public function setSetParcelTrackingData(?ParcelTrackingData $setParcelTrackingData): void
+ {
+ $this->setParcelTrackingData = $setParcelTrackingData;
+ }
+
+ /**
+ * @param ?ParcelItemsCollection $setParcelItems
+ */
+ public function setSetParcelItems(?ParcelItemsCollection $setParcelItems): void
+ {
+ $this->setParcelItems = $setParcelItems;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImport.php b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImport.php
new file mode 100644
index 00000000000..3b1becc6ebe
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImport.php
@@ -0,0 +1,42 @@
+Maps to Order.orderNumber
, String that uniquely identifies an order, unique across a project.
+ *
+ * @return null|string
+ */
+ public function getOrderNumber();
+
+ /**
+ * Each field referenced must be defined in an already existing order in the commercetools project or the import operation state is set to ValidationFailed
.
+ *
+ * @return null|OrderField
+ */
+ public function getFields();
+
+ /**
+ * @param ?string $orderNumber
+ */
+ public function setOrderNumber(?string $orderNumber): void;
+
+ /**
+ * @param ?OrderField $fields
+ */
+ public function setFields(?OrderField $fields): void;
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportBuilder.php b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportBuilder.php
new file mode 100644
index 00000000000..384102adc5d
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportBuilder.php
@@ -0,0 +1,98 @@
+
+ */
+final class OrderPatchImportBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $orderNumber;
+
+ /**
+ * @var null|OrderField|OrderFieldBuilder
+ */
+ private $fields;
+
+ /**
+ * Maps to Order.orderNumber
, String that uniquely identifies an order, unique across a project.
+ *
+ * @return null|string
+ */
+ public function getOrderNumber()
+ {
+ return $this->orderNumber;
+ }
+
+ /**
+ * Each field referenced must be defined in an already existing order in the commercetools project or the import operation state is set to ValidationFailed
.
+ *
+ * @return null|OrderField
+ */
+ public function getFields()
+ {
+ return $this->fields instanceof OrderFieldBuilder ? $this->fields->build() : $this->fields;
+ }
+
+ /**
+ * @param ?string $orderNumber
+ * @return $this
+ */
+ public function withOrderNumber(?string $orderNumber)
+ {
+ $this->orderNumber = $orderNumber;
+
+ return $this;
+ }
+
+ /**
+ * @param ?OrderField $fields
+ * @return $this
+ */
+ public function withFields(?OrderField $fields)
+ {
+ $this->fields = $fields;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withFields() instead
+ * @return $this
+ */
+ public function withFieldsBuilder(?OrderFieldBuilder $fields)
+ {
+ $this->fields = $fields;
+
+ return $this;
+ }
+
+ public function build(): OrderPatchImport
+ {
+ return new OrderPatchImportModel(
+ $this->orderNumber,
+ $this->fields instanceof OrderFieldBuilder ? $this->fields->build() : $this->fields
+ );
+ }
+
+ public static function of(): OrderPatchImportBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportCollection.php b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportCollection.php
new file mode 100644
index 00000000000..9bd37ff91bd
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportCollection.php
@@ -0,0 +1,55 @@
+
+ * @method OrderPatchImport current()
+ * @method OrderPatchImport at($offset)
+ */
+class OrderPatchImportCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert OrderPatchImport $value
+ * @psalm-param OrderPatchImport|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return OrderPatchImportCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof OrderPatchImport) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?OrderPatchImport
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?OrderPatchImport {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var OrderPatchImport $data */
+ $data = OrderPatchImportModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportModel.php b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportModel.php
new file mode 100644
index 00000000000..f2f1d4da18c
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/OrderPatchImportModel.php
@@ -0,0 +1,99 @@
+orderNumber = $orderNumber;
+ $this->fields = $fields;
+ }
+
+ /**
+ * Maps to Order.orderNumber
, String that uniquely identifies an order, unique across a project.
+ *
+ * @return null|string
+ */
+ public function getOrderNumber()
+ {
+ if (is_null($this->orderNumber)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_ORDER_NUMBER);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->orderNumber = (string) $data;
+ }
+
+ return $this->orderNumber;
+ }
+
+ /**
+ * Each field referenced must be defined in an already existing order in the commercetools project or the import operation state is set to ValidationFailed
.
+ *
+ * @return null|OrderField
+ */
+ public function getFields()
+ {
+ if (is_null($this->fields)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_FIELDS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->fields = OrderFieldModel::of($data);
+ }
+
+ return $this->fields;
+ }
+
+
+ /**
+ * @param ?string $orderNumber
+ */
+ public function setOrderNumber(?string $orderNumber): void
+ {
+ $this->orderNumber = $orderNumber;
+ }
+
+ /**
+ * @param ?OrderField $fields
+ */
+ public function setFields(?OrderField $fields): void
+ {
+ $this->fields = $fields;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelItems.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelItems.php
new file mode 100644
index 00000000000..f76bd7ffb22
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelItems.php
@@ -0,0 +1,39 @@
+
+ */
+final class ParcelItemsBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $parcelId;
+
+ /**
+ * @var ?DeliveryItemCollection
+ */
+ private $items;
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ return $this->parcelId;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ /**
+ * @param ?string $parcelId
+ * @return $this
+ */
+ public function withParcelId(?string $parcelId)
+ {
+ $this->parcelId = $parcelId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ * @return $this
+ */
+ public function withItems(?DeliveryItemCollection $items)
+ {
+ $this->items = $items;
+
+ return $this;
+ }
+
+
+ public function build(): ParcelItems
+ {
+ return new ParcelItemsModel(
+ $this->parcelId,
+ $this->items
+ );
+ }
+
+ public static function of(): ParcelItemsBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelItemsCollection.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelItemsCollection.php
new file mode 100644
index 00000000000..eb7edae7f30
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelItemsCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ParcelItems current()
+ * @method ParcelItems at($offset)
+ */
+class ParcelItemsCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert ParcelItems $value
+ * @psalm-param ParcelItems|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ParcelItemsCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ParcelItems) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ParcelItems
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ParcelItems {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ParcelItems $data */
+ $data = ParcelItemsModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelItemsModel.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelItemsModel.php
new file mode 100644
index 00000000000..fbb447573f3
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelItemsModel.php
@@ -0,0 +1,95 @@
+parcelId = $parcelId;
+ $this->items = $items;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ if (is_null($this->parcelId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_PARCEL_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->parcelId = (string) $data;
+ }
+
+ return $this->parcelId;
+ }
+
+ /**
+ * @return null|DeliveryItemCollection
+ */
+ public function getItems()
+ {
+ if (is_null($this->items)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_ITEMS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->items = DeliveryItemCollection::fromArray($data);
+ }
+
+ return $this->items;
+ }
+
+
+ /**
+ * @param ?string $parcelId
+ */
+ public function setParcelId(?string $parcelId): void
+ {
+ $this->parcelId = $parcelId;
+ }
+
+ /**
+ * @param ?DeliveryItemCollection $items
+ */
+ public function setItems(?DeliveryItemCollection $items): void
+ {
+ $this->items = $items;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraft.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraft.php
new file mode 100644
index 00000000000..56b73ce5aae
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraft.php
@@ -0,0 +1,39 @@
+
+ */
+final class ParcelMeasurementDraftBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $parcelId;
+
+ /**
+ * @var null|ParcelMeasurements|ParcelMeasurementsBuilder
+ */
+ private $measurements;
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ return $this->parcelId;
+ }
+
+ /**
+ * @return null|ParcelMeasurements
+ */
+ public function getMeasurements()
+ {
+ return $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements;
+ }
+
+ /**
+ * @param ?string $parcelId
+ * @return $this
+ */
+ public function withParcelId(?string $parcelId)
+ {
+ $this->parcelId = $parcelId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?ParcelMeasurements $measurements
+ * @return $this
+ */
+ public function withMeasurements(?ParcelMeasurements $measurements)
+ {
+ $this->measurements = $measurements;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withMeasurements() instead
+ * @return $this
+ */
+ public function withMeasurementsBuilder(?ParcelMeasurementsBuilder $measurements)
+ {
+ $this->measurements = $measurements;
+
+ return $this;
+ }
+
+ public function build(): ParcelMeasurementDraft
+ {
+ return new ParcelMeasurementDraftModel(
+ $this->parcelId,
+ $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements
+ );
+ }
+
+ public static function of(): ParcelMeasurementDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraftCollection.php
new file mode 100644
index 00000000000..762d0e88c65
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ParcelMeasurementDraft current()
+ * @method ParcelMeasurementDraft at($offset)
+ */
+class ParcelMeasurementDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert ParcelMeasurementDraft $value
+ * @psalm-param ParcelMeasurementDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ParcelMeasurementDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ParcelMeasurementDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ParcelMeasurementDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ParcelMeasurementDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ParcelMeasurementDraft $data */
+ $data = ParcelMeasurementDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraftModel.php
new file mode 100644
index 00000000000..ad5e5b75645
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelMeasurementDraftModel.php
@@ -0,0 +1,97 @@
+parcelId = $parcelId;
+ $this->measurements = $measurements;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ if (is_null($this->parcelId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_PARCEL_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->parcelId = (string) $data;
+ }
+
+ return $this->parcelId;
+ }
+
+ /**
+ * @return null|ParcelMeasurements
+ */
+ public function getMeasurements()
+ {
+ if (is_null($this->measurements)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_MEASUREMENTS);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->measurements = ParcelMeasurementsModel::of($data);
+ }
+
+ return $this->measurements;
+ }
+
+
+ /**
+ * @param ?string $parcelId
+ */
+ public function setParcelId(?string $parcelId): void
+ {
+ $this->parcelId = $parcelId;
+ }
+
+ /**
+ * @param ?ParcelMeasurements $measurements
+ */
+ public function setMeasurements(?ParcelMeasurements $measurements): void
+ {
+ $this->measurements = $measurements;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingData.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingData.php
new file mode 100644
index 00000000000..2d7067f3723
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingData.php
@@ -0,0 +1,39 @@
+
+ */
+final class ParcelTrackingDataBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $parcelId;
+
+ /**
+ * @var null|TrackingData|TrackingDataBuilder
+ */
+ private $trackingData;
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ return $this->parcelId;
+ }
+
+ /**
+ * @return null|TrackingData
+ */
+ public function getTrackingData()
+ {
+ return $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData;
+ }
+
+ /**
+ * @param ?string $parcelId
+ * @return $this
+ */
+ public function withParcelId(?string $parcelId)
+ {
+ $this->parcelId = $parcelId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?TrackingData $trackingData
+ * @return $this
+ */
+ public function withTrackingData(?TrackingData $trackingData)
+ {
+ $this->trackingData = $trackingData;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withTrackingData() instead
+ * @return $this
+ */
+ public function withTrackingDataBuilder(?TrackingDataBuilder $trackingData)
+ {
+ $this->trackingData = $trackingData;
+
+ return $this;
+ }
+
+ public function build(): ParcelTrackingData
+ {
+ return new ParcelTrackingDataModel(
+ $this->parcelId,
+ $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData
+ );
+ }
+
+ public static function of(): ParcelTrackingDataBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingDataCollection.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingDataCollection.php
new file mode 100644
index 00000000000..2c91c3898dc
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingDataCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ParcelTrackingData current()
+ * @method ParcelTrackingData at($offset)
+ */
+class ParcelTrackingDataCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert ParcelTrackingData $value
+ * @psalm-param ParcelTrackingData|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ParcelTrackingDataCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ParcelTrackingData) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ParcelTrackingData
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ParcelTrackingData {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ParcelTrackingData $data */
+ $data = ParcelTrackingDataModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingDataModel.php b/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingDataModel.php
new file mode 100644
index 00000000000..b7b68af04d3
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ParcelTrackingDataModel.php
@@ -0,0 +1,97 @@
+parcelId = $parcelId;
+ $this->trackingData = $trackingData;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ if (is_null($this->parcelId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_PARCEL_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->parcelId = (string) $data;
+ }
+
+ return $this->parcelId;
+ }
+
+ /**
+ * @return null|TrackingData
+ */
+ public function getTrackingData()
+ {
+ if (is_null($this->trackingData)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_TRACKING_DATA);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->trackingData = TrackingDataModel::of($data);
+ }
+
+ return $this->trackingData;
+ }
+
+
+ /**
+ * @param ?string $parcelId
+ */
+ public function setParcelId(?string $parcelId): void
+ {
+ $this->parcelId = $parcelId;
+ }
+
+ /**
+ * @param ?TrackingData $trackingData
+ */
+ public function setTrackingData(?TrackingData $trackingData): void
+ {
+ $this->trackingData = $trackingData;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraft.php b/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraft.php
new file mode 100644
index 00000000000..af1dffe059d
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraft.php
@@ -0,0 +1,27 @@
+
+ */
+final class RemoveDeliveryDraftBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $id;
+
+ /**
+ * @return null|string
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param ?string $id
+ * @return $this
+ */
+ public function withId(?string $id)
+ {
+ $this->id = $id;
+
+ return $this;
+ }
+
+
+ public function build(): RemoveDeliveryDraft
+ {
+ return new RemoveDeliveryDraftModel(
+ $this->id
+ );
+ }
+
+ public static function of(): RemoveDeliveryDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraftCollection.php
new file mode 100644
index 00000000000..6f232106b14
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method RemoveDeliveryDraft current()
+ * @method RemoveDeliveryDraft at($offset)
+ */
+class RemoveDeliveryDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert RemoveDeliveryDraft $value
+ * @psalm-param RemoveDeliveryDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return RemoveDeliveryDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof RemoveDeliveryDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?RemoveDeliveryDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?RemoveDeliveryDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var RemoveDeliveryDraft $data */
+ $data = RemoveDeliveryDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraftModel.php
new file mode 100644
index 00000000000..86761bbf5c0
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/RemoveDeliveryDraftModel.php
@@ -0,0 +1,62 @@
+id = $id;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getId()
+ {
+ if (is_null($this->id)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->id = (string) $data;
+ }
+
+ return $this->id;
+ }
+
+
+ /**
+ * @param ?string $id
+ */
+ public function setId(?string $id): void
+ {
+ $this->id = $id;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraft.php b/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraft.php
new file mode 100644
index 00000000000..f4a9d7b3419
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraft.php
@@ -0,0 +1,27 @@
+
+ */
+final class RemoveParcelFromDeliveryDraftBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $parcelId;
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ return $this->parcelId;
+ }
+
+ /**
+ * @param ?string $parcelId
+ * @return $this
+ */
+ public function withParcelId(?string $parcelId)
+ {
+ $this->parcelId = $parcelId;
+
+ return $this;
+ }
+
+
+ public function build(): RemoveParcelFromDeliveryDraft
+ {
+ return new RemoveParcelFromDeliveryDraftModel(
+ $this->parcelId
+ );
+ }
+
+ public static function of(): RemoveParcelFromDeliveryDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraftCollection.php
new file mode 100644
index 00000000000..ba541b4546f
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method RemoveParcelFromDeliveryDraft current()
+ * @method RemoveParcelFromDeliveryDraft at($offset)
+ */
+class RemoveParcelFromDeliveryDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert RemoveParcelFromDeliveryDraft $value
+ * @psalm-param RemoveParcelFromDeliveryDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return RemoveParcelFromDeliveryDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof RemoveParcelFromDeliveryDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?RemoveParcelFromDeliveryDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?RemoveParcelFromDeliveryDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var RemoveParcelFromDeliveryDraft $data */
+ $data = RemoveParcelFromDeliveryDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraftModel.php
new file mode 100644
index 00000000000..fd425ce4460
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/RemoveParcelFromDeliveryDraftModel.php
@@ -0,0 +1,62 @@
+parcelId = $parcelId;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getParcelId()
+ {
+ if (is_null($this->parcelId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_PARCEL_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->parcelId = (string) $data;
+ }
+
+ return $this->parcelId;
+ }
+
+
+ /**
+ * @param ?string $parcelId
+ */
+ public function setParcelId(?string $parcelId): void
+ {
+ $this->parcelId = $parcelId;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnInfo.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfo.php
new file mode 100644
index 00000000000..ed8c7834aab
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfo.php
@@ -0,0 +1,54 @@
+Maps to ReturnInfo.returnTrackingId
+ *
+ * @return null|string
+ */
+ public function getReturnTrackingId();
+
+ /**
+ * Maps to ReturnInfo.returnDate
+ *
+ * @return null|DateTimeImmutable
+ */
+ public function getReturnDate();
+
+ /**
+ * @param ?ReturnItemDraftCollection $items
+ */
+ public function setItems(?ReturnItemDraftCollection $items): void;
+
+ /**
+ * @param ?string $returnTrackingId
+ */
+ public function setReturnTrackingId(?string $returnTrackingId): void;
+
+ /**
+ * @param ?DateTimeImmutable $returnDate
+ */
+ public function setReturnDate(?DateTimeImmutable $returnDate): void;
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoBuilder.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoBuilder.php
new file mode 100644
index 00000000000..2f2346db79d
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoBuilder.php
@@ -0,0 +1,114 @@
+
+ */
+final class ReturnInfoBuilder implements Builder
+{
+ /**
+ * @var ?ReturnItemDraftCollection
+ */
+ private $items;
+
+ /**
+ * @var ?string
+ */
+ private $returnTrackingId;
+
+ /**
+ * @var ?DateTimeImmutable
+ */
+ private $returnDate;
+
+ /**
+ * @return null|ReturnItemDraftCollection
+ */
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ /**
+ * Maps to ReturnInfo.returnTrackingId
+ *
+ * @return null|string
+ */
+ public function getReturnTrackingId()
+ {
+ return $this->returnTrackingId;
+ }
+
+ /**
+ * Maps to ReturnInfo.returnDate
+ *
+ * @return null|DateTimeImmutable
+ */
+ public function getReturnDate()
+ {
+ return $this->returnDate;
+ }
+
+ /**
+ * @param ?ReturnItemDraftCollection $items
+ * @return $this
+ */
+ public function withItems(?ReturnItemDraftCollection $items)
+ {
+ $this->items = $items;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $returnTrackingId
+ * @return $this
+ */
+ public function withReturnTrackingId(?string $returnTrackingId)
+ {
+ $this->returnTrackingId = $returnTrackingId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DateTimeImmutable $returnDate
+ * @return $this
+ */
+ public function withReturnDate(?DateTimeImmutable $returnDate)
+ {
+ $this->returnDate = $returnDate;
+
+ return $this;
+ }
+
+
+ public function build(): ReturnInfo
+ {
+ return new ReturnInfoModel(
+ $this->items,
+ $this->returnTrackingId,
+ $this->returnDate
+ );
+ }
+
+ public static function of(): ReturnInfoBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoCollection.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoCollection.php
new file mode 100644
index 00000000000..12fad722848
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ReturnInfo current()
+ * @method ReturnInfo at($offset)
+ */
+class ReturnInfoCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert ReturnInfo $value
+ * @psalm-param ReturnInfo|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ReturnInfoCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ReturnInfo) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ReturnInfo
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ReturnInfo {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ReturnInfo $data */
+ $data = ReturnInfoModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoModel.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoModel.php
new file mode 100644
index 00000000000..89e3819e9ef
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnInfoModel.php
@@ -0,0 +1,145 @@
+items = $items;
+ $this->returnTrackingId = $returnTrackingId;
+ $this->returnDate = $returnDate;
+ }
+
+ /**
+ * @return null|ReturnItemDraftCollection
+ */
+ public function getItems()
+ {
+ if (is_null($this->items)) {
+ /** @psalm-var ?list $data */
+ $data = $this->raw(self::FIELD_ITEMS);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->items = ReturnItemDraftCollection::fromArray($data);
+ }
+
+ return $this->items;
+ }
+
+ /**
+ * Maps to ReturnInfo.returnTrackingId
+ *
+ * @return null|string
+ */
+ public function getReturnTrackingId()
+ {
+ if (is_null($this->returnTrackingId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_RETURN_TRACKING_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->returnTrackingId = (string) $data;
+ }
+
+ return $this->returnTrackingId;
+ }
+
+ /**
+ * Maps to ReturnInfo.returnDate
+ *
+ * @return null|DateTimeImmutable
+ */
+ public function getReturnDate()
+ {
+ if (is_null($this->returnDate)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_RETURN_DATE);
+ if (is_null($data)) {
+ return null;
+ }
+ $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
+ if (false === $data) {
+ return null;
+ }
+ $this->returnDate = $data;
+ }
+
+ return $this->returnDate;
+ }
+
+
+ /**
+ * @param ?ReturnItemDraftCollection $items
+ */
+ public function setItems(?ReturnItemDraftCollection $items): void
+ {
+ $this->items = $items;
+ }
+
+ /**
+ * @param ?string $returnTrackingId
+ */
+ public function setReturnTrackingId(?string $returnTrackingId): void
+ {
+ $this->returnTrackingId = $returnTrackingId;
+ }
+
+ /**
+ * @param ?DateTimeImmutable $returnDate
+ */
+ public function setReturnDate(?DateTimeImmutable $returnDate): void
+ {
+ $this->returnDate = $returnDate;
+ }
+
+
+ public function jsonSerialize()
+ {
+ $data = $this->toArray();
+ if (isset($data[ReturnInfo::FIELD_RETURN_DATE]) && $data[ReturnInfo::FIELD_RETURN_DATE] instanceof \DateTimeImmutable) {
+ $data[ReturnInfo::FIELD_RETURN_DATE] = $data[ReturnInfo::FIELD_RETURN_DATE]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
+ }
+ return (object) $data;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraft.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraft.php
new file mode 100644
index 00000000000..b5b49c03012
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraft.php
@@ -0,0 +1,73 @@
+Maps to ReturnItem.shipmentState
+ *
+ * @return null|string
+ */
+ public function getShipmentState();
+
+ /**
+ * @param ?float $quantity
+ */
+ public function setQuantity(?float $quantity): void;
+
+ /**
+ * @param ?string $lineItemId
+ */
+ public function setLineItemId(?string $lineItemId): void;
+
+ /**
+ * @param ?string $customLineItemId
+ */
+ public function setCustomLineItemId(?string $customLineItemId): void;
+
+ /**
+ * @param ?string $comment
+ */
+ public function setComment(?string $comment): void;
+
+ /**
+ * @param ?string $shipmentState
+ */
+ public function setShipmentState(?string $shipmentState): void;
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftBuilder.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftBuilder.php
new file mode 100644
index 00000000000..74be646fe38
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftBuilder.php
@@ -0,0 +1,161 @@
+
+ */
+final class ReturnItemDraftBuilder implements Builder
+{
+ /**
+ * @var ?float
+ */
+ private $quantity;
+
+ /**
+ * @var ?string
+ */
+ private $lineItemId;
+
+ /**
+ * @var ?string
+ */
+ private $customLineItemId;
+
+ /**
+ * @var ?string
+ */
+ private $comment;
+
+ /**
+ * @var ?string
+ */
+ private $shipmentState;
+
+ /**
+ * @return null|float
+ */
+ public function getQuantity()
+ {
+ return $this->quantity;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getLineItemId()
+ {
+ return $this->lineItemId;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getCustomLineItemId()
+ {
+ return $this->customLineItemId;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getComment()
+ {
+ return $this->comment;
+ }
+
+ /**
+ * Maps to ReturnItem.shipmentState
+ *
+ * @return null|string
+ */
+ public function getShipmentState()
+ {
+ return $this->shipmentState;
+ }
+
+ /**
+ * @param ?float $quantity
+ * @return $this
+ */
+ public function withQuantity(?float $quantity)
+ {
+ $this->quantity = $quantity;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $lineItemId
+ * @return $this
+ */
+ public function withLineItemId(?string $lineItemId)
+ {
+ $this->lineItemId = $lineItemId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $customLineItemId
+ * @return $this
+ */
+ public function withCustomLineItemId(?string $customLineItemId)
+ {
+ $this->customLineItemId = $customLineItemId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $comment
+ * @return $this
+ */
+ public function withComment(?string $comment)
+ {
+ $this->comment = $comment;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $shipmentState
+ * @return $this
+ */
+ public function withShipmentState(?string $shipmentState)
+ {
+ $this->shipmentState = $shipmentState;
+
+ return $this;
+ }
+
+
+ public function build(): ReturnItemDraft
+ {
+ return new ReturnItemDraftModel(
+ $this->quantity,
+ $this->lineItemId,
+ $this->customLineItemId,
+ $this->comment,
+ $this->shipmentState
+ );
+ }
+
+ public static function of(): ReturnItemDraftBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftCollection.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftCollection.php
new file mode 100644
index 00000000000..aa0fc485acd
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ReturnItemDraft current()
+ * @method ReturnItemDraft at($offset)
+ */
+class ReturnItemDraftCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert ReturnItemDraft $value
+ * @psalm-param ReturnItemDraft|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ReturnItemDraftCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ReturnItemDraft) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ReturnItemDraft
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ReturnItemDraft {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ReturnItemDraft $data */
+ $data = ReturnItemDraftModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftModel.php b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftModel.php
new file mode 100644
index 00000000000..88665dcd9e1
--- /dev/null
+++ b/lib/commercetools-import/src/Models/OrderPatches/ReturnItemDraftModel.php
@@ -0,0 +1,192 @@
+quantity = $quantity;
+ $this->lineItemId = $lineItemId;
+ $this->customLineItemId = $customLineItemId;
+ $this->comment = $comment;
+ $this->shipmentState = $shipmentState;
+ }
+
+ /**
+ * @return null|float
+ */
+ public function getQuantity()
+ {
+ if (is_null($this->quantity)) {
+ /** @psalm-var ?float $data */
+ $data = $this->raw(self::FIELD_QUANTITY);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->quantity = (float) $data;
+ }
+
+ return $this->quantity;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getLineItemId()
+ {
+ if (is_null($this->lineItemId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_LINE_ITEM_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->lineItemId = (string) $data;
+ }
+
+ return $this->lineItemId;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getCustomLineItemId()
+ {
+ if (is_null($this->customLineItemId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_CUSTOM_LINE_ITEM_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->customLineItemId = (string) $data;
+ }
+
+ return $this->customLineItemId;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getComment()
+ {
+ if (is_null($this->comment)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_COMMENT);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->comment = (string) $data;
+ }
+
+ return $this->comment;
+ }
+
+ /**
+ * Maps to ReturnItem.shipmentState
+ *
+ * @return null|string
+ */
+ public function getShipmentState()
+ {
+ if (is_null($this->shipmentState)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_SHIPMENT_STATE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->shipmentState = (string) $data;
+ }
+
+ return $this->shipmentState;
+ }
+
+
+ /**
+ * @param ?float $quantity
+ */
+ public function setQuantity(?float $quantity): void
+ {
+ $this->quantity = $quantity;
+ }
+
+ /**
+ * @param ?string $lineItemId
+ */
+ public function setLineItemId(?string $lineItemId): void
+ {
+ $this->lineItemId = $lineItemId;
+ }
+
+ /**
+ * @param ?string $customLineItemId
+ */
+ public function setCustomLineItemId(?string $customLineItemId): void
+ {
+ $this->customLineItemId = $customLineItemId;
+ }
+
+ /**
+ * @param ?string $comment
+ */
+ public function setComment(?string $comment): void
+ {
+ $this->comment = $comment;
+ }
+
+ /**
+ * @param ?string $shipmentState
+ */
+ public function setShipmentState(?string $shipmentState): void
+ {
+ $this->shipmentState = $shipmentState;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInput.php b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInput.php
new file mode 100644
index 00000000000..d191a285be4
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInput.php
@@ -0,0 +1,46 @@
+A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.
+ * {
+ * "de": "Hundefutter",
+ * "en": "dog food"
+ * }
+ *
+ *
+ * @return null|LocalizedString
+ */
+ public function getLabel();
+
+ /**
+ * @param ?string $key
+ */
+ public function setKey(?string $key): void;
+
+ /**
+ * @param ?LocalizedString $label
+ */
+ public function setLabel(?LocalizedString $label): void;
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputBuilder.php b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputBuilder.php
new file mode 100644
index 00000000000..e4d96527582
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputBuilder.php
@@ -0,0 +1,103 @@
+
+ */
+final class ClassificationShippingRateInputBuilder implements Builder
+{
+ /**
+ * @var ?string
+ */
+ private $key;
+
+ /**
+ * @var null|LocalizedString|LocalizedStringBuilder
+ */
+ private $label;
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ /**
+ * A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.
+ * {
+ * "de": "Hundefutter",
+ * "en": "dog food"
+ * }
+ *
+ *
+ * @return null|LocalizedString
+ */
+ public function getLabel()
+ {
+ return $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label;
+ }
+
+ /**
+ * @param ?string $key
+ * @return $this
+ */
+ public function withKey(?string $key)
+ {
+ $this->key = $key;
+
+ return $this;
+ }
+
+ /**
+ * @param ?LocalizedString $label
+ * @return $this
+ */
+ public function withLabel(?LocalizedString $label)
+ {
+ $this->label = $label;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withLabel() instead
+ * @return $this
+ */
+ public function withLabelBuilder(?LocalizedStringBuilder $label)
+ {
+ $this->label = $label;
+
+ return $this;
+ }
+
+ public function build(): ClassificationShippingRateInput
+ {
+ return new ClassificationShippingRateInputModel(
+ $this->key,
+ $this->label instanceof LocalizedStringBuilder ? $this->label->build() : $this->label
+ );
+ }
+
+ public static function of(): ClassificationShippingRateInputBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputCollection.php b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputCollection.php
new file mode 100644
index 00000000000..ac1d42ab682
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ClassificationShippingRateInput current()
+ * @method ClassificationShippingRateInput at($offset)
+ */
+class ClassificationShippingRateInputCollection extends ShippingRateInputCollection
+{
+ /**
+ * @psalm-assert ClassificationShippingRateInput $value
+ * @psalm-param ClassificationShippingRateInput|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ClassificationShippingRateInputCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ClassificationShippingRateInput) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ClassificationShippingRateInput
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ClassificationShippingRateInput {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ClassificationShippingRateInput $data */
+ $data = ClassificationShippingRateInputModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputModel.php b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputModel.php
new file mode 100644
index 00000000000..d80f0592902
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ClassificationShippingRateInputModel.php
@@ -0,0 +1,128 @@
+key = $key;
+ $this->label = $label;
+ $this->type = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getType()
+ {
+ if (is_null($this->type)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->type = (string) $data;
+ }
+
+ return $this->type;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getKey()
+ {
+ if (is_null($this->key)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_KEY);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->key = (string) $data;
+ }
+
+ return $this->key;
+ }
+
+ /**
+ * A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.
+ * {
+ * "de": "Hundefutter",
+ * "en": "dog food"
+ * }
+ *
+ *
+ * @return null|LocalizedString
+ */
+ public function getLabel()
+ {
+ if (is_null($this->label)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_LABEL);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->label = LocalizedStringModel::of($data);
+ }
+
+ return $this->label;
+ }
+
+
+ /**
+ * @param ?string $key
+ */
+ public function setKey(?string $key): void
+ {
+ $this->key = $key;
+ }
+
+ /**
+ * @param ?LocalizedString $label
+ */
+ public function setLabel(?LocalizedString $label): void
+ {
+ $this->label = $label;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/DiscountCodeInfo.php b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfo.php
new file mode 100644
index 00000000000..5a3620f80fc
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfo.php
@@ -0,0 +1,43 @@
+References a discount code by its key.
+ *
+ * @return null|DiscountCodeKeyReference
+ */
+ public function getDiscountCode();
+
+ /**
+ * Maps to DiscountCodeInfo.state
+ *
+ * @return null|string
+ */
+ public function getState();
+
+ /**
+ * @param ?DiscountCodeKeyReference $discountCode
+ */
+ public function setDiscountCode(?DiscountCodeKeyReference $discountCode): void;
+
+ /**
+ * @param ?string $state
+ */
+ public function setState(?string $state): void;
+}
diff --git a/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoBuilder.php b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoBuilder.php
new file mode 100644
index 00000000000..22d2d4c2ae0
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoBuilder.php
@@ -0,0 +1,100 @@
+
+ */
+final class DiscountCodeInfoBuilder implements Builder
+{
+ /**
+ * @var null|DiscountCodeKeyReference|DiscountCodeKeyReferenceBuilder
+ */
+ private $discountCode;
+
+ /**
+ * @var ?string
+ */
+ private $state;
+
+ /**
+ * References a discount code by its key.
+ *
+ * @return null|DiscountCodeKeyReference
+ */
+ public function getDiscountCode()
+ {
+ return $this->discountCode instanceof DiscountCodeKeyReferenceBuilder ? $this->discountCode->build() : $this->discountCode;
+ }
+
+ /**
+ * Maps to DiscountCodeInfo.state
+ *
+ * @return null|string
+ */
+ public function getState()
+ {
+ return $this->state;
+ }
+
+ /**
+ * @param ?DiscountCodeKeyReference $discountCode
+ * @return $this
+ */
+ public function withDiscountCode(?DiscountCodeKeyReference $discountCode)
+ {
+ $this->discountCode = $discountCode;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $state
+ * @return $this
+ */
+ public function withState(?string $state)
+ {
+ $this->state = $state;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withDiscountCode() instead
+ * @return $this
+ */
+ public function withDiscountCodeBuilder(?DiscountCodeKeyReferenceBuilder $discountCode)
+ {
+ $this->discountCode = $discountCode;
+
+ return $this;
+ }
+
+ public function build(): DiscountCodeInfo
+ {
+ return new DiscountCodeInfoModel(
+ $this->discountCode instanceof DiscountCodeKeyReferenceBuilder ? $this->discountCode->build() : $this->discountCode,
+ $this->state
+ );
+ }
+
+ public static function of(): DiscountCodeInfoBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoCollection.php b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoCollection.php
new file mode 100644
index 00000000000..c91a8c32e05
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoCollection.php
@@ -0,0 +1,55 @@
+
+ * @method DiscountCodeInfo current()
+ * @method DiscountCodeInfo at($offset)
+ */
+class DiscountCodeInfoCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert DiscountCodeInfo $value
+ * @psalm-param DiscountCodeInfo|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return DiscountCodeInfoCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof DiscountCodeInfo) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?DiscountCodeInfo
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?DiscountCodeInfo {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var DiscountCodeInfo $data */
+ $data = DiscountCodeInfoModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoModel.php b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoModel.php
new file mode 100644
index 00000000000..17d86f2b0d3
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/DiscountCodeInfoModel.php
@@ -0,0 +1,101 @@
+discountCode = $discountCode;
+ $this->state = $state;
+ }
+
+ /**
+ * References a discount code by its key.
+ *
+ * @return null|DiscountCodeKeyReference
+ */
+ public function getDiscountCode()
+ {
+ if (is_null($this->discountCode)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_DISCOUNT_CODE);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->discountCode = DiscountCodeKeyReferenceModel::of($data);
+ }
+
+ return $this->discountCode;
+ }
+
+ /**
+ * Maps to DiscountCodeInfo.state
+ *
+ * @return null|string
+ */
+ public function getState()
+ {
+ if (is_null($this->state)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_STATE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->state = (string) $data;
+ }
+
+ return $this->state;
+ }
+
+
+ /**
+ * @param ?DiscountCodeKeyReference $discountCode
+ */
+ public function setDiscountCode(?DiscountCodeKeyReference $discountCode): void
+ {
+ $this->discountCode = $discountCode;
+ }
+
+ /**
+ * @param ?string $state
+ */
+ public function setState(?string $state): void
+ {
+ $this->state = $state;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraft.php b/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraft.php
index dd6b7ee73ef..4fa00a09ce5 100644
--- a/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraft.php
+++ b/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraft.php
@@ -11,12 +11,12 @@
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use Commercetools\Import\Models\Common\ImageCollection;
-use Commercetools\Import\Models\Common\ProductKeyReference;
+use Commercetools\Import\Models\Common\ProductVariantKeyReference;
use Commercetools\Import\Models\Productvariants\AttributeCollection;
interface LineItemProductVariantImportDraft extends JsonObject
{
- public const FIELD_PRODUCT = 'product';
+ public const FIELD_PRODUCT_VARIANT = 'productVariant';
public const FIELD_SKU = 'sku';
public const FIELD_PRICES = 'prices';
public const FIELD_ATTRIBUTES = 'attributes';
@@ -25,9 +25,9 @@ interface LineItemProductVariantImportDraft extends JsonObject
/**
* Maps to ProductVariant.product
.
*
- * @return null|ProductKeyReference
+ * @return null|ProductVariantKeyReference
*/
- public function getProduct();
+ public function getProductVariant();
/**
* Maps to ProductVariantImportDraft.sku
.
@@ -58,9 +58,9 @@ public function getAttributes();
public function getImages();
/**
- * @param ?ProductKeyReference $product
+ * @param ?ProductVariantKeyReference $productVariant
*/
- public function setProduct(?ProductKeyReference $product): void;
+ public function setProductVariant(?ProductVariantKeyReference $productVariant): void;
/**
* @param ?string $sku
diff --git a/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftBuilder.php b/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftBuilder.php
index f01c4aa1da6..6422b7116b7 100644
--- a/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftBuilder.php
+++ b/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftBuilder.php
@@ -14,8 +14,8 @@
use Commercetools\Base\JsonObjectModel;
use Commercetools\Base\MapperFactory;
use Commercetools\Import\Models\Common\ImageCollection;
-use Commercetools\Import\Models\Common\ProductKeyReference;
-use Commercetools\Import\Models\Common\ProductKeyReferenceBuilder;
+use Commercetools\Import\Models\Common\ProductVariantKeyReference;
+use Commercetools\Import\Models\Common\ProductVariantKeyReferenceBuilder;
use Commercetools\Import\Models\Productvariants\AttributeCollection;
use stdClass;
@@ -25,9 +25,9 @@
final class LineItemProductVariantImportDraftBuilder implements Builder
{
/**
- * @var null|ProductKeyReference|ProductKeyReferenceBuilder
+ * @var null|ProductVariantKeyReference|ProductVariantKeyReferenceBuilder
*/
- private $product;
+ private $productVariant;
/**
* @var ?string
@@ -52,11 +52,11 @@ final class LineItemProductVariantImportDraftBuilder implements Builder
/**
* Maps to ProductVariant.product
.
*
- * @return null|ProductKeyReference
+ * @return null|ProductVariantKeyReference
*/
- public function getProduct()
+ public function getProductVariant()
{
- return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
+ return $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant;
}
/**
@@ -100,12 +100,12 @@ public function getImages()
}
/**
- * @param ?ProductKeyReference $product
+ * @param ?ProductVariantKeyReference $productVariant
* @return $this
*/
- public function withProduct(?ProductKeyReference $product)
+ public function withProductVariant(?ProductVariantKeyReference $productVariant)
{
- $this->product = $product;
+ $this->productVariant = $productVariant;
return $this;
}
@@ -155,12 +155,12 @@ public function withImages(?ImageCollection $images)
}
/**
- * @deprecated use withProduct() instead
+ * @deprecated use withProductVariant() instead
* @return $this
*/
- public function withProductBuilder(?ProductKeyReferenceBuilder $product)
+ public function withProductVariantBuilder(?ProductVariantKeyReferenceBuilder $productVariant)
{
- $this->product = $product;
+ $this->productVariant = $productVariant;
return $this;
}
@@ -168,7 +168,7 @@ public function withProductBuilder(?ProductKeyReferenceBuilder $product)
public function build(): LineItemProductVariantImportDraft
{
return new LineItemProductVariantImportDraftModel(
- $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product,
+ $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant,
$this->sku,
$this->prices,
$this->attributes,
diff --git a/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftModel.php b/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftModel.php
index 61a1e999493..dfe6f428c9b 100644
--- a/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftModel.php
+++ b/lib/commercetools-import/src/Models/Orders/LineItemProductVariantImportDraftModel.php
@@ -13,8 +13,8 @@
use Commercetools\Base\JsonObjectModel;
use Commercetools\Base\MapperFactory;
use Commercetools\Import\Models\Common\ImageCollection;
-use Commercetools\Import\Models\Common\ProductKeyReference;
-use Commercetools\Import\Models\Common\ProductKeyReferenceModel;
+use Commercetools\Import\Models\Common\ProductVariantKeyReference;
+use Commercetools\Import\Models\Common\ProductVariantKeyReferenceModel;
use Commercetools\Import\Models\Productvariants\AttributeCollection;
use stdClass;
@@ -24,9 +24,9 @@
final class LineItemProductVariantImportDraftModel extends JsonObjectModel implements LineItemProductVariantImportDraft
{
/**
- * @var ?ProductKeyReference
+ * @var ?ProductVariantKeyReference
*/
- protected $product;
+ protected $productVariant;
/**
* @var ?string
@@ -53,13 +53,13 @@ final class LineItemProductVariantImportDraftModel extends JsonObjectModel imple
* @psalm-suppress MissingParamType
*/
public function __construct(
- ?ProductKeyReference $product = null,
+ ?ProductVariantKeyReference $productVariant = null,
?string $sku = null,
?LineItemPriceCollection $prices = null,
?AttributeCollection $attributes = null,
?ImageCollection $images = null
) {
- $this->product = $product;
+ $this->productVariant = $productVariant;
$this->sku = $sku;
$this->prices = $prices;
$this->attributes = $attributes;
@@ -69,21 +69,21 @@ public function __construct(
/**
* Maps to ProductVariant.product
.
*
- * @return null|ProductKeyReference
+ * @return null|ProductVariantKeyReference
*/
- public function getProduct()
+ public function getProductVariant()
{
- if (is_null($this->product)) {
+ if (is_null($this->productVariant)) {
/** @psalm-var stdClass|array|null $data */
- $data = $this->raw(self::FIELD_PRODUCT);
+ $data = $this->raw(self::FIELD_PRODUCT_VARIANT);
if (is_null($data)) {
return null;
}
- $this->product = ProductKeyReferenceModel::of($data);
+ $this->productVariant = ProductVariantKeyReferenceModel::of($data);
}
- return $this->product;
+ return $this->productVariant;
}
/**
@@ -164,11 +164,11 @@ public function getImages()
/**
- * @param ?ProductKeyReference $product
+ * @param ?ProductVariantKeyReference $productVariant
*/
- public function setProduct(?ProductKeyReference $product): void
+ public function setProductVariant(?ProductVariantKeyReference $productVariant): void
{
- $this->product = $product;
+ $this->productVariant = $productVariant;
}
/**
diff --git a/lib/commercetools-import/src/Models/Orders/OrderImport.php b/lib/commercetools-import/src/Models/Orders/OrderImport.php
index 0287834a872..ff1e2e174f8 100644
--- a/lib/commercetools-import/src/Models/Orders/OrderImport.php
+++ b/lib/commercetools-import/src/Models/Orders/OrderImport.php
@@ -44,7 +44,7 @@ interface OrderImport extends JsonObject
public const FIELD_ITEM_SHIPPING_ADDRESSES = 'itemShippingAddresses';
/**
- * Maps to Order.orderNumber
. A string that identifies an Order. Must be unique across a Project. Once it is set, it cannot be changed.
+ * Maps to Order.orderNumber
, String that uniquely identifies an order. It should be unique across a project. Once it's set it cannot be changed.
*
* @return null|string
*/
diff --git a/lib/commercetools-import/src/Models/Orders/OrderImportBuilder.php b/lib/commercetools-import/src/Models/Orders/OrderImportBuilder.php
index 64498f43da3..da821cadef7 100644
--- a/lib/commercetools-import/src/Models/Orders/OrderImportBuilder.php
+++ b/lib/commercetools-import/src/Models/Orders/OrderImportBuilder.php
@@ -143,7 +143,7 @@ final class OrderImportBuilder implements Builder
private $itemShippingAddresses;
/**
- * Maps to Order.orderNumber
. A string that identifies an Order. Must be unique across a Project. Once it is set, it cannot be changed.
+ * Maps to Order.orderNumber
, String that uniquely identifies an order. It should be unique across a project. Once it's set it cannot be changed.
*
* @return null|string
*/
diff --git a/lib/commercetools-import/src/Models/Orders/OrderImportModel.php b/lib/commercetools-import/src/Models/Orders/OrderImportModel.php
index e3db79aaaff..967bee875f7 100644
--- a/lib/commercetools-import/src/Models/Orders/OrderImportModel.php
+++ b/lib/commercetools-import/src/Models/Orders/OrderImportModel.php
@@ -194,7 +194,7 @@ public function __construct(
}
/**
- * Maps to Order.orderNumber
. A string that identifies an Order. Must be unique across a Project. Once it is set, it cannot be changed.
+ * Maps to Order.orderNumber
, String that uniquely identifies an order. It should be unique across a project. Once it's set it cannot be changed.
*
* @return null|string
*/
diff --git a/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInput.php b/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInput.php
new file mode 100644
index 00000000000..14e061f4dce
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInput.php
@@ -0,0 +1,27 @@
+
+ */
+final class ScoreShippingRateInputBuilder implements Builder
+{
+ /**
+ * @var ?float
+ */
+ private $score;
+
+ /**
+ * @return null|float
+ */
+ public function getScore()
+ {
+ return $this->score;
+ }
+
+ /**
+ * @param ?float $score
+ * @return $this
+ */
+ public function withScore(?float $score)
+ {
+ $this->score = $score;
+
+ return $this;
+ }
+
+
+ public function build(): ScoreShippingRateInput
+ {
+ return new ScoreShippingRateInputModel(
+ $this->score
+ );
+ }
+
+ public static function of(): ScoreShippingRateInputBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInputCollection.php b/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInputCollection.php
new file mode 100644
index 00000000000..e28ced9ddc6
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInputCollection.php
@@ -0,0 +1,55 @@
+
+ * @method ScoreShippingRateInput current()
+ * @method ScoreShippingRateInput at($offset)
+ */
+class ScoreShippingRateInputCollection extends ShippingRateInputCollection
+{
+ /**
+ * @psalm-assert ScoreShippingRateInput $value
+ * @psalm-param ScoreShippingRateInput|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ScoreShippingRateInputCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ScoreShippingRateInput) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?ScoreShippingRateInput
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ScoreShippingRateInput {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var ScoreShippingRateInput $data */
+ $data = ScoreShippingRateInputModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInputModel.php b/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInputModel.php
new file mode 100644
index 00000000000..cdd408b7c6f
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ScoreShippingRateInputModel.php
@@ -0,0 +1,86 @@
+score = $score;
+ $this->type = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getType()
+ {
+ if (is_null($this->type)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->type = (string) $data;
+ }
+
+ return $this->type;
+ }
+
+ /**
+ * @return null|float
+ */
+ public function getScore()
+ {
+ if (is_null($this->score)) {
+ /** @psalm-var ?float $data */
+ $data = $this->raw(self::FIELD_SCORE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->score = (float) $data;
+ }
+
+ return $this->score;
+ }
+
+
+ /**
+ * @param ?float $score
+ */
+ public function setScore(?float $score): void
+ {
+ $this->score = $score;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ShippingRateInput.php b/lib/commercetools-import/src/Models/Orders/ShippingRateInput.php
new file mode 100644
index 00000000000..2217bb6c540
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ShippingRateInput.php
@@ -0,0 +1,23 @@
+
+ */
+final class ShippingRateInputBuilder implements Builder
+{
+ public function build(): ShippingRateInput
+ {
+ return new ShippingRateInputModel(
+ );
+ }
+
+ public static function of(): ShippingRateInputBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ShippingRateInputCollection.php b/lib/commercetools-import/src/Models/Orders/ShippingRateInputCollection.php
new file mode 100644
index 00000000000..7d917a18f83
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ShippingRateInputCollection.php
@@ -0,0 +1,58 @@
+
+ * @psalm-method T current()
+ * @psalm-method T at($offset)
+ * @method ShippingRateInput current()
+ * @method ShippingRateInput at($offset)
+ */
+class ShippingRateInputCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert T $value
+ * @psalm-param T|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return ShippingRateInputCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof ShippingRateInput) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?T
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?ShippingRateInput {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var T $data */
+ $data = ShippingRateInputModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/ShippingRateInputModel.php b/lib/commercetools-import/src/Models/Orders/ShippingRateInputModel.php
new file mode 100644
index 00000000000..aac57b67e51
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/ShippingRateInputModel.php
@@ -0,0 +1,92 @@
+ >
+ *
+ */
+ private static $discriminatorClasses = [
+ 'Classification' => ClassificationShippingRateInputModel::class,
+ 'Score' => ScoreShippingRateInputModel::class,
+ ];
+
+ /**
+ * @psalm-suppress MissingParamType
+ */
+ public function __construct(
+ ) {
+ $this->type = static::DISCRIMINATOR_VALUE;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getType()
+ {
+ if (is_null($this->type)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_TYPE);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->type = (string) $data;
+ }
+
+ return $this->type;
+ }
+
+
+
+
+
+ /**
+ * @psalm-param stdClass|array $value
+ * @psalm-return class-string
+ */
+ public static function resolveDiscriminatorClass($value): string
+ {
+ $fieldName = ShippingRateInput::DISCRIMINATOR_FIELD;
+ if (is_object($value) && isset($value->$fieldName)) {
+ /** @psalm-var string $discriminatorValue */
+ $discriminatorValue = $value->$fieldName;
+ if (isset(self::$discriminatorClasses[$discriminatorValue])) {
+ return self::$discriminatorClasses[$discriminatorValue];
+ }
+ }
+ if (is_array($value) && isset($value[$fieldName])) {
+ /** @psalm-var string $discriminatorValue */
+ $discriminatorValue = $value[$fieldName];
+ if (isset(self::$discriminatorClasses[$discriminatorValue])) {
+ return self::$discriminatorClasses[$discriminatorValue];
+ }
+ }
+
+ /** @psalm-var class-string */
+ $type = ShippingRateInputModel::class;
+ return $type;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/SyncInfo.php b/lib/commercetools-import/src/Models/Orders/SyncInfo.php
new file mode 100644
index 00000000000..3ded5f324ed
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/SyncInfo.php
@@ -0,0 +1,57 @@
+Maps to SyncInfo.channel
+ *
+ * @return null|ChannelKeyReference
+ */
+ public function getChannel();
+
+ /**
+ * Maps to SyncInfo.externalId
+ *
+ * @return null|string
+ */
+ public function getExternalId();
+
+ /**
+ * Maps to SyncInfo.syncedAt
+ *
+ * @return null|DateTimeImmutable
+ */
+ public function getSyncedAt();
+
+ /**
+ * @param ?ChannelKeyReference $channel
+ */
+ public function setChannel(?ChannelKeyReference $channel): void;
+
+ /**
+ * @param ?string $externalId
+ */
+ public function setExternalId(?string $externalId): void;
+
+ /**
+ * @param ?DateTimeImmutable $syncedAt
+ */
+ public function setSyncedAt(?DateTimeImmutable $syncedAt): void;
+}
diff --git a/lib/commercetools-import/src/Models/Orders/SyncInfoBuilder.php b/lib/commercetools-import/src/Models/Orders/SyncInfoBuilder.php
new file mode 100644
index 00000000000..f0e3f50a48e
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/SyncInfoBuilder.php
@@ -0,0 +1,128 @@
+
+ */
+final class SyncInfoBuilder implements Builder
+{
+ /**
+ * @var null|ChannelKeyReference|ChannelKeyReferenceBuilder
+ */
+ private $channel;
+
+ /**
+ * @var ?string
+ */
+ private $externalId;
+
+ /**
+ * @var ?DateTimeImmutable
+ */
+ private $syncedAt;
+
+ /**
+ * Maps to SyncInfo.channel
+ *
+ * @return null|ChannelKeyReference
+ */
+ public function getChannel()
+ {
+ return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
+ }
+
+ /**
+ * Maps to SyncInfo.externalId
+ *
+ * @return null|string
+ */
+ public function getExternalId()
+ {
+ return $this->externalId;
+ }
+
+ /**
+ * Maps to SyncInfo.syncedAt
+ *
+ * @return null|DateTimeImmutable
+ */
+ public function getSyncedAt()
+ {
+ return $this->syncedAt;
+ }
+
+ /**
+ * @param ?ChannelKeyReference $channel
+ * @return $this
+ */
+ public function withChannel(?ChannelKeyReference $channel)
+ {
+ $this->channel = $channel;
+
+ return $this;
+ }
+
+ /**
+ * @param ?string $externalId
+ * @return $this
+ */
+ public function withExternalId(?string $externalId)
+ {
+ $this->externalId = $externalId;
+
+ return $this;
+ }
+
+ /**
+ * @param ?DateTimeImmutable $syncedAt
+ * @return $this
+ */
+ public function withSyncedAt(?DateTimeImmutable $syncedAt)
+ {
+ $this->syncedAt = $syncedAt;
+
+ return $this;
+ }
+
+ /**
+ * @deprecated use withChannel() instead
+ * @return $this
+ */
+ public function withChannelBuilder(?ChannelKeyReferenceBuilder $channel)
+ {
+ $this->channel = $channel;
+
+ return $this;
+ }
+
+ public function build(): SyncInfo
+ {
+ return new SyncInfoModel(
+ $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
+ $this->externalId,
+ $this->syncedAt
+ );
+ }
+
+ public static function of(): SyncInfoBuilder
+ {
+ return new self();
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/SyncInfoCollection.php b/lib/commercetools-import/src/Models/Orders/SyncInfoCollection.php
new file mode 100644
index 00000000000..0d36c145687
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/SyncInfoCollection.php
@@ -0,0 +1,55 @@
+
+ * @method SyncInfo current()
+ * @method SyncInfo at($offset)
+ */
+class SyncInfoCollection extends MapperSequence
+{
+ /**
+ * @psalm-assert SyncInfo $value
+ * @psalm-param SyncInfo|stdClass $value
+ * @throws InvalidArgumentException
+ *
+ * @return SyncInfoCollection
+ */
+ public function add($value)
+ {
+ if (!$value instanceof SyncInfo) {
+ throw new InvalidArgumentException();
+ }
+ $this->store($value);
+
+ return $this;
+ }
+
+ /**
+ * @psalm-return callable(int):?SyncInfo
+ */
+ protected function mapper()
+ {
+ return function (int $index): ?SyncInfo {
+ $data = $this->get($index);
+ if ($data instanceof stdClass) {
+ /** @var SyncInfo $data */
+ $data = SyncInfoModel::of($data);
+ $this->set($data, $index);
+ }
+
+ return $data;
+ };
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Orders/SyncInfoModel.php b/lib/commercetools-import/src/Models/Orders/SyncInfoModel.php
new file mode 100644
index 00000000000..845aa673089
--- /dev/null
+++ b/lib/commercetools-import/src/Models/Orders/SyncInfoModel.php
@@ -0,0 +1,150 @@
+channel = $channel;
+ $this->externalId = $externalId;
+ $this->syncedAt = $syncedAt;
+ }
+
+ /**
+ * Maps to SyncInfo.channel
+ *
+ * @return null|ChannelKeyReference
+ */
+ public function getChannel()
+ {
+ if (is_null($this->channel)) {
+ /** @psalm-var stdClass|array|null $data */
+ $data = $this->raw(self::FIELD_CHANNEL);
+ if (is_null($data)) {
+ return null;
+ }
+
+ $this->channel = ChannelKeyReferenceModel::of($data);
+ }
+
+ return $this->channel;
+ }
+
+ /**
+ * Maps to SyncInfo.externalId
+ *
+ * @return null|string
+ */
+ public function getExternalId()
+ {
+ if (is_null($this->externalId)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_EXTERNAL_ID);
+ if (is_null($data)) {
+ return null;
+ }
+ $this->externalId = (string) $data;
+ }
+
+ return $this->externalId;
+ }
+
+ /**
+ * Maps to SyncInfo.syncedAt
+ *
+ * @return null|DateTimeImmutable
+ */
+ public function getSyncedAt()
+ {
+ if (is_null($this->syncedAt)) {
+ /** @psalm-var ?string $data */
+ $data = $this->raw(self::FIELD_SYNCED_AT);
+ if (is_null($data)) {
+ return null;
+ }
+ $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
+ if (false === $data) {
+ return null;
+ }
+ $this->syncedAt = $data;
+ }
+
+ return $this->syncedAt;
+ }
+
+
+ /**
+ * @param ?ChannelKeyReference $channel
+ */
+ public function setChannel(?ChannelKeyReference $channel): void
+ {
+ $this->channel = $channel;
+ }
+
+ /**
+ * @param ?string $externalId
+ */
+ public function setExternalId(?string $externalId): void
+ {
+ $this->externalId = $externalId;
+ }
+
+ /**
+ * @param ?DateTimeImmutable $syncedAt
+ */
+ public function setSyncedAt(?DateTimeImmutable $syncedAt): void
+ {
+ $this->syncedAt = $syncedAt;
+ }
+
+
+ public function jsonSerialize()
+ {
+ $data = $this->toArray();
+ if (isset($data[SyncInfo::FIELD_SYNCED_AT]) && $data[SyncInfo::FIELD_SYNCED_AT] instanceof \DateTimeImmutable) {
+ $data[SyncInfo::FIELD_SYNCED_AT] = $data[SyncInfo::FIELD_SYNCED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
+ }
+ return (object) $data;
+ }
+}
diff --git a/lib/commercetools-import/src/Models/Prices/PriceImport.php b/lib/commercetools-import/src/Models/Prices/PriceImport.php
index 398a61f5e27..e36c1ed1600 100644
--- a/lib/commercetools-import/src/Models/Prices/PriceImport.php
+++ b/lib/commercetools-import/src/Models/Prices/PriceImport.php
@@ -38,7 +38,6 @@ interface PriceImport extends ImportResource
/**
* Maps to Price.value
.
- * The Import API only supports centPrecision
prices.
*
* @return null|TypedMoney
*/
diff --git a/lib/commercetools-import/src/Models/Prices/PriceImportBuilder.php b/lib/commercetools-import/src/Models/Prices/PriceImportBuilder.php
index a776ada8ea0..3b6aa8162a7 100644
--- a/lib/commercetools-import/src/Models/Prices/PriceImportBuilder.php
+++ b/lib/commercetools-import/src/Models/Prices/PriceImportBuilder.php
@@ -113,7 +113,6 @@ public function getKey()
/**
* Maps to Price.value
.
- * The Import API only supports centPrecision
prices.
*
* @return null|TypedMoney
*/
diff --git a/lib/commercetools-import/src/Models/Prices/PriceImportModel.php b/lib/commercetools-import/src/Models/Prices/PriceImportModel.php
index d04bdbccf46..e87c1fe41f2 100644
--- a/lib/commercetools-import/src/Models/Prices/PriceImportModel.php
+++ b/lib/commercetools-import/src/Models/Prices/PriceImportModel.php
@@ -155,7 +155,6 @@ public function getKey()
/**
* Maps to Price.value
.
- * The Import API only supports centPrecision
prices.
*
* @return null|TypedMoney
*/
diff --git a/lib/commercetools-ml-tests/gen.properties b/lib/commercetools-ml-tests/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-ml-tests/gen.properties
+++ b/lib/commercetools-ml-tests/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837
diff --git a/lib/commercetools-ml/gen.properties b/lib/commercetools-ml/gen.properties
index e8572c987b1..9fb98242987 100644
--- a/lib/commercetools-ml/gen.properties
+++ b/lib/commercetools-ml/gen.properties
@@ -1 +1 @@
-hash=05a877634096132acd39e22070622c84161d8ff3
+hash=2ad3d6c01ca5cf8f6f2cee54062ae5755e592837