Ship deploy build for multi-company order items.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+8
-2
@@ -32,7 +32,7 @@ let CashPaymentsService = class CashPaymentsService {
|
||||
async submitReceipt(userId, orderId, dto) {
|
||||
const order = await this.prisma.order.findUnique({
|
||||
where: { id: orderId },
|
||||
include: { cashReceipt: true },
|
||||
include: { cashReceipt: true, items: true },
|
||||
});
|
||||
if (!order)
|
||||
throw new common_1.NotFoundException('سفارش یافت نشد');
|
||||
@@ -49,10 +49,16 @@ let CashPaymentsService = class CashPaymentsService {
|
||||
order.cashInvoiceExpiresAt.getTime() < Date.now()) {
|
||||
throw new common_1.BadRequestException('مهلت پرداخت فاکتور نقدی به پایان رسیده است');
|
||||
}
|
||||
const companyIds = [
|
||||
...new Set([
|
||||
order.companyId,
|
||||
...order.items.map((item) => item.companyId).filter(Boolean),
|
||||
].filter(Boolean)),
|
||||
];
|
||||
const account = await this.prisma.bankAccount.findFirst({
|
||||
where: {
|
||||
id: dto.destinationAccountId,
|
||||
companyId: order.companyId,
|
||||
companyId: { in: companyIds },
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user