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