Skip to content

Commit faa78e2

Browse files
committed
chore: fix path and security and x attributes
Signed-off-by: Matias Perrone <github@matiasperrone.com>
1 parent d6b8631 commit faa78e2

File tree

1 file changed

+89
-21
lines changed

1 file changed

+89
-21
lines changed

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

Lines changed: 89 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,42 @@ public function reserve($summit_id)
246246
*/
247247
#[OA\Put(
248248
path: '/api/public/v1/summits/{id}/orders/{hash}/checkout',
249+
summary: 'Checkout a reserved order (Public)',
250+
description: 'Processes payment and completes an order reservation',
251+
operationId: 'checkoutPublic',
252+
tags: ['Orders (Public)'],
253+
parameters: [
254+
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),
255+
new OA\Parameter(name: 'hash', in: 'path', required: true, description: 'Order hash', schema: new OA\Schema(type: 'string')),
256+
],
257+
requestBody: new OA\RequestBody(
258+
required: false,
259+
content: new OA\JsonContent(ref: '#/components/schemas/CheckoutOrderRequest')
260+
),
261+
responses: [
262+
new OA\Response(
263+
response: Response::HTTP_CREATED,
264+
description: 'Order checked out successfully',
265+
content: new OA\JsonContent(ref: '#/components/schemas/SummitOrderCheckout')
266+
),
267+
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: 'Bad Request'),
268+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: 'Summit or order not found'),
269+
new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: 'Validation Error'),
270+
]
271+
)]
272+
#[OA\Put(
273+
path: '/api/v1/summits/{id}/orders/{hash}/checkout',
249274
summary: 'Checkout a reserved order',
250275
description: 'Processes payment and completes an order reservation',
251276
operationId: 'checkout',
252-
tags: ['Orders (Public)'],
277+
security: [
278+
[
279+
'summit_orders_auth' => [
280+
SummitScopes::UpdateMyRegistrationOrders,
281+
]
282+
]
283+
],
284+
tags: ['Orders'],
253285
parameters: [
254286
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),
255287
new OA\Parameter(name: 'hash', in: 'path', required: true, description: 'Order hash', schema: new OA\Schema(type: 'string')),
@@ -308,10 +340,36 @@ public function checkout($summit_id, $hash)
308340
*/
309341
#[OA\Get(
310342
path: '/api/public/v1/summits/{id}/orders/{hash}/tickets/mine',
343+
summary: 'Get my ticket by order hash (Public)',
344+
description: 'Returns ticket information for the current user using order hash',
345+
operationId: 'getMyTicketByOrderHashPublic',
346+
tags: ['Orders (Public)'],
347+
parameters: [
348+
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),
349+
new OA\Parameter(name: 'hash', in: 'path', required: true, description: 'Order hash', schema: new OA\Schema(type: 'string')),
350+
],
351+
responses: [
352+
new OA\Response(
353+
response: Response::HTTP_CREATED,
354+
description: 'Ticket information',
355+
content: new OA\JsonContent(ref: '#/components/schemas/SummitAttendeeTicketGuest')
356+
),
357+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: 'Summit or order not found'),
358+
]
359+
)]
360+
#[OA\Get(
361+
path: '/api/v1/summits/{id}/orders/{hash}/tickets/mine',
311362
summary: 'Get my ticket by order hash',
312363
description: 'Returns ticket information for the current user using order hash',
313364
operationId: 'getMyTicketByOrderHash',
314-
tags: ['Orders (Public)'],
365+
security: [
366+
[
367+
'summit_orders_auth' => [
368+
SummitScopes::ReadMyRegistrationOrders,
369+
]
370+
]
371+
],
372+
tags: ['Orders'],
315373
parameters: [
316374
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),
317375
new OA\Parameter(name: 'hash', in: 'path', required: true, description: 'Order hash', schema: new OA\Schema(type: 'string')),
@@ -351,10 +409,32 @@ public function getMyTicketByOrderHash($summit_id, $hash)
351409
*/
352410
#[OA\Delete(
353411
path: '/api/public/v1/summits/{id}/orders/{hash}',
412+
summary: 'Cancel order by hash (Public)',
413+
description: 'Cancels an order using its hash',
414+
operationId: 'cancelPublic',
415+
tags: ['Orders (Public)'],
416+
parameters: [
417+
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),
418+
new OA\Parameter(name: 'hash', in: 'path', required: true, description: 'Order hash', schema: new OA\Schema(type: 'string')),
419+
],
420+
responses: [
421+
new OA\Response(response: Response::HTTP_NO_CONTENT, description: 'Order cancelled successfully'),
422+
new OA\Response(response: Response::HTTP_NOT_FOUND, description: 'Summit or order not found'),
423+
]
424+
)]
425+
#[OA\Delete(
426+
path: '/api/v1/summits/{id}/orders/{hash}',
354427
summary: 'Cancel order by hash',
355428
description: 'Cancels an order using its hash',
356429
operationId: 'cancel',
357-
tags: ['Orders (Public)'],
430+
security: [
431+
[
432+
'summit_orders_auth' => [
433+
SummitScopes::DeleteMyRegistrationOrders,
434+
]
435+
]
436+
],
437+
tags: ['Orders'],
358438
parameters: [
359439
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),
360440
new OA\Parameter(name: 'hash', in: 'path', required: true, description: 'Order hash', schema: new OA\Schema(type: 'string')),
@@ -609,7 +689,7 @@ function () {
609689
*/
610690

611691
#[OA\Get(
612-
path: '/api/v1/orders/me',
692+
path: '/api/v1/summits/all/orders/me',
613693
summary: 'Get all my orders across all summits',
614694
description: 'Returns paginated list of current user orders across all summits',
615695
operationId: 'getAllMyOrders',
@@ -2093,9 +2173,6 @@ public function getMyOrderById($order_id)
20932173
new OA\Parameter(name: 'filter', in: 'query', required: false, description: 'Filter criteria', schema: new OA\Schema(type: 'string')),
20942174
new OA\Parameter(name: 'order', in: 'query', required: false, description: 'Sort order', schema: new OA\Schema(type: 'string')),
20952175
],
2096-
requestBody: new OA\RequestBody(
2097-
content: new OA\JsonContent(ref: '#/components/schemas/GetMyTicketsByOrderIdRequest')
2098-
),
20992176
responses: [
21002177
new OA\Response(
21012178
response: Response::HTTP_OK,
@@ -2169,9 +2246,9 @@ function ($filter) use ($owner, $order_id) {
21692246
$filter->addFilterCondition(FilterElement::makeEqual('order_id', intval($order_id)));
21702247
$filter->addFilterCondition(FilterElement::makeEqual('order_owner_id', $owner->getId()));
21712248
$filter->addFilterCondition(FilterElement::makeEqual('status', IOrderConstants::PaidStatus));
2172-
if($filter->hasFilter("assigned_to")){
2249+
if($filter->hasFilter("assigned_to")) {
21732250
$assigned_to = $filter->getValue("assigned_to")[0];
2174-
if(in_array($assigned_to, ['Me','SomeoneElse'])){
2251+
if(in_array($assigned_to, ['Me','SomeoneElse'])) {
21752252
$filter->addFilterCondition(FilterElement::makeEqual('owner_member_id', $owner->getId()));
21762253
$filter->addFilterCondition(FilterElement::makeEqual('owner_member_email', $owner->getEmail()));
21772254
}
@@ -2182,7 +2259,7 @@ function ($filter) use ($owner, $order_id) {
21822259
function () {
21832260
return ISummitOrderSerializerTypes::AdminType;
21842261
}
2185-
, null, null,
2262+
, null, null,
21862263
function ($page, $per_page, $filter, $order, $applyExtraFilters) {
21872264
return $this->ticket_repository->getAllByPage(
21882265
new PagingInfo($page, $per_page),
@@ -2541,24 +2618,15 @@ function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit) {
25412618
#[OA\Put(
25422619
path: '/api/v1/summits/{id}/orders/{order_id}/tickets/{ticket_id}/delegate',
25432620
summary: 'Delegate ticket to another attendee',
2544-
description: 'Delegates/transfers ticket ownership to another attendee. Admin access required.',
2621+
description: 'Delegates/transfers ticket ownership to another attendee.',
25452622
operationId: 'delegateTicket',
25462623
security: [
25472624
[
25482625
'summit_orders_auth' => [
2549-
SummitScopes::WriteSummitData,
2550-
SummitScopes::UpdateRegistrationOrders,
2626+
SummitScopes::UpdateMyRegistrationOrders,
25512627
]
25522628
]
25532629
],
2554-
x: [
2555-
'authz_groups' => [
2556-
IGroup::SuperAdmins,
2557-
IGroup::Administrators,
2558-
IGroup::SummitAdministrators,
2559-
IGroup::SummitRegistrationAdmins,
2560-
]
2561-
],
25622630
tags: ['Orders'],
25632631
parameters: [
25642632
new OA\Parameter(name: 'id', in: 'path', required: true, description: 'Summit ID or slug', schema: new OA\Schema(type: 'string')),

0 commit comments

Comments
 (0)