|
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; |
| 20 | +use Illuminate\Support\Facades\Cache; |
19 | 21 | use models\oauth2\IResourceServerContext; |
20 | 22 | use models\summit\IPaymentConstants; |
21 | 23 | use models\summit\ISummitRepository; |
|
24 | 26 | use models\exceptions\EntityNotFoundException; |
25 | 27 | use models\exceptions\ValidationException; |
26 | 28 | use Exception; |
| 29 | +use OpenApi\Attributes as OA; |
| 30 | + |
27 | 31 | /** |
28 | 32 | * Class PaymentGatewayWebHookController |
29 | 33 | * @package App\Http\Controllers |
@@ -96,6 +100,46 @@ private function getProcessPaymentService(string $application_type):?IProcessPay |
96 | 100 | * @param LaravelRequest $request |
97 | 101 | * @return \Illuminate\Http\JsonResponse|mixed |
98 | 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 | + content: new OA\JsonContent(ref: '#/components/schemas/PaymentProcessingResponse') |
| 128 | + ), |
| 129 | + new OA\Response( |
| 130 | + response: Response::HTTP_ALREADY_REPORTED, |
| 131 | + description: "Already reported" |
| 132 | + ), |
| 133 | + new OA\Response( |
| 134 | + response: Response::HTTP_BAD_REQUEST, |
| 135 | + description: "Payload error" |
| 136 | + ), |
| 137 | + new OA\Response( |
| 138 | + response: Response::HTTP_PRECONDITION_FAILED, |
| 139 | + description: "Precondition failed - missing configuration or invalid data" |
| 140 | + ) |
| 141 | + ] |
| 142 | + )] |
99 | 143 | public function genericConfirm($application_type, LaravelRequest $request){ |
100 | 144 | try { |
101 | 145 |
|
@@ -150,6 +194,53 @@ public function genericConfirm($application_type, LaravelRequest $request){ |
150 | 194 | * @param LaravelRequest $request |
151 | 195 | * @return \Illuminate\Http\JsonResponse|mixed |
152 | 196 | */ |
| 197 | + #[OA\Post( |
| 198 | + path: "/api/public/v1/summits/{summit_id}/payments/{application_name}/confirm", |
| 199 | + summary: "Summit payment gateway webhook confirmation", |
| 200 | + description: "Handles payment gateway webhook callbacks for a given summit and application type.", |
| 201 | + operationId: "confirm", |
| 202 | + tags: ["PaymentGatewayHook"], |
| 203 | + security: [], |
| 204 | + parameters: [ |
| 205 | + new OA\Parameter( |
| 206 | + name: "summit_id", |
| 207 | + in: "path", |
| 208 | + required: true, |
| 209 | + description: "Summit identifier", |
| 210 | + schema: new OA\Schema(type: "integer") |
| 211 | + ), |
| 212 | + new OA\Parameter( |
| 213 | + name: "application_name", |
| 214 | + in: "path", |
| 215 | + required: true, |
| 216 | + description: "Application Name (e.g ShowAdmin)", |
| 217 | + schema: new OA\Schema(type: "string") |
| 218 | + ) |
| 219 | + ], |
| 220 | + requestBody: new OA\RequestBody( |
| 221 | + required: false, |
| 222 | + content: new OA\JsonContent(ref: '#/components/schemas/PaymentGatewayWebhookRequest') |
| 223 | + ), |
| 224 | + responses: [ |
| 225 | + new OA\Response( |
| 226 | + response: Response::HTTP_OK, |
| 227 | + description: "Payment processed successfully", |
| 228 | + content: new OA\JsonContent(ref: '#/components/schemas/PaymentProcessingResponse') |
| 229 | + ), |
| 230 | + new OA\Response( |
| 231 | + response: Response::HTTP_ALREADY_REPORTED, |
| 232 | + description: "Already reported" |
| 233 | + ), |
| 234 | + new OA\Response( |
| 235 | + response: Response::HTTP_BAD_REQUEST, |
| 236 | + description: "Payload error" |
| 237 | + ), |
| 238 | + new OA\Response( |
| 239 | + response: Response::HTTP_PRECONDITION_FAILED, |
| 240 | + description: "Precondition failed - missing configuration or invalid data" |
| 241 | + ) |
| 242 | + ] |
| 243 | + )] |
153 | 244 | public function confirm($summit_id, $application_type, LaravelRequest $request){ |
154 | 245 |
|
155 | 246 | try { |
|
0 commit comments