Skip to content

Commit 7263656

Browse files
authored
added type property to Product and ProductBatchModel
2 parents af8a793 + 37e9ca0 commit 7263656

File tree

6 files changed

+66
-0
lines changed

6 files changed

+66
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/**
4+
* PHP 7.3
5+
*
6+
* @category PaymentInvoiceType
7+
* @package RetailCrm\Api\Enum\Payments
8+
*/
9+
10+
namespace RetailCrm\Api\Enum\Payments;
11+
12+
/**
13+
* Class PaymentInvoiceType
14+
*
15+
* @category PaymentInvoiceType
16+
* @package RetailCrm\Api\Enum\Payments
17+
*/
18+
final class PaymentObjectType
19+
{
20+
public const COMMODITY = 'commodity';
21+
public const SERVICE = 'service';
22+
public const PAYMENT = 'payment';
23+
}

src/Enum/Product/ProductType.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/**
4+
* PHP version 7.3
5+
*
6+
* @category CallEventType
7+
* @package RetailCrm\Api\Enum\Telephony
8+
*/
9+
10+
namespace RetailCrm\Api\Enum\Product;
11+
12+
/**
13+
* Class CallEventType
14+
*
15+
* @category CallEventType
16+
* @package RetailCrm\Api\Enum\Telephony
17+
*/
18+
final class ProductType
19+
{
20+
public const PRODUCT = 'product';
21+
public const SERVICE = 'service';
22+
}

src/Model/Entity/Store/Product.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,12 @@ class Product
187187
* @JMS\SerializedName("updatedAt")
188188
*/
189189
public $updatedAt;
190+
191+
/**
192+
* @var string
193+
*
194+
* @JMS\Type("string")
195+
* @JMS\SerializedName("type")
196+
*/
197+
public $type;
190198
}

src/Model/Entity/Store/ProductBatchBase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,12 @@ abstract class ProductBatchBase
130130
* @JMS\SerializedName("catalogId")
131131
*/
132132
public $catalogId;
133+
134+
/**
135+
* @var string
136+
*
137+
* @JMS\Type("string")
138+
* @JMS\SerializedName("type")
139+
*/
140+
public $type;
133141
}

src/ResourceGroup/Store.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ public function productBatchEdit(ProductBatchEditRequest $request): ProductBatch
629629
* use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
630630
* use RetailCrm\Api\Factory\SimpleClientFactory;
631631
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
632+
* use RetailCrm\Api\Enum\Product\ProductType;
632633
*
633634
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
634635
*
@@ -646,6 +647,7 @@ public function productBatchEdit(ProductBatchEditRequest $request): ProductBatch
646647
* $productInput->popular = true;
647648
* $productInput->recommended = true;
648649
* $productInput->stock = true;
650+
* $productInput->type = ProductType::PRODUCT;
649651
* $productEditGroupInput = new ProductEditGroupInput();
650652
* $productEditGroupInput->externalId = 'testExternalId';
651653
* $productEditGroupInput->id = 10;

tests/src/ResourceGroup/StoreTest.php

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

1212
use RetailCrm\Api\Component\Transformer\DateTimeTransformer;
1313
use RetailCrm\Api\Enum\NumericBoolean;
14+
use RetailCrm\Api\Enum\Product\ProductType;
1415
use RetailCrm\Api\Enum\RequestMethod;
1516
use RetailCrm\Api\Model\Entity\Store\Inventory;
1617
use RetailCrm\Api\Model\Entity\Store\Offer;
@@ -375,6 +376,7 @@ public function testProducts(): void
375376
"maxPrice": 624,
376377
"id": 828272,
377378
"article": "38311",
379+
"type": "product",
378380
"name": "Test Product",
379381
"url": "https://example.com",
380382
"imageUrl": "https://example.com/image.jpg",
@@ -699,6 +701,7 @@ public function testProductBatchCreate(): void
699701
$productInput->popular = true;
700702
$productInput->recommended = true;
701703
$productInput->stock = true;
704+
$productInput->type = ProductType::PRODUCT;
702705

703706
$productEditGroupInput = new ProductEditGroupInput();
704707
$productEditGroupInput->id = 9717;

0 commit comments

Comments
 (0)