Skip to content

Commit 9658785

Browse files
committed
MC-20636: Order Details : Order Details by Order Number
- add base64 encode - fix static
1 parent 30383c3 commit 9658785

File tree

7 files changed

+32
-25
lines changed

7 files changed

+32
-25
lines changed

app/code/Magento/SalesGraphQl/Model/InvoiceItemInterfaceTypeResolverComposite.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ public function __construct(array $productTypeNameResolvers = [])
2929
}
3030

3131
/**
32-
* @inheritdoc
32+
* Resolve item type of an invoice through composite resolvers
33+
*
34+
* @param array $data
35+
* @return string
3336
* @throws GraphQlInputException
3437
*/
3538
public function resolveType(array $data): string

app/code/Magento/SalesGraphQl/Model/OrderItemInterfaceTypeResolverComposite.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ public function __construct(array $productTypeNameResolvers = [])
2929
}
3030

3131
/**
32-
* {@inheritdoc}
32+
* Resolve item type of an order through composite resolvers
33+
*
34+
* @param array $data
35+
* @return string
3336
* @throws GraphQlInputException
3437
*/
3538
public function resolveType(array $data) : string

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function resolve(
7777
$orders[] = [
7878
'created_at' => $order['created_at'],
7979
'grand_total' => $order['grand_total'],
80-
'id' => $order['entity_id'],
80+
'id' => base64_encode($order['entity_id']),
8181
'increment_id' => $order['increment_id'],
8282
'number' => $order['increment_id'],
8383
'order_date' => $order['created_at'],

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function resolve(
4141
$index = $key;
4242
$appliedTaxType = $appliedTaxForItem->getType();
4343
$taxLineItems = $appliedTaxForItem->getAppliedTaxes();
44-
foreach ($taxLineItems as $new => $taxLineItem) {
44+
foreach ($taxLineItems as $taxLineItem) {
4545
$allAppliedTaxesForItemsData[$key][$index]['title'] = $taxLineItem->getDataByKey('title');
4646
$allAppliedTaxesForItemsData[$key][$index]['percent'] = $taxLineItem->getDataByKey('percent');
4747
$allAppliedTaxesForItemsData[$key][$index]['amount'] = $taxLineItem->getDataByKey('amount');
@@ -136,7 +136,7 @@ private function getAppliedTaxesDetails(Order $order, array $appliedTaxesArray):
136136
if (empty($appliedTaxesArray)) {
137137
$taxes [] = [];
138138
} else {
139-
foreach ($appliedTaxesArray as $key => $appliedTaxes) {
139+
foreach ($appliedTaxesArray as $key => $appliedTaxes) {
140140
if (empty($appliedTaxes[$key])) {
141141
$taxes [] = [
142142
'title' => $appliedTaxes[$key]['title'] ?? " ",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function resolve(
5555
/** @var Order $order */
5656
foreach ($orders as $order) {
5757
$items[] = [
58-
'id' => base64_encode($order->getId()),
58+
'id' => $order->getId(),
5959
'increment_id' => $order->getIncrementId(),
6060
'order_number' => $order->getIncrementId(),
6161
'created_at' => $order->getCreatedAt(),

app/code/Magento/SalesGraphQl/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"magento/module-sales": "*",
99
"magento/module-store": "*",
1010
"magento/module-catalog": "*",
11-
"magento/module-shipping": "*",
1211
"magento/module-graph-ql": "*"
1312
},
1413
"suggest": {

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ public function testGetMatchingOrdersForLowerQueryLength()
462462
/**
463463
* @magentoApiDataFixture Magento/Customer/_files/customer.php
464464
* @magentoApiDataFixture Magento/Sales/_files/orders_with_customer.php
465+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
465466
*/
466467
public function testGetMultipleCustomerOrdersQueryWithDefaultPagination()
467468
{
@@ -816,7 +817,8 @@ public function testGetCustomerOrdersTwoStoreViewQuery(string $orderNumber, stri
816817
$query,
817818
[],
818819
'',
819-
array_merge($this->customerAuthenticationHeader->execute(
820+
array_merge(
821+
$this->customerAuthenticationHeader->execute(
820822
$currentEmail, $currentPassword),
821823
['Store' => $store]
822824
)
@@ -924,24 +926,23 @@ private function assertTotalsWithTaxesAndDiscountsOnShippingAndTotal(array $cust
924926
$this->assertCount(2, $customerOrderItem['total']['taxes']);
925927
$expectedProductAndShippingTaxes =
926928
[
927-
[
929+
[
928930
'amount' => [
929-
'value' => 2.7,
930-
'currency' => 'USD'
931-
],
932-
'title' => 'US-TEST-*-Rate-1',
933-
'rate' => 7.5
934-
],
935-
[
936-
'amount' => [
937-
'value' => 1.35,
938-
'currency' => 'USD'
931+
'value' => 2.7,
932+
'currency' => 'USD',
933+
],
934+
'title' => 'US-TEST-*-Rate-1',
935+
'rate' => 7.5,
939936
],
940-
941-
'title' => 'US-TEST-*-Rate-1',
942-
'rate' => 7.5
943-
]
944-
];
937+
[
938+
'amount' => [
939+
'value' => 1.35,
940+
'currency' => 'USD'
941+
],
942+
'title' => 'US-TEST-*-Rate-1',
943+
'rate' => 7.5,
944+
]
945+
];
945946
$this->assertEquals($expectedProductAndShippingTaxes, $customerOrderItem['total']['taxes']);
946947
$this->assertEquals(
947948
21.5,
@@ -1377,7 +1378,8 @@ private function setPaymentMethod(string $cartId, array $method): void
13771378
$currentEmail = '[email protected]';
13781379
$currentPassword = 'password';
13791380
$this->graphQlMutation(
1380-
$query, [],
1381+
$query,
1382+
[],
13811383
'',
13821384
$this->customerAuthenticationHeader->execute($currentEmail, $currentPassword)
13831385
);

0 commit comments

Comments
 (0)