update switch providers and nama provider. fix original send
This commit is contained in:
@@ -41,13 +41,17 @@ export class SalesInvoicesService {
|
||||
await tx.salesInvoice.count({ where }),
|
||||
])
|
||||
|
||||
const summaryItems = items.map(invoice => ({
|
||||
...invoice,
|
||||
status: translateEnumValue(
|
||||
'TspProviderResponseStatus',
|
||||
invoice.tsp_attempts?.[0]?.status || TspProviderResponseStatus.NOT_SEND,
|
||||
),
|
||||
}))
|
||||
const summaryItems = items.map(invoice => {
|
||||
const { tsp_attempts, type, ...rest } = invoice
|
||||
return {
|
||||
...rest,
|
||||
type: translateEnumValue('TspProviderRequestType', type),
|
||||
status: translateEnumValue(
|
||||
'TspProviderResponseStatus',
|
||||
invoice.tsp_attempts?.[0]?.status || TspProviderResponseStatus.NOT_SEND,
|
||||
),
|
||||
}
|
||||
})
|
||||
|
||||
return ResponseMapper.paginate(summaryItems, { total, page, perPage })
|
||||
}
|
||||
@@ -69,15 +73,17 @@ export class SalesInvoicesService {
|
||||
})
|
||||
|
||||
if (invoice) {
|
||||
const { tsp_attempts, ...rest } = invoice || {}
|
||||
|
||||
return ResponseMapper.single({
|
||||
const { tsp_attempts, type, ...rest } = invoice
|
||||
const mappedInvoice = {
|
||||
...rest,
|
||||
type: translateEnumValue('TspProviderRequestType', type),
|
||||
status: translateEnumValue(
|
||||
'TspProviderResponseStatus',
|
||||
invoice.tsp_attempts?.[0]?.status || TspProviderResponseStatus.NOT_SEND,
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
return ResponseMapper.single(mappedInvoice)
|
||||
} else throw new NotFoundException('فاکتور مورد نظر شما یافت نشد.')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user