feat: enhance CustomerIndividual and CustomerLegal models with new unique input types
feat: add cache invalidation method for POS middleware feat: implement Redis caching in POS middleware for improved performance feat: refactor sales invoice DTOs for POS to include correction functionality feat: extend SalesInvoicesController to handle invoice corrections and returns feat: update SalesInvoicesService to support invoice correction and return operations feat: enhance TSP provider correction functionality with new DTOs and utility methods fix: improve error handling and logging in Nama provider switch adapter refactor: streamline invoice payload building in TSP provider utilities
This commit is contained in:
@@ -9,7 +9,10 @@ import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { Prisma } from 'generated/prisma/client'
|
||||
import { TspProviderRequestType, TspProviderResponseStatus } from 'generated/prisma/enums'
|
||||
import { SalesInvoiceTspService } from '../../tspProviders/sales-invoice-tsp.service'
|
||||
import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto'
|
||||
import {
|
||||
PosCorrectionSalesInvoiceDto,
|
||||
PosCreateSalesInvoiceDto,
|
||||
} from './dto/create-sales-invoice.dto'
|
||||
import { SalesInvoicesFilterDto } from './dto/sales-invoices-filter.dto'
|
||||
|
||||
@Injectable()
|
||||
@@ -91,7 +94,7 @@ export class SalesInvoicesService {
|
||||
} else throw new NotFoundException('فاکتور مورد نظر شما یافت نشد.')
|
||||
}
|
||||
|
||||
async create(data: CreateSalesInvoiceDto, posInfo: IPosPayload) {
|
||||
async create(data: PosCreateSalesInvoiceDto, posInfo: IPosPayload) {
|
||||
let salesInvoice = await this.sharedSaleInvoiceCreateService.create({
|
||||
data,
|
||||
businessId: posInfo.business_id,
|
||||
@@ -148,6 +151,39 @@ export class SalesInvoicesService {
|
||||
return ResponseMapper.single(invoice)
|
||||
}
|
||||
|
||||
async correction(
|
||||
invoiceId: string,
|
||||
posInfo: IPosPayload,
|
||||
data: PosCorrectionSalesInvoiceDto,
|
||||
) {
|
||||
const { consumer_account_id, pos_id, business_id, complex_id } = posInfo
|
||||
|
||||
const invoice = await this.sharedSaleInvoiceActionsService.correction(
|
||||
data,
|
||||
consumer_account_id,
|
||||
pos_id,
|
||||
complex_id,
|
||||
business_id,
|
||||
invoiceId,
|
||||
)
|
||||
|
||||
return ResponseMapper.single(invoice)
|
||||
}
|
||||
|
||||
async return(invoiceId: string, posInfo: IPosPayload) {
|
||||
const { consumer_account_id, pos_id, business_id, complex_id } = posInfo
|
||||
|
||||
const invoice = await this.sharedSaleInvoiceActionsService.revoke(
|
||||
consumer_account_id,
|
||||
pos_id,
|
||||
complex_id,
|
||||
business_id,
|
||||
invoiceId,
|
||||
)
|
||||
|
||||
return ResponseMapper.single(invoice)
|
||||
}
|
||||
|
||||
async inquiry(consumer_account_id: string, pos_id: string, invoiceId: string) {
|
||||
const invoice = await this.sharedSaleInvoiceActionsService.inquiry(
|
||||
consumer_account_id,
|
||||
|
||||
Reference in New Issue
Block a user