From 2310b3b82558e07d5340eb9007c215dec259c2f9 Mon Sep 17 00:00:00 2001 From: angelina pehova Date: Tue, 16 Jan 2024 11:14:57 +0300 Subject: [PATCH 1/2] added type var to Product and ProductBatchModel --- src/Enum/Payments/PaymentObjectType.php | 23 +++++++++++++++++++++ src/Enum/Product/ProductType.php | 22 ++++++++++++++++++++ src/Model/Entity/Store/Product.php | 8 +++++++ src/Model/Entity/Store/ProductBatchBase.php | 8 +++++++ src/ResourceGroup/Store.php | 1 + tests/src/ResourceGroup/StoreTest.php | 2 ++ 6 files changed, 64 insertions(+) create mode 100644 src/Enum/Payments/PaymentObjectType.php create mode 100644 src/Enum/Product/ProductType.php diff --git a/src/Enum/Payments/PaymentObjectType.php b/src/Enum/Payments/PaymentObjectType.php new file mode 100644 index 0000000..e61fcfc --- /dev/null +++ b/src/Enum/Payments/PaymentObjectType.php @@ -0,0 +1,23 @@ +popular = true; * $productInput->recommended = true; * $productInput->stock = true; + * $productInput->type = 'product'; * $productEditGroupInput = new ProductEditGroupInput(); * $productEditGroupInput->externalId = 'testExternalId'; * $productEditGroupInput->id = 10; diff --git a/tests/src/ResourceGroup/StoreTest.php b/tests/src/ResourceGroup/StoreTest.php index a77ed4b..ee1aba1 100644 --- a/tests/src/ResourceGroup/StoreTest.php +++ b/tests/src/ResourceGroup/StoreTest.php @@ -375,6 +375,7 @@ EOF; "maxPrice": 624, "id": 828272, "article": "38311", + "type": "product", "name": "Test Product", "url": "https://example.com", "imageUrl": "https://example.com/image.jpg", @@ -699,6 +700,7 @@ EOF; $productInput->popular = true; $productInput->recommended = true; $productInput->stock = true; + $productInput->type = 'product'; $productEditGroupInput = new ProductEditGroupInput(); $productEditGroupInput->id = 9717; From 37e9ca0110754331b2a2e9f658e4d7f30218f840 Mon Sep 17 00:00:00 2001 From: angelina pehova Date: Thu, 18 Jan 2024 10:06:52 +0300 Subject: [PATCH 2/2] type fix in Store and StoreTest --- src/ResourceGroup/Store.php | 3 ++- tests/src/ResourceGroup/StoreTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ResourceGroup/Store.php b/src/ResourceGroup/Store.php index e77f317..0f7e4d5 100644 --- a/src/ResourceGroup/Store.php +++ b/src/ResourceGroup/Store.php @@ -629,6 +629,7 @@ class Store extends AbstractApiResourceGroup * 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'); * @@ -646,7 +647,7 @@ class Store extends AbstractApiResourceGroup * $productInput->popular = true; * $productInput->recommended = true; * $productInput->stock = true; - * $productInput->type = 'product'; + * $productInput->type = ProductType::PRODUCT; * $productEditGroupInput = new ProductEditGroupInput(); * $productEditGroupInput->externalId = 'testExternalId'; * $productEditGroupInput->id = 10; diff --git a/tests/src/ResourceGroup/StoreTest.php b/tests/src/ResourceGroup/StoreTest.php index ee1aba1..82b8dca 100644 --- a/tests/src/ResourceGroup/StoreTest.php +++ b/tests/src/ResourceGroup/StoreTest.php @@ -11,6 +11,7 @@ namespace RetailCrm\Tests\ResourceGroup; 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; @@ -700,7 +701,7 @@ EOF; $productInput->popular = true; $productInput->recommended = true; $productInput->stock = true; - $productInput->type = 'product'; + $productInput->type = ProductType::PRODUCT; $productEditGroupInput = new ProductEditGroupInput(); $productEditGroupInput->id = 9717;