Skip to content

Commit 44e5dd7

Browse files
fix: incorrect types and descriptions for errors
1 parent f3fe46c commit 44e5dd7

1 file changed

Lines changed: 33 additions & 32 deletions

File tree

app/Http/Controllers/Apis/Protected/Summit/OAuth2PaymentGatewayProfileApiController.php

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use models\utils\IEntity;
2121
use ModelSerializers\SerializerRegistry;
2222
use OpenApi\Attributes as OA;
23+
use Symfony\Component\HttpFoundation\Response;
2324

2425
/**
2526
* Class OAuth2PaymentGatewayProfileApiController
@@ -125,12 +126,13 @@ public function __construct
125126
description: 'Payment gateway profiles retrieved successfully',
126127
content: new OA\JsonContent(ref: '#/components/schemas/PaginatedPaymentGatewayProfilesResponse')
127128
),
128-
new OA\Response(response: 400, ref: '#/components/responses/400'),
129-
new OA\Response(response: 401, ref: '#/components/responses/401'),
130-
new OA\Response(response: 403, ref: '#/components/responses/403'),
131-
new OA\Response(response: 404, ref: '#/components/responses/404'),
132-
new OA\Response(response: 412, ref: '#/components/responses/412'),
133-
new OA\Response(response: 500, ref: '#/components/responses/500'),
129+
130+
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
131+
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
132+
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
133+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"),
134+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
135+
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
134136
]
135137
)]
136138

@@ -162,12 +164,13 @@ public function __construct
162164
description: 'Payment gateway profile retrieved successfully',
163165
content: new OA\JsonContent(ref: '#/components/schemas/PaymentGatewayProfile')
164166
),
165-
new OA\Response(response: 400, ref: '#/components/responses/400'),
166-
new OA\Response(response: 401, ref: '#/components/responses/401'),
167-
new OA\Response(response: 403, ref: '#/components/responses/403'),
168-
new OA\Response(response: 404, ref: '#/components/responses/404'),
169-
new OA\Response(response: 412, ref: '#/components/responses/412'),
170-
new OA\Response(response: 500, ref: '#/components/responses/500'),
167+
168+
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
169+
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
170+
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
171+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"),
172+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
173+
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
171174
]
172175
)]
173176

@@ -196,13 +199,12 @@ public function __construct
196199
description: 'Payment gateway profile created successfully',
197200
content: new OA\JsonContent(ref: '#/components/schemas/PaymentGatewayProfile')
198201
),
199-
new OA\Response(response: 400, ref: '#/components/responses/400'),
200-
new OA\Response(response: 401, ref: '#/components/responses/401'),
201-
new OA\Response(response: 403, ref: '#/components/responses/403'),
202-
new OA\Response(response: 404, ref: '#/components/responses/404'),
203-
new OA\Response(response: 412, ref: '#/components/responses/412'),
204-
new OA\Response(response: 422, ref: '#/components/responses/422'),
205-
new OA\Response(response: 500, ref: '#/components/responses/500'),
202+
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
203+
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
204+
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
205+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"),
206+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
207+
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
206208
]
207209
)]
208210

@@ -238,13 +240,12 @@ public function __construct
238240
description: 'Payment gateway profile updated successfully',
239241
content: new OA\JsonContent(ref: '#/components/schemas/PaymentGatewayProfile')
240242
),
241-
new OA\Response(response: 400, ref: '#/components/responses/400'),
242-
new OA\Response(response: 401, ref: '#/components/responses/401'),
243-
new OA\Response(response: 403, ref: '#/components/responses/403'),
244-
new OA\Response(response: 404, ref: '#/components/responses/404'),
245-
new OA\Response(response: 412, ref: '#/components/responses/412'),
246-
new OA\Response(response: 422, ref: '#/components/responses/422'),
247-
new OA\Response(response: 500, ref: '#/components/responses/500'),
243+
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
244+
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
245+
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
246+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"),
247+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
248+
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
248249
]
249250
)]
250251

@@ -275,12 +276,12 @@ public function __construct
275276
response: 204,
276277
description: 'Payment gateway profile deleted successfully'
277278
),
278-
new OA\Response(response: 400, ref: '#/components/responses/400'),
279-
new OA\Response(response: 401, ref: '#/components/responses/401'),
280-
new OA\Response(response: 403, ref: '#/components/responses/403'),
281-
new OA\Response(response: 404, ref: '#/components/responses/404'),
282-
new OA\Response(response: 412, ref: '#/components/responses/412'),
283-
new OA\Response(response: 500, ref: '#/components/responses/500'),
279+
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
280+
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
281+
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
282+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"),
283+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"),
284+
new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"),
284285
]
285286
)]
286287

0 commit comments

Comments
 (0)