Skip to content

Commit 1b810ac

Browse files
PWA-1506: Billing address parameter 'same_as_shipping' cause error 'The shipping method is missing'
* Updated exception messages per code review suggestions Co-authored-by: Kevin Harper <[email protected]>
1 parent 6d68bb6 commit 1b810ac

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function checkForInputExceptions(
100100

101101
if (null === $customerAddressId && null === $addressInput && empty($sameAsShipping)) {
102102
throw new GraphQlInputException(
103-
__('The billing address must contain either "customer_address_id", "address" or "same_as_shipping".')
103+
__('The billing address must contain either "customer_address_id", "address", or "same_as_shipping".')
104104
);
105105
}
106106

@@ -123,13 +123,13 @@ private function validateCanUseShippingForBilling(CartInterface $quote)
123123

124124
if (count($shippingAddresses) > 1) {
125125
throw new GraphQlInputException(
126-
__('Could not use the "same_as_shipping" option with multiple shipping addresses set.')
126+
__('Could not use the "same_as_shipping" option, because multiple shipping addresses have been set.')
127127
);
128128
}
129129

130130
if (empty($shippingAddresses) || $shippingAddresses[0]->validate() !== true) {
131131
throw new GraphQlInputException(
132-
__('Could not use the "same_as_shipping" option as the shipping address has not been set.')
132+
__('Could not use the "same_as_shipping" option, because the shipping address has not been set.')
133133
);
134134
}
135135
}
@@ -146,7 +146,7 @@ private function validateCanUseBillingForShipping(CartInterface $quote)
146146

147147
if (count($shippingAddresses) > 1) {
148148
throw new GraphQlInputException(
149-
__('Could not use the "use_for_shipping" option with multiple shipping addresses already set.')
149+
__('Could not use the "use_for_shipping" option, because multiple shipping addresses have already been set.')
150150
);
151151
}
152152
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public function testSetNewBillingAddressWithoutCustomerAddressIdAndAddress()
420420
QUERY;
421421

422422
self::expectExceptionMessage(
423-
'The billing address must contain either "customer_address_id", "address" or "same_as_shipping".'
423+
'The billing address must contain either "customer_address_id", "address", or "same_as_shipping".'
424424
);
425425
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
426426
}
@@ -532,7 +532,7 @@ public function testSetBillingAddressWithSameAsShippingWithoutShippingAddressOnC
532532
}
533533
QUERY;
534534
self::expectExceptionMessage(
535-
'Could not use the "same_as_shipping" option as the shipping address has not been set.'
535+
'Could not use the "same_as_shipping" option, because the shipping address has not been set.'
536536
);
537537
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
538538
}
@@ -570,7 +570,7 @@ public function testSetNewBillingAddressWithSameAsShippingAndMultishipping()
570570
QUERY;
571571

572572
self::expectExceptionMessage(
573-
'Could not use the "same_as_shipping" option with multiple shipping addresses set.'
573+
'Could not use the "same_as_shipping" option, because multiple shipping addresses have been set.'
574574
);
575575
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
576576
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public function testSetBillingAddressWithoutProvidingAddress()
423423
QUERY;
424424

425425
self::expectExceptionMessage(
426-
'The billing address must contain either "customer_address_id", "address" or "same_as_shipping".'
426+
'The billing address must contain either "customer_address_id", "address", or "same_as_shipping".'
427427
);
428428
$this->graphQlMutation($query);
429429
}
@@ -543,7 +543,7 @@ public function testSetBillingAddressWithSameAsShippingWithoutShippingAddressOnC
543543
}
544544
QUERY;
545545
self::expectExceptionMessage(
546-
'Could not use the "same_as_shipping" option as the shipping address has not been set.'
546+
'Could not use the "same_as_shipping" option, because the shipping address has not been set.'
547547
);
548548
$this->graphQlMutation($query);
549549
}
@@ -580,7 +580,7 @@ public function testSetBillingAddressWithSameAsShippingAndMultishipping()
580580
QUERY;
581581

582582
self::expectExceptionMessage(
583-
'Could not use the "same_as_shipping" option with multiple shipping addresses set.'
583+
'Could not use the "same_as_shipping" option, because multiple shipping addresses have been set.'
584584
);
585585
$this->graphQlMutation($query);
586586
}

0 commit comments

Comments
 (0)