feat: complete scheduled publishing, security remediation and DEV_TICKETS implementation
This commit is contained in:
1 parent
d6d4158cbe
commit
efb3c473c4
35 files changed
+685
-185
No files matched your search
@@ -230,7 +230,7 @@ export class OrdersService {
|
||||
});
|
||||
}
|
||||
|
||||
return tx.order.create({
|
||||
const newOrder = await tx.order.create({
|
||||
data: {
|
||||
userId,
|
||||
couponId,
|
||||
@@ -252,6 +252,17 @@ export class OrdersService {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (couponId) {
|
||||
await tx.coupon
|
||||
.update({
|
||||
where: { id: couponId },
|
||||
data: { usedCount: { increment: 1 } },
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
return newOrder;
|
||||
});
|
||||
|
||||
// Send Order Confirmation SMS for wallet orders
|
||||
@@ -570,8 +581,11 @@ export class OrdersService {
|
||||
throw new NotFoundException('سفارش مورد نظر یافت نشد');
|
||||
}
|
||||
|
||||
if (['shipped', 'delivered'].includes(order.status)) {
|
||||
throw new BadRequestException('این سفارش قبلاً پرداخت و تکمیل شده است');
|
||||
const ALLOWED_RETRY_STATUSES = ['pending_payment', 'failed'];
|
||||
if (!ALLOWED_RETRY_STATUSES.includes(order.status)) {
|
||||
throw new BadRequestException(
|
||||
'تنها سفارشهای در انتظار پرداخت یا ناموفق قابلیت پرداخت مجدد دارند.',
|
||||
);
|
||||
}
|
||||
|
||||
const selectedMethod = paymentMethod || order.paymentMethod || 'online';
|
||||
|
||||
Reference in new issue
Block a user