fix: wrong condition
This commit is contained in:
parent
0410c56060
commit
82fd331205
1 changed files with 3 additions and 6 deletions
|
|
@ -156,7 +156,7 @@ export class QuotationPayment extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
const paymentSum = await prisma.payment.aggregate({
|
||||
const paymentSum = await tx.payment.aggregate({
|
||||
_sum: { amount: true },
|
||||
where: {
|
||||
invoice: {
|
||||
|
|
@ -166,10 +166,6 @@ export class QuotationPayment extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
if (body.paymentStatus === "PaymentSuccess") {
|
||||
paymentSum._sum.amount = (paymentSum._sum.amount || 0) + payment.amount;
|
||||
}
|
||||
|
||||
await tx.quotation.update({
|
||||
where: { id: quotation.id },
|
||||
data: {
|
||||
|
|
@ -178,7 +174,8 @@ export class QuotationPayment extends Controller {
|
|||
? "PaymentSuccess"
|
||||
: "PaymentInProcess",
|
||||
requestData:
|
||||
quotation.quotationStatus === "PaymentPending"
|
||||
body.paymentStatus === "PaymentSuccess" &&
|
||||
(paymentSum._sum.amount || 0) - payment.amount <= 0
|
||||
? {
|
||||
create: quotation.worker.map((v) => ({
|
||||
employeeId: v.employeeId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue