coupon bug
This commit is contained in:
@@ -17,7 +17,7 @@ import { Delivery } from '../../delivery/entities/delivery.entity';
|
||||
import { Cart, CartItem } from '../interfaces/cart.interface';
|
||||
import { CouponService } from 'src/modules/coupons/providers/coupon.service';
|
||||
import { OrderCouponDetail } from 'src/modules/orders/interface/order-status';
|
||||
import { CouponType } from 'src/modules/coupons/entities/coupon.entity';
|
||||
import { CouponType } from 'src/modules/coupons/interface/coupon';
|
||||
|
||||
@Injectable()
|
||||
export class CartService {
|
||||
@@ -489,7 +489,8 @@ export class CartService {
|
||||
*/
|
||||
async setAddress(userId: string, restaurantId: string, setAddressDto: SetAddressDto): Promise<Cart> {
|
||||
const cart = await this.findOneOrFail(userId, restaurantId);
|
||||
|
||||
|
||||
if (!cart.deliveryMethodId) throw new BadRequestException('Delivery method must be set before setting address');
|
||||
// Find and validate address belongs to user
|
||||
const address = await this.em.findOne(UserAddress, { id: setAddressDto.addressId }, { populate: ['user'] });
|
||||
if (!address) {
|
||||
|
||||
Reference in New Issue
Block a user