Skip to content

Commit de229c2

Browse files
committed
MC-32655: (GraphQL) Set default value of save_in_address_book to true when no value is specified
- Refactored code to fix jenkin builds
1 parent a073071 commit de229c2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
6767
$sameAsShipping = isset($billingAddressInput['same_as_shipping'])
6868
? (bool)$billingAddressInput['same_as_shipping'] : $sameAsShipping;
6969

70-
$this->checkForInputExceptions($customerAddressId, $addressInput);
70+
$this->checkForInputExceptions($billingAddressInput);
7171

7272
$addresses = $cart->getAllShippingAddresses();
7373
if ($sameAsShipping && count($addresses) > 1) {
@@ -84,14 +84,15 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
8484
/**
8585
* Check for the input exceptions
8686
*
87-
* @param int|null $customerAddressId
88-
* @param array|null $addressInput
87+
* @param array $billingAddressInput
8988
* @throws GraphQlInputException
9089
*/
9190
private function checkForInputExceptions(
92-
?int $customerAddressId,
93-
?array $addressInput
91+
?array $billingAddressInput
9492
) {
93+
$customerAddressId = $billingAddressInput['customer_address_id'] ?? null;
94+
$addressInput = $billingAddressInput['address'] ?? null;
95+
9596
if (null === $customerAddressId && null === $addressInput) {
9697
throw new GraphQlInputException(
9798
__('The billing address must contain either "customer_address_id" or "address".')

0 commit comments

Comments
 (0)