downloadFileNotFound example

'message' => 'These customers "id-1, id-2" are not found',
        ];

        yield CustomerException::CUSTOMER_NOT_LOGGED_IN => [
            'exception' => CustomerException::customerNotLoggedIn(),
            'statusCode' => Response::HTTP_FORBIDDEN,
            'errorCode' => CustomerException::CUSTOMER_NOT_LOGGED_IN,
            'message' => 'Customer is not logged in.',
        ];

        yield CustomerException::LINE_ITEM_DOWNLOAD_FILE_NOT_FOUND => [
            'exception' => CustomerException::downloadFileNotFound('id-1'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => CustomerException::LINE_ITEM_DOWNLOAD_FILE_NOT_FOUND,
            'message' => 'Line item download file with id "id-1" not found.',
        ];

        yield CustomerException::CUSTOMER_IDS_PARAMETER_IS_MISSING => [
            'exception' => CustomerException::customerIdsParameterIsMissing(),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CustomerException::CUSTOMER_IDS_PARAMETER_IS_MISSING,
            'message' => 'Parameter "customerIds" is missing.',
        ];

        
MultiFilter::CONNECTION_AND,
            [
                new EqualsFilter('orderLineItem.order.id', $orderId),
                new EqualsFilter('orderLineItem.order.orderCustomer.customerId', $customer->getId()),
                new EqualsFilter('accessGranted', true),
            ]
        ));

        $download = $this->downloadRepository->search($criteria$context->getContext())->first();

        if (!$download instanceof OrderLineItemDownloadEntity || !$download->getMedia()) {
            throw CustomerException::downloadFileNotFound($downloadId);
        }

        $media = $download->getMedia();

        return $this->downloadResponseGenerator->getResponse($media$context);
    }
}
Home | Imprint | This part of the site doesn't use cookies.