Skip to content

Commit be994fd

Browse files
committed
MC-19676: Refactored product tier prices
1 parent c47be6a commit be994fd

File tree

4 files changed

+31
-56
lines changed

4 files changed

+31
-56
lines changed

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ interface ProductLinksInterface @typeResolver(class: "Magento\\CatalogGraphQl\\M
5858
position: Int @doc(description: "The position within the list of product links.")
5959
}
6060

61-
type ProductTierPrices @doc(description: "The ProductTierPrices object defines a tier price, which is a quantity discount offered to a specific customer group.") {
62-
customer_group_id: String @doc(description: "The ID of the customer group.")
63-
qty: Float @doc(description: "The number of items that must be purchased to qualify for tier pricing.")
64-
value: Float @doc(description: "The price of the fixed price item.")
65-
percentage_value: Float @doc(description: "The percentage discount of the item.")
66-
website_id: Float @doc(description: "The ID assigned to the website.")
67-
}
6861

6962
interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes.") {
7063
id: Int @doc(description: "The ID number assigned to the product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\EntityIdToId")
@@ -93,7 +86,6 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
9386
websites: [Website] @doc(description: "An array of websites in which the product is available.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Websites")
9487
product_links: [ProductLinksInterface] @doc(description: "An array of ProductLinks objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductLinks")
9588
media_gallery_entries: [MediaGalleryEntry] @deprecated(reason: "Use product's `media_gallery` instead") @doc(description: "An array of MediaGalleryEntry objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGalleryEntries")
96-
tier_prices: [ProductTierPrices] @doc(description: "An array of ProductTierPrices objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\TierPrices")
9789
price: ProductPrices @doc(description: "A ProductPrices object, indicating the price of an item.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Price")
9890
gift_message_available: String @doc(description: "Indicates whether a gift message is available.")
9991
manufacturer: Int @doc(description: "A number representing the product's manufacturer.")

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"magento/module-captcha": "*",
124124
"magento/module-cardinal-commerce": "*",
125125
"magento/module-catalog": "*",
126+
"magento/module-catalog-customer-graph-ql": "*",
126127
"magento/module-catalog-analytics": "*",
127128
"magento/module-catalog-import-export": "*",
128129
"magento/module-catalog-inventory": "*",

composer.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ public function testQueryAllFieldsSimpleProduct()
282282
$this->assertBaseFields($product, $response['products']['items'][0]);
283283
$this->assertEavAttributes($product, $response['products']['items'][0]);
284284
$this->assertOptions($product, $response['products']['items'][0]);
285-
$this->assertTierPrices($product, $response['products']['items'][0]);
286285
$this->assertArrayHasKey('websites', $response['products']['items'][0]);
287286
$this->assertWebsites($product, $response['products']['items'][0]['websites']);
288287
self::assertEquals(
@@ -723,24 +722,7 @@ private function assertCustomAttribute($actualResponse)
723722
$customAttribute = null;
724723
$this->assertEquals($customAttribute, $actualResponse['attribute_code_custom']);
725724
}
726-
727-
/**
728-
* @param ProductInterface $product
729-
* @param $actualResponse
730-
*/
731-
private function assertTierPrices($product, $actualResponse)
732-
{
733-
$tierPrices = $product->getTierPrices();
734-
$this->assertNotEmpty($actualResponse['tier_prices'], "Precondition failed: 'tier_prices' must not be empty");
735-
foreach ($actualResponse['tier_prices'] as $tierPriceIndex => $tierPriceArray) {
736-
foreach ($tierPriceArray as $key => $value) {
737-
/** @var \Magento\Catalog\Model\Product\TierPrice $tierPrice */
738-
$tierPrice = $tierPrices[$tierPriceIndex];
739-
$this->assertEquals($value, $tierPrice->getData($key));
740-
}
741-
}
742-
}
743-
725+
744726
/**
745727
* @param ProductInterface $product
746728
* @param $actualResponse

0 commit comments

Comments
 (0)