Skip to content

Commit 095d707

Browse files
author
Vitaliy Boyko
committed
graphQl-903: deprecated use_for_shipping in billing address schema
1 parent d9d4b82 commit 095d707

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ public function __construct(
3939
*
4040
* @param CartInterface $cart
4141
* @param AddressInterface $billingAddress
42-
* @param bool $useForShipping
42+
* @param bool $sameAsShipping
4343
* @throws GraphQlInputException
4444
* @throws GraphQlNoSuchEntityException
4545
*/
4646
public function execute(
4747
CartInterface $cart,
4848
AddressInterface $billingAddress,
49-
bool $useForShipping
49+
bool $sameAsShipping
5050
): void {
5151
try {
52-
$this->billingAddressManagement->assign($cart->getId(), $billingAddress, $useForShipping);
52+
$this->billingAddressManagement->assign($cart->getId(), $billingAddress, $sameAsShipping);
5353
} catch (NoSuchEntityException $e) {
5454
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
5555
} catch (LocalizedException $e) {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
5656
{
5757
$customerAddressId = $billingAddressInput['customer_address_id'] ?? null;
5858
$addressInput = $billingAddressInput['address'] ?? null;
59-
$useForShipping = isset($billingAddressInput['use_for_shipping'])
60-
? (bool)$billingAddressInput['use_for_shipping'] : false;
59+
$sameAsshipping = isset($billingAddressInput['same_as_shipping'])
60+
? (bool)$billingAddressInput['same_as_shipping'] : false;
6161

6262
if (null === $customerAddressId && null === $addressInput) {
6363
throw new GraphQlInputException(
@@ -72,15 +72,15 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
7272
}
7373

7474
$addresses = $cart->getAllShippingAddresses();
75-
if ($useForShipping && count($addresses) > 1) {
75+
if ($sameAsshipping && count($addresses) > 1) {
7676
throw new GraphQlInputException(
77-
__('Using the "use_for_shipping" option with multishipping is not possible.')
77+
__('Using the "same_as_shipping" option with multishipping is not possible.')
7878
);
7979
}
8080

8181
$billingAddress = $this->createBillingAddress($context, $customerAddressId, $addressInput);
8282

83-
$this->assignBillingAddressToCart->execute($cart, $billingAddress, $useForShipping);
83+
$this->assignBillingAddressToCart->execute($cart, $billingAddress, $sameAsshipping);
8484
}
8585

8686
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ input SetBillingAddressOnCartInput {
9696
input BillingAddressInput {
9797
customer_address_id: Int
9898
address: CartAddressInput
99-
use_for_shipping: Boolean
99+
use_for_shipping: Boolean @doc(description: "Deprecated. Use same_as_shipping")
100+
same_as_shipping: Boolean
100101
}
101102

102103
input CartAddressInput {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testSetNewBillingAddress()
120120
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
121121
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
122122
*/
123-
public function testSetNewBillingAddressWithUseForShippingParameter()
123+
public function testSetNewBillingAddressWithSameAsShippingParameter()
124124
{
125125
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
126126

@@ -142,7 +142,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
142142
telephone: "88776655"
143143
save_in_address_book: false
144144
}
145-
use_for_shipping: true
145+
same_as_shipping: true
146146
}
147147
}
148148
) {
@@ -337,7 +337,7 @@ public function testSetNewBillingAddressWithoutCustomerAddressIdAndAddress()
337337
input: {
338338
cart_id: "$maskedQuoteId"
339339
billing_address: {
340-
use_for_shipping: true
340+
same_as_shipping: true
341341
}
342342
}
343343
) {
@@ -363,7 +363,7 @@ public function testSetNewBillingAddressWithoutCustomerAddressIdAndAddress()
363363
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
364364
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php
365365
*/
366-
public function testSetNewBillingAddressWithUseForShippingAndMultishipping()
366+
public function testSetNewBillingAddressWithSameAsShippingAndMultishipping()
367367
{
368368
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
369369

@@ -385,7 +385,7 @@ public function testSetNewBillingAddressWithUseForShippingAndMultishipping()
385385
telephone: "88776655"
386386
save_in_address_book: false
387387
}
388-
use_for_shipping: true
388+
same_as_shipping: true
389389
}
390390
}
391391
) {
@@ -399,7 +399,7 @@ public function testSetNewBillingAddressWithUseForShippingAndMultishipping()
399399
QUERY;
400400

401401
self::expectExceptionMessage(
402-
'Using the "use_for_shipping" option with multishipping is not possible.'
402+
'Using the "same_as_shipping" option with multishipping is not possible.'
403403
);
404404
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
405405
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testSetNewBillingAddress()
9090
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
9191
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
9292
*/
93-
public function testSetNewBillingAddressWithUseForShippingParameter()
93+
public function testSetNewBillingAddressWithSameAsShippingParameter()
9494
{
9595
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
9696

@@ -112,7 +112,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
112112
telephone: "88776655"
113113
save_in_address_book: false
114114
}
115-
use_for_shipping: true
115+
same_as_shipping: true
116116
}
117117
}
118118
) {
@@ -346,7 +346,7 @@ public function testSetNewBillingAddressWithoutCustomerAddressIdAndAddress()
346346
input: {
347347
cart_id: "$maskedQuoteId"
348348
billing_address: {
349-
use_for_shipping: true
349+
same_as_shipping: true
350350
}
351351
}
352352
) {
@@ -371,7 +371,7 @@ public function testSetNewBillingAddressWithoutCustomerAddressIdAndAddress()
371371
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
372372
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php
373373
*/
374-
public function testSetNewBillingAddressWithUseForShippingAndMultishipping()
374+
public function testSetNewBillingAddressWithSameAsShippingAndMultishipping()
375375
{
376376
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
377377

@@ -393,7 +393,7 @@ public function testSetNewBillingAddressWithUseForShippingAndMultishipping()
393393
telephone: "88776655"
394394
save_in_address_book: false
395395
}
396-
use_for_shipping: true
396+
same_as_shipping: true
397397
}
398398
}
399399
) {
@@ -407,7 +407,7 @@ public function testSetNewBillingAddressWithUseForShippingAndMultishipping()
407407
QUERY;
408408

409409
self::expectExceptionMessage(
410-
'Using the "use_for_shipping" option with multishipping is not possible.'
410+
'Using the "same_as_shipping" option with multishipping is not possible.'
411411
);
412412
$this->graphQlMutation($query);
413413
}

0 commit comments

Comments
 (0)