Skip to content

Commit 363e270

Browse files
author
Prabhu Ram
committed
MC-19254: Implement the schema changes
- chagning cart prices discount to total_item_discount
1 parent 0aac262 commit 363e270

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/CartItemPrices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
7070
'currency' => $currencyCode,
7171
'value' => $cartItem->getRowTotalInclTax(),
7272
],
73-
'discount' => [
73+
'total_item_discount' => [
7474
'currency' => $currencyCode,
7575
'value' => $cartItem->getDiscountAmount(),
7676
],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ type CartItemPrices {
333333
row_total: Money!
334334
row_total_including_tax: Money!
335335
discounts: [Discount] @doc(description:"An array of discounts to be applied to the cart item")
336-
discount: Money @doc(description:"The total of all discounts applied to the item")
336+
total_item_discount: Money @doc(description:"The total of all discounts applied to the item")
337337
}
338338

339339
type SelectedCustomizableOption {

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CartPromotionsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private function assertLineItemDiscountPrices($response, $productsInCart, $qty,
8888
'prices' => [
8989
'row_total' => ['value' => $productsInCart[$itemIndex]->getSpecialPrice()*$qty],
9090
'row_total_including_tax' => ['value' => $productsInCart[$itemIndex]->getSpecialPrice()*$qty],
91-
'discount' => ['value' => $productsInCart[$itemIndex]->getSpecialPrice()*$qty*0.5],
91+
'total_item_discount' => ['value' => $productsInCart[$itemIndex]->getSpecialPrice()*$qty*0.5],
9292
'discounts' => [
9393
0 =>[
9494
'amount' =>
@@ -169,7 +169,7 @@ public function testCartPromotionsMultipleCartRules()
169169

170170
//removing the elements from the response so that the rest of the response values can be compared
171171
unset($productsInResponse[$itemIndex][0]['prices']['discounts']);
172-
unset($productsInResponse[$itemIndex][0]['prices']['discount']);
172+
unset($productsInResponse[$itemIndex][0]['prices']['total_item_discount']);
173173
$this->assertResponseFields(
174174
$productsInResponse[$itemIndex][0],
175175
[
@@ -253,7 +253,7 @@ public function testCartPromotionsSingleCartRulesWithTaxes()
253253
// row_total including tax is the price + price * tax rate
254254
'row_total_including_tax' => ['value' => $rowTotalIncludingTax],
255255
// discount from cart rule after tax is applied : 50% of row_total_including_tax
256-
'discount' => ['value' => round($rowTotalIncludingTax/2, 2)],
256+
'total_item_discount' => ['value' => round($rowTotalIncludingTax/2, 2)],
257257
'discounts' => [
258258
0 =>[
259259
'amount' =>
@@ -285,7 +285,7 @@ private function getCartItemPricesQuery(string $cartId): string
285285
row_total_including_tax{
286286
value
287287
}
288-
discount{value}
288+
total_item_discount{value}
289289
discounts{
290290
amount{value}
291291
label

0 commit comments

Comments
 (0)