Skip to content

Commit

Permalink
added type property to Product and ProductBatchModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Neur0toxine authored Jan 18, 2024
2 parents af8a793 + 37e9ca0 commit 7263656
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Enum/Payments/PaymentObjectType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* PHP 7.3
*
* @category PaymentInvoiceType
* @package RetailCrm\Api\Enum\Payments
*/

namespace RetailCrm\Api\Enum\Payments;

/**
* Class PaymentInvoiceType
*
* @category PaymentInvoiceType
* @package RetailCrm\Api\Enum\Payments
*/
final class PaymentObjectType
{
public const COMMODITY = 'commodity';
public const SERVICE = 'service';
public const PAYMENT = 'payment';
}
22 changes: 22 additions & 0 deletions src/Enum/Product/ProductType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* PHP version 7.3
*
* @category CallEventType
* @package RetailCrm\Api\Enum\Telephony
*/

namespace RetailCrm\Api\Enum\Product;

/**
* Class CallEventType
*
* @category CallEventType
* @package RetailCrm\Api\Enum\Telephony
*/
final class ProductType
{
public const PRODUCT = 'product';
public const SERVICE = 'service';
}
8 changes: 8 additions & 0 deletions src/Model/Entity/Store/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,12 @@ class Product
* @JMS\SerializedName("updatedAt")
*/
public $updatedAt;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("type")
*/
public $type;
}
8 changes: 8 additions & 0 deletions src/Model/Entity/Store/ProductBatchBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,12 @@ abstract class ProductBatchBase
* @JMS\SerializedName("catalogId")
*/
public $catalogId;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("type")
*/
public $type;
}
2 changes: 2 additions & 0 deletions src/ResourceGroup/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ public function productBatchEdit(ProductBatchEditRequest $request): ProductBatch
* use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Enum\Product\ProductType;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
Expand All @@ -646,6 +647,7 @@ public function productBatchEdit(ProductBatchEditRequest $request): ProductBatch
* $productInput->popular = true;
* $productInput->recommended = true;
* $productInput->stock = true;
* $productInput->type = ProductType::PRODUCT;
* $productEditGroupInput = new ProductEditGroupInput();
* $productEditGroupInput->externalId = 'testExternalId';
* $productEditGroupInput->id = 10;
Expand Down
3 changes: 3 additions & 0 deletions tests/src/ResourceGroup/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use RetailCrm\Api\Component\Transformer\DateTimeTransformer;
use RetailCrm\Api\Enum\NumericBoolean;
use RetailCrm\Api\Enum\Product\ProductType;
use RetailCrm\Api\Enum\RequestMethod;
use RetailCrm\Api\Model\Entity\Store\Inventory;
use RetailCrm\Api\Model\Entity\Store\Offer;
Expand Down Expand Up @@ -375,6 +376,7 @@ public function testProducts(): void
"maxPrice": 624,
"id": 828272,
"article": "38311",
"type": "product",
"name": "Test Product",
"url": "https://example.com",
"imageUrl": "https://example.com/image.jpg",
Expand Down Expand Up @@ -699,6 +701,7 @@ public function testProductBatchCreate(): void
$productInput->popular = true;
$productInput->recommended = true;
$productInput->stock = true;
$productInput->type = ProductType::PRODUCT;

$productEditGroupInput = new ProductEditGroupInput();
$productEditGroupInput->id = 9717;
Expand Down

0 comments on commit 7263656

Please sign in to comment.