diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 7dd25d4bcc4a..c31c5a62ef12 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -642,6 +642,49 @@ class CreditController extends BaseController } } + /** + * @OA\Get( + * path="/api/v1/credit/{invitation_key}/download", + * operationId="downloadCredit", + * tags={"quotes"}, + * summary="Download a specific credit by invitation key", + * description="Downloads a specific quote", + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="invitation_key", + * in="path", + * description="The Credit Invitation Key", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the credit pdf", + * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * @param $invitation_key + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ public function downloadPdf($invitation_key) { $invitation = $this->credit_repository->getInvitationByKey($invitation_key); @@ -649,7 +692,7 @@ class CreditController extends BaseController if (! $invitation) { return response()->json(['message' => 'no record found'], 400); } - + $credit = $invitation->credit; $file = $credit->service()->getCreditPdf($invitation); diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index d3f26596b839..7d0faf1cab41 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -779,6 +779,50 @@ class QuoteController extends BaseController } } + /** + * @OA\Get( + * path="/api/v1/quote/{invitation_key}/download", + * operationId="downloadQuote", + * tags={"quotes"}, + * summary="Download a specific quote by invitation key", + * description="Downloads a specific quote", + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="invitation_key", + * in="path", + * description="The Quote Invitation Key", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the quote pdf", + * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * @param $invitation_key + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function downloadPdf($invitation_key) { $invitation = $this->quote_repo->getInvitationByKey($invitation_key);