This commit is contained in:
2025-12-13 10:35:15 +03:30
parent 85b4e5bb6a
commit 3eb6b889a4
20 changed files with 114 additions and 20 deletions
@@ -1,6 +1,14 @@
import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common';
import { PaymentsService } from '../services/payments.service';
import { ApiTags, ApiOperation, ApiNotFoundResponse, ApiBody, ApiParam, ApiBearerAuth } from '@nestjs/swagger';
import {
ApiTags,
ApiOperation,
ApiNotFoundResponse,
ApiBody,
ApiParam,
ApiBearerAuth,
ApiHeader,
} from '@nestjs/swagger';
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
import { PaymentMethodService } from '../services/payment-method.service';
import { CreatePaymentMethodDto } from '../dto/create-payment-method.dto';
@@ -21,6 +29,7 @@ export class PaymentsController {
@ApiBearerAuth()
@Get('public/payments/methods/restaurant')
@ApiOperation({ summary: 'Get the restaurant payment methods' })
@ApiHeader({ name: 'X-Slug', required: true, description: 'Restaurant slug identifier', example: 'zhivan' })
@ApiNotFoundResponse({ description: 'Restaurant payment methods not found' })
getTheRestaurantPaymentMethods(@RestId() restId: string) {
return this.paymentMethodService.findByRestaurant(restId);
@@ -30,6 +39,7 @@ export class PaymentsController {
@ApiBearerAuth()
@Get('public/payments')
@ApiOperation({ summary: 'Get all the restaurant payments for user' })
@ApiHeader({ name: 'X-Slug', required: true, description: 'Restaurant slug identifier', example: 'zhivan' })
findAllByRestaurant(@UserId() userId: string, @RestId() restId: string) {
return this.paymentsService.findAllByRestaurantId(restId, userId);
}
@@ -117,6 +127,7 @@ export class PaymentsController {
@Post('public/payments/verify')
@ApiOperation({ summary: 'Verify a payment' })
@ApiHeader({ name: 'X-Slug', required: true, description: 'Restaurant slug identifier', example: 'zhivan' })
@ApiBody({ type: VerifyPaymentDto })
@ApiNotFoundResponse({ description: 'Payment not found' })
verifyPayment(@Body() verifyPaymentDto: VerifyPaymentDto) {