Refactor: Remove stored procedures and replace with direct database operations

feat: Add economic code and guild information to sales invoice selection

fix: Update error messages for invoice access and creation to use "صورت‌حساب"

fix: Change error messages in SaleInvoicesService to use "صورت‌حساب" instead of "فاکتور"

fix: Update error messages in SalesInvoicesService for not found cases to use "صورت‌حساب"

fix: Modify TSP service to handle invoice updates and error messages consistently with "صورت‌حساب"

fix: Update common DTO descriptions to refer to "صورت‌حساب" instead of "فاکتور"

fix: Adjust utility functions to handle invoice references and error messages with "صورت‌حساب"
This commit is contained in:
2026-06-11 16:13:17 +03:30
parent 47a27fb54f
commit 23bfe1ecbe
12 changed files with 114 additions and 2105 deletions
@@ -21,7 +21,7 @@ export class SharedSaleInvoiceAccessService {
})
if (!consumer) {
throw new BadRequestException('شما دسترسی لازم برای ارسال فاکتور را ندارید.')
throw new BadRequestException('شما دسترسی لازم برای ارسال صورت‌حساب را ندارید.')
}
return consumer.consumer_id
@@ -109,7 +109,7 @@ export class SharedSaleInvoiceCreateService {
}
}
throw new BadRequestException('ایجاد فاکتور با خطا مواجه شد.')
throw new BadRequestException('ایجاد صورت‌حساب با خطا مواجه شد.')
}
private isRetryableInvoiceConflict(error: unknown) {
@@ -197,7 +197,7 @@ export class SharedSaleInvoiceCreateService {
const roundedTotalAmount = Number(Number(totalAmount).toFixed(2))
if (roundedTotalPayments !== roundedTotalAmount) {
throw new BadRequestException('مبلغ پرداختی باید برابر با مبلغ کل فاکتور باشد.')
throw new BadRequestException('مبلغ پرداختی باید برابر با مبلغ کل صورت‌حساب باشد.')
}
const terminalPayments = payments.filter(
@@ -431,7 +431,7 @@ export class SharedSaleInvoiceCreateService {
type !== TspProviderRequestType.ORIGINAL &&
!(main_invoice_id || ref_invoice_id)
) {
throw new BadRequestException('متاسفانه مشکلی در اطلاعات فاکتور وجود دارد.')
throw new BadRequestException('متاسفانه مشکلی در اطلاعات صورت‌حساب وجود دارد.')
}
const salesInvoiceData: SalesInvoiceCreateInput = {