pay as admin

This commit is contained in:
2026-01-19 12:19:44 +03:30
parent 3b76081fed
commit c7f5fdf241
4 changed files with 40 additions and 13 deletions
@@ -15,6 +15,8 @@ import { UserId } from 'src/common/decorators';
import { AuthGuard } from 'src/modules/auth/guards/auth.guard';
import { PayOrderDto } from '../dto/pay-order.dto';
import { FindPaymentsDto } from '../dto/find-payments.dto';
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
import { AdminId } from 'src/common/decorators/admin-id.decorator';
@ApiTags('payment')
@Controller()
@@ -49,13 +51,21 @@ export class PaymentController {
/*=============== Admin =============== */
@Post('admin/payments/pay-order/:orderId')
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@Get('public/payments')
@ApiOperation({ summary: 'get all payments as user' })
findAll(@Query() dto: FindPaymentsDto) {
return this.paymentsService.findAll(dto);
@ApiOperation({ summary: 'Pay for an order as Admin' })
payOrderAsAdmin(@Param('orderId') orderId: string, @AdminId() adminId: string, @Body() dto: PayOrderDto) {
return this.paymentsService.payOrder(orderId, dto, adminId);
}
@Post('public/payments/:token/verify/online')
@UseGuards(AdminAuthGuard)
@ApiBearerAuth()
@ApiOperation({ summary: 'Verify online payment as admin' })
verifyOnlinePaymentAsAdmin(@Param('paymentId') token: string) {
return this.paymentsService.verifyOnlinePayment(token);
}
@Post('admin/payments/:paymentId/verify/cash')
@UseGuards(AuthGuard)