Skip to content

Commit 60c3b6f

Browse files
committed
LYNX-699 Review feedback fixed
1 parent c136579 commit 60c3b6f

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

app/code/Magento/SalesGraphQl/Model/Resolver/OrderTotal.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,14 @@ public function resolve(
8989
*/
9090
private function getAllAppliedTaxesOnOrders(OrderInterface $order): array
9191
{
92-
$orderTaxDetails = $this->orderTaxManagement->getOrderTaxDetails($order->getEntityId());
93-
$appliedTaxes = $orderTaxDetails->getAppliedTaxes();
94-
$allAppliedTaxOnOrders = [];
95-
foreach ($appliedTaxes as $taxIndex => $appliedTaxesData) {
96-
$allAppliedTaxOnOrders[$taxIndex] = [
92+
return array_map(
93+
fn($appliedTaxesData) => [
9794
'title' => $appliedTaxesData->getDataByKey('title'),
9895
'percent' => $appliedTaxesData->getDataByKey('percent'),
9996
'amount' => $appliedTaxesData->getDataByKey('amount'),
100-
];
101-
}
102-
103-
return $allAppliedTaxOnOrders;
97+
],
98+
$this->orderTaxManagement->getOrderTaxDetails($order->getEntityId())->getAppliedTaxes()
99+
);
104100
}
105101

106102
/**

dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/PlaceOrderTaxTitleTest.php

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,47 @@ protected function setUp(): void
8383
public function testTaxTitleOnPlaceOrder(): void
8484
{
8585
$maskedQuoteId = $this->fixtures->get('quoteIdMask')->getMaskedId();
86-
$headerMap = $this->getCustomerAuthHeaders($this->fixtures->get('customer')->getEmail());
86+
$customerAuthHeaders = $this->getCustomerAuthHeaders($this->fixtures->get('customer')->getEmail());
8787

8888
//set shipping address to cart (save_in_address_book => true)
89-
$this->graphQlMutation($this->getSetShippingAddressOnCartMutation($maskedQuoteId), [], '', $headerMap);
89+
$this->graphQlMutation(
90+
$this->getSetShippingAddressOnCartMutation($maskedQuoteId),
91+
[],
92+
'',
93+
$customerAuthHeaders
94+
);
9095

9196
//set billing address to cart same as shipping
92-
$this->graphQlMutation($this->getBillingAddressMutationSameAsShipping($maskedQuoteId), [], '', $headerMap);
97+
$this->graphQlMutation(
98+
$this->getBillingAddressMutationSameAsShipping($maskedQuoteId),
99+
[],
100+
'',
101+
$customerAuthHeaders
102+
);
93103

94104
//set shipping method on cart
95-
$this->graphQlMutation($this->getShippingMethodMutation($maskedQuoteId), [], '', $headerMap);
105+
$this->graphQlMutation(
106+
$this->getShippingMethodMutation($maskedQuoteId),
107+
[],
108+
'',
109+
$customerAuthHeaders
110+
);
96111

97112
//set payment method on cart
98-
$this->graphQlMutation($this->getPaymentMethodMutation($maskedQuoteId), [], '', $headerMap);
113+
$this->graphQlMutation(
114+
$this->getPaymentMethodMutation($maskedQuoteId),
115+
[],
116+
'',
117+
$customerAuthHeaders
118+
);
99119

100120
//place order
101-
$orderResponse = $this->graphQlMutation($this->getPlaceOrderMutation($maskedQuoteId), [], '', $headerMap);
121+
$orderResponse = $this->graphQlMutation(
122+
$this->getPlaceOrderMutation($maskedQuoteId),
123+
[],
124+
'',
125+
$customerAuthHeaders
126+
);
102127

103128
//assert tax title
104129
self::assertNotNull($orderResponse['placeOrder']['orderV2']['total']['taxes'][0]['title']);

0 commit comments

Comments
 (0)