set payment method
This commit is contained in:
@@ -4,6 +4,7 @@ import { AddItemToCartDto } from '../dto/add-item.dto';
|
||||
import { UpdateItemQuantityDto } from '../dto/update-item.dto';
|
||||
import { ApplyCouponDto } from '../dto/apply-coupon.dto';
|
||||
import { SetAddressDto } from '../dto/set-address.dto';
|
||||
import { SetPaymentMethodDto } from '../dto/set-payment-method.dto';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth, ApiBody, ApiParam } from '@nestjs/swagger';
|
||||
import { AuthGuard } from '../../auth/guards/auth.guard';
|
||||
import { UserId } from 'src/common/decorators/user-id.decorator';
|
||||
@@ -84,4 +85,18 @@ export class CartController {
|
||||
async setAddress(@UserId() userId: string, @RestId() restaurantId: string, @Body() setAddressDto: SetAddressDto) {
|
||||
return this.cartService.setAddress(userId, restaurantId, setAddressDto);
|
||||
}
|
||||
|
||||
@Patch('payment-method')
|
||||
@ApiOperation({ summary: 'Set payment method for cart' })
|
||||
@ApiBody({ type: SetPaymentMethodDto })
|
||||
@ApiResponse({ status: 200, description: 'Payment method set successfully' })
|
||||
@ApiResponse({ status: 400, description: 'Bad request (e.g., payment method is not active)' })
|
||||
@ApiResponse({ status: 404, description: 'Payment method not found for restaurant' })
|
||||
async setPaymentMethod(
|
||||
@UserId() userId: string,
|
||||
@RestId() restaurantId: string,
|
||||
@Body() setPaymentMethodDto: SetPaymentMethodDto,
|
||||
) {
|
||||
return this.cartService.setPaymentMethod(userId, restaurantId, setPaymentMethodDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user