diff --git a/app/Http/Controllers/PaymentGatewayWebHookController.php b/app/Http/Controllers/PaymentGatewayWebHookController.php index 303613253..a3c002f9f 100644 --- a/app/Http/Controllers/PaymentGatewayWebHookController.php +++ b/app/Http/Controllers/PaymentGatewayWebHookController.php @@ -16,6 +16,7 @@ use App\Services\Model\IProcessPaymentService; use App\Services\Model\ISummitOrderService; use Illuminate\Http\Request as LaravelRequest; +use Illuminate\Http\Response; use Illuminate\Support\Facades\Cache; use models\oauth2\IResourceServerContext; use models\summit\IPaymentConstants; @@ -25,6 +26,8 @@ use models\exceptions\EntityNotFoundException; use models\exceptions\ValidationException; use Exception; +use OpenApi\Attributes as OA; + /** * Class PaymentGatewayWebHookController * @package App\Http\Controllers @@ -97,6 +100,45 @@ private function getProcessPaymentService(string $application_type):?IProcessPay * @param LaravelRequest $request * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/public/v1/summits/all/payments/{application_type}/confirm", + summary: "Generic payment gateway webhook confirmation", + description: "Handles payment gateway webhook callbacks for a given application type.", + operationId: "genericConfirm", + tags: ["PaymentGatewayHook"], + security: [], + parameters: [ + new OA\Parameter( + name: "application_type", + in: "path", + required: true, + description: "Application type (e.g., registration, bookable-rooms)", + schema: new OA\Schema(type: "string") + ) + ], + requestBody: new OA\RequestBody( + required: false, + content: new OA\JsonContent() + ), + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Payment processed successfully" + ), + new OA\Response( + response: Response::HTTP_ALREADY_REPORTED, + description: "Already reported" + ), + new OA\Response( + response: Response::HTTP_BAD_REQUEST, + description: "Payload error" + ), + new OA\Response( + response: Response::HTTP_PRECONDITION_FAILED, + description: "Precondition failed - missing configuration or invalid data" + ) + ] + )] public function genericConfirm($application_type, LaravelRequest $request){ try { @@ -156,6 +198,52 @@ public function genericConfirm($application_type, LaravelRequest $request){ * @param LaravelRequest $request * @return \Illuminate\Http\JsonResponse|mixed */ + #[OA\Post( + path: "/api/public/v1/summits/{summit_id}/payments/{application_type}/confirm", + summary: "Summit payment gateway webhook confirmation", + description: "Handles payment gateway webhook callbacks for a given summit and application type.", + operationId: "confirm", + tags: ["PaymentGatewayHook"], + security: [], + parameters: [ + new OA\Parameter( + name: "summit_id", + in: "path", + required: true, + description: "Summit identifier", + schema: new OA\Schema(type: "integer") + ), + new OA\Parameter( + name: "application_type", + in: "path", + required: true, + description: "Application type (e.g., registration, bookable-rooms)", + schema: new OA\Schema(type: "string") + ) + ], + requestBody: new OA\RequestBody( + required: false, + content: new OA\JsonContent() + ), + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Payment processed successfully" + ), + new OA\Response( + response: Response::HTTP_ALREADY_REPORTED, + description: "Already reported" + ), + new OA\Response( + response: Response::HTTP_BAD_REQUEST, + description: "Payload error" + ), + new OA\Response( + response: Response::HTTP_PRECONDITION_FAILED, + description: "Precondition failed - missing configuration or invalid data" + ) + ] + )] public function confirm($summit_id, $application_type, LaravelRequest $request){ try { diff --git a/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php b/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php index 9629a92fd..769fb9d63 100644 --- a/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php +++ b/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php @@ -52,26 +52,26 @@ public function __construct(EntityManagerInterface $em, ClassMetadata $class) /** @var array}> */ private array $joinCatalog = [ - 'o' => ['e.order', 'join', []], - 's' => ['e.summit', 'join', []], - 'ord_m' => ['o.owner', 'leftJoin', ['o']], - 'a' => ['e.owner', 'leftJoin', []], - 'a_c' => ['a.company', 'leftJoin', ['a']], - 'm' => ['a.member', 'leftJoin', ['a']], - 'am' => ['a.manager', 'leftJoin', ['a']], - 'm2' => ['am.member', 'leftJoin', ['am']], - 'b' => ['e.badge', 'leftJoin', []], - 'bt' => ['b.type', 'leftJoin', ['b']], - 'al' => ['bt.access_levels', 'leftJoin', ['bt']], - 'bf' => ['b.features', 'leftJoin', ['b']], - 'bt_bf' => ['bt.badge_features', 'leftJoin', ['bt']], - 'prt' => ['b.prints', 'leftJoin', ['b']], - 'rr' => ['e.refund_requests', 'leftJoin', []], - 'ta' => ['e.applied_taxes', 'leftJoin', []], - 'tt' => ['e.ticket_type', 'join', []], - 'pc' => ['e.promo_code', 'leftJoin', []], - 'pct' => ['pc.tags', 'leftJoin', ['pc']], - 'avt' => ['bt.allowed_view_types', 'join', ['bt']], + 'o' => ['e.order', 'join', []], + 's' => ['e.summit', 'join', []], + 'ord_m' => ['o.owner', 'leftJoin', ['o']], + 'a' => ['e.owner', 'leftJoin', []], + 'a_c' => ['a.company', 'leftJoin', ['a']], + 'm' => ['a.member', 'leftJoin', ['a']], + 'am' => ['a.manager', 'leftJoin', ['a']], + 'm2' => ['am.member', 'leftJoin', ['am']], + 'b' => ['e.badge', 'leftJoin', []], + 'bt' => ['b.type', 'leftJoin', ['b']], + 'al' => ['bt.access_levels', 'leftJoin', ['bt']], + 'bf' => ['b.features', 'leftJoin', ['b']], + 'bt_bf' => ['bt.badge_features', 'leftJoin', ['bt']], + 'prt' => ['b.prints', 'leftJoin', ['b']], + 'rr' => ['e.refund_requests', 'leftJoin', []], + 'ta' => ['e.applied_taxes', 'leftJoin', []], + 'tt' => ['e.ticket_type', 'join', []], + 'pc' => ['e.promo_code', 'leftJoin', []], + 'pct' => ['pc.tags', 'leftJoin', ['pc']], + 'avt' => ['bt.allowed_view_types', 'join', ['bt']], ]; private function ensureJoin(QueryBuilder $qb, string $alias): void