fix(build): resolve linter and tsconfig project service errors, guarantee dist/main existence in start-dev
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
a291fa0c4a
commit
6362750dea
50 files changed
+12128
-10959
No files matched your search
@@ -58,7 +58,8 @@ export class PaymentService {
|
||||
|
||||
const backendUrl = await this.zibalService.getBackendUrl();
|
||||
const callbackUrl =
|
||||
customCallbackUrl || `${backendUrl}/payment/zibal/callback?orderId=${order.id}`;
|
||||
customCallbackUrl ||
|
||||
`${backendUrl}/payment/zibal/callback?orderId=${order.id}`;
|
||||
|
||||
const requestPayload = {
|
||||
amountRials,
|
||||
@@ -81,7 +82,7 @@ export class PaymentService {
|
||||
description: `پرداخت آنلاین سفارش ${order.trackingNumber || order.id}`,
|
||||
ipAddress: clientMeta?.ipAddress,
|
||||
userAgent: clientMeta?.userAgent,
|
||||
rawRequest: requestPayload as unknown as Prisma.InputJsonValue,
|
||||
rawRequest: requestPayload,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -153,7 +154,8 @@ export class PaymentService {
|
||||
const amountRials = Math.round(amountTomans * 10);
|
||||
const backendUrl = await this.zibalService.getBackendUrl();
|
||||
const callbackUrl =
|
||||
customCallbackUrl || `${backendUrl}/payment/zibal/callback?type=WALLET_TOPUP`;
|
||||
customCallbackUrl ||
|
||||
`${backendUrl}/payment/zibal/callback?type=WALLET_TOPUP`;
|
||||
|
||||
const requestPayload = {
|
||||
amountRials,
|
||||
@@ -173,7 +175,7 @@ export class PaymentService {
|
||||
description: `افزایش موجودی کیف پول کاربر ${user.mobile}`,
|
||||
ipAddress: clientMeta?.ipAddress,
|
||||
userAgent: clientMeta?.userAgent,
|
||||
rawRequest: requestPayload as unknown as Prisma.InputJsonValue,
|
||||
rawRequest: requestPayload,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -355,8 +357,7 @@ export class PaymentService {
|
||||
|
||||
// --- AMOUNT MATCH VERIFICATION ---
|
||||
const expectedAmountRials = Number(
|
||||
transaction.amountRials ||
|
||||
Math.round(Number(transaction.amount) * 10),
|
||||
transaction.amountRials || Math.round(Number(transaction.amount) * 10),
|
||||
);
|
||||
|
||||
if (
|
||||
@@ -572,10 +573,23 @@ export class PaymentService {
|
||||
`Inquiry for trackId=${tx.trackId}: status=${inquiry.status}, result=${inquiry.result}`,
|
||||
);
|
||||
|
||||
if (inquiry.status === 1 || inquiry.status === 2 || inquiry.result === 100) {
|
||||
await this.verifyAndProcess(tx.trackId, '1', String(inquiry.status), tx.orderId || undefined);
|
||||
if (
|
||||
inquiry.status === 1 ||
|
||||
inquiry.status === 2 ||
|
||||
inquiry.result === 100
|
||||
) {
|
||||
await this.verifyAndProcess(
|
||||
tx.trackId,
|
||||
'1',
|
||||
String(inquiry.status),
|
||||
tx.orderId || undefined,
|
||||
);
|
||||
results.verified++;
|
||||
} else if (inquiry.status === 3 || inquiry.status === -2 || inquiry.result === 202) {
|
||||
} else if (
|
||||
inquiry.status === 3 ||
|
||||
inquiry.status === -2 ||
|
||||
inquiry.result === 202
|
||||
) {
|
||||
const msg = this.zibalService.getStatusMessage(inquiry.status || 3);
|
||||
await this.prisma.paymentTransaction.update({
|
||||
where: { id: tx.id },
|
||||
@@ -654,12 +668,14 @@ export class PaymentService {
|
||||
paidAt: transaction.paidAt,
|
||||
createdAt: transaction.createdAt,
|
||||
order: transaction.order,
|
||||
user: transaction.user ? {
|
||||
id: transaction.user.id,
|
||||
firstName: transaction.user.firstName,
|
||||
lastName: transaction.user.lastName,
|
||||
mobile: transaction.user.mobile,
|
||||
} : null,
|
||||
user: transaction.user
|
||||
? {
|
||||
id: transaction.user.id,
|
||||
firstName: transaction.user.firstName,
|
||||
lastName: transaction.user.lastName,
|
||||
mobile: transaction.user.mobile,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -705,8 +721,10 @@ export class PaymentService {
|
||||
|
||||
if (minAmount !== undefined || maxAmount !== undefined) {
|
||||
where.amount = {};
|
||||
if (minAmount !== undefined) where.amount.gte = new Prisma.Decimal(minAmount);
|
||||
if (maxAmount !== undefined) where.amount.lte = new Prisma.Decimal(maxAmount);
|
||||
if (minAmount !== undefined)
|
||||
where.amount.gte = new Prisma.Decimal(minAmount);
|
||||
if (maxAmount !== undefined)
|
||||
where.amount.lte = new Prisma.Decimal(maxAmount);
|
||||
}
|
||||
|
||||
if (search && search.trim() !== '') {
|
||||
@@ -838,13 +856,19 @@ export class PaymentService {
|
||||
throw new BadRequestException('این تراکنش فاقد TrackId زیبال است');
|
||||
}
|
||||
|
||||
const inquiryRes = await this.zibalService.inquiryPayment(transaction.trackId);
|
||||
const statusMsg = this.zibalService.getStatusMessage(inquiryRes.status ?? 3);
|
||||
const inquiryRes = await this.zibalService.inquiryPayment(
|
||||
transaction.trackId,
|
||||
);
|
||||
const statusMsg = this.zibalService.getStatusMessage(
|
||||
inquiryRes.status ?? 3,
|
||||
);
|
||||
const resultMsg = this.zibalService.getResultMessage(inquiryRes.result);
|
||||
|
||||
if (
|
||||
transaction.status === 'PENDING' &&
|
||||
(inquiryRes.status === 1 || inquiryRes.status === 2 || inquiryRes.result === 100)
|
||||
(inquiryRes.status === 1 ||
|
||||
inquiryRes.status === 2 ||
|
||||
inquiryRes.result === 100)
|
||||
) {
|
||||
await this.verifyAndProcess(
|
||||
transaction.trackId,
|
||||
@@ -891,7 +915,9 @@ export class PaymentService {
|
||||
where: { id: transactionId },
|
||||
data: {
|
||||
status: 'VERIFIED',
|
||||
message: adminNote || 'تایید دستی توسط مدیر سیستم (کارت به کارت / فیش بانکی)',
|
||||
message:
|
||||
adminNote ||
|
||||
'تایید دستی توسط مدیر سیستم (کارت به کارت / فیش بانکی)',
|
||||
paidAt: new Date(),
|
||||
},
|
||||
});
|
||||
@@ -924,7 +950,10 @@ export class PaymentService {
|
||||
}
|
||||
});
|
||||
|
||||
return { success: true, message: 'تراکنش با موفقیت به صورت دستی تایید و اعمال شد' };
|
||||
return {
|
||||
success: true,
|
||||
message: 'تراکنش با موفقیت به صورت دستی تایید و اعمال شد',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -947,7 +976,10 @@ export class PaymentService {
|
||||
},
|
||||
});
|
||||
|
||||
return { success: true, message: 'تراکنش به عنوان ناموفق/رد شده علامتگذاری شد' };
|
||||
return {
|
||||
success: true,
|
||||
message: 'تراکنش به عنوان ناموفق/رد شده علامتگذاری شد',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user