Skip to content

Commit 8b23025

Browse files
committed
Merge remote-tracking branch 'origin/AC1096' into Spartans_246_quality_graphql_mainlinepr
2 parents 2681800 + 1ff8ff3 commit 8b23025

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/ExtractQuoteAddressData.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\QuoteGraphQl\Model\Cart;
99

1010
use Magento\Framework\Api\ExtensibleDataObjectConverter;
11+
use Magento\Framework\GraphQl\Query\Uid;
1112
use Magento\Quote\Api\Data\AddressInterface;
1213
use Magento\Quote\Model\Quote\Address as QuoteAddress;
1314

@@ -24,9 +25,20 @@ class ExtractQuoteAddressData
2425
/**
2526
* @param ExtensibleDataObjectConverter $dataObjectConverter
2627
*/
27-
public function __construct(ExtensibleDataObjectConverter $dataObjectConverter)
28-
{
28+
29+
/** @var Uid */
30+
private Uid $uidEncoder;
31+
32+
/**
33+
* @param ExtensibleDataObjectConverter $dataObjectConverter
34+
* @param Uid $uidEncoder
35+
*/
36+
public function __construct(
37+
ExtensibleDataObjectConverter $dataObjectConverter,
38+
Uid $uidEncoder
39+
) {
2940
$this->dataObjectConverter = $dataObjectConverter;
41+
$this->uidEncoder = $uidEncoder;
3042
}
3143

3244
/**
@@ -52,6 +64,7 @@ public function execute(QuoteAddress $address): array
5264
'label' => $address->getRegion(),
5365
'region_id'=> $address->getRegionId()
5466
],
67+
'uid' => $this->uidEncoder->encode((string)$address->getAddressId()) ,
5568
'street' => $address->getStreet(),
5669
'items_weight' => $address->getWeight(),
5770
'customer_notes' => $address->getCustomerNotes()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ type Cart @doc(description: "Contains the contents and other details about a gue
221221
}
222222

223223
interface CartAddressInterface @typeResolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddressTypeResolver") {
224+
uid: String! @doc(description: "The unique id of the customer address.")
224225
firstname: String! @doc(description: "The first name of the customer or guest.")
225226
lastname: String! @doc(description: "The last name of the customer or guest.")
226227
company: String @doc(description: "The company specified for the billing or shipping address.")

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ public function testGetSpecifiedShippingAddress()
5252
$response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
5353
self::assertArrayHasKey('cart', $response);
5454
self::assertArrayHasKey('shipping_addresses', $response['cart']);
55-
55+
$uid = $response['cart']['shipping_addresses'][0]['uid'];
5656
$expectedShippingAddressData = [
57+
'uid' => $uid,
5758
'firstname' => 'John',
5859
'lastname' => 'Smith',
5960
'company' => 'CompanyName',
@@ -160,18 +161,19 @@ private function getQuery(string $maskedQuoteId): string
160161
{
161162
cart(cart_id: "$maskedQuoteId") {
162163
shipping_addresses {
164+
uid
163165
firstname
164166
lastname
165167
company
166168
street
167169
city
168-
region
170+
region
169171
{
170172
code
171173
label
172174
}
173175
postcode
174-
country
176+
country
175177
{
176178
code
177179
label

0 commit comments

Comments
 (0)