pay as admin
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user