shippingAddressManagement = $shippingAddressManagement; $this->getCartForUser = $getCartForUser; $this->arrayManager = $arrayManager; $this->setShippingAddressesOnCart = $setShippingAddressesOnCart; } /** * @inheritdoc */ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) { $shippingAddresses = $this->arrayManager->get('input/shipping_addresses', $args); $maskedCartId = (string) $this->arrayManager->get('input/cart_id', $args); if (!$maskedCartId) { throw new GraphQlInputException(__('Required parameter "cart_id" is missing')); } if (!$shippingAddresses) { throw new GraphQlInputException(__('Required parameter "shipping_addresses" is missing')); } $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId()); $this->setShippingAddressesOnCart->execute($context, $cart, $shippingAddresses); return [ 'cart' => [ 'cart_id' => $maskedCartId, 'model' => $cart, ] ]; } }