|
16 | 16 | use App\Services\Model\IProcessPaymentService; |
17 | 17 | use App\Services\Model\ISummitOrderService; |
18 | 18 | use Illuminate\Http\Request as LaravelRequest; |
| 19 | +use Illuminate\Http\Response; |
19 | 20 | use Illuminate\Support\Facades\Cache; |
20 | 21 | use models\oauth2\IResourceServerContext; |
21 | 22 | use models\summit\IPaymentConstants; |
|
25 | 26 | use models\exceptions\EntityNotFoundException; |
26 | 27 | use models\exceptions\ValidationException; |
27 | 28 | use Exception; |
| 29 | +use OpenApi\Attributes as OA; |
| 30 | + |
28 | 31 | /** |
29 | 32 | * Class PaymentGatewayWebHookController |
30 | 33 | * @package App\Http\Controllers |
@@ -97,6 +100,45 @@ private function getProcessPaymentService(string $application_type):?IProcessPay |
97 | 100 | * @param LaravelRequest $request |
98 | 101 | * @return \Illuminate\Http\JsonResponse|mixed |
99 | 102 | */ |
| 103 | + #[OA\Post( |
| 104 | + path: "/api/public/v1/summits/all/payments/{application_name}/confirm", |
| 105 | + summary: "Generic payment gateway webhook confirmation", |
| 106 | + description: "Handles payment gateway webhook callbacks for a given application type.", |
| 107 | + operationId: "genericConfirm", |
| 108 | + tags: ["PaymentGatewayHook"], |
| 109 | + security: [], |
| 110 | + parameters: [ |
| 111 | + new OA\Parameter( |
| 112 | + name: "application_name", |
| 113 | + in: "path", |
| 114 | + required: true, |
| 115 | + description: "Application name (e.g. Show admin)", |
| 116 | + schema: new OA\Schema(type: "string") |
| 117 | + ) |
| 118 | + ], |
| 119 | + requestBody: new OA\RequestBody( |
| 120 | + required: false, |
| 121 | + content: new OA\JsonContent(ref: '#/components/schemas/PaymentGatewayWebhookRequest') |
| 122 | + ), |
| 123 | + responses: [ |
| 124 | + new OA\Response( |
| 125 | + response: Response::HTTP_OK, |
| 126 | + description: "Payment processed successfully" |
| 127 | + ), |
| 128 | + new OA\Response( |
| 129 | + response: Response::HTTP_ALREADY_REPORTED, |
| 130 | + description: "Already reported" |
| 131 | + ), |
| 132 | + new OA\Response( |
| 133 | + response: Response::HTTP_BAD_REQUEST, |
| 134 | + description: "Payload error" |
| 135 | + ), |
| 136 | + new OA\Response( |
| 137 | + response: Response::HTTP_PRECONDITION_FAILED, |
| 138 | + description: "Precondition failed - missing configuration or invalid data" |
| 139 | + ) |
| 140 | + ] |
| 141 | + )] |
100 | 142 | public function genericConfirm($application_type, LaravelRequest $request){ |
101 | 143 | try { |
102 | 144 |
|
@@ -156,6 +198,52 @@ public function genericConfirm($application_type, LaravelRequest $request){ |
156 | 198 | * @param LaravelRequest $request |
157 | 199 | * @return \Illuminate\Http\JsonResponse|mixed |
158 | 200 | */ |
| 201 | + #[OA\Post( |
| 202 | + path: "/api/public/v1/summits/{summit_id}/payments/{application_name}/confirm", |
| 203 | + summary: "Summit payment gateway webhook confirmation", |
| 204 | + description: "Handles payment gateway webhook callbacks for a given summit and application type.", |
| 205 | + operationId: "confirm", |
| 206 | + tags: ["PaymentGatewayHook"], |
| 207 | + security: [], |
| 208 | + parameters: [ |
| 209 | + new OA\Parameter( |
| 210 | + name: "summit_id", |
| 211 | + in: "path", |
| 212 | + required: true, |
| 213 | + description: "Summit identifier", |
| 214 | + schema: new OA\Schema(type: "integer") |
| 215 | + ), |
| 216 | + new OA\Parameter( |
| 217 | + name: "application_name", |
| 218 | + in: "path", |
| 219 | + required: true, |
| 220 | + description: "Application Name (e.g ShowAdmin)", |
| 221 | + schema: new OA\Schema(type: "string") |
| 222 | + ) |
| 223 | + ], |
| 224 | + requestBody: new OA\RequestBody( |
| 225 | + required: false, |
| 226 | + content: new OA\JsonContent(ref: '#/components/schemas/PaymentGatewayWebhookRequest') |
| 227 | + ), |
| 228 | + responses: [ |
| 229 | + new OA\Response( |
| 230 | + response: Response::HTTP_OK, |
| 231 | + description: "Payment processed successfully" |
| 232 | + ), |
| 233 | + new OA\Response( |
| 234 | + response: Response::HTTP_ALREADY_REPORTED, |
| 235 | + description: "Already reported" |
| 236 | + ), |
| 237 | + new OA\Response( |
| 238 | + response: Response::HTTP_BAD_REQUEST, |
| 239 | + description: "Payload error" |
| 240 | + ), |
| 241 | + new OA\Response( |
| 242 | + response: Response::HTTP_PRECONDITION_FAILED, |
| 243 | + description: "Precondition failed - missing configuration or invalid data" |
| 244 | + ) |
| 245 | + ] |
| 246 | + )] |
159 | 247 | public function confirm($summit_id, $application_type, LaravelRequest $request){ |
160 | 248 |
|
161 | 249 | try { |
|
0 commit comments