Skip to content

Commit 8282c5c

Browse files
committed
MC-20636: Order Details : Order Details by Order Number
- fix static
1 parent 10020ad commit 8282c5c

File tree

14 files changed

+147
-70
lines changed

14 files changed

+147
-70
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
1212

1313
/**
14-
* @inheritdoc
14+
* @inheritDoc
1515
*/
1616
class InvoiceItemInterfaceTypeResolverComposite implements TypeResolverInterface
1717
{
@@ -29,10 +29,10 @@ public function __construct(array $productTypeNameResolvers = [])
2929
}
3030

3131
/**
32-
* {@inheritdoc}
32+
* @inheritdoc
3333
* @throws GraphQlInputException
3434
*/
35-
public function resolveType(array $data) : string
35+
public function resolveType(array $data): string
3636
{
3737
$resolvedType = null;
3838

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CustomerOrders implements ResolverInterface
3030
private $searchQuery;
3131

3232
/**
33-
* @param SearchQuery $orderRepository
33+
* @param SearchQuery $searchQuery
3434
*/
3535
public function __construct(
3636
SearchQuery $searchQuery

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

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function __construct(
7474
* @param array $args
7575
* @param StoreInterface $store
7676
* @param SearchCriteriaBuilder $searchCriteriaBuilder
77-
* @throws InputException
7877
*/
7978
public function applyFilter(
8079
int $userId,
@@ -104,7 +103,11 @@ public function applyFilter(
104103
if (is_array($value)) {
105104
throw new InputException(__('Invalid match filter'));
106105
}
107-
$filters[] = $this->addMatchFilter($field, $value, $store);
106+
$searchValue = str_replace('%', '', $value);
107+
$filters[] = $this->filterBuilder->setField($field)
108+
->setValue("%{$searchValue}%")
109+
->setConditionType('like')
110+
->create();
108111
} else {
109112
$filters[] = $this->filterBuilder->setField($field)
110113
->setValue($value)
@@ -116,39 +119,7 @@ public function applyFilter(
116119

117120
$this->filterGroupBuilder->setFilters($filters);
118121
$filterGroups[] = $this->filterGroupBuilder->create();
119-
120122
}
121123
$searchCriteriaBuilder->setFilterGroups($filterGroups);
122124
}
123-
124-
/**
125-
* Add match filter to collection
126-
*
127-
* @param Collection $orderCollection
128-
* @param string $field
129-
* @param string $value
130-
* @param StoreInterface $store
131-
* @throws InputException
132-
*/
133-
private function addMatchFilter(
134-
string $field,
135-
string $value,
136-
StoreInterface $store
137-
): Filter {
138-
$minQueryLength = $this->scopeConfig->getValue(
139-
'catalog/search/min_query_length',
140-
ScopeInterface::SCOPE_STORE,
141-
$store
142-
) ?? self::DEFAULT_MIN_QUERY_LENGTH;
143-
$searchValue = str_replace('%', '', $value);
144-
$matchLength = strlen($searchValue);
145-
if ($matchLength < $minQueryLength) {
146-
throw new InputException(__('Invalid match filter. Minimum length is %1.', $minQueryLength));
147-
}
148-
149-
return $this->filterBuilder->setField($field)
150-
->setValue("%{$searchValue}%")
151-
->setConditionType('like')
152-
->create();
153-
}
154125
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(
6262
* Filter order data based off given search criteria
6363
*
6464
* @param array $args
65-
* @param int $userId,
65+
* @param int $userId
6666
* @param StoreInterface $store
6767
* @return DataObject
6868
* @throws InputException

app/code/Magento/SalesGraphQl/Model/Resolver/LineItem/DataProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
27

38
namespace Magento\SalesGraphQl\Model\Resolver\LineItem;
49

app/code/Magento/SalesGraphQl/Model/Resolver/OrderItem/OptionsProcessor.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public function getItemOptions(OrderItemInterface $orderItem): array
3030
$optionsTypes = $this->processOptions($options['options']);
3131
} elseif (isset($options['attributes_info'])) {
3232
$optionsTypes = $this->processAttributesInfo($options['attributes_info']);
33-
} elseif (isset($options['additional_options'])) {
34-
// TODO $options['additional_options']
3533
}
3634
}
3735
return $optionsTypes;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ public function resolve(
6969
'discounts' => $this->getDiscountDetails($order),
7070
'total_shipping' => ['value' => $order->getShippingAmount(), 'currency' => $currency],
7171
'shipping_handling' => [
72-
'amount_excluding_tax' => ['value' => $order->getShippingAmount(), 'currency' => $order->getOrderCurrencyCode()],
72+
'amount_excluding_tax' => [
73+
'value' => $order->getShippingAmount(),
74+
'currency' => $order->getOrderCurrencyCode()
75+
],
7376
'amount_including_tax' => ['value' => $order->getShippingInclTax(), 'currency' => $currency],
7477
'total_amount' => ['value' => $order->getBaseShippingAmount(), 'currency' => $currency],
7578
'taxes' => $this->getAppliedTaxesDetails($order, $appliedShippingTaxesForItemsData),

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' => $order->getId(),
58+
'id' => base64_encode($order->getId()),
5959
'increment_id' => $order->getIncrementId(),
6060
'order_number' => $order->getIncrementId(),
6161
'created_at' => $order->getCreatedAt(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ class SalesTotalAmountTypeResolver implements TypeResolverInterface
1616
*/
1717
public function resolveType(array $data): string
1818
{
19-
// TODO: Implement resolveType() method.
19+
return 'OrderTotal';
2020
}
2121
}

app/code/Magento/SalesGraphQl/composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"php": "~7.3.0||~7.4.0",
77
"magento/framework": "*",
88
"magento/module-sales": "*",
9+
"magento/module-store": "*",
10+
"magento/module-catalog": "*",
911
"magento/module-shipping": "*",
1012
"magento/module-graph-ql": "*"
1113
},

0 commit comments

Comments
 (0)