some update

This commit is contained in:
2026-05-30 19:05:56 +03:30
parent 7ae027633b
commit c11166b365
6 changed files with 49 additions and 39 deletions
+3 -3
View File
@@ -9,9 +9,8 @@
"editor.formatOnSave": true "editor.formatOnSave": true
}, },
"[typescript]": { "[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"editor.formatOnSave": true,
"cSpell.words": [ "cSpell.words": [
"ARVANCLOUD", "ARVANCLOUD",
"autoincrement", "autoincrement",
@@ -27,5 +26,6 @@
"setm", "setm",
"spro", "spro",
"sstid" "sstid"
] ],
"editor.formatOnSave": true
} }
+1 -1
View File
@@ -137,7 +137,7 @@ export default {
SUN: 'سان', SUN: 'سان',
}, },
TspProviderResponseStatus: { TspProviderResponseStatus: {
[TspProviderResponseStatus.SUCCESS]: 'موفق', [TspProviderResponseStatus.SUCCESS]: 'تایید شده',
[TspProviderResponseStatus.FAILURE]: 'ناموفق', [TspProviderResponseStatus.FAILURE]: 'ناموفق',
[TspProviderResponseStatus.NOT_SEND]: 'ارسال نشده', [TspProviderResponseStatus.NOT_SEND]: 'ارسال نشده',
[TspProviderResponseStatus.QUEUED]: 'در صف ارسال', [TspProviderResponseStatus.QUEUED]: 'در صف ارسال',
@@ -95,7 +95,7 @@ export class ResponseMappingInterceptor implements NestInterceptor {
meta = { meta = {
totalRecords: total, totalRecords: total,
totalPages: Math.max(1, Math.ceil(total / perPage)), totalPages: Math.max(1, Math.ceil(total / perPage)),
page, page: parseInt(page),
perPage, perPage,
} }
break break
@@ -188,7 +188,7 @@ export class ResponseMappingInterceptor implements NestInterceptor {
meta = { meta = {
totalRecords: total, totalRecords: total,
totalPages: Math.max(1, Math.ceil(total / perPage)), totalPages: Math.max(1, Math.ceil(total / perPage)),
page, page: parseInt(page),
perPage, perPage,
} }
} }
@@ -47,8 +47,8 @@ export class SalesInvoicesFilterDto {
@ApiPropertyOptional() @ApiPropertyOptional()
@IsOptional() @IsOptional()
@IsString() @IsNumber()
code?: string invoice_number?: number
@ApiPropertyOptional() @ApiPropertyOptional()
@IsOptional() @IsOptional()
@@ -163,10 +163,8 @@ export class SalesInvoicesService {
}, },
} }
if (query.code?.trim()) { if (query.invoice_number) {
where.code = { where.invoice_number = parseInt(query.invoice_number + '')
contains: query.code.trim(),
}
} }
if (query.invoice_date_from || query.invoice_date_to) { if (query.invoice_date_from || query.invoice_date_to) {
@@ -420,7 +420,16 @@ export async function buildOriginalPayload(
throw new NotFoundException('فاکتور مورد نظر یافت نشد.') throw new NotFoundException('فاکتور مورد نظر یافت نشد.')
} }
const { pos, id, invoice_number, invoice_date, total_amount, discount_amount, tax_amount, settlement_type } = invoice const {
pos,
id,
invoice_number,
invoice_date,
total_amount,
discount_amount,
tax_amount,
settlement_type,
} = invoice
const { business_activity: ba } = pos.complex const { business_activity: ba } = pos.complex
const unknown_customer = (invoice.unknown_customer || {}) as Record<string, string> const unknown_customer = (invoice.unknown_customer || {}) as Record<string, string>
@@ -478,9 +487,7 @@ export async function buildOriginalPayload(
good_id: item.good_id, good_id: item.good_id,
service_id: item.service_id, service_id: item.service_id,
good_snapshot: item.good_snapshot, good_snapshot: item.good_snapshot,
gold_type_payload: isGoldTypePayload(item.payload) gold_type_payload: isGoldTypePayload(item.payload) ? item.payload : undefined,
? item.payload
: undefined
})), })),
} }
} }
@@ -512,7 +519,6 @@ export async function onResult(
provider_request_payload: result['provider_request_payload'] provider_request_payload: result['provider_request_payload']
? JSON.parse(JSON.stringify(result['provider_request_payload'])) ? JSON.parse(JSON.stringify(result['provider_request_payload']))
: undefined, : undefined,
provider_response: JSON.parse(JSON.stringify(result.provider_response)),
status: result.status, status: result.status,
received_at: result.received_at || new Date().toISOString(), received_at: result.received_at || new Date().toISOString(),
message: resultMessage message: resultMessage
@@ -525,12 +531,19 @@ export async function onResult(
tax_id: result['tax_id'] ? result['tax_id'] : undefined, tax_id: result['tax_id'] ? result['tax_id'] : undefined,
}, },
}, },
error_message: result.error_message || undefined,
} }
if (result.hasError) { if (result.provider_response) {
attemptUpdatedData.error_message = result.error_message attemptUpdatedData.provider_response = JSON.parse(
JSON.stringify(result.provider_response),
)
}
if (result.validation_errors) {
attemptUpdatedData.validation_errors = JSON.parse( attemptUpdatedData.validation_errors = JSON.parse(
JSON.stringify(result.validation_errors), JSON.stringify(result.validation_errors),
) )
}
if (result.fiscal_warnings) {
attemptUpdatedData.fiscal_warnings = JSON.parse( attemptUpdatedData.fiscal_warnings = JSON.parse(
JSON.stringify(result.fiscal_warnings), JSON.stringify(result.fiscal_warnings),
) )
@@ -562,7 +575,6 @@ export async function onResult(
} }
} }
function isGoldTypePayload(value: unknown): value is goldTypePayload { function isGoldTypePayload(value: unknown): value is goldTypePayload {
return typeof value === 'object' && value !== null && !Array.isArray(value); return typeof value === 'object' && value !== null && !Array.isArray(value)
} }